diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index ce9d9fa61..e774da4d5 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1453,7 +1453,7 @@ "partstotal": "This is the total of all parts and sublet amounts on the vehicle (some of these may require an in-house invoice).
\nItems such as shop and paint materials, labor online lines, etc. are not included in this total.", "totalreturns": "The total amount of returns created for this job." }, - "prt_dsmk_total": "Line Item Markup", + "prt_dsmk_total": "Line Item Adjustment", "rates": "Rates", "rates_subtotal": "All Rates Subtotal", "reconciliation": { diff --git a/server/accounting/qbxml/qbxml-receivables.js b/server/accounting/qbxml/qbxml-receivables.js index ff3c98e4a..dd49732f8 100644 --- a/server/accounting/qbxml/qbxml-receivables.js +++ b/server/accounting/qbxml/qbxml-receivables.js @@ -257,7 +257,9 @@ const generateInvoiceQbxml = ( 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) + DineroAmount.percentage(Math.abs(jobline.prt_dsmk_p || 0)).multiply( + jobline.prt_dsmk_p > 0 ? 1 : -1 + ) ); } const account = responsibilityCenters.profits.find( diff --git a/server/job/job-costing.js b/server/job/job-costing.js index a143959a4..3b466c6d1 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -301,7 +301,8 @@ function GenerateCostingData(job) { amount: Math.round((val.act_price || 0) * 100), }) .multiply(val.part_qty || 0) - .percentage(val.prt_dsmk_p || 0) + .percentage(Math.abs(val.prt_dsmk_p || 0)) + .multiply(val.prt_dsmk_p > 0 ? 1 : -1) ); if (!acc.parts[partsProfitCenter]) acc.parts[partsProfitCenter] = Dinero(); @@ -330,7 +331,8 @@ function GenerateCostingData(job) { amount: Math.round((val.act_price || 0) * 100), }) .multiply(val.part_qty || 0) - .percentage(val.prt_dsmk_p || 0) + .percentage(Math.abs(val.prt_dsmk_p || 0)) + .multiply(val.prt_dsmk_p > 0 ? 1 : -1) ); if (!acc.parts[partsProfitCenter]) diff --git a/server/job/job-totals.js b/server/job/job-totals.js index 2bd40d284..54b94f5e1 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -258,7 +258,8 @@ function CalculatePartsTotals(jobLines) { amount: Math.round((value.act_price || 0) * 100), }) .multiply(value.part_qty || 0) - .percentage(value.prt_dsmk_p || 0) + .percentage(Math.abs(value.prt_dsmk_p || 0)) + .multiply(value.prt_dsmk_p > 0 ? 1 : -1) ), list: { ...acc.parts.list, @@ -289,7 +290,8 @@ function CalculatePartsTotals(jobLines) { amount: Math.round((value.act_price || 0) * 100), }) .multiply(value.part_qty || 0) - .percentage(value.prt_dsmk_p || 0) + .percentage(Math.abs(value.prt_dsmk_p || 0)) + .multiply(value.prt_dsmk_p > 0 ? 1 : -1) ), }, }; @@ -425,7 +427,8 @@ function CalculateTaxesTotals(job, otherTotals) { amount: Math.round((val.act_price || 0) * 100), }) .multiply(val.part_qty || 0) - .percentage(val.prt_dsmk_p || 0) + .percentage(Math.abs(val.prt_dsmk_p || 0)) + .multiply(val.prt_dsmk_p > 0 ? 1 : -1) ) .percentage( ((job.parts_tax_rates &&