Subversion Repositories SmartDukaan

Rev

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

Rev 32327 Rev 32328
Line 343... Line 343...
343
        // console.log(el);
343
        // console.log(el);
344
        // console.log(index);
344
        // console.log(index);
345
        var $el = $(el);
345
        var $el = $(el);
346
        var $unitPriceElement = $el.find('.unitPrice');
346
        var $unitPriceElement = $el.find('.unitPrice');
347
        var itemId = parseInt($unitPriceElement.attr("itemId"));
347
        var itemId = parseInt($unitPriceElement.attr("itemId"));
-
 
348
        var qty = parseInt($unitPriceElement.attr("quantity"));
348
        var found = false;
349
        var found = false;
349
        let tmpObj;
350
        let tmpObj;
350
        let filteredList = priceQtyArray.filter(x => x.itemId === itemId);
351
        let filteredList = priceQtyArray.filter(x => x.itemId === itemId);
351
        if (filteredList.length === 0) {
352
        if (filteredList.length === 0) {
352
            var $discountElement = $el.find('.discount');
353
            var $discountElement = $el.find('.discount');
353
            var unitPrice = parseFloat($unitPriceElement.val());
354
            var unitPrice = parseFloat($unitPriceElement.val());
354
            var discount = parseFloat($discountElement.val());
355
            var discount = parseFloat($discountElement.val());
355
            if (isNaN(discount)) {
356
            if (isNaN(discount)) {
356
                discount = 0;
357
                discount = 0;
357
            }
358
            }
358
            var qty = parseInt($unitPriceElement.attr("quantity"));
-
 
359
            tmpObj = {
359
            tmpObj = {
360
                itemId: itemId,
360
                itemId: itemId,
361
                sellingPrice: unitPrice - discount,
361
                sellingPrice: unitPrice - discount,
362
                quantity: qty,
362
                quantity: 0,
363
                discountAmount: discount,
363
                discountAmount: discount,
364
                serialNumberDetails: []
364
                serialNumberDetails: []
365
            };
365
            };
366
            priceQtyArray.push(tmpObj);
366
            priceQtyArray.push(tmpObj);
367
        } else {
367
        } else {
368
            tmpObj = filteredList[0];
368
            tmpObj = filteredList[0];
369
        }
369
        }
370
 
370
 
-
 
371
        tmpObj.quantity += qty;
-
 
372
 
371
        var $serialNumberElement = $(el).find('.serialNumber');
373
        var $serialNumberElement = $(el).find('.serialNumber');
372
        var insuranceEle = $(el).find('.insuranceamount');
374
        var insuranceEle = $(el).find('.insuranceamount');
373
        var insuranceAmount = 0;
375
        var insuranceAmount = 0;
374
        if (insuranceEle.length > 0) {
376
        if (insuranceEle.length > 0) {
375
            insuranceAmount = parseFloat(insuranceEle.val());
377
            insuranceAmount = parseFloat(insuranceEle.val());