Add US_NE tax calc.

This commit is contained in:
Patrick Fic
2023-08-31 08:24:52 -07:00
parent 03d04fd8d1
commit 9dea43fd34
4 changed files with 46 additions and 5 deletions

View File

@@ -798,6 +798,44 @@ function CalculateTaxesTotals(job, otherTotals) {
}
console.log(statePartsTax.toFormat(), val.line_desc);
});
console.log("Total State Parts Tax", statePartsTax.toFormat());
let laborTaxTotal = Dinero();
if (job.cieca_pfl) {
//Do it by labor type
const types = [
"la1",
"la2",
"la3",
"la4",
"lau",
"laa",
"lab",
"lad",
"lae",
"laf",
"lag",
"lam",
"lar",
"las",
];
types.forEach((type) => {
laborTaxTotal = laborTaxTotal.add(
otherTotals.rates[type].total.percentage(
job.cieca_pfl[type.toUpperCase()]
? job.cieca_pfl[type.toUpperCase()].lbr_taxp
: (job.tax_lbr_rt || 0) * 100
)
);
console.log("Lab Tax Total", type, laborTaxTotal.toFormat());
});
} else {
//We don't have it, just add in how it was before.
laborTaxTotal = otherTotals.rates.subtotal.percentage(
(job.tax_lbr_rt || 0) * 100
); // THis is currently using the lbr tax rate from PFH not PFL.
}
let ret = {
subtotal: subtotal,
@@ -810,9 +848,7 @@ function CalculateTaxesTotals(job, otherTotals) {
),
statePartsTax,
state_tax: statePartsTax
.add(
otherTotals.rates.subtotal.percentage((job.tax_lbr_rt || 0) * 100) // THis is currently using the lbr tax rate from PFH not PFL.
)
.add(laborTaxTotal)
.add(
otherTotals.additional.adjustments.percentage(
(job.tax_lbr_rt || 0) * 100
@@ -835,7 +871,7 @@ function CalculateTaxesTotals(job, otherTotals) {
.add(
otherTotals.rates.mash.hasMashLine === false //If parts and materials were not added as lines, we must calculate the taxes on them.
? otherTotals.rates.mash.total.percentage(
(job.tax_paint_mat_rt || 0) * 100
(job.tax_shop_mat_rt || 0) * 100
)
: Dinero()
),