Subversion Repositories SmartDukaan

Rev

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

Rev 32297 Rev 32300
Line 1... Line 1...
1
$(function() {
1
$(function() {
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
 
-
 
7
	$(document).on('click', ".warehouse-receive-new-invoice", function() {
6
	$(document).on('click', ".warehouse-receive-new-invoice", function() {
8
		loadNewReceiveInvoice("main-content");
7
		loadNewReceiveInvoice("main-content");
9
	});
8
	});
10
 
9
 
11
 
10
 
12
 
-
 
13
 
-
 
14
	$(document).on('click', ".warehouse-grn-request", function() {
11
	$(document).on('click', ".warehouse-grn-request", function() {
15
		loadGrnRequest("main-content");
12
		loadGrnRequest("main-content");
16
	});
13
	});
17
 
14
 
-
 
15
 
18
	$(document).on('click', ".warehouse-debit-note", function() {
16
	$(document).on('click', ".warehouse-debit-note", function() {
19
		loadDebitNote("main-content");
17
		loadDebitNote("main-content");
20
	});
18
	});
21
 
19
 
22
 
20
 
23
 
21
 
-
 
22
	$(document).on('click', ".warehouse-invoices", function() {
-
 
23
		loadWarehouseInvoices("main-content");
-
 
24
	});
-
 
25
 
-
 
26
 
-
 
27
	$(document).on('click', '.dateWiseInvoices', function() {
-
 
28
 
-
 
29
		var startDate = getDatesFromPicker('input[name="invoice-duration"]').startDate;
-
 
30
		var endDate = getDatesFromPicker('input[name="invoice-duration"]').endDate
-
 
31
 
-
 
32
		var vendorId = $('#vendorId').val();
-
 
33
 
-
 
34
		doGetAjaxRequestHandler(context + "/getWarehouseInvoicesByVendor?vendorId=" + vendorId + "&startDate=" + startDate + "&endDate=" + endDate, function(response) {
-
 
35
			$('.invoicesviewcontainer').html(response);
-
 
36
 
-
 
37
		});
-
 
38
 
-
 
39
 
-
 
40
	});
-
 
41
 
-
 
42
 
24
	$(document)
43
	$(document)
25
		.on(
44
		.on(
26
			'input',
45
			'input',
27
			'#invoice',
46
			'#invoice',
28
			function() {
47
			function() {
Line 44... Line 63...
44
								console.log("documentId : "
63
								console.log("documentId : "
45
									+ documentId);
64
									+ documentId);
46
								localStorage.setItem("invoiceDocument",
65
								localStorage.setItem("invoiceDocument",
47
									documentId);
66
									documentId);
48
 
67
 
49
							
68
 
50
							});
69
							});
51
 
70
 
52
					}
71
					}
53
				} else {
72
				} else {
54
					// Do nothing!
73
					// Do nothing!
Line 379... Line 398...
379
		var row = $(this).closest("tr");
398
		var row = $(this).closest("tr");
380
		row.remove();
399
		row.remove();
381
	});
400
	});
382
 
401
 
383
 
402
 
384
 
-
 
385
 
-
 
386
 
-
 
387
 
-
 
388
	$(document).on('click', ".addRowForInvoiceItem", function() {
403
	$(document).on('click', ".addRowForInvoiceItem", function() {
389
 
404
 
390
		var numitems = $(this).data("numitems");
405
		var numitems = $(this).data("numitems");
391
		var invoiceId = $(this).data("invoiceid");
406
		var invoiceId = $(this).data("invoiceid");
392
 
-
 
393
 
-
 
394
		var invoiceItemIds = [];
407
		var invoiceItemIds = [];
395
		var totalQty = 0
408
		var totalQty = 0
396
 
409
 
397
		$("#invoice-order-table > tbody > tr").each(function() {
410
		$("#invoice-order-table > tbody > tr").each(function() {
398
			var itemId = $(this).find(".rate").data('itemid');
411
			var itemId = $(this).find(".rate").data('itemid');
399
			var qty = $(this).find(".qty").val();
412
			var qty = $(this).find(".qty").val();
400
 
413
 
401
			console.log(qty)
-
 
402
 
-
 
403
			if (qty != undefined) {
414
			if (qty != undefined) {
404
				totalQty += qty
415
				totalQty += qty
405
			}
416
			}
406
 
417
 
407
			console.log(totalQty)
-
 
408
 
-
 
409
 
-
 
410
			if (itemId != undefined) {
418
			if (itemId != undefined) {
411
				invoiceItemIds.push(itemId)
419
				invoiceItemIds.push(itemId)
412
			}
420
			}
413
		});
421
		});
414
 
422
 
Line 754... Line 762...
754
	doGetAjaxRequestHandler(context + "/getDebitNote", function(response) {
762
	doGetAjaxRequestHandler(context + "/getDebitNote", function(response) {
755
		$('#' + domId).html(response);
763
		$('#' + domId).html(response);
756
	});
764
	});
757
}
765
}
758
 
766
 
-
 
767
function loadWarehouseInvoices(domId) {
-
 
768
	doGetAjaxRequestHandler(context + "/getWarehouseInvoices", function(response) {
-
 
769
		$('#' + domId).html(response);
-
 
770
	});
-
 
771
}
-
 
772
 
759
function createPurchase(sendPo) {
773
function createPurchase(sendPo) {
760
	var purchaseOrder = {};
774
	var purchaseOrder = {};
761
 
775
 
762
	var vendorId = $('#vendorId').val();
776
	var vendorId = $('#vendorId').val();
763
 
777