diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 3383153e0..ce4ef3c21 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -95,7 +95,6 @@ export function JobsAvailableContainer({ setOwnerModalVisible(false); setInsertLoading(true); - console.log("Using this as the data.", lazyData || estDataRaw); const estData = replaceEmpty( lazyData?.available_jobs_by_pk || estDataRaw.data.available_jobs_by_pk ); @@ -196,7 +195,7 @@ export function JobsAvailableContainer({ await deleteJob({ variables: { id: estData.id }, }).then((r) => { - if (!lazyData) refetch(); + refetch(); setInsertLoading(false); }); } catch (r) { @@ -393,21 +392,25 @@ export function JobsAvailableContainer({ onCancel={onJobModalCancel} modalSearchState={modalSearchState} /> - + {currentUser.email.includes("@rome.") || + currentUser.email.includes("@imex.") ? ( + + ) : null} + 0) { + ret.profitcenter_part = defaults.profits["PAO"]; } else { ret.profitcenter_part = null; } diff --git a/server/accounting/qb-receivables-lines.js b/server/accounting/qb-receivables-lines.js index 20c2c622e..2463390af 100644 --- a/server/accounting/qb-receivables-lines.js +++ b/server/accounting/qb-receivables-lines.js @@ -393,7 +393,7 @@ exports.default = function ({ //Add Towing, storage and adjustment lines. - if (jobs_by_pk.towing_payable && jobs_by_pk.towing_payable !== 0) { + if (jobs_by_pk.job_totals.additional.towing.amount > 0) { if (qbo) { //Going to always assume that we need to apply GST and PST for labor. const taxAccountCode = findTaxCode( @@ -417,9 +417,9 @@ exports.default = function ({ : taxCodes[taxAccountCode]; InvoiceLineAdd.push({ DetailType: "SalesItemLineDetail", - Amount: Dinero({ - amount: Math.round((jobs_by_pk.towing_payable || 0) * 100), - }).toFormat(DineroQbFormat), + Amount: Dinero(jobs_by_pk.job_totals.additional.towing).toFormat( + DineroQbFormat + ), SalesItemLineDetail: { ...(jobs_by_pk.class ? { ClassRef: { value: classes[jobs_by_pk.class] } } @@ -442,9 +442,9 @@ exports.default = function ({ }, Desc: "Towing", Quantity: 1, - Amount: Dinero({ - amount: Math.round((jobs_by_pk.towing_payable || 0) * 100), - }).toFormat(DineroQbFormat), + Amount: Dinero(jobs_by_pk.job_totals.additional.towing).toFormat( + DineroQbFormat + ), SalesTaxCodeRef: { FullName: bodyshop.md_responsibility_centers.taxes.itemexemptcode || "NON", @@ -452,7 +452,7 @@ exports.default = function ({ }); } } - if (jobs_by_pk.storage_payable && jobs_by_pk.storage_payable !== 0) { + if (jobs_by_pk.job_totals.additional.storage.amount > 0) { if (qbo) { //Going to always assume that we need to apply GST and PST for labor. const taxAccountCode = findTaxCode( @@ -476,9 +476,9 @@ exports.default = function ({ : taxCodes[taxAccountCode]; InvoiceLineAdd.push({ DetailType: "SalesItemLineDetail", - Amount: Dinero({ - amount: Math.round((jobs_by_pk.storage_payable || 0) * 100), - }).toFormat(DineroQbFormat), + Amount: Dinero( + jobs_by_pk.job_totals.additional.storage.amount + ).toFormat(DineroQbFormat), SalesItemLineDetail: { ...(jobs_by_pk.class ? { ClassRef: { value: classes[jobs_by_pk.class] } } @@ -501,9 +501,9 @@ exports.default = function ({ }, Desc: "Storage", Quantity: 1, - Amount: Dinero({ - amount: Math.round((jobs_by_pk.storage_payable || 0) * 100), - }).toFormat(DineroQbFormat), + Amount: Dinero( + jobs_by_pk.job_totals.additional.storage.amount + ).toFormat(DineroQbFormat), SalesTaxCodeRef: { FullName: bodyshop.md_responsibility_centers.taxes.itemexemptcode || "NON", @@ -586,6 +586,7 @@ exports.default = function ({ const taxAmount = Dinero( job_totals.totals.us_sales_tax_breakdown[`ty${tyCounter}Tax`] ); + console.log(`Tax ${tyCounter}`, taxAmount.toFormat()); if (taxAmount.getAmount() > 0) { if (qbo) { InvoiceLineAdd.push({ diff --git a/server/job/job-costing.js b/server/job/job-costing.js index e7568fa72..c4603110d 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -972,6 +972,8 @@ const getAdditionalCostCenter = (jl, profitCenters) => { return profitCenters["ATS"]; } else if (lineDesc.includes("towing")) { return profitCenters["TOW"]; + } else if (jl.act_price > 0) { + ret.profitcenter_part = defaults.profits["PAO"]; } else { return null; }