Merge pull request #1483 from Safelite/feature/CSR-1392
Feature/csr 1392
This commit is contained in:
commit
f3c6a08dee
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;
|
return totalPrice;
|
||||||
},
|
},
|
||||||
filterOutFees(lineItems) {
|
filterOutFees(lineItems) {
|
||||||
|
|
@ -101,22 +101,30 @@ export default {
|
||||||
});
|
});
|
||||||
return filteredLineItems;
|
return filteredLineItems;
|
||||||
},
|
},
|
||||||
getTotalPriceOfAllLineItemsAndChildParts(lineItems) {
|
getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) {
|
||||||
let totalPrice = 0;
|
let totalPrice = 0;
|
||||||
lineItems.forEach((lineItem) => {
|
lineItems.forEach((lineItem) => {
|
||||||
totalPrice += this.getTotalLineItemPrice(lineItem);
|
totalPrice += this.getTotalLineItemPrice(lineItem, includeTax);
|
||||||
if (lineItem.childParts) {
|
if (lineItem.childParts) {
|
||||||
totalPrice += this.getTotalPriceOfAllLineItemsAndChildParts(
|
totalPrice += this.getTotalPriceOfAllLineItemsAndChildParts(
|
||||||
lineItem.childParts
|
lineItem.childParts,
|
||||||
|
includeTax
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return totalPrice;
|
return totalPrice;
|
||||||
},
|
},
|
||||||
getTotalLineItemPrice(lineItem) {
|
getTotalLineItemPrice(lineItem, includeTax) {
|
||||||
return (
|
if (includeTax) {
|
||||||
lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice + lineItem.salesTax
|
return (
|
||||||
);
|
lineItem.kitPrice +
|
||||||
|
lineItem.laborAmount +
|
||||||
|
lineItem.sellingPrice +
|
||||||
|
lineItem.salesTax
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getDisplayAmountDue(lineItems) {
|
getDisplayAmountDue(lineItems) {
|
||||||
return this.getAmountDue(lineItems).toLocaleString("en-US", {
|
return this.getAmountDue(lineItems).toLocaleString("en-US", {
|
||||||
|
|
@ -127,15 +135,19 @@ export default {
|
||||||
getAmountDue(lineItems) {
|
getAmountDue(lineItems) {
|
||||||
var amountDue = 0;
|
var amountDue = 0;
|
||||||
if (lineItems.glassParts) {
|
if (lineItems.glassParts) {
|
||||||
amountDue = this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.glassParts);
|
amountDue = this.getTotalPriceOfAllLineItemsAndChildParts(
|
||||||
|
lineItems.glassParts,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (lineItems.supportingItems) {
|
if (lineItems.supportingItems) {
|
||||||
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(
|
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(
|
||||||
lineItems.supportingItems
|
lineItems.supportingItems,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (lineItems.vaps) {
|
if (lineItems.vaps) {
|
||||||
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.vaps);
|
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.vaps, true);
|
||||||
}
|
}
|
||||||
return amountDue;
|
return amountDue;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue