Add tax rates to shop config, resolve rate population on job detail.

This commit is contained in:
Patrick Fic
2023-09-19 15:23:47 -07:00
parent fef680fb99
commit eff4f82ad7
9 changed files with 665 additions and 23 deletions

View File

@@ -767,6 +767,7 @@ function CalculateTaxesTotals(job, otherTotals) {
let statePartsTax = Dinero();
let additionalItemsTax = Dinero();
let us_sales_tax_breakdown;
//Audatex sends additional glass part types. IO-774
const BackupGlassTax =
@@ -977,8 +978,8 @@ function CalculateTaxesTotals(job, otherTotals) {
.add(totalTaxByTier.ty4Tax)
.add(totalTaxByTier.ty5Tax)
.add(totalTaxByTier.ty6Tax);
console.log("Tiered Taxes Total for Parts", statePartsTax.toFormat());
us_sales_tax_breakdown = totalTaxByTier;
console.log("Tiered Taxes Total for Parts/Labor", statePartsTax.toFormat());
} else {
//Use the old thing.
job.joblines
@@ -1037,6 +1038,8 @@ function CalculateTaxesTotals(job, otherTotals) {
let laborTaxTotal = Dinero();
if (Object.keys(job.cieca_pfl).length > 0) {
//Ignore it now, we have calculated it above.
//This was previously used for JCS before parts were also calculated at a different rate.
} else {
//We don't have it, just add in how it was before.
laborTaxTotal = otherTotals.rates.subtotal.percentage(
@@ -1055,6 +1058,7 @@ function CalculateTaxesTotals(job, otherTotals) {
)
),
statePartsTax,
us_sales_tax_breakdown,
state_tax: statePartsTax
.add(laborTaxTotal)
.add(
@@ -1083,7 +1087,6 @@ function CalculateTaxesTotals(job, otherTotals) {
)
: Dinero()
),
local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100),
};
ret.total_repairs = ret.subtotal