Subversion Repositories SmartDukaan

Rev

Rev 32145 | Rev 32195 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32145 Rev 32192
Line 2... Line 2...
2
	$(document).on('click', ".warehouse-create-purchase-order", function() {
2
	$(document).on('click', ".warehouse-create-purchase-order", function() {
3
		loadCreatePurchase("main-content");
3
		loadCreatePurchase("main-content");
4
	});
4
	});
5
 
5
 
6
 
6
 
-
 
7
	$(document).on('click', ".warehouse-receive-new-invoice", function() {
-
 
8
		loadNewReceiveInvoice("main-content");
-
 
9
	});
-
 
10
 
-
 
11
 
-
 
12
 
-
 
13
 
-
 
14
 
-
 
15
 
-
 
16
 
-
 
17
	$(document)
-
 
18
		.on(
-
 
19
			'input',
-
 
20
			'#invoice',
-
 
21
			function() {
-
 
22
				if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
23
					var fileSelector = $('#invoice')[0];
-
 
24
					if (fileSelector != undefined
-
 
25
						&& fileSelector.files[0] != undefined) {
-
 
26
						var url = context + '/document-upload';
-
 
27
 
-
 
28
						console.log(url);
-
 
29
						var file = this.files[0];
-
 
30
						doAjaxUploadRequestHandler(
-
 
31
							url,
-
 
32
							'POST',
-
 
33
							file,
-
 
34
							function(response) {
-
 
35
								console.log(response);
-
 
36
								var documentId = response.response.document_id;
-
 
37
								console.log("documentId : "
-
 
38
									+ documentId);
-
 
39
								$("#invoicehidden").val(documentId);
-
 
40
							});
-
 
41
 
-
 
42
					}
-
 
43
				} else {
-
 
44
					// Do nothing!
-
 
45
				}
-
 
46
			});
-
 
47
 
-
 
48
	$(document).on('click', ".createReceiveInvoice", function() {
-
 
49
 
-
 
50
		var invoiceDate = $('#actualDate').val();
-
 
51
 
-
 
52
		var warehouseId = $('#warehouseMap').val();
-
 
53
 
-
 
54
		var numItems = $('#numberofItems').val();
-
 
55
 
-
 
56
		var receivedBy = $('#authUser').val();
-
 
57
 
-
 
58
		var supplierId = $('#vendorId').val();
-
 
59
 
-
 
60
		var totalValue = $('#totalValue').val();
-
 
61
 
-
 
62
		var invoiceNumber = $('#invoiceNumber').val();
-
 
63
 
-
 
64
 
-
 
65
		var invoiceDoc = $("#invoicehidden").val();
-
 
66
 
-
 
67
 
-
 
68
		console.log(invoiceDoc)
-
 
69
 
-
 
70
 
-
 
71
		if (invoiceDate === "" && warehouseId === "" && numItems === "" && receivedBy === "" && supplierId === "" && totalValue === "" && invoiceNumber === "" && invoiceDoc === "") {
-
 
72
			alert("Field can't be empty");
-
 
73
			return false;
-
 
74
		}
-
 
75
 
-
 
76
 
-
 
77
		if (invoiceDate === "") {
-
 
78
			alert("please select date");
-
 
79
			return false;
-
 
80
		}
-
 
81
		if (warehouseId === "") {
-
 
82
			alert("please choose warehouse");
-
 
83
			return false;
-
 
84
		}
-
 
85
 
-
 
86
		if (numItems === "") {
-
 
87
			alert("please fill number of items.");
-
 
88
			return false;
-
 
89
		}
-
 
90
		if (receivedBy === "") {
-
 
91
			alert("please choose received by  user");
-
 
92
			return false;
-
 
93
		}
-
 
94
 
-
 
95
		if (supplierId === "") {
-
 
96
			alert("please choose supplier");
-
 
97
			return false;
-
 
98
		}
-
 
99
 
-
 
100
 
-
 
101
 
-
 
102
		if (totalValue === "") {
-
 
103
			alert("please fill Total Value.");
-
 
104
			return false;
-
 
105
		}
-
 
106
 
-
 
107
		if (invoiceNumber === "") {
-
 
108
			alert("please fill Invoice Number.");
-
 
109
			return false;
-
 
110
		}
-
 
111
 
-
 
112
 
-
 
113
		if (invoiceDoc === "") {
-
 
114
			alert("please upload invoice.");
-
 
115
			return false;
-
 
116
		}
-
 
117
		var newReceiveInvoice = {};
-
 
118
 
-
 
119
		newReceiveInvoice['invoiceDate'] = invoiceDate;
-
 
120
		newReceiveInvoice['warehouseId'] = warehouseId
-
 
121
		newReceiveInvoice['numItems'] = numItems
-
 
122
		newReceiveInvoice['receivedBy'] = receivedBy
-
 
123
		newReceiveInvoice['supplierId'] = supplierId
-
 
124
		newReceiveInvoice['totalValue'] = totalValue
-
 
125
		newReceiveInvoice['invoiceNumber'] = invoiceNumber
-
 
126
		newReceiveInvoice['invoiceDoc'] = invoiceDoc
-
 
127
 
-
 
128
		if (confirm("Are you sure you want to add new Invoice") == true) {
-
 
129
 
-
 
130
			doPostAjaxRequestWithJsonHandler(context
-
 
131
				+ "/newReceiveInvoice", JSON
-
 
132
					.stringify(newReceiveInvoice), function(response) {
-
 
133
						if (response == 'true') {
-
 
134
							alert("successfully added");
-
 
135
							loadNewReceiveInvoice("main-content");
-
 
136
						}
-
 
137
					});
-
 
138
		}
-
 
139
 
-
 
140
 
-
 
141
 
-
 
142
 
-
 
143
 
-
 
144
	});
-
 
145
 
-
 
146
 
7
 
147
 
8
	$(document).on('click', ".purchaseorderitemview", function() {
148
	$(document).on('click', ".purchaseorderitemview", function() {
9
 
149
 
10
		var vendorId = $('#vendorId').val();
150
		var vendorId = $('#vendorId').val();
11
		var warehouseId = $('#warehouseMap').val();
151
		var warehouseId = $('#warehouseMap').val();
Line 29... Line 169...
29
		doGetAjaxRequestHandler(context + "/addPurchaseItemView?warehouseId=" + warehouseId + "&vendorId=" + vendorId, function(response) {
169
		doGetAjaxRequestHandler(context + "/addPurchaseItemView?warehouseId=" + warehouseId + "&vendorId=" + vendorId, function(response) {
30
			$(".createpurchaseordercontainer").html(response);
170
			$(".createpurchaseordercontainer").html(response);
31
		});
171
		});
32
	});
172
	});
33
 
173
 
34
	var itemIds = [];
-
 
35
 
174
 
36
	$(document).on('click', ".addRowInPurchaseOrder", function() {
175
	$(document).on('click', ".addRowInPurchaseOrder", function() {
-
 
176
 
-
 
177
 
-
 
178
		var purchaseItemIds = [];
-
 
179
		var totalQty = 0
-
 
180
 
-
 
181
		$("table > tbody > tr").each(function() {
-
 
182
			var itemId = $(this).find(".transferPrice").data('itemid');
-
 
183
			var qty = $(this).find(".qty").val();
-
 
184
 
-
 
185
			console.log(qty)
-
 
186
 
-
 
187
			if (qty != undefined) {
-
 
188
				totalQty += parseInt(qty)
-
 
189
			}
-
 
190
 
-
 
191
			console.log(totalQty)
-
 
192
 
-
 
193
 
-
 
194
			if (itemId != undefined) {
-
 
195
				purchaseItemIds.push(itemId)
-
 
196
			}
-
 
197
		});
-
 
198
 
37
		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> ');
199
		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> ');
38
 
200
 
39
 
201
 
-
 
202
 
40
		getItemAheadOptions($html.find('.typeaheaditem'), true, function(
203
		getItemAheadOptions($html.find('.typeaheaditem'), true, function(
41
			selectedItem) {
204
			selectedItem) {
42
			var itemId = selectedItem.itemId;
205
			var itemId = selectedItem.itemId;
43
 
206
 
44
			var vendorId = $('#vendorId').val();
207
			var vendorId = $('#vendorId').val();
45
 
208
 
46
			if (itemIds.indexOf(itemId) > -1) {
209
			if (purchaseItemIds.indexOf(itemId) > -1) {
47
				alert("item already selected");
210
				alert("item already selected");
48
				$html.find('.typeaheaditem').val("")
211
				$html.find('.typeaheaditem').val("")
49
 
212
 
50
				return false;
213
				return false;
51
			}
214
			}
52
 
215
 
53
			itemIds.push(itemId)
216
			purchaseItemIds.push(itemId)
54
 
217
 
55
 
218
 
56
 
219
 
57
			doGetAjaxRequestHandler(context + "/getPricing?vendorId=" + vendorId + "&itemId=" + itemId, function(response) {
220
			doGetAjaxRequestHandler(context + "/getPricing?vendorId=" + vendorId + "&itemId=" + itemId, function(response) {
58
				console.log(response)
221
				console.log(response)
Line 112... Line 275...
112
 
275
 
113
	});
276
	});
114
 
277
 
115
 
278
 
116
 
279
 
117
	$(document).on("click", '.removeInPurchaseOrder', function() {
-
 
118
 
-
 
119
		var row = $(this).closest("tr");
-
 
120
		var itemId = $(this).find(".transferPrice").data('itemid');
-
 
121
		itemIds.splice(itemIds.indexOf(itemId), 1);
-
 
122
		row.remove();
-
 
123
	});
-
 
124
 
-
 
125
 
280
 
126
	$(document).on('click', '.warehouse-open-purchase-order', function() {
281
	$(document).on('click', '.warehouse-open-purchase-order', function() {
127
		loadOpenPurchase("main-content");
282
		loadOpenPurchase("main-content");
128
	});
283
	});
129
 
284
 
Line 174... Line 329...
174
		});
329
		});
175
	});
330
	});
176
 
331
 
177
 
332
 
178
 
333
 
-
 
334
 
-
 
335
 
179
	$(document).on('click', '.dateWisePo', function() {
336
	$(document).on('click', '.dateWisePo', function() {
180
 
337
 
181
		var startDate = getDatesFromPicker('input[name="duration"]').startDate;
338
		var startDate = getDatesFromPicker('input[name="duration"]').startDate;
182
		var endDate = getDatesFromPicker('input[name="duration"]').endDate
339
		var endDate = getDatesFromPicker('input[name="duration"]').endDate
183
 
340
 
Line 201... Line 358...
201
		});
358
		});
202
	});
359
	});
203
 
360
 
204
 
361
 
205
 
362
 
-
 
363
 
-
 
364
	$(document).on("click", '.removeInPurchaseOrder', function() {
-
 
365
 
-
 
366
		var row = $(this).closest("tr");
-
 
367
		row.remove();
-
 
368
	});
-
 
369
 
-
 
370
	$(document).on('click', ".addRowForInvoiceItem", function() {
-
 
371
 
-
 
372
		var numitems = $(this).data("numitems");
-
 
373
		var invoiceId = $(this).data("invoiceid");
-
 
374
 
-
 
375
 
-
 
376
		var invoiceItemIds = [];
-
 
377
		var totalQty = 0
-
 
378
 
-
 
379
		$("#invoice-order-table > tbody > tr").each(function() {
-
 
380
			var itemId = $(this).find(".rate").data('itemid');
-
 
381
			var qty = $(this).find(".qty").val();
-
 
382
 
-
 
383
			console.log(qty)
-
 
384
 
-
 
385
			if (qty != undefined) {
-
 
386
				totalQty += qty
-
 
387
			}
-
 
388
 
-
 
389
			console.log(totalQty)
-
 
390
 
-
 
391
 
-
 
392
			if (itemId != undefined) {
-
 
393
				invoiceItemIds.push(itemId)
-
 
394
			}
-
 
395
		});
-
 
396
 
-
 
397
		var $html = $('<tr>  <td>  <input type="text" class="form-control typeaheaditem"   autocomplete="off"  placeholder="Search Model"/> </td>' +
-
 
398
			'<td>  <input type="number" class="form-control qty"  name = "qty" placeholder="Quantity"/> </td>' +
-
 
399
			'<td>  <input type="number" class="form-control rate"  disable placeholder="Rate"/> </td>' +
-
 
400
			'<td> <input class="form-control btn btn-primary removeInInvoiceItem" type="button" value="Remove"></td>  </tr> ');
-
 
401
 
-
 
402
 
-
 
403
		getItemAheadOptions($html.find('.typeaheaditem'), true, function(
-
 
404
			selectedItem) {
-
 
405
			var itemId = selectedItem.itemId;
-
 
406
 
-
 
407
 
-
 
408
			console.log(invoiceItemIds)
-
 
409
 
-
 
410
			if (invoiceItemIds.indexOf(itemId) > -1) {
-
 
411
				alert("item already selected");
-
 
412
				$html.find('.typeaheaditem').val("")
-
 
413
 
-
 
414
				return false;
-
 
415
			}
-
 
416
			$html.find('.rate').data('itemid', itemId)
-
 
417
 
-
 
418
			$html.find('.removeInInvoiceItem').data('invoiceid', invoiceId)
-
 
419
			$html.find('.removeInInvoiceItem').data('itemid', itemId)
-
 
420
 
-
 
421
		});
-
 
422
 
-
 
423
 
-
 
424
		if (totalQty < numitems) {
-
 
425
 
-
 
426
			$('#invoice-order-table tbody').append($html);
-
 
427
		}
-
 
428
 
-
 
429
	});
-
 
430
 
-
 
431
 
-
 
432
 
-
 
433
 
-
 
434
 
-
 
435
	$(document).on('click', '.saveInvoiceDetail', function() {
-
 
436
 
-
 
437
		var numItems = $(this).data("numitems");
-
 
438
		var invoiceId = $(this).data("invoiceid");
-
 
439
		var warehouseId = $(this).data("warehouseid");
-
 
440
		var supplierId = $(this).data("supplierid");
-
 
441
		getInvoiceItemData(numItems, invoiceId, warehouseId, supplierId, false);
-
 
442
 
-
 
443
	});
-
 
444
 
-
 
445
 
-
 
446
 
-
 
447
	$(document).on('click', '.validateInvoiceDetail', function() {
-
 
448
		var numItems = $(this).data("numitems");
-
 
449
		var invoiceId = $(this).data("invoiceid");
-
 
450
		var warehouseId = $(this).data("warehouseid");
-
 
451
		var supplierId = $(this).data("supplierid");
-
 
452
 
-
 
453
		getInvoiceItemData(numItems, invoiceId, warehouseId, supplierId, true);
-
 
454
 
-
 
455
	});
-
 
456
 
-
 
457
 
-
 
458
	$(document).on("click", '.removeInInvoiceItem', function() {
-
 
459
 
-
 
460
		var row = $(this).closest("tr");
-
 
461
		var invoiceId = $(this).data("invoiceid");
-
 
462
		var itemId = $(this).data("itemid");
-
 
463
		if (invoiceId != undefined && itemId != undefined) {
-
 
464
			doDeleteAjaxRequestHandler(context + "/removeInvoiceItem?invoiceId="
-
 
465
				+ invoiceId + "&itemId=" + itemId, function(response) {
-
 
466
					if (response == "true") {
-
 
467
						alert("Item removed successfully");
-
 
468
 
-
 
469
					}
-
 
470
				});
-
 
471
		}
-
 
472
 
-
 
473
		row.remove();
-
 
474
 
-
 
475
	});
-
 
476
 
-
 
477
 
-
 
478
	$(document).on('click', '.purchaseGrn', function() {
-
 
479
 
-
 
480
		var grnItemArray = [];
-
 
481
 
-
 
482
		var invoiceId = $(this).data("invoiceid");
-
 
483
 
-
 
484
 
-
 
485
		$("#invoice-purchase-validate > tbody > tr").each(function() {
-
 
486
			var grnItemJson = {};
-
 
487
 
-
 
488
			var itemId = $(this).find(".itemId").text();
-
 
489
			var qty = $(this).find(".qty").text();
-
 
490
			var poId = $(this).find(".purchaseId").text();
-
 
491
 
-
 
492
			var itemType = $(this).find(".itemType").text();
-
 
493
 
-
 
494
			console.log(itemType);
-
 
495
 
-
 
496
			if (itemType == "Serialized") {
-
 
497
				var serialNumbers = $(".imeis-to-grn").tagsinput('items');
-
 
498
				grnItemJson['serialNumbers'] = serialNumbers
-
 
499
 
-
 
500
			}
-
 
501
			console.log(serialNumbers)
-
 
502
			grnItemJson['itemId'] = itemId;
-
 
503
			grnItemJson['serialNumbers'] = serialNumbers
-
 
504
			grnItemJson['qty'] = qty
-
 
505
			grnItemJson['poId'] = poId
-
 
506
			grnItemJson['invoiceId'] = invoiceId
-
 
507
			grnItemArray.push(grnItemJson)
-
 
508
 
-
 
509
			console.log(grnItemArray)
-
 
510
 
-
 
511
		});
-
 
512
 
-
 
513
		for (var i = 0; i < grnItemArray.length; i++) {
-
 
514
 
-
 
515
			var serialNumbers = grnItemArray[i].serialNumbers.length
-
 
516
 
-
 
517
			if (serialNumbers > 0) {
-
 
518
 
-
 
519
				var serialNumbers = grnItemArray[i].serialNumbers.length
-
 
520
				var qty = grnItemArray[i].qty
-
 
521
 
-
 
522
				if (serialNumbers != qty) {
-
 
523
					alert("serial number is not matched with qty")
-
 
524
					return false;
-
 
525
				}
-
 
526
			}
-
 
527
 
-
 
528
		}
-
 
529
 
-
 
530
 
-
 
531
		console.log(JSON.stringify(grnItemArray))
-
 
532
		if (confirm("Are you sure you want to grn purchase order") == true) {
-
 
533
 
-
 
534
			doPostAjaxRequestWithJsonHandler(context
-
 
535
				+ "/createGrn", JSON
-
 
536
					.stringify(grnItemArray), function(response) {
-
 
537
						if (response == 'true') {
-
 
538
							alert("successfully done");
-
 
539
						}
-
 
540
					});
-
 
541
		}
-
 
542
 
-
 
543
 
-
 
544
 
-
 
545
	});
-
 
546
 
-
 
547
 
206
});
548
});
207
 
549
 
208
function loadCreatePurchase(domId) {
550
function loadCreatePurchase(domId) {
209
	doGetAjaxRequestHandler(context + "/warehousePurchaseOrder", function(response) {
551
	doGetAjaxRequestHandler(context + "/warehousePurchaseOrder", function(response) {
210
		$('#' + domId).html(response);
552
		$('#' + domId).html(response);
211
	});
553
	});
212
}
554
}
213
 
555
 
-
 
556
 
-
 
557
 
214
function loadOpenPurchase(domId) {
558
function loadOpenPurchase(domId) {
215
 
559
 
216
	doGetAjaxRequestHandler(context + "/getOpenPurchaseOrder", function(response) {
560
	doGetAjaxRequestHandler(context + "/getOpenPurchaseOrder", function(response) {
217
		$('#' + domId).html(response);
561
		$('#' + domId).html(response);
218
	});
562
	});
219
}
563
}
220
 
564
 
-
 
565
function loadNewReceiveInvoice(domId) {
-
 
566
	doGetAjaxRequestHandler(context + "/newReceiveInvoice", function(response) {
-
 
567
		$('#' + domId).html(response);
-
 
568
	});
-
 
569
}
-
 
570
 
221
function createPurchase(sendPo) {
571
function createPurchase(sendPo) {
222
	var purchaseOrder = {};
572
	var purchaseOrder = {};
223
 
573
 
224
	var vendorId = $('#vendorId').val();
574
	var vendorId = $('#vendorId').val();
225
 
575
 
Line 279... Line 629...
279
 
629
 
280
 
630
 
281
 
631
 
282
	}
632
	}
283
 
633
 
284
 
-
 
285
 
-
 
286
 
-
 
287
	purchaseOrder['vendorId'] = vendorId;
634
	purchaseOrder['vendorId'] = vendorId;
288
	purchaseOrder['warehouseId'] = warehouseId
635
	purchaseOrder['warehouseId'] = warehouseId
289
	purchaseOrder['sendPo'] = sendPo
636
	purchaseOrder['sendPo'] = sendPo
290
 
637
 
291
	purchaseOrder['items'] = items
638
	purchaseOrder['items'] = items
Line 359... Line 706...
359
	}
706
	}
360
 
707
 
361
}
708
}
362
 
709
 
363
 
710
 
-
 
711
function getInvoiceItemData(numItems, invoiceId, warehouseId, supplierId, validate) {
-
 
712
 
-
 
713
	var invoiceJson = {};
-
 
714
	console.log(numItems)
-
 
715
	var totalQty = 0;
-
 
716
	var invoiceItems = []
-
 
717
	$("#invoice-order-table > tbody > tr").each(function() {
-
 
718
		var invoiceItemJson = {};
-
 
719
		var itemId = $(this).find(".rate").data('itemid');
-
 
720
		var qty = $(this).find(".qty").val();
-
 
721
 
-
 
722
		if (qty != undefined) {
-
 
723
			totalQty += parseInt(qty)
-
 
724
		}
-
 
725
		var rate = $(this).find(".rate").val();
-
 
726
		invoiceItemJson['itemId'] = itemId;
-
 
727
		invoiceItemJson['qty'] = qty
-
 
728
		invoiceItemJson['rate'] = rate
-
 
729
		invoiceItems.push(invoiceItemJson)
-
 
730
	});
-
 
731
 
-
 
732
 
-
 
733
	for (var i = 0; i < invoiceItems.length; i++) {
-
 
734
 
-
 
735
		var itemId = invoiceItems[i].itemId
-
 
736
		var qty = invoiceItems[i].qty
-
 
737
		var rate = invoiceItems[i].rate
-
 
738
		if (itemId === "" && qty === "" && rate === "") {
-
 
739
			alert("Field can't be empty");
-
 
740
			return false;
-
 
741
		}
-
 
742
 
-
 
743
		if (itemId === "") {
-
 
744
			alert("please select item");
-
 
745
			return false;
-
 
746
		}
-
 
747
		if (qty === "") {
-
 
748
			alert("please choose qty");
-
 
749
			return false;
-
 
750
		}
-
 
751
 
-
 
752
		if (rate === "") {
-
 
753
			alert("Rate can't be empty");
-
 
754
			return false;
-
 
755
		}
-
 
756
 
-
 
757
	}
-
 
758
 
-
 
759
	console.log(totalQty)
-
 
760
 
-
 
761
	if (totalQty > numItems) {
-
 
762
		alert("Qty Should not be more than  Invoice items");
-
 
763
		return false;
-
 
764
	}
-
 
765
 
-
 
766
	if (validate) {
-
 
767
 
-
 
768
		if (totalQty != numItems) {
-
 
769
			alert("Qty Should not match with Invoice items");
-
 
770
			return false;
-
 
771
		}
-
 
772
	}
-
 
773
 
-
 
774
 
-
 
775
	invoiceJson['invoiceId'] = invoiceId;
-
 
776
	invoiceJson['warehouseId'] = warehouseId;
-
 
777
	invoiceJson['supplierId'] = supplierId;
-
 
778
	invoiceJson['invoiceItems'] = invoiceItems
-
 
779
	if (validate) {
-
 
780
		validateInvoiceItems(invoiceJson);
-
 
781
	} else {
-
 
782
		saveInvoiceItems(invoiceJson)
-
 
783
	}
-
 
784
}
-
 
785
 
-
 
786
 
-
 
787
function saveInvoiceItems(invoiceJson) {
-
 
788
 
-
 
789
 
-
 
790
	if (confirm("Are you sure you want to save invoice item") == true) {
-
 
791
 
-
 
792
		doPostAjaxRequestWithJsonHandler(context
-
 
793
			+ "/invoiceItemDetail", JSON
-
 
794
				.stringify(invoiceJson), function(response) {
-
 
795
					if (response == 'true') {
-
 
796
						getInvoiceItems(invoiceJson.invoiceId);
-
 
797
					}
-
 
798
				});
-
 
799
	}
-
 
800
 
-
 
801
}
-
 
802
 
-
 
803
 
-
 
804
function validateInvoiceItems(invoiceJson) {
-
 
805
 
-
 
806
 
-
 
807
	if (confirm("Are you sure you want to validate invoice item") == true) {
-
 
808
 
-
 
809
		doPostAjaxRequestWithJsonHandler(context
-
 
810
			+ "/validateInvoiceItemDetail", JSON
-
 
811
				.stringify(invoiceJson), function(response) {
-
 
812
					$('.invoiceadditemcontainer').html(response);
-
 
813
 
-
 
814
				});
-
 
815
	}
-
 
816
 
-
 
817
}
-
 
818
 
-
 
819
function getOpenPOFromWarehouse() {
-
 
820
 
-
 
821
	var warehouseId = $('#warehouseMap').val();
-
 
822
	doGetAjaxRequestHandler(context + "/getOpenPurchaseOrderByWarehouseId?warehouseId=" + warehouseId, function(response) {
-
 
823
		$('#warehouseManagePuchaseContainer').html(response);
-
 
824
	});
-
 
825
 
-
 
826
 
-
 
827
 
-
 
828
}
-
 
829
 
-
 
830
function getPurchaseLineitem(poId) {
-
 
831
 
-
 
832
 
-
 
833
	doGetAjaxRequestHandler(context + "/getPurchaseOrderItemByPoId?poId=" + poId, function(response) {
-
 
834
		$('#warehouseManagePuchaseItemContainer').html(response);
-
 
835
		$('#warehousepurchaseitemgrn').hide()
-
 
836
	});
-
 
837
 
-
 
838
 
-
 
839
}
-
 
840
 
-
 
841
 
-
 
842
function getInvoiceItems(invoiceId) {
-
 
843
 
-
 
844
	doGetAjaxRequestHandler(context + "/getInvoiceItems?invoiceId=" + invoiceId, function(response) {
-
 
845
		$('.invoiceadditemcontainer').html(response);
-
 
846
 
-
 
847
	});
-
 
848
}
-
 
849
 
-
 
850