| 32145 |
tejbeer |
1 |
$(function() {
|
|
|
2 |
$(document).on('click', ".warehouse-create-purchase-order", function() {
|
|
|
3 |
loadCreatePurchase("main-content");
|
|
|
4 |
});
|
|
|
5 |
|
|
|
6 |
|
| 32192 |
tejbeer |
7 |
$(document).on('click', ".warehouse-receive-new-invoice", function() {
|
|
|
8 |
loadNewReceiveInvoice("main-content");
|
|
|
9 |
});
|
| 32145 |
tejbeer |
10 |
|
| 32192 |
tejbeer |
11 |
|
|
|
12 |
|
|
|
13 |
|
| 32256 |
tejbeer |
14 |
$(document).on('click', ".warehouse-grn-request", function() {
|
|
|
15 |
loadGrnRequest("main-content");
|
|
|
16 |
});
|
| 32192 |
tejbeer |
17 |
|
| 32256 |
tejbeer |
18 |
$(document).on('click', ".warehouse-debit-note", function() {
|
|
|
19 |
loadDebitNote("main-content");
|
|
|
20 |
});
|
| 32192 |
tejbeer |
21 |
|
|
|
22 |
|
| 32256 |
tejbeer |
23 |
|
| 32192 |
tejbeer |
24 |
$(document)
|
|
|
25 |
.on(
|
|
|
26 |
'input',
|
|
|
27 |
'#invoice',
|
|
|
28 |
function() {
|
|
|
29 |
if (confirm('Document has been selected, Do you want to upload ?')) {
|
|
|
30 |
var fileSelector = $('#invoice')[0];
|
|
|
31 |
if (fileSelector != undefined
|
|
|
32 |
&& fileSelector.files[0] != undefined) {
|
|
|
33 |
var url = context + '/document-upload';
|
|
|
34 |
|
|
|
35 |
console.log(url);
|
|
|
36 |
var file = this.files[0];
|
|
|
37 |
doAjaxUploadRequestHandler(
|
|
|
38 |
url,
|
|
|
39 |
'POST',
|
|
|
40 |
file,
|
|
|
41 |
function(response) {
|
|
|
42 |
console.log(response);
|
|
|
43 |
var documentId = response.response.document_id;
|
|
|
44 |
console.log("documentId : "
|
|
|
45 |
+ documentId);
|
| 32296 |
tejbeer |
46 |
localStorage.setItem("invoiceDocument",
|
|
|
47 |
documentId);
|
| 32295 |
tejbeer |
48 |
|
|
|
49 |
console.log(invoiceDoc)
|
|
|
50 |
|
| 32192 |
tejbeer |
51 |
});
|
|
|
52 |
|
|
|
53 |
}
|
|
|
54 |
} else {
|
|
|
55 |
// Do nothing!
|
|
|
56 |
}
|
|
|
57 |
});
|
|
|
58 |
|
|
|
59 |
$(document).on('click', ".createReceiveInvoice", function() {
|
|
|
60 |
|
|
|
61 |
var invoiceDate = $('#actualDate').val();
|
|
|
62 |
|
|
|
63 |
var warehouseId = $('#warehouseMap').val();
|
|
|
64 |
|
|
|
65 |
var numItems = $('#numberofItems').val();
|
|
|
66 |
|
|
|
67 |
var receivedBy = $('#authUser').val();
|
|
|
68 |
|
|
|
69 |
var supplierId = $('#vendorId').val();
|
|
|
70 |
|
|
|
71 |
var totalValue = $('#totalValue').val();
|
|
|
72 |
|
|
|
73 |
var invoiceNumber = $('#invoiceNumber').val();
|
|
|
74 |
|
|
|
75 |
|
| 32296 |
tejbeer |
76 |
var invoiceDoc = localStorage
|
|
|
77 |
.getItem("invoiceDocument");
|
| 32192 |
tejbeer |
78 |
|
|
|
79 |
|
|
|
80 |
console.log(invoiceDoc)
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
if (invoiceDate === "" && warehouseId === "" && numItems === "" && receivedBy === "" && supplierId === "" && totalValue === "" && invoiceNumber === "" && invoiceDoc === "") {
|
|
|
84 |
alert("Field can't be empty");
|
|
|
85 |
return false;
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
if (invoiceDate === "") {
|
|
|
90 |
alert("please select date");
|
|
|
91 |
return false;
|
|
|
92 |
}
|
|
|
93 |
if (warehouseId === "") {
|
|
|
94 |
alert("please choose warehouse");
|
|
|
95 |
return false;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
if (numItems === "") {
|
|
|
99 |
alert("please fill number of items.");
|
|
|
100 |
return false;
|
|
|
101 |
}
|
|
|
102 |
if (receivedBy === "") {
|
|
|
103 |
alert("please choose received by user");
|
|
|
104 |
return false;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
if (supplierId === "") {
|
|
|
108 |
alert("please choose supplier");
|
|
|
109 |
return false;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
if (totalValue === "") {
|
|
|
115 |
alert("please fill Total Value.");
|
|
|
116 |
return false;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
if (invoiceNumber === "") {
|
|
|
120 |
alert("please fill Invoice Number.");
|
|
|
121 |
return false;
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
if (invoiceDoc === "") {
|
|
|
126 |
alert("please upload invoice.");
|
|
|
127 |
return false;
|
|
|
128 |
}
|
|
|
129 |
var newReceiveInvoice = {};
|
|
|
130 |
|
|
|
131 |
newReceiveInvoice['invoiceDate'] = invoiceDate;
|
|
|
132 |
newReceiveInvoice['warehouseId'] = warehouseId
|
|
|
133 |
newReceiveInvoice['numItems'] = numItems
|
|
|
134 |
newReceiveInvoice['receivedBy'] = receivedBy
|
|
|
135 |
newReceiveInvoice['supplierId'] = supplierId
|
|
|
136 |
newReceiveInvoice['totalValue'] = totalValue
|
|
|
137 |
newReceiveInvoice['invoiceNumber'] = invoiceNumber
|
|
|
138 |
newReceiveInvoice['invoiceDoc'] = invoiceDoc
|
|
|
139 |
|
| 32295 |
tejbeer |
140 |
console.log()
|
|
|
141 |
|
| 32192 |
tejbeer |
142 |
if (confirm("Are you sure you want to add new Invoice") == true) {
|
|
|
143 |
|
|
|
144 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
145 |
+ "/newReceiveInvoice", JSON
|
|
|
146 |
.stringify(newReceiveInvoice), function(response) {
|
|
|
147 |
if (response == 'true') {
|
|
|
148 |
alert("successfully added");
|
| 32296 |
tejbeer |
149 |
localStorage.removeItem("invoiceDocument");
|
| 32192 |
tejbeer |
150 |
loadNewReceiveInvoice("main-content");
|
|
|
151 |
}
|
|
|
152 |
});
|
|
|
153 |
}
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
});
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
|
| 32145 |
tejbeer |
163 |
$(document).on('click', ".purchaseorderitemview", function() {
|
|
|
164 |
|
|
|
165 |
var vendorId = $('#vendorId').val();
|
|
|
166 |
var warehouseId = $('#warehouseMap').val();
|
|
|
167 |
|
|
|
168 |
console.log(warehouseId)
|
|
|
169 |
|
|
|
170 |
if (warehouseId == null && vendorId === "") {
|
|
|
171 |
alert("Field can't be empty");
|
|
|
172 |
return;
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
if (warehouseId == null) {
|
|
|
177 |
alert("please select warehouse");
|
|
|
178 |
return;
|
|
|
179 |
}
|
|
|
180 |
if (vendorId === "") {
|
|
|
181 |
alert("please select vendor");
|
|
|
182 |
return;
|
|
|
183 |
}
|
|
|
184 |
doGetAjaxRequestHandler(context + "/addPurchaseItemView?warehouseId=" + warehouseId + "&vendorId=" + vendorId, function(response) {
|
|
|
185 |
$(".createpurchaseordercontainer").html(response);
|
|
|
186 |
});
|
|
|
187 |
});
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
$(document).on('click', ".addRowInPurchaseOrder", function() {
|
| 32192 |
tejbeer |
191 |
|
|
|
192 |
|
|
|
193 |
var purchaseItemIds = [];
|
|
|
194 |
var totalQty = 0
|
|
|
195 |
|
|
|
196 |
$("table > tbody > tr").each(function() {
|
|
|
197 |
var itemId = $(this).find(".transferPrice").data('itemid');
|
|
|
198 |
var qty = $(this).find(".qty").val();
|
|
|
199 |
|
|
|
200 |
console.log(qty)
|
|
|
201 |
|
|
|
202 |
if (qty != undefined) {
|
|
|
203 |
totalQty += parseInt(qty)
|
|
|
204 |
}
|
|
|
205 |
|
|
|
206 |
console.log(totalQty)
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
if (itemId != undefined) {
|
|
|
210 |
purchaseItemIds.push(itemId)
|
|
|
211 |
}
|
|
|
212 |
});
|
|
|
213 |
|
| 32145 |
tejbeer |
214 |
var $html = $('<tr> <td> <input type="text" class="form-control typeaheaditem" autocomplete="off" placeholder="Search Model"/> </td> <td> <input type="number" class="form-control qty" name = "qty" placeholder="Quantity"/> </td><td> <input type="number" class="form-control transferPrice" disable placeholder="Transfer Price"/> </td> <td> <input type="number" class="form-control totalValue" disable placeholder="Total Value"/> </td> <td> <input class="form-control btn btn-primary removeInPurchaseOrder" type="button" value="Remove"></td> </tr> ');
|
|
|
215 |
|
| 32195 |
tejbeer |
216 |
var vendorId = $('#vendorId').val();
|
| 32145 |
tejbeer |
217 |
|
| 32192 |
tejbeer |
218 |
|
| 32195 |
tejbeer |
219 |
getVendorItemAheadOptions($html.find('.typeaheaditem'), vendorId, function(
|
| 32145 |
tejbeer |
220 |
selectedItem) {
|
|
|
221 |
var itemId = selectedItem.itemId;
|
|
|
222 |
|
| 32192 |
tejbeer |
223 |
if (purchaseItemIds.indexOf(itemId) > -1) {
|
| 32145 |
tejbeer |
224 |
alert("item already selected");
|
|
|
225 |
$html.find('.typeaheaditem').val("")
|
|
|
226 |
|
|
|
227 |
return false;
|
|
|
228 |
}
|
|
|
229 |
|
| 32192 |
tejbeer |
230 |
purchaseItemIds.push(itemId)
|
| 32145 |
tejbeer |
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
doGetAjaxRequestHandler(context + "/getPricing?vendorId=" + vendorId + "&itemId=" + itemId, function(response) {
|
|
|
235 |
console.log(response)
|
|
|
236 |
if (response != "null") {
|
|
|
237 |
var jsonObj = JSON.parse(response);
|
|
|
238 |
|
|
|
239 |
console.log(jsonObj)
|
|
|
240 |
$html.find('.transferPrice').val(jsonObj.transferPrice)
|
|
|
241 |
|
|
|
242 |
$html.find('.transferPrice').data('itemid', itemId)
|
|
|
243 |
} else {
|
|
|
244 |
|
|
|
245 |
console.log(response)
|
|
|
246 |
$html.find('.typeaheaditem').val("")
|
|
|
247 |
|
|
|
248 |
}
|
|
|
249 |
});
|
|
|
250 |
|
|
|
251 |
});
|
|
|
252 |
$('tbody').append($html);
|
|
|
253 |
|
|
|
254 |
});
|
|
|
255 |
|
|
|
256 |
$(document).on('click', '.createSendPurchaseOrder', function() {
|
|
|
257 |
|
|
|
258 |
createPurchase(true);
|
|
|
259 |
|
|
|
260 |
});
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
$(document).on('click', '.createPurchaseOrder', function() {
|
|
|
264 |
|
|
|
265 |
|
|
|
266 |
createPurchase(false);
|
|
|
267 |
});
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
$(document).on('change', '.qty', function() {
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
var row = $(this).closest("tr");
|
|
|
274 |
var qty = $(row).find(".qty").val();
|
|
|
275 |
var transferPrice = $(row).find(".transferPrice").val();
|
|
|
276 |
|
|
|
277 |
var totalVal = transferPrice * qty;
|
|
|
278 |
|
|
|
279 |
var totalValue = $(row).find(".totalValue").val(totalVal);
|
|
|
280 |
|
|
|
281 |
var purchaseOrderValue = 0;
|
|
|
282 |
|
|
|
283 |
$("table > tbody > tr").each(function() {
|
|
|
284 |
|
|
|
285 |
var totalValue = $(this).find(".totalValue").val();
|
|
|
286 |
purchaseOrderValue += totalValue
|
|
|
287 |
|
|
|
288 |
});
|
|
|
289 |
|
|
|
290 |
});
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
$(document).on('click', '.warehouse-open-purchase-order', function() {
|
|
|
296 |
loadOpenPurchase("main-content");
|
|
|
297 |
});
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
$(document).on('click', '.editViewPurchaseOrder', function() {
|
|
|
302 |
var purchaseOrderId = $(this).data('poid');
|
|
|
303 |
doGetAjaxRequestHandler(context + "/getEditPOByPurchaseId?purchaseId=" + purchaseOrderId, function(response) {
|
|
|
304 |
$('#warehouseEditPurchaseContainer .modal-content').html(response);
|
|
|
305 |
});
|
|
|
306 |
|
|
|
307 |
});
|
|
|
308 |
|
|
|
309 |
$(document).on('click', '.editPurchaseOrder', function() {
|
|
|
310 |
var purchaseOrderId = $(this).data('poid');
|
|
|
311 |
|
| 32256 |
tejbeer |
312 |
editPurchase(false, purchaseOrderId);
|
| 32145 |
tejbeer |
313 |
|
|
|
314 |
});
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
$(document).on('click', '.editSendPurchaseOrder', function() {
|
|
|
318 |
var purchaseOrderId = $(this).data('poid');
|
|
|
319 |
|
|
|
320 |
|
| 32256 |
tejbeer |
321 |
editPurchase(true, purchaseOrderId);
|
| 32145 |
tejbeer |
322 |
});
|
|
|
323 |
|
|
|
324 |
$(document).on('click', '.closePurchaseOrder', function() {
|
|
|
325 |
var purchaseOrderId = $(this).data('poid');
|
|
|
326 |
if (confirm("Are you sure you want to close the PO") == true) {
|
|
|
327 |
doPostAjaxRequestHandler(context + "/closePuchaseOrder?purchaseId=" + purchaseOrderId,
|
|
|
328 |
function(response) {
|
|
|
329 |
|
|
|
330 |
console.log(response);
|
|
|
331 |
if (response == 'true') {
|
|
|
332 |
alert("successfully closed");
|
|
|
333 |
loadOpenPurchase("main-content")
|
|
|
334 |
}
|
|
|
335 |
});
|
|
|
336 |
}
|
|
|
337 |
});
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
$(document).on('click', '.warehouse-view-purchase-order', function() {
|
|
|
341 |
doGetAjaxRequestHandler(context + "/viewPurchaseOrder", function(response) {
|
|
|
342 |
$('#' + 'main-content').html(response);
|
|
|
343 |
});
|
|
|
344 |
});
|
|
|
345 |
|
|
|
346 |
|
|
|
347 |
|
| 32192 |
tejbeer |
348 |
|
|
|
349 |
|
| 32145 |
tejbeer |
350 |
$(document).on('click', '.dateWisePo', function() {
|
|
|
351 |
|
|
|
352 |
var startDate = getDatesFromPicker('input[name="duration"]').startDate;
|
|
|
353 |
var endDate = getDatesFromPicker('input[name="duration"]').endDate
|
|
|
354 |
|
|
|
355 |
|
|
|
356 |
doGetAjaxRequestHandler(context + "/getPurchaseOrders?startDate=" + startDate + "&endDate=" + endDate, function(response) {
|
|
|
357 |
$('.purchaseorderviewcontainer').html(response);
|
|
|
358 |
|
|
|
359 |
});
|
|
|
360 |
|
|
|
361 |
|
|
|
362 |
});
|
|
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
|
366 |
$(document).on('click', '.viewPurchaseOrderlineItem', function() {
|
|
|
367 |
var purchaseOrderId = $(this).data('poid');
|
|
|
368 |
|
|
|
369 |
doGetAjaxRequestHandler(context + "/getWarehouseLineItemByPurchaseId?purchaseId=" + purchaseOrderId, function(response) {
|
|
|
370 |
$('#warehouseLineItem .modal-content').html(response);
|
|
|
371 |
|
|
|
372 |
});
|
|
|
373 |
});
|
|
|
374 |
|
|
|
375 |
|
|
|
376 |
|
| 32192 |
tejbeer |
377 |
|
|
|
378 |
$(document).on("click", '.removeInPurchaseOrder', function() {
|
|
|
379 |
|
|
|
380 |
var row = $(this).closest("tr");
|
|
|
381 |
row.remove();
|
|
|
382 |
});
|
|
|
383 |
|
| 32256 |
tejbeer |
384 |
|
|
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
|
| 32192 |
tejbeer |
389 |
$(document).on('click', ".addRowForInvoiceItem", function() {
|
|
|
390 |
|
|
|
391 |
var numitems = $(this).data("numitems");
|
|
|
392 |
var invoiceId = $(this).data("invoiceid");
|
|
|
393 |
|
|
|
394 |
|
|
|
395 |
var invoiceItemIds = [];
|
|
|
396 |
var totalQty = 0
|
|
|
397 |
|
|
|
398 |
$("#invoice-order-table > tbody > tr").each(function() {
|
|
|
399 |
var itemId = $(this).find(".rate").data('itemid');
|
|
|
400 |
var qty = $(this).find(".qty").val();
|
|
|
401 |
|
|
|
402 |
console.log(qty)
|
|
|
403 |
|
|
|
404 |
if (qty != undefined) {
|
|
|
405 |
totalQty += qty
|
|
|
406 |
}
|
|
|
407 |
|
|
|
408 |
console.log(totalQty)
|
|
|
409 |
|
|
|
410 |
|
|
|
411 |
if (itemId != undefined) {
|
|
|
412 |
invoiceItemIds.push(itemId)
|
|
|
413 |
}
|
|
|
414 |
});
|
|
|
415 |
|
|
|
416 |
var $html = $('<tr> <td> <input type="text" class="form-control typeaheaditem" autocomplete="off" placeholder="Search Model"/> </td>' +
|
|
|
417 |
'<td> <input type="number" class="form-control qty" name = "qty" placeholder="Quantity"/> </td>' +
|
|
|
418 |
'<td> <input type="number" class="form-control rate" disable placeholder="Rate"/> </td>' +
|
|
|
419 |
'<td> <input class="form-control btn btn-primary removeInInvoiceItem" type="button" value="Remove"></td> </tr> ');
|
|
|
420 |
|
|
|
421 |
|
|
|
422 |
getItemAheadOptions($html.find('.typeaheaditem'), true, function(
|
|
|
423 |
selectedItem) {
|
|
|
424 |
var itemId = selectedItem.itemId;
|
|
|
425 |
|
|
|
426 |
|
|
|
427 |
console.log(invoiceItemIds)
|
|
|
428 |
|
|
|
429 |
if (invoiceItemIds.indexOf(itemId) > -1) {
|
|
|
430 |
alert("item already selected");
|
|
|
431 |
$html.find('.typeaheaditem').val("")
|
|
|
432 |
|
|
|
433 |
return false;
|
|
|
434 |
}
|
|
|
435 |
$html.find('.rate').data('itemid', itemId)
|
|
|
436 |
|
|
|
437 |
$html.find('.removeInInvoiceItem').data('invoiceid', invoiceId)
|
|
|
438 |
$html.find('.removeInInvoiceItem').data('itemid', itemId)
|
|
|
439 |
|
|
|
440 |
});
|
|
|
441 |
|
|
|
442 |
|
|
|
443 |
if (totalQty < numitems) {
|
|
|
444 |
|
|
|
445 |
$('#invoice-order-table tbody').append($html);
|
|
|
446 |
}
|
|
|
447 |
|
|
|
448 |
});
|
|
|
449 |
|
|
|
450 |
|
|
|
451 |
|
|
|
452 |
|
|
|
453 |
|
|
|
454 |
$(document).on('click', '.saveInvoiceDetail', function() {
|
|
|
455 |
|
|
|
456 |
var numItems = $(this).data("numitems");
|
|
|
457 |
var invoiceId = $(this).data("invoiceid");
|
|
|
458 |
var warehouseId = $(this).data("warehouseid");
|
|
|
459 |
var supplierId = $(this).data("supplierid");
|
|
|
460 |
getInvoiceItemData(numItems, invoiceId, warehouseId, supplierId, false);
|
|
|
461 |
|
|
|
462 |
});
|
|
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
|
466 |
$(document).on('click', '.validateInvoiceDetail', function() {
|
|
|
467 |
var numItems = $(this).data("numitems");
|
|
|
468 |
var invoiceId = $(this).data("invoiceid");
|
|
|
469 |
var warehouseId = $(this).data("warehouseid");
|
|
|
470 |
var supplierId = $(this).data("supplierid");
|
|
|
471 |
|
|
|
472 |
getInvoiceItemData(numItems, invoiceId, warehouseId, supplierId, true);
|
|
|
473 |
|
|
|
474 |
});
|
|
|
475 |
|
|
|
476 |
|
|
|
477 |
$(document).on("click", '.removeInInvoiceItem', function() {
|
|
|
478 |
|
|
|
479 |
var row = $(this).closest("tr");
|
|
|
480 |
var invoiceId = $(this).data("invoiceid");
|
|
|
481 |
var itemId = $(this).data("itemid");
|
|
|
482 |
if (invoiceId != undefined && itemId != undefined) {
|
|
|
483 |
doDeleteAjaxRequestHandler(context + "/removeInvoiceItem?invoiceId="
|
|
|
484 |
+ invoiceId + "&itemId=" + itemId, function(response) {
|
|
|
485 |
if (response == "true") {
|
|
|
486 |
alert("Item removed successfully");
|
|
|
487 |
|
|
|
488 |
}
|
|
|
489 |
});
|
|
|
490 |
}
|
|
|
491 |
|
|
|
492 |
row.remove();
|
|
|
493 |
|
|
|
494 |
});
|
|
|
495 |
|
|
|
496 |
|
|
|
497 |
$(document).on('click', '.purchaseGrn', function() {
|
|
|
498 |
|
|
|
499 |
var grnItemArray = [];
|
|
|
500 |
|
|
|
501 |
var invoiceId = $(this).data("invoiceid");
|
|
|
502 |
|
|
|
503 |
|
|
|
504 |
$("#invoice-purchase-validate > tbody > tr").each(function() {
|
|
|
505 |
var grnItemJson = {};
|
|
|
506 |
|
|
|
507 |
var itemId = $(this).find(".itemId").text();
|
|
|
508 |
var qty = $(this).find(".qty").text();
|
|
|
509 |
var poId = $(this).find(".purchaseId").text();
|
| 32256 |
tejbeer |
510 |
var excessQty = $(this).find(".excessQty").text();
|
| 32192 |
tejbeer |
511 |
var itemType = $(this).find(".itemType").text();
|
|
|
512 |
|
|
|
513 |
console.log(itemType);
|
|
|
514 |
|
|
|
515 |
if (itemType == "Serialized") {
|
| 32256 |
tejbeer |
516 |
var serialNumbers = $(this).find(".imeis-to-grn").tagsinput('items');
|
| 32192 |
tejbeer |
517 |
grnItemJson['serialNumbers'] = serialNumbers
|
|
|
518 |
|
| 32256 |
tejbeer |
519 |
if (excessQty > 0) {
|
|
|
520 |
var returnSerialNumbers = $(this).find(".imeis-to-grn-return").tagsinput('items');
|
|
|
521 |
grnItemJson['returnSerialNumbers'] = returnSerialNumbers
|
|
|
522 |
}
|
| 32192 |
tejbeer |
523 |
}
|
|
|
524 |
console.log(serialNumbers)
|
|
|
525 |
grnItemJson['itemId'] = itemId;
|
|
|
526 |
grnItemJson['serialNumbers'] = serialNumbers
|
|
|
527 |
grnItemJson['qty'] = qty
|
|
|
528 |
grnItemJson['poId'] = poId
|
|
|
529 |
grnItemJson['invoiceId'] = invoiceId
|
| 32256 |
tejbeer |
530 |
grnItemJson['itemType'] = itemType
|
|
|
531 |
grnItemJson['excessQty'] = excessQty
|
|
|
532 |
|
|
|
533 |
grnItemJson['returnSerialNumbers'] = returnSerialNumbers
|
|
|
534 |
|
| 32192 |
tejbeer |
535 |
grnItemArray.push(grnItemJson)
|
|
|
536 |
|
|
|
537 |
console.log(grnItemArray)
|
|
|
538 |
|
|
|
539 |
});
|
|
|
540 |
|
|
|
541 |
for (var i = 0; i < grnItemArray.length; i++) {
|
|
|
542 |
|
|
|
543 |
var serialNumbers = grnItemArray[i].serialNumbers.length
|
|
|
544 |
|
| 32256 |
tejbeer |
545 |
var itemType = grnItemArray[i].itemType
|
| 32192 |
tejbeer |
546 |
|
| 32256 |
tejbeer |
547 |
|
|
|
548 |
if (itemType == "Serialized") {
|
|
|
549 |
var excessQty = grnItemArray[i].excessQty
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
|
| 32192 |
tejbeer |
553 |
var serialNumbers = grnItemArray[i].serialNumbers.length
|
|
|
554 |
var qty = grnItemArray[i].qty
|
|
|
555 |
|
|
|
556 |
if (serialNumbers != qty) {
|
|
|
557 |
alert("serial number is not matched with qty")
|
|
|
558 |
return false;
|
|
|
559 |
}
|
| 32256 |
tejbeer |
560 |
|
|
|
561 |
if (excessQty > 0) {
|
|
|
562 |
|
|
|
563 |
var returnSerialNumbers = grnItemArray[i].returnSerialNumbers.length
|
|
|
564 |
|
|
|
565 |
if (returnSerialNumbers != excessQty) {
|
|
|
566 |
alert("Return serial number is not matched with excess qty")
|
|
|
567 |
return false;
|
|
|
568 |
}
|
|
|
569 |
|
|
|
570 |
}
|
| 32192 |
tejbeer |
571 |
}
|
|
|
572 |
|
|
|
573 |
}
|
|
|
574 |
|
|
|
575 |
|
|
|
576 |
console.log(JSON.stringify(grnItemArray))
|
|
|
577 |
if (confirm("Are you sure you want to grn purchase order") == true) {
|
|
|
578 |
|
|
|
579 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
580 |
+ "/createGrn", JSON
|
|
|
581 |
.stringify(grnItemArray), function(response) {
|
|
|
582 |
if (response == 'true') {
|
| 32258 |
tejbeer |
583 |
alert("successfully done");
|
|
|
584 |
loadNewReceiveInvoice("main-content");
|
| 32256 |
tejbeer |
585 |
}
|
|
|
586 |
});
|
|
|
587 |
}
|
|
|
588 |
|
|
|
589 |
|
|
|
590 |
|
|
|
591 |
});
|
|
|
592 |
|
|
|
593 |
|
|
|
594 |
|
|
|
595 |
$(document).on('click', '.grnRequest', function() {
|
|
|
596 |
|
|
|
597 |
var grnRequestJson = {};
|
|
|
598 |
var grnRequestItemArray = [];
|
|
|
599 |
|
|
|
600 |
var invoiceId = $(this).data("invoiceid");
|
|
|
601 |
|
|
|
602 |
|
|
|
603 |
$("#invoice-purchase-validate > tbody > tr").each(function() {
|
|
|
604 |
var grnItemJson = {};
|
|
|
605 |
|
|
|
606 |
var itemId = $.trim($(this).find(".itemId").text());
|
|
|
607 |
var poId = $.trim($(this).find(".purchaseId").text());
|
|
|
608 |
|
|
|
609 |
var qty = parseInt($(this).find(".qty").text());
|
|
|
610 |
|
|
|
611 |
var excessQty = parseInt($(this).find(".excessQty").text());
|
|
|
612 |
|
|
|
613 |
var priceMismatch = $.trim($(this).find(".priceMismatch").text());
|
|
|
614 |
console.log(priceMismatch)
|
|
|
615 |
|
|
|
616 |
|
|
|
617 |
if (priceMismatch != null || excessQty > 0) {
|
|
|
618 |
console.log(typeof priceMismatch)
|
|
|
619 |
console.log(excessQty)
|
|
|
620 |
grnItemJson['itemId'] = itemId;
|
|
|
621 |
grnItemJson['qty'] = qty;
|
|
|
622 |
grnItemJson['excessQty'] = excessQty
|
| 32264 |
tejbeer |
623 |
grnItemJson['mismatch'] = priceMismatch
|
| 32256 |
tejbeer |
624 |
grnItemJson['poId'] = poId
|
|
|
625 |
|
|
|
626 |
grnRequestItemArray.push(grnItemJson)
|
|
|
627 |
}
|
|
|
628 |
});
|
|
|
629 |
|
|
|
630 |
console.log(grnRequestItemArray)
|
|
|
631 |
|
|
|
632 |
|
|
|
633 |
|
|
|
634 |
grnRequestJson['invoiceId'] = invoiceId;
|
|
|
635 |
grnRequestJson['warehousePurchaseModel'] = grnRequestItemArray
|
|
|
636 |
|
|
|
637 |
if (confirm("Are you sure you want to raise grn request") == true) {
|
|
|
638 |
|
|
|
639 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
640 |
+ "/grnRequest", JSON
|
|
|
641 |
.stringify(grnRequestJson), function(response) {
|
|
|
642 |
if (response == 'true') {
|
| 32192 |
tejbeer |
643 |
alert("successfully done");
|
| 32256 |
tejbeer |
644 |
loadNewReceiveInvoice("main-content");
|
| 32192 |
tejbeer |
645 |
}
|
|
|
646 |
});
|
|
|
647 |
}
|
|
|
648 |
|
|
|
649 |
|
|
|
650 |
|
|
|
651 |
});
|
|
|
652 |
|
|
|
653 |
|
| 32256 |
tejbeer |
654 |
$(document).on('click', '.resolvedPriceMismatchRequest', function() {
|
|
|
655 |
var id = $(this).data("id");
|
|
|
656 |
|
|
|
657 |
var invoiceId = $(this).data("invoiceid");
|
|
|
658 |
|
|
|
659 |
var requestId = $(this).data("requestid");
|
|
|
660 |
|
| 32261 |
tejbeer |
661 |
var mismatch = $(this).data("mismatch");
|
| 32256 |
tejbeer |
662 |
|
| 32261 |
tejbeer |
663 |
if (mismatch == "InvoiceMismatch") {
|
| 32256 |
tejbeer |
664 |
if (confirm("Are you sure you want to resolve invoice mismatch") == true) {
|
|
|
665 |
|
|
|
666 |
doGetAjaxRequestHandler(context + "/resolvedMismatchRequest?id=" + id, function(response) {
|
|
|
667 |
if (response == 'true') {
|
|
|
668 |
getGrnRequestItems(requestId, invoiceId)
|
|
|
669 |
}
|
|
|
670 |
});
|
|
|
671 |
|
|
|
672 |
}
|
| 32261 |
tejbeer |
673 |
} else if (mismatch == "PoMismatch") {
|
| 32256 |
tejbeer |
674 |
if (confirm("Are you sure you want to resolve Po Mismatch. Discard the current PoLineItem new Po will generate on the invoice date.") == true) {
|
|
|
675 |
|
|
|
676 |
doGetAjaxRequestHandler(context + "/resolvedMismatchRequest?id=" + id, function(response) {
|
|
|
677 |
if (response == 'true') {
|
|
|
678 |
getGrnRequestItems(requestId, invoiceId)
|
|
|
679 |
}
|
|
|
680 |
});
|
|
|
681 |
|
|
|
682 |
}
|
|
|
683 |
}
|
|
|
684 |
|
|
|
685 |
});
|
|
|
686 |
|
|
|
687 |
|
|
|
688 |
|
|
|
689 |
$(document).on('click', '.resolvedQtyMismatchRequest', function() {
|
|
|
690 |
var id = $(this).data("id");
|
|
|
691 |
|
|
|
692 |
var invoiceId = $(this).data("invoiceid");
|
|
|
693 |
|
|
|
694 |
var requestId = $(this).data("requestid");
|
|
|
695 |
var requestId = $(this).data("requestid");
|
|
|
696 |
|
|
|
697 |
|
| 32261 |
tejbeer |
698 |
var mismatch = $(this).data("mismatch");
|
| 32256 |
tejbeer |
699 |
|
|
|
700 |
var $row = $(this).closest("tr");
|
|
|
701 |
var requiredQty = $row.find(".requiredQty").val();
|
|
|
702 |
|
|
|
703 |
console.log(requiredQty);
|
|
|
704 |
|
| 32261 |
tejbeer |
705 |
if (mismatch == "QtyMismatch") {
|
| 32256 |
tejbeer |
706 |
if (confirm("Are you sure you want to resolve qty mismatch") == true) {
|
|
|
707 |
|
|
|
708 |
doGetAjaxRequestHandler(context + "/resolvedMismatchRequest?id=" + id + "&requiredQty=" + requiredQty, function(response) {
|
|
|
709 |
if (response == 'true') {
|
|
|
710 |
getGrnRequestItems(requestId, invoiceId)
|
|
|
711 |
}
|
|
|
712 |
});
|
|
|
713 |
|
|
|
714 |
}
|
|
|
715 |
}
|
|
|
716 |
|
|
|
717 |
});
|
|
|
718 |
|
|
|
719 |
|
|
|
720 |
|
|
|
721 |
|
|
|
722 |
|
| 32145 |
tejbeer |
723 |
});
|
|
|
724 |
|
|
|
725 |
function loadCreatePurchase(domId) {
|
|
|
726 |
doGetAjaxRequestHandler(context + "/warehousePurchaseOrder", function(response) {
|
|
|
727 |
$('#' + domId).html(response);
|
|
|
728 |
});
|
|
|
729 |
}
|
|
|
730 |
|
| 32192 |
tejbeer |
731 |
|
|
|
732 |
|
| 32145 |
tejbeer |
733 |
function loadOpenPurchase(domId) {
|
|
|
734 |
|
|
|
735 |
doGetAjaxRequestHandler(context + "/getOpenPurchaseOrder", function(response) {
|
|
|
736 |
$('#' + domId).html(response);
|
|
|
737 |
});
|
|
|
738 |
}
|
|
|
739 |
|
| 32192 |
tejbeer |
740 |
function loadNewReceiveInvoice(domId) {
|
|
|
741 |
doGetAjaxRequestHandler(context + "/newReceiveInvoice", function(response) {
|
|
|
742 |
$('#' + domId).html(response);
|
|
|
743 |
});
|
|
|
744 |
}
|
|
|
745 |
|
| 32256 |
tejbeer |
746 |
|
|
|
747 |
|
|
|
748 |
function loadGrnRequest(domId) {
|
|
|
749 |
doGetAjaxRequestHandler(context + "/grnRequest", function(response) {
|
|
|
750 |
$('#' + domId).html(response);
|
|
|
751 |
});
|
|
|
752 |
}
|
|
|
753 |
|
|
|
754 |
function loadDebitNote(domId) {
|
|
|
755 |
doGetAjaxRequestHandler(context + "/getDebitNote", function(response) {
|
|
|
756 |
$('#' + domId).html(response);
|
|
|
757 |
});
|
|
|
758 |
}
|
|
|
759 |
|
| 32145 |
tejbeer |
760 |
function createPurchase(sendPo) {
|
|
|
761 |
var purchaseOrder = {};
|
|
|
762 |
|
|
|
763 |
var vendorId = $('#vendorId').val();
|
|
|
764 |
|
|
|
765 |
var warehouseId = $('#warehouseMap').val();
|
|
|
766 |
|
|
|
767 |
|
|
|
768 |
var items = []
|
|
|
769 |
$("table > tbody > tr").each(function() {
|
|
|
770 |
var purchaseOrderJson = {};
|
|
|
771 |
|
|
|
772 |
var itemId = $(this).find(".transferPrice").data('itemid');
|
|
|
773 |
var qty = $(this).find(".qty").val();
|
|
|
774 |
var transferPrice = $(this).find(".transferPrice").val();
|
|
|
775 |
var totalValue = $(this).find(".totalValue").val();
|
|
|
776 |
|
|
|
777 |
|
|
|
778 |
purchaseOrderJson['itemId'] = itemId;
|
| 32256 |
tejbeer |
779 |
purchaseOrderJson['amendedQty'] = qty
|
| 32145 |
tejbeer |
780 |
purchaseOrderJson['totalValue'] = totalValue
|
|
|
781 |
purchaseOrderJson['transferPrice'] = transferPrice
|
|
|
782 |
|
|
|
783 |
items.push(purchaseOrderJson)
|
|
|
784 |
});
|
|
|
785 |
|
|
|
786 |
|
|
|
787 |
for (var i = 0; i < items.length; i++) {
|
|
|
788 |
console.log(items[i])
|
|
|
789 |
|
|
|
790 |
var itemId = items[i].itemId
|
| 32261 |
tejbeer |
791 |
var qty = items[i].amendedQty
|
| 32145 |
tejbeer |
792 |
var transferPrice = items[i].transferPrice
|
|
|
793 |
var totalValue = items[i].totalValue
|
|
|
794 |
|
|
|
795 |
if (itemId === "" && qty === "" && transferPrice === "" && totalValue === "") {
|
|
|
796 |
alert("Field can't be empty");
|
|
|
797 |
return false;
|
|
|
798 |
}
|
|
|
799 |
|
|
|
800 |
|
|
|
801 |
if (itemId === "") {
|
|
|
802 |
alert("please select item");
|
|
|
803 |
return false;
|
|
|
804 |
}
|
|
|
805 |
if (qty === "") {
|
|
|
806 |
alert("please choose qty");
|
|
|
807 |
return false;
|
|
|
808 |
}
|
|
|
809 |
|
|
|
810 |
if (transferPrice === "") {
|
|
|
811 |
alert("Transfer Price can't be empty");
|
|
|
812 |
return false;
|
|
|
813 |
}
|
|
|
814 |
if (totalValue === "") {
|
|
|
815 |
alert("Total value can't be empty");
|
|
|
816 |
return false;
|
|
|
817 |
}
|
|
|
818 |
|
| 32261 |
tejbeer |
819 |
if (qty <= 0) {
|
|
|
820 |
alert("Please fill Qty");
|
|
|
821 |
return false;
|
|
|
822 |
}
|
| 32145 |
tejbeer |
823 |
|
|
|
824 |
|
| 32261 |
tejbeer |
825 |
|
| 32145 |
tejbeer |
826 |
}
|
|
|
827 |
|
|
|
828 |
purchaseOrder['vendorId'] = vendorId;
|
|
|
829 |
purchaseOrder['warehouseId'] = warehouseId
|
|
|
830 |
purchaseOrder['sendPo'] = sendPo
|
|
|
831 |
|
|
|
832 |
purchaseOrder['items'] = items
|
|
|
833 |
|
|
|
834 |
console.log(purchaseOrder)
|
|
|
835 |
|
|
|
836 |
|
|
|
837 |
|
|
|
838 |
if (confirm("Are you sure you want to create purchase order") == true) {
|
|
|
839 |
|
|
|
840 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
841 |
+ "/createPurchaseOrder", JSON
|
|
|
842 |
.stringify(purchaseOrder), function(response) {
|
|
|
843 |
if (response == 'true') {
|
|
|
844 |
alert("successfully created");
|
| 32256 |
tejbeer |
845 |
loadCreatePurchase("main-content");
|
| 32145 |
tejbeer |
846 |
}
|
|
|
847 |
});
|
|
|
848 |
}
|
|
|
849 |
|
|
|
850 |
}
|
|
|
851 |
|
|
|
852 |
|
|
|
853 |
function editPurchase(sendPo, poid) {
|
|
|
854 |
var editpurchaseOrder = {}
|
|
|
855 |
var items = []
|
|
|
856 |
$("#purchase-edit-lineitem > tbody > tr").each(function() {
|
|
|
857 |
var purchaseOrderJson = {};
|
|
|
858 |
var itemId = $(this).find("td:eq(0)").text();
|
|
|
859 |
|
| 32256 |
tejbeer |
860 |
var qty = $(this).find("td:eq(2)").text();
|
| 32145 |
tejbeer |
861 |
|
| 32256 |
tejbeer |
862 |
var amendedQty = $(this).find(".editqty").val();
|
|
|
863 |
|
| 32283 |
tejbeer |
864 |
var transferPrice = $.trim($(this).find(".transferPrice").html());
|
| 32256 |
tejbeer |
865 |
|
|
|
866 |
|
| 32145 |
tejbeer |
867 |
purchaseOrderJson['itemId'] = itemId;
|
| 32256 |
tejbeer |
868 |
purchaseOrderJson['amendedQty'] = parseInt(amendedQty)
|
|
|
869 |
purchaseOrderJson['qty'] = parseInt(qty)
|
| 32282 |
tejbeer |
870 |
purchaseOrderJson['transferPrice'] = transferPrice
|
| 32145 |
tejbeer |
871 |
|
|
|
872 |
items.push(purchaseOrderJson)
|
|
|
873 |
});
|
|
|
874 |
|
|
|
875 |
|
|
|
876 |
for (var i = 0; i < items.length; i++) {
|
|
|
877 |
console.log(items[i])
|
|
|
878 |
|
| 32256 |
tejbeer |
879 |
var amendedQty = items[i].amendedQty
|
| 32145 |
tejbeer |
880 |
var qty = items[i].qty
|
|
|
881 |
|
| 32256 |
tejbeer |
882 |
|
|
|
883 |
if (amendedQty === "") {
|
| 32145 |
tejbeer |
884 |
alert("please choose qty");
|
|
|
885 |
return false;
|
|
|
886 |
}
|
|
|
887 |
|
| 32256 |
tejbeer |
888 |
if (amendedQty < qty) {
|
|
|
889 |
alert("Quantity should be greater than existing qty");
|
| 32145 |
tejbeer |
890 |
return false;
|
|
|
891 |
}
|
|
|
892 |
|
|
|
893 |
|
|
|
894 |
}
|
|
|
895 |
|
|
|
896 |
editpurchaseOrder['purchaseOrderId'] = poid;
|
|
|
897 |
editpurchaseOrder['sendPo'] = sendPo
|
|
|
898 |
editpurchaseOrder['items'] = items
|
|
|
899 |
|
|
|
900 |
|
|
|
901 |
if (confirm("Are you sure you want to edit purchase order") == true) {
|
|
|
902 |
|
|
|
903 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
904 |
+ "/editPurchaseOrder", JSON
|
|
|
905 |
.stringify(editpurchaseOrder), function(response) {
|
|
|
906 |
if (response == 'true') {
|
|
|
907 |
alert("successfully created");
|
| 32295 |
tejbeer |
908 |
$('#warehouseEditPurchaseContainer').modal('hide');
|
|
|
909 |
$('.modal-backdrop').remove();
|
|
|
910 |
|
| 32256 |
tejbeer |
911 |
loadOpenPurchase("main-content")
|
| 32145 |
tejbeer |
912 |
}
|
|
|
913 |
});
|
|
|
914 |
}
|
|
|
915 |
|
|
|
916 |
}
|
|
|
917 |
|
|
|
918 |
|
| 32192 |
tejbeer |
919 |
function getInvoiceItemData(numItems, invoiceId, warehouseId, supplierId, validate) {
|
|
|
920 |
|
|
|
921 |
var invoiceJson = {};
|
|
|
922 |
console.log(numItems)
|
|
|
923 |
var totalQty = 0;
|
|
|
924 |
var invoiceItems = []
|
|
|
925 |
$("#invoice-order-table > tbody > tr").each(function() {
|
|
|
926 |
var invoiceItemJson = {};
|
|
|
927 |
var itemId = $(this).find(".rate").data('itemid');
|
|
|
928 |
var qty = $(this).find(".qty").val();
|
|
|
929 |
|
|
|
930 |
if (qty != undefined) {
|
|
|
931 |
totalQty += parseInt(qty)
|
|
|
932 |
}
|
|
|
933 |
var rate = $(this).find(".rate").val();
|
|
|
934 |
invoiceItemJson['itemId'] = itemId;
|
|
|
935 |
invoiceItemJson['qty'] = qty
|
|
|
936 |
invoiceItemJson['rate'] = rate
|
|
|
937 |
invoiceItems.push(invoiceItemJson)
|
|
|
938 |
});
|
|
|
939 |
|
|
|
940 |
|
|
|
941 |
for (var i = 0; i < invoiceItems.length; i++) {
|
|
|
942 |
|
|
|
943 |
var itemId = invoiceItems[i].itemId
|
|
|
944 |
var qty = invoiceItems[i].qty
|
|
|
945 |
var rate = invoiceItems[i].rate
|
|
|
946 |
if (itemId === "" && qty === "" && rate === "") {
|
|
|
947 |
alert("Field can't be empty");
|
|
|
948 |
return false;
|
|
|
949 |
}
|
|
|
950 |
|
|
|
951 |
if (itemId === "") {
|
|
|
952 |
alert("please select item");
|
|
|
953 |
return false;
|
|
|
954 |
}
|
|
|
955 |
if (qty === "") {
|
|
|
956 |
alert("please choose qty");
|
|
|
957 |
return false;
|
|
|
958 |
}
|
|
|
959 |
|
|
|
960 |
if (rate === "") {
|
|
|
961 |
alert("Rate can't be empty");
|
|
|
962 |
return false;
|
|
|
963 |
}
|
|
|
964 |
|
|
|
965 |
}
|
|
|
966 |
|
|
|
967 |
console.log(totalQty)
|
|
|
968 |
|
|
|
969 |
if (totalQty > numItems) {
|
|
|
970 |
alert("Qty Should not be more than Invoice items");
|
|
|
971 |
return false;
|
|
|
972 |
}
|
|
|
973 |
|
|
|
974 |
if (validate) {
|
|
|
975 |
|
|
|
976 |
if (totalQty != numItems) {
|
|
|
977 |
alert("Qty Should not match with Invoice items");
|
|
|
978 |
return false;
|
|
|
979 |
}
|
|
|
980 |
}
|
|
|
981 |
|
|
|
982 |
|
|
|
983 |
invoiceJson['invoiceId'] = invoiceId;
|
|
|
984 |
invoiceJson['warehouseId'] = warehouseId;
|
|
|
985 |
invoiceJson['supplierId'] = supplierId;
|
|
|
986 |
invoiceJson['invoiceItems'] = invoiceItems
|
|
|
987 |
if (validate) {
|
|
|
988 |
validateInvoiceItems(invoiceJson);
|
|
|
989 |
} else {
|
|
|
990 |
saveInvoiceItems(invoiceJson)
|
|
|
991 |
}
|
|
|
992 |
}
|
|
|
993 |
|
|
|
994 |
|
|
|
995 |
function saveInvoiceItems(invoiceJson) {
|
|
|
996 |
|
|
|
997 |
|
|
|
998 |
if (confirm("Are you sure you want to save invoice item") == true) {
|
|
|
999 |
|
|
|
1000 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
1001 |
+ "/invoiceItemDetail", JSON
|
|
|
1002 |
.stringify(invoiceJson), function(response) {
|
|
|
1003 |
if (response == 'true') {
|
|
|
1004 |
getInvoiceItems(invoiceJson.invoiceId);
|
|
|
1005 |
}
|
|
|
1006 |
});
|
|
|
1007 |
}
|
|
|
1008 |
|
|
|
1009 |
}
|
|
|
1010 |
|
|
|
1011 |
|
|
|
1012 |
function validateInvoiceItems(invoiceJson) {
|
|
|
1013 |
|
|
|
1014 |
|
|
|
1015 |
if (confirm("Are you sure you want to validate invoice item") == true) {
|
|
|
1016 |
|
|
|
1017 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
1018 |
+ "/validateInvoiceItemDetail", JSON
|
|
|
1019 |
.stringify(invoiceJson), function(response) {
|
|
|
1020 |
$('.invoiceadditemcontainer').html(response);
|
|
|
1021 |
|
|
|
1022 |
});
|
|
|
1023 |
}
|
|
|
1024 |
|
|
|
1025 |
}
|
|
|
1026 |
|
|
|
1027 |
function getOpenPOFromWarehouse() {
|
|
|
1028 |
|
|
|
1029 |
var warehouseId = $('#warehouseMap').val();
|
|
|
1030 |
doGetAjaxRequestHandler(context + "/getOpenPurchaseOrderByWarehouseId?warehouseId=" + warehouseId, function(response) {
|
|
|
1031 |
$('#warehouseManagePuchaseContainer').html(response);
|
|
|
1032 |
});
|
|
|
1033 |
|
|
|
1034 |
|
|
|
1035 |
|
|
|
1036 |
}
|
|
|
1037 |
|
|
|
1038 |
function getPurchaseLineitem(poId) {
|
|
|
1039 |
|
|
|
1040 |
|
|
|
1041 |
doGetAjaxRequestHandler(context + "/getPurchaseOrderItemByPoId?poId=" + poId, function(response) {
|
|
|
1042 |
$('#warehouseManagePuchaseItemContainer').html(response);
|
|
|
1043 |
$('#warehousepurchaseitemgrn').hide()
|
|
|
1044 |
});
|
|
|
1045 |
|
|
|
1046 |
|
|
|
1047 |
}
|
|
|
1048 |
|
|
|
1049 |
|
|
|
1050 |
function getInvoiceItems(invoiceId) {
|
|
|
1051 |
|
|
|
1052 |
doGetAjaxRequestHandler(context + "/getInvoiceItems?invoiceId=" + invoiceId, function(response) {
|
|
|
1053 |
$('.invoiceadditemcontainer').html(response);
|
|
|
1054 |
|
|
|
1055 |
});
|
|
|
1056 |
}
|
|
|
1057 |
|
|
|
1058 |
|
| 32256 |
tejbeer |
1059 |
function getGrnRequestItems(requestId, invoiceId) {
|
|
|
1060 |
|
|
|
1061 |
doGetAjaxRequestHandler(context + "/grnRequestItem?requestId=" + requestId + "&invoiceId=" + invoiceId, function(response) {
|
|
|
1062 |
$('.grnRequestItemContainer').html(response);
|
|
|
1063 |
|
|
|
1064 |
});
|
|
|
1065 |
}
|
|
|
1066 |
|
|
|
1067 |
|