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 (!costCenterHash[mapaAccountName])
|
||||
costCenterHash[mapaAccountName] = Dinero();
|
||||
costCenterHash[mapaAccountName] = costCenterHash[mapaAccountName].add(
|
||||
Dinero(job.job_totals.rates.mapa.total).percentage(
|
||||
bodyshop?.cdk_configuration?.sendmaterialscosting
|
||||
)
|
||||
);
|
||||
if (job.bodyshop.use_paint_scale_data === true) {
|
||||
if (job.mixdata.length > 0) {
|
||||
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 {
|
||||
//console.log("NO MAPA ACCOUNT FOUND!!");
|
||||
}
|
||||
|
||||
@@ -1793,6 +1793,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
|
||||
md_responsibility_centers
|
||||
cdk_configuration
|
||||
pbs_configuration
|
||||
use_paint_scale_data
|
||||
}
|
||||
ro_number
|
||||
dms_allocation
|
||||
@@ -1900,6 +1901,10 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
|
||||
line_ref
|
||||
unq_seq
|
||||
}
|
||||
mixdata(limit: 1, order_by: {updated_at: desc}) {
|
||||
jobid
|
||||
totalliquidcost
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user