Merged in feature/IO-2854-ProManager-Profile-Discounts (pull request #1564)

Correct query and object call
This commit is contained in:
Allan Carr
2024-08-02 21:17:49 +00:00
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"
}

View File

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

View File

@@ -1528,6 +1528,7 @@ exports.QUERY_JOB_COSTING_DETAILS = ` query QUERY_JOB_COSTING_DETAILS($id: uuid!
ca_customer_gst
dms_allocation
cieca_pfl
materials
joblines(where: { removed: { _eq: false } }) {
id
db_ref
@@ -1642,6 +1643,8 @@ exports.QUERY_JOB_COSTING_DETAILS_MULTI = ` query QUERY_JOB_COSTING_DETAILS_MULT
ca_bc_pvrt
ca_customer_gst
dms_allocation
cieca_pfl
materials
joblines(where: {removed: {_eq: false}}) {
id
db_ref
@@ -1867,6 +1870,8 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
scheduled_in
actual_in
ca_bc_pvrt
cieca_pfl
materials
timetickets {
id
actualhrs