Merged in feature/IO-2717-Paint-Material-from-Scale-for-CDK (pull request #1438)
IO-2717 CDK Use Scale Data for Paint Materials Cost
This commit is contained in:
@@ -224,11 +224,34 @@ exports.default = async function (socket, jobid) {
|
|||||||
if (mapaAccount) {
|
if (mapaAccount) {
|
||||||
if (!costCenterHash[mapaAccountName])
|
if (!costCenterHash[mapaAccountName])
|
||||||
costCenterHash[mapaAccountName] = Dinero();
|
costCenterHash[mapaAccountName] = Dinero();
|
||||||
costCenterHash[mapaAccountName] = costCenterHash[mapaAccountName].add(
|
if (job.bodyshop.use_paint_scale_data === true) {
|
||||||
Dinero(job.job_totals.rates.mapa.total).percentage(
|
if (job.mixdata.length > 0) {
|
||||||
bodyshop?.cdk_configuration?.sendmaterialscosting
|
costCenterHash[mapaAccountName] = costCenterHash[
|
||||||
)
|
mapaAccountName
|
||||||
);
|
].add(
|
||||||
|
Dinero({
|
||||||
|
amount: Math.round(
|
||||||
|
((job.mixdata[0] && job.mixdata[0].totalliquidcost) || 0) *
|
||||||
|
100
|
||||||
|
),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
costCenterHash[mapaAccountName] = costCenterHash[
|
||||||
|
mapaAccountName
|
||||||
|
].add(
|
||||||
|
Dinero(job.job_totals.rates.mapa.total).percentage(
|
||||||
|
bodyshop?.cdk_configuration?.sendmaterialscosting
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
costCenterHash[mapaAccountName] = costCenterHash[mapaAccountName].add(
|
||||||
|
Dinero(job.job_totals.rates.mapa.total).percentage(
|
||||||
|
bodyshop?.cdk_configuration?.sendmaterialscosting
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//console.log("NO MAPA ACCOUNT FOUND!!");
|
//console.log("NO MAPA ACCOUNT FOUND!!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1793,6 +1793,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
|
|||||||
md_responsibility_centers
|
md_responsibility_centers
|
||||||
cdk_configuration
|
cdk_configuration
|
||||||
pbs_configuration
|
pbs_configuration
|
||||||
|
use_paint_scale_data
|
||||||
}
|
}
|
||||||
ro_number
|
ro_number
|
||||||
dms_allocation
|
dms_allocation
|
||||||
@@ -1900,6 +1901,10 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
|
|||||||
line_ref
|
line_ref
|
||||||
unq_seq
|
unq_seq
|
||||||
}
|
}
|
||||||
|
mixdata(limit: 1, order_by: {updated_at: desc}) {
|
||||||
|
jobid
|
||||||
|
totalliquidcost
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user