Subversion Repositories SmartDukaan

Rev

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

Rev 32311 Rev 32325
Line 169... Line 169...
169
 
169
 
170
 
170
 
171
	});
171
	});
172
 
172
 
173
 
173
 
174
 
-
 
-
 
174
	var purchaseItemIds;
175
	$(document).on('click', ".purchaseorderitemview", function() {
175
	$(document).on('click', ".purchaseorderitemview", function() {
176
 
-
 
-
 
176
		purchaseItemIds = [];
177
		var vendorId = $('#vendorId').val();
177
		var vendorId = $('#vendorId').val();
178
		var warehouseId = $('#warehouseMap').val();
178
		var warehouseId = $('#warehouseMap').val();
179
 
179
 
180
		console.log(warehouseId)
180
		console.log(warehouseId)
181
 
181
 
Line 198... Line 198...
198
		});
198
		});
199
	});
199
	});
200
 
200
 
201
 
201
 
202
	$(document).on('click', ".addRowInPurchaseOrder", function() {
202
	$(document).on('click', ".addRowInPurchaseOrder", function() {
203
 
-
 
204
 
-
 
205
		var purchaseItemIds = [];
-
 
206
		var totalQty = 0
203
		var totalQty = 0
207
 
204
 
208
		$("table > tbody > tr").each(function() {
205
		$("table > tbody > tr").each(function() {
209
			var itemId = $(this).find(".transferPrice").data('itemid');
206
			var itemId = $(this).find(".transferPrice").data('itemid');
210
			var qty = $(this).find(".qty").val();
207
			var qty = $(this).find(".qty").val();
Line 225... Line 222...
225
 
222
 
226
		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> ');
223
		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> ');
227
 
224
 
228
		var vendorId = $('#vendorId').val();
225
		var vendorId = $('#vendorId').val();
229
 
226
 
230
 
-
 
-
 
227
		$('tbody').append($html);
231
		getVendorItemAheadOptions($html.find('.typeaheaditem'), vendorId, function(
228
		getVendorItemAheadOptions($html.find('.typeaheaditem'), vendorId, function(
232
			selectedItem) {
229
			selectedItem) {
233
			var itemId = selectedItem.itemId;
230
			var itemId = selectedItem.itemId;
234
 
231
 
235
			if (purchaseItemIds.indexOf(itemId) > -1) {
232
			if (purchaseItemIds.indexOf(itemId) > -1) {
Line 259... Line 256...
259
 
256
 
260
				}
257
				}
261
			});
258
			});
262
 
259
 
263
		});
260
		});
264
		$('tbody').append($html);
-
 
265
 
261
 
266
	});
262
	});
267
 
263
 
268
	$(document).on('click', '.createSendPurchaseOrder', function() {
264
	$(document).on('click', '.createSendPurchaseOrder', function() {
269
 
265
 
Line 388... Line 384...
388
 
384
 
389
 
385
 
390
	$(document).on("click", '.removeInPurchaseOrder', function() {
386
	$(document).on("click", '.removeInPurchaseOrder', function() {
391
 
387
 
392
		var row = $(this).closest("tr");
388
		var row = $(this).closest("tr");
-
 
389
		let itemIndex = purchaseItemIds.indexOf();
-
 
390
		if (itemIndex > -1) { // only splice array when item is found
-
 
391
			purchaseItemIds.splice(itemIndex, 1); // 2nd parameter means remove one item only
-
 
392
		}
393
		row.remove();
393
		row.remove();
394
	});
394
	});
395
 
395
 
396
 
396
 
397
	$(document).on('click', ".addRowForInvoiceItem", function() {
397
	$(document).on('click', ".addRowForInvoiceItem", function() {