PBS AP: skip posting of bills/wip for AR
This commit is contained in:
@@ -118,26 +118,34 @@ exports.default = async function (socket, jobid) {
|
||||
} for cost export.`
|
||||
);
|
||||
|
||||
const costCenterHash = job.bills.reduce((bill_acc, bill_val) => {
|
||||
bill_val.billlines.map((line_val) => {
|
||||
if (!bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]])
|
||||
let costCenterHash = {};
|
||||
//Check whether to skip this if PBS and using AP module.
|
||||
const disablebillwip = !!bodyshop?.pbs_configuration?.disablebillwip;
|
||||
|
||||
if (!disablebillwip) {
|
||||
costCenterHash = job.bills.reduce((bill_acc, bill_val) => {
|
||||
bill_val.billlines.map((line_val) => {
|
||||
if (
|
||||
!bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]]
|
||||
)
|
||||
bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] =
|
||||
Dinero();
|
||||
|
||||
let lineDinero = Dinero({
|
||||
amount: Math.round((line_val.actual_cost || 0) * 100),
|
||||
})
|
||||
.multiply(line_val.quantity)
|
||||
.multiply(bill_val.is_credit_memo ? -1 : 1);
|
||||
|
||||
bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] =
|
||||
Dinero();
|
||||
|
||||
let lineDinero = Dinero({
|
||||
amount: Math.round((line_val.actual_cost || 0) * 100),
|
||||
})
|
||||
.multiply(line_val.quantity)
|
||||
.multiply(bill_val.is_credit_memo ? -1 : 1);
|
||||
|
||||
bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] =
|
||||
bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]].add(
|
||||
lineDinero
|
||||
);
|
||||
return null;
|
||||
});
|
||||
return bill_acc;
|
||||
}, {});
|
||||
bill_acc[
|
||||
selectedDmsAllocationConfig.costs[line_val.cost_center]
|
||||
].add(lineDinero);
|
||||
return null;
|
||||
});
|
||||
return bill_acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
job.timetickets.forEach((ticket) => {
|
||||
//Get the total amount of the ticket.
|
||||
|
||||
@@ -1351,6 +1351,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
|
||||
id
|
||||
md_responsibility_centers
|
||||
cdk_configuration
|
||||
pbs_configuration
|
||||
}
|
||||
ro_number
|
||||
dms_allocation
|
||||
|
||||
Reference in New Issue
Block a user