Correct query and object call

Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
Allan Carr
2024-08-02 14:19:58 -07:00
parent f1940a320c
commit 11a182c68a
3 changed files with 12 additions and 7 deletions

View File

@@ -719,11 +719,11 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
});
//Handle insurance profile adjustments for Labor and Materials
Object.keys(job_totals.rate).forEach((key) => {
Object.keys(job_totals.rates).forEach((key) => {
if (
job_totals.rate[key] &&
job_totals.rate[key].adjustment &&
job_totals.rate[key].adjustment.isZero() === false
job_totals.rates[key] &&
job_totals.rates[key].adjustment &&
job_totals.rates[key].adjustment.isZero() === false
) {
if (qbo) {
//Going to always assume that we need to apply GST and PST for labor.
@@ -748,7 +748,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
: taxCodes[taxAccountCode];
InvoiceLineAdd.push({
DetailType: "SalesItemLineDetail",
Amount: Dinero(job_totals.rate[key]).adjustment.toFormat(DineroQbFormat),
Amount: Dinero(job_totals.rates[key]).adjustment.toFormat(DineroQbFormat),
Description: `${account.accountdesc} - Adjustment`,
SalesItemLineDetail: {
...(jobs_by_pk.class ? { ClassRef: { value: classes[jobs_by_pk.class] } } : {}),
@@ -770,7 +770,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
},
Desc: "Storage",
Quantity: 1,
Amount: Dinero(job_totals.rate[key]).adjustment.toFormat(DineroQbFormat),
Amount: Dinero(job_totals.rates[key]).adjustment.toFormat(DineroQbFormat),
SalesTaxCodeRef: {
FullName: bodyshop.md_responsibility_centers.taxes.itemexemptcode || "NON"
}