IO-2814 Correct Parts Price and add Console Log
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
@@ -318,7 +318,7 @@ function GenerateCostingData(job) {
|
||||
if (!partsProfitCenter)
|
||||
console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type);
|
||||
const partsAmount = Dinero({
|
||||
amount: Math.round((val.act_price || 0) * 100)
|
||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
||||
})
|
||||
.multiply(val.part_qty || 1)
|
||||
.add(
|
||||
@@ -327,7 +327,7 @@ function GenerateCostingData(job) {
|
||||
? val.prt_dsmk_m
|
||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||
: Dinero({
|
||||
amount: Math.round(val.act_price * 100)
|
||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
||||
})
|
||||
.multiply(val.part_qty || 0)
|
||||
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
||||
@@ -396,6 +396,8 @@ function GenerateCostingData(job) {
|
||||
|
||||
if (!acc.additional[partsProfitCenter]) acc.additional[partsProfitCenter] = Dinero();
|
||||
acc.additional[partsProfitCenter] = acc.additional[partsProfitCenter].add(partsAmount);
|
||||
|
||||
console.log("line_desc", val.line_desc, "partsProfitCenter", partsProfitCenter, "partsAmount", partsAmount.toUnit(), "acc", acc.additional[partsProfitCenter].add(partsAmount).toUnit());
|
||||
}
|
||||
|
||||
return acc;
|
||||
|
||||
Reference in New Issue
Block a user