IO-1468 Resolve line markup for MCE.

This commit is contained in:
Patrick Fic
2021-10-14 10:52:08 -07:00
parent 1b885e4114
commit 660f463aea
3 changed files with 70 additions and 41 deletions

View File

@@ -162,7 +162,11 @@ export function JobLinesComponent({
ellipsis: true, ellipsis: true,
render: (text, record) => ( render: (text, record) => (
<> <>
<CurrencyFormatter>{record.act_price}</CurrencyFormatter> <CurrencyFormatter>
{record.db_ref === "900510" || record.db_ref === "900511"
? record.prt_dsmk_m
: record.act_price}
</CurrencyFormatter>
{record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? ( {record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? (
<span <span
style={{ marginLeft: ".2rem" }} style={{ marginLeft: ".2rem" }}

View File

@@ -498,6 +498,12 @@ async function CheckTaxRates(estData, bodyshop) {
) { ) {
estData.joblines.data[index].tax_part = jl.lbr_tax; estData.joblines.data[index].tax_part = jl.lbr_tax;
} }
//Set markup lines and tax lines as taxable.
//900510 is a mark up. 900510 is a discount.
if (bodyshop.region_config === "CA_SK" && jl.db_ref === "900510") {
estData.joblines.data[index].tax_part = true;
}
}); });
//} //}
} }

View File

@@ -284,7 +284,12 @@ function CalculatePartsTotals(jobLines) {
}; };
default: default:
if (!value.part_type) return acc; if (
!value.part_type &&
value.db_ref !== "900510" &&
value.db_ref !== "900511"
)
return acc;
return { return {
...acc, ...acc,
parts: { parts: {
@@ -299,24 +304,34 @@ function CalculatePartsTotals(jobLines) {
.percentage(Math.abs(value.prt_dsmk_p || 0)) .percentage(Math.abs(value.prt_dsmk_p || 0))
.multiply(value.prt_dsmk_p > 0 ? 1 : -1) .multiply(value.prt_dsmk_p > 0 ? 1 : -1)
), ),
...(value.part_type
? {
list: { list: {
...acc.parts.list, ...acc.parts.list,
[value.part_type]: [value.part_type]:
acc.parts.list[value.part_type] && acc.parts.list[value.part_type] &&
acc.parts.list[value.part_type].total acc.parts.list[value.part_type].total
? { ? {
total: acc.parts.list[value.part_type].total.add( total: acc.parts.list[
value.part_type
].total.add(
Dinero({ Dinero({
amount: Math.round((value.act_price || 0) * 100), amount: Math.round(
(value.act_price || 0) * 100
),
}).multiply(value.part_qty || 0) }).multiply(value.part_qty || 0)
), ),
} }
: { : {
total: Dinero({ total: Dinero({
amount: Math.round((value.act_price || 0) * 100), amount: Math.round(
(value.act_price || 0) * 100
),
}).multiply(value.part_qty || 0), }).multiply(value.part_qty || 0),
}, },
}, },
}
: {}),
subtotal: acc.parts.subtotal subtotal: acc.parts.subtotal
.add( .add(
Dinero({ Dinero({
@@ -481,6 +496,10 @@ function CalculateTaxesTotals(job, otherTotals) {
val.part_type.startsWith("PAG") && val.part_type.startsWith("PAG") &&
BackupGlassTax && BackupGlassTax &&
BackupGlassTax.prt_tax_rt) || BackupGlassTax.prt_tax_rt) ||
(!val.part_type &&
val.db_ref === "900510" &&
job.parts_tax_rates["PAN"] &&
job.parts_tax_rates["PAN"].prt_tax_rt) ||
0) * 100 0) * 100
) )
); );