forked from roneetshaw/GSTInvoicingApplication
-
Notifications
You must be signed in to change notification settings - Fork 0
/
itemdashboard.php
256 lines (241 loc) · 7.93 KB
/
itemdashboard.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="assets/img/favicon.ico">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Items Warehouse</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<meta name="viewport" content="width=device-width" />
<?php include 'csslibrary.php';?>
<?php include 'jslibrary.php';?>
<style>
table.dataTable thead th { font-size: 15px; color: black;}
a { cursor: pointer; }
</style>
</head>
<body>
<div class="wrapper">
<?php include 'left-nav.php';?>
<div class="main-panel">
<?php include 'upper-nav.php';?>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="header">
<div class="row" style="margin:10px;">
<div class="col-md-9">
<h4 class="title">Items</h4>
<p class="category">*All Items</p>
</div>
<div class="col-md-3" style="padding-left:37px;">
<input type="button" value="Add Item" id="btnItemAdd" >
</div>
</div>
</div>
<div class="content">
<div class="row" style="margin:20px;">
<table id="itemDisplay" class="table table-condensed table-hover" width="100%"></table>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" class="form-control" value = "-99" id="itemHiddensave">
</div>
</div>
</div>
<div class="modal fade" id="addItemModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-sm-4">
<h4 class="modal-title">Add Item</h4>
</div>
<div class="col-sm-6" style="text-align:center">
<button type="button" class="btn btn-default" id="btnItemSave">Save</button>
</div>
<div class="col-sm-2">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
</div>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<label for="usr">Item Description (*required)</label>
<input type="text" class="form-control" id="itemDesp">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-6">
<label for="usr">Item Type (*required)</label>
<div class="dropdown" id="itemType">
<button class="btn btn-default dropdown-toggle" style="width:250px" type="button" data-toggle="dropdown">Item Type
<span class="caret"></span></button>
<ul class="dropdown-menu" style="width:250px">
<li><a href="#">Goods</a></li>
<li><a href="#">Services</a></li>
</ul>
</div>
</div>
<div class="col-sm-6">
<label for="usr">HSN/SAC code (*required)</label>
<input type="text" class="form-control" id="itemHSNCode">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-6">
<label for="usr">Item/SKU code</label>
<input type="text" class="form-control" id="itemSKUCode">
</div>
<div class="col-sm-6">
<label for="usr">Unit</label>
<div class="dropdown" id="itemUnit">
<button class="btn btn-default dropdown-toggle" style="width:250px" type="button" data-toggle="dropdown">Unit
<span class="caret"></span></button>
<ul class="dropdown-menu" style="width:250px">
<li><a value="Pieces">Pieces</a></li>
<li><a value="Packs">Packs</a></li>
<li><a value="Pairs">Pairs</a></li>
<li><a value="Rolls">Rolls</a></li>
<li><a value="Set">Set</a></li>
<li><a value="Boxes">Boxes</a></li>
<li><a value="Dorzen">Dorzen</a></li>
<li><a value="Others">Others</a></li>
</ul>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-6">
<label for="usr">Tax Rate</label>
<div class="dropdown" id="itemTaxRate">
<button class="btn btn-default dropdown-toggle" style="width:250px" type="button" data-toggle="dropdown">Tax Rate
<span class="caret"></span></button>
<ul class="dropdown-menu" style="width:250px">
<li><a href="#">0.25%</a></li>
<li><a href="#">12%</a></li>
<li><a href="#">18%</a></li>
<li><a href="#">28%</a></li>
<li><a href="#">3%</a></li>
<li><a href="#">5%</a></li>
</ul>
</div>
</div>
<div class="col-sm-6">
<label for="usr">Discount</label>
<input type="text" class="form-control" id="itemDiscount">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-6">
<label for="usr">Cess Amount</label>
<input type="text" class="form-control" id="itemCess">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-6">
<label for="usr">Purchase Price</label>
<input type="text" class="form-control" id="itemPurchase">
</div>
<div class="col-sm-6">
<label for="usr">Selling price</label>
<input type="text" class="form-control" id="itemSelling">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
initTable();
function clearFields()
{
$("#addItemModal input").val("");
}
function initTable()
{
$.ajax({
url: 'webmethods.php',
type: 'POST',
data: {type: 5 },
success: function (data1) {
var arr = JSON.parse(data1);
fillItemTable(arr);
},
error: function (log) {
console.log(log.message);
}
});
}
function fillItemTable(dataSet)
{
$('#itemDisplay').DataTable( {
data: dataSet,
dom: 'Bfrtip',
buttons: [
'pdf'
],
destroy: true,
columns: [
{ title: "Sr. no." },
{ title: "ITEM DESCRIPTION" },
{ title: "HSN/SAC" },
{ title: "PURCHASE PRICE (₹)" },
{ title: "SELLING PRICE (₹)" },
{ title: "GST (%)" },
{ title: "DISCOUNT (%)" },
{ title: "QUANTITY" },
]
});
}
function saveIteminDB()
{
$.ajax({
url: 'webmethods.php',
type: 'POST',
data: {type: 4, Description: $("#addItemModal input:eq(0)").val(),ItemType: $("#addItemModal button:eq(2)").text(),HSN: $("#addItemModal input:eq(1)").val(),ITEMCODE: $("#addItemModal input:eq(2)").val(),UNIT: $("#addItemModal button:eq(3)").text(),TAXRATE: $("#addItemModal button:eq(4)").text(), DISCOUNT: $("#addItemModal input:eq(3)").val(),CESSAMOUNT: $("#addItemModal input:eq(4)").val(),PURCHASEPRICE: $("#addItemModal input:eq(5)").val(),SELLINGPRICE:$("#addItemModal input:eq(6)").val(), query_type: $("#itemHiddensave").val() },
success: function (d) {
initTable();
if(d == "1")
$("#addItemModal").modal('hide');
},
error: function (log) {
console.log(log);
}
});
}
$("#btnItemSave").on('click',function(){
if($("#itemDesp").val().length > 0)
{
saveIteminDB();
}
else
alert("Please add Vendor Name");
})
$("#btnItemAdd").on('click',function(){
clearFields();
$("#itemType button").html('Item Type<span class="caret"></span>');
$("#itemUnit button").html('Unit<span class="caret"></span>');
$("#itemTaxRate button").html('Tax Rate<span class="caret"></span>');
$("#addItemModal").modal('show');
})
});
</script>
</html>