IO-1487 MPI Totals Adjustments
This commit is contained in:
@@ -535,6 +535,7 @@ export const GET_JOB_BY_PK = gql`
|
|||||||
unq_seq
|
unq_seq
|
||||||
line_ind
|
line_ind
|
||||||
line_desc
|
line_desc
|
||||||
|
line_ref
|
||||||
part_type
|
part_type
|
||||||
oem_partno
|
oem_partno
|
||||||
db_price
|
db_price
|
||||||
|
|||||||
@@ -797,6 +797,7 @@ exports.GET_JOB_BY_PK = ` query GET_JOB_BY_PK($id: uuid!) {
|
|||||||
line_ind
|
line_ind
|
||||||
line_desc
|
line_desc
|
||||||
part_type
|
part_type
|
||||||
|
line_ref
|
||||||
oem_partno
|
oem_partno
|
||||||
db_price
|
db_price
|
||||||
act_price
|
act_price
|
||||||
|
|||||||
@@ -486,7 +486,9 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
||||||
.multiply(val.part_qty || 0)
|
.multiply(val.part_qty || 0)
|
||||||
.add(
|
.add(
|
||||||
val.prt_dsmk_m && val.prt_dsmk_m !== 0
|
val.prt_dsmk_m &&
|
||||||
|
val.prt_dsmk_m !== 0 &&
|
||||||
|
DiscountNotAlreadyCounted(val, job.joblines)
|
||||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||||
: Dinero({
|
: Dinero({
|
||||||
amount: Math.round(val.act_price * 100),
|
amount: Math.round(val.act_price * 100),
|
||||||
@@ -566,3 +568,9 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.default = Totals;
|
exports.default = Totals;
|
||||||
|
|
||||||
|
function DiscountNotAlreadyCounted(jobline, joblines) {
|
||||||
|
if (jobline.db_ref !== "900510") return true;
|
||||||
|
const ParentLine = joblines.find((j) => j.unq_seq === jobline.line_ref);
|
||||||
|
return ParentLine && !(ParentLine.prt_dsmk_m && ParentLine.prt_dsmk_m !== 0);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user