CSR-1391 parts and labor in afterpay line items
This commit is contained in:
parent
d869962652
commit
aa8a88b819
1 changed files with 12 additions and 16 deletions
|
|
@ -515,26 +515,22 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getPiaLineItems(cartItems) {
|
getPiaLineItems(cartItems) {
|
||||||
const itemMap = new Map();
|
|
||||||
const glassParts = store.getters.order.lineItems.glassParts;
|
const glassParts = store.getters.order.lineItems.glassParts;
|
||||||
const supportingItems = store.getters.order.lineItems.supportingItems;
|
let lineItems = [];
|
||||||
const vaps = store.getters.order.lineItems.vaps;
|
|
||||||
const items = [...(glassParts ?? []), ...(supportingItems ?? []), ...(vaps ?? [])];
|
|
||||||
|
|
||||||
for (const item of items) {
|
if (glassParts === null) {
|
||||||
const amount = item.laborAmount + item.sellingPrice;
|
lineItems = ["Labor|0|1", "Repair supplies|0|1"];
|
||||||
const key = `${item.partType}|${amount}`;
|
} else {
|
||||||
|
lineItems = ["Parts and labor|0|1"];
|
||||||
if (itemMap.has(key)) {
|
|
||||||
itemMap.get(key).quantity++;
|
|
||||||
} else {
|
|
||||||
itemMap.set(key, { partType: item.partType, amount, quantity: 1 });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.piaLineItems = Array.from(itemMap.values())
|
cartItems.forEach((item) => {
|
||||||
.map((item) => `${item.partType}|${item.amount}|${item.quantity}`)
|
if (item.name !== null) {
|
||||||
.join("||");
|
lineItems.push(`${item.name}|${(item.salesTax + item.subTotal).toFixed(2)}|1`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.piaLineItems = lineItems.join("||");
|
||||||
},
|
},
|
||||||
getAmountDue() {
|
getAmountDue() {
|
||||||
return baseMixin.methods.getAmountDue(store.getters.order.lineItems);
|
return baseMixin.methods.getAmountDue(store.getters.order.lineItems);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue