WIP TotalsUpdates.
This commit is contained in:
@@ -687,13 +687,15 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
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.act_price * 100),
|
||||
})
|
||||
.multiply(val.part_qty || 0)
|
||||
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
||||
.multiply(val.prt_dsmk_p > 0 ? 1 : -1)
|
||||
? val.prt_dsmk_m
|
||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||
: Dinero({
|
||||
amount: Math.round(val.act_price * 100),
|
||||
})
|
||||
.multiply(val.part_qty || 0)
|
||||
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
||||
.multiply(val.prt_dsmk_p > 0 ? 1 : -1)
|
||||
: Dinero()
|
||||
)
|
||||
.percentage(
|
||||
((job.parts_tax_rates &&
|
||||
@@ -711,8 +713,9 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
)
|
||||
);
|
||||
}
|
||||
console.log(statePartsTax.toFormat(), val.line_desc);
|
||||
});
|
||||
|
||||
console.log("State Parts Tax", statePartsTax.toFormat());
|
||||
let ret = {
|
||||
subtotal: subtotal,
|
||||
federal_tax: subtotal
|
||||
@@ -738,22 +741,22 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
.add(
|
||||
otherTotals.additional.storage.percentage((job.tax_str_rt || 0) * 100)
|
||||
)
|
||||
.add(additionalItemsTax),
|
||||
// .add(
|
||||
// otherTotals.rates.mapa.hasMapaLine === false //If parts and materials were not added as lines, we must calculate the taxes on them.
|
||||
// ? otherTotals.rates.mapa.total.percentage(
|
||||
// (job.tax_paint_mat_rt || 0) * 100
|
||||
// )
|
||||
// : Dinero()
|
||||
// )
|
||||
// .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
|
||||
// )
|
||||
// : Dinero()
|
||||
// ),
|
||||
// .add(otherTotals.additional.pvrt),
|
||||
.add(additionalItemsTax)
|
||||
.add(
|
||||
otherTotals.rates.mapa.hasMapaLine === false //If parts and materials were not added as lines, we must calculate the taxes on them.
|
||||
? otherTotals.rates.mapa.total.percentage(
|
||||
(job.tax_paint_mat_rt || 0) * 100
|
||||
)
|
||||
: Dinero()
|
||||
)
|
||||
.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
|
||||
)
|
||||
: Dinero()
|
||||
),
|
||||
|
||||
local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100),
|
||||
};
|
||||
ret.total_repairs = ret.subtotal
|
||||
@@ -796,6 +799,7 @@ function DiscountNotAlreadyCounted(jobline, joblines) {
|
||||
(jobline.prt_dsmk_m / (jobline.act_price - jobline.prt_dsmk_m)) * 100
|
||||
) === Math.abs(jobline.prt_dsmk_p)
|
||||
) {
|
||||
console.log(jobline.line_desc, "Already had the discount counted.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user