Merged in test (pull request #79)

Update 2021-06-04 Feature Branch with latest fixes.
This commit is contained in:
Patrick Fic
2021-05-31 15:14:08 +00:00
3 changed files with 10 additions and 9 deletions

View File

@@ -1485,6 +1485,7 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
op_code_desc
profitcenter_labor
profitcenter_part
prt_dsmk_p
}
}
}

View File

@@ -212,17 +212,16 @@ const generateInvoiceQbxml = (
}
if (jobline.profitcenter_part && jobline.act_price) {
const DineroAmount = Dinero({
let DineroAmount = Dinero({
amount: Math.round(jobline.act_price * 100),
})
.multiply(jobline.part_qty || 1)
.add(
Dinero({
amount: Math.round((jobline.act_price || 0) * 100),
})
.multiply(jobline.part_qty || 0)
.percentage(jobline.prt_dsmk_p)
}).multiply(jobline.part_qty || 1);
if (jobline.prt_dsmk_p && jobline.prt_dsmk_p !== 0) {
console.log("Have a part discount", jobline);
DineroAmount = DineroAmount.add(
DineroAmount.percentage(jobline.prt_dsmk_p || 0)
);
}
const account = responsibilityCenters.profits.find(
(i) => jobline.profitcenter_part.toLowerCase() === i.name.toLowerCase()
);

View File

@@ -101,6 +101,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
profitcenter_labor
profitcenter_part
db_ref
prt_dsmk_p
}
}
bodyshops(where: {associations: {active: {_eq: true}}}) {