IO-233 Revert ITC Calculations.

This commit is contained in:
Patrick Fic
2021-09-13 14:56:54 -07:00
parent d9abe84949
commit b198ca5051

View File

@@ -86,44 +86,44 @@ exports.default = async function (socket, jobid) {
.multiply(line_val.quantity) .multiply(line_val.quantity)
.multiply(bill_val.is_credit_memo ? -1 : 1); .multiply(bill_val.is_credit_memo ? -1 : 1);
//Add appropriate tax amounts. // //Add appropriate tax amounts.
const { // const {
applicable_taxes: { local, state, federal }, // applicable_taxes: { local, state, federal },
} = line_val; // } = line_val;
if (local) { // if (local) {
if (bodyshop.cdk_configuration.itc_local) // if (bodyshop.cdk_configuration.itc_local)
taxAllocations.local.cost = taxAllocations.local.cost.add( // taxAllocations.local.cost = taxAllocations.local.cost.add(
lineDinero.percentage(bill_val.local_tax_rate || 0) // lineDinero.percentage(bill_val.local_tax_rate || 0)
); // );
lineDinero = lineDinero.add( // lineDinero = lineDinero.add(
lineDinero.percentage(bill_val.local_tax_rate || 0) // lineDinero.percentage(bill_val.local_tax_rate || 0)
); // );
} // }
if (state) { // if (state) {
if (bodyshop.cdk_configuration.itc_state) // if (bodyshop.cdk_configuration.itc_state)
taxAllocations.state.cost = taxAllocations.state.cost.add( // taxAllocations.state.cost = taxAllocations.state.cost.add(
lineDinero.percentage(bill_val.state_tax_rate || 0) // lineDinero.percentage(bill_val.state_tax_rate || 0)
); // );
lineDinero = lineDinero.add( // lineDinero = lineDinero.add(
lineDinero.percentage(bill_val.state_tax_rate || 0) // lineDinero.percentage(bill_val.state_tax_rate || 0)
); // );
} // }
if (federal) { // if (federal) {
//If it's an ITC, add it as a negative cost, otherwise add it to the item cost. // //If it's an ITC, add it as a negative cost, otherwise add it to the item cost.
if (bodyshop.cdk_configuration.itc_federal) // if (bodyshop.cdk_configuration.itc_federal)
taxAllocations.federal.cost = taxAllocations.federal.cost.add( // taxAllocations.federal.cost = taxAllocations.federal.cost.add(
lineDinero.percentage(bill_val.federal_tax_rate || 0) // lineDinero.percentage(bill_val.federal_tax_rate || 0)
); // );
lineDinero = lineDinero.add( // lineDinero = lineDinero.add(
lineDinero.percentage(bill_val.federal_tax_rate || 0) // lineDinero.percentage(bill_val.federal_tax_rate || 0)
); // );
// bill_acc[line_val.cost_center] = bill_acc[line_val.cost_center].add( // // bill_acc[line_val.cost_center] = bill_acc[line_val.cost_center].add(
// lineDinero.percentage(bill_val.federal_tax_rate || 0) // // lineDinero.percentage(bill_val.federal_tax_rate || 0)
// ); // // );
} // }
bill_acc[line_val.cost_center] = bill_acc[line_val.cost_center] =
bill_acc[line_val.cost_center].add(lineDinero); bill_acc[line_val.cost_center].add(lineDinero);