Merge remote-tracking branch 'origin/develop' into feature/CSR-1391.1
This commit is contained in:
commit
39e42b8c7c
1 changed files with 23 additions and 11 deletions
|
|
@ -89,7 +89,7 @@ export default {
|
|||
);
|
||||
});
|
||||
|
||||
let totalPrice = this.getTotalPriceOfAllLineItemsAndChildParts(lineItemsToPrice);
|
||||
let totalPrice = this.getTotalPriceOfAllLineItemsAndChildParts(lineItemsToPrice, false);
|
||||
return totalPrice;
|
||||
},
|
||||
filterOutFees(lineItems) {
|
||||
|
|
@ -101,22 +101,30 @@ export default {
|
|||
});
|
||||
return filteredLineItems;
|
||||
},
|
||||
getTotalPriceOfAllLineItemsAndChildParts(lineItems) {
|
||||
getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) {
|
||||
let totalPrice = 0;
|
||||
lineItems.forEach((lineItem) => {
|
||||
totalPrice += this.getTotalLineItemPrice(lineItem);
|
||||
totalPrice += this.getTotalLineItemPrice(lineItem, includeTax);
|
||||
if (lineItem.childParts) {
|
||||
totalPrice += this.getTotalPriceOfAllLineItemsAndChildParts(
|
||||
lineItem.childParts
|
||||
lineItem.childParts,
|
||||
includeTax
|
||||
);
|
||||
}
|
||||
});
|
||||
return totalPrice;
|
||||
},
|
||||
getTotalLineItemPrice(lineItem) {
|
||||
return (
|
||||
lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice + lineItem.salesTax
|
||||
);
|
||||
getTotalLineItemPrice(lineItem, includeTax) {
|
||||
if (includeTax) {
|
||||
return (
|
||||
lineItem.kitPrice +
|
||||
lineItem.laborAmount +
|
||||
lineItem.sellingPrice +
|
||||
lineItem.salesTax
|
||||
);
|
||||
} else {
|
||||
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
|
||||
}
|
||||
},
|
||||
getDisplayAmountDue(lineItems) {
|
||||
return this.getAmountDue(lineItems).toLocaleString("en-US", {
|
||||
|
|
@ -127,15 +135,19 @@ export default {
|
|||
getAmountDue(lineItems) {
|
||||
var amountDue = 0;
|
||||
if (lineItems.glassParts) {
|
||||
amountDue = this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.glassParts);
|
||||
amountDue = this.getTotalPriceOfAllLineItemsAndChildParts(
|
||||
lineItems.glassParts,
|
||||
true
|
||||
);
|
||||
}
|
||||
if (lineItems.supportingItems) {
|
||||
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(
|
||||
lineItems.supportingItems
|
||||
lineItems.supportingItems,
|
||||
true
|
||||
);
|
||||
}
|
||||
if (lineItems.vaps) {
|
||||
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.vaps);
|
||||
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.vaps, true);
|
||||
}
|
||||
return amountDue;
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue