Subversion Repositories SmartDukaan

Rev

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

Rev 36316 Rev 36408
Line 101... Line 101...
101
		doAjaxRequestHandler(context + "/return/invoice/search?invoiceNumber=" + encodeURIComponent(invoiceNumber), "GET", function (response) {
101
		doAjaxRequestHandler(context + "/return/invoice/search?invoiceNumber=" + encodeURIComponent(invoiceNumber), "GET", function (response) {
102
			$('#invoice-return-results').html(response);
102
			$('#invoice-return-results').html(response);
103
		});
103
		});
104
	});
104
	});
105
 
105
 
-
 
106
	// Date-range filter
-
 
107
	$(document).on('click', '#invoice-return-date-apply', function () {
-
 
108
		var fromDate = $('#invoice-return-from-date').val();
-
 
109
		var toDate = $('#invoice-return-to-date').val();
-
 
110
		if (!fromDate || !toDate) {
-
 
111
			alert("Please pick both From and To dates");
-
 
112
			return;
-
 
113
		}
-
 
114
		if (fromDate > toDate) {
-
 
115
			alert("From date must be on or before To date");
-
 
116
			return;
-
 
117
		}
-
 
118
		doAjaxRequestHandler(context + "/return/invoice?fromDate=" + encodeURIComponent(fromDate)
-
 
119
				+ "&toDate=" + encodeURIComponent(toDate), "GET", function (response) {
-
 
120
			$('#main-content').html(response);
-
 
121
		});
-
 
122
	});
-
 
123
 
106
	// Debit Note Details
124
	// Debit Note Details
107
	$(document).on('click', '.debit-note-details', function () {
125
	$(document).on('click', '.debit-note-details', function () {
108
		var debitNoteId = $(this).data("debitnote-id");
126
		var debitNoteId = $(this).data("debitnote-id");
109
		doAjaxRequestHandler(context + "/return/debit-note/details/" + debitNoteId, "GET", function (response) {
127
		doAjaxRequestHandler(context + "/return/debit-note/details/" + debitNoteId, "GET", function (response) {
110
			$('#main-content').html(response);
128
			$('#main-content').html(response);
Line 251... Line 269...
251
				}
269
				}
252
			});
270
			});
253
		}
271
		}
254
	});
272
	});
255
 
273
 
-
 
274
	// Reject Invoice Return — sale stands, no inventory/wallet/GST action
-
 
275
	$(document).on('click', '.reject-invoice-return', function () {
-
 
276
		var proId = $(this).data("pro-id");
-
 
277
		var rejectRemark = prompt("Reason for rejecting this invoice return? (sale will stand, no refund will be issued)");
-
 
278
		if (!rejectRemark) {
-
 
279
			return;
-
 
280
		}
-
 
281
		if (confirm("Reject invoice return and let the sale stand? This cannot be undone.")) {
-
 
282
			doAjaxRequestHandler(context + "/return/invoice/reject/" + proId + "?rejectRemark=" + encodeURIComponent(rejectRemark), "PUT", function (response) {
-
 
283
				if (response === 'true') {
-
 
284
					alert("Invoice return rejected");
-
 
285
					doAjaxRequestHandler(context + "/return/invoice", "GET", function (resp) {
-
 
286
						$('#main-content').html(resp);
-
 
287
					});
-
 
288
				} else {
-
 
289
					alert("Rejection failed: " + response);
-
 
290
				}
-
 
291
			});
-
 
292
		}
-
 
293
	});
-
 
294
 
256
	// Process Invoice Return (non-GRN'd)
295
	// Process Invoice Return (non-GRN'd)
257
	$(document).on('click', '.process-invoice-return', function () {
296
	$(document).on('click', '.process-invoice-return', function () {
258
		var invoiceNumber = $(this).data("invoice");
297
		var invoiceNumber = $(this).data("invoice");
259
		var remark = $('#invoice-return-remark').val();
298
		var remark = $('#invoice-return-remark').val();
260
		if (confirm("Are you sure you want to process return for invoice " + invoiceNumber + "?")) {
299
		if (confirm("Are you sure you want to process return for invoice " + invoiceNumber + "?")) {