Correct for Dinero type

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

View File

@@ -723,7 +723,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes
if ( if (
job_totals.rates[key] && job_totals.rates[key] &&
job_totals.rates[key].adjustment && job_totals.rates[key].adjustment &&
job_totals.rates[key].adjustment.isZero() === false Dinero(job_totals.rates[key].adjustment).isZero() === false
) { ) {
if (qbo) { if (qbo) {
//Going to always assume that we need to apply GST and PST for labor. //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]; : taxCodes[taxAccountCode];
InvoiceLineAdd.push({ InvoiceLineAdd.push({
DetailType: "SalesItemLineDetail", DetailType: "SalesItemLineDetail",
Amount: Dinero(job_totals.rates[key]).adjustment.toFormat(DineroQbFormat), Amount: Dinero(job_totals.rates[key].adjustment).toFormat(DineroQbFormat),
Description: `${account.accountdesc} - Adjustment`, Description: `${account.accountdesc} - Adjustment`,
SalesItemLineDetail: { SalesItemLineDetail: {
...(jobs_by_pk.class ? { ClassRef: { value: classes[jobs_by_pk.class] } } : {}), ...(jobs_by_pk.class ? { ClassRef: { value: classes[jobs_by_pk.class] } } : {}),

View File

@@ -380,7 +380,7 @@ function calculateAllocations(connectionData, job) {
}); });
//profile level adjustments for labor and materials //profile level adjustments for labor and materials
Object.keys(job.job_totals.rates).forEach((key) => { Object.keys(job.job_totals.rates).forEach((key) => {
if (job.job_totals.rates[key] && job.job_totals.rates[key].adjustment && job.job_totals.rates[key].adjustment.isZero() === false) { if (job.job_totals.rates[key] && job.job_totals.rates[key].adjustment && Dinero(job.job_totals.rates[key].adjustment).isZero() === false) {
const accountName = selectedDmsAllocationConfig.profits[key.toUpperCase()]; const accountName = selectedDmsAllocationConfig.profits[key.toUpperCase()];
const otherAccount = bodyshop.md_responsibility_centers.profits.find((c) => c.name === accountName); const otherAccount = bodyshop.md_responsibility_centers.profits.find((c) => c.name === accountName);
if (otherAccount) { if (otherAccount) {