BOD-63 Prevent render of invoice detail when not selected
This commit is contained in:
@@ -8,20 +8,20 @@ export const CalculateInvoiceTotal = (invoice) => {
|
||||
local_tax_rate,
|
||||
state_tax_rate,
|
||||
} = invoice;
|
||||
|
||||
//TODO Determine why this recalculates so many times.
|
||||
console.log("Calculating invoice total...");
|
||||
let subtotal = Dinero({ amount: 0 });
|
||||
let federalTax = Dinero({ amount: 0 });
|
||||
let stateTax = Dinero({ amount: 0 });
|
||||
let localTax = Dinero({ amount: 0 });
|
||||
if (!!!invoicelines) return null;
|
||||
invoicelines.map((i) => {
|
||||
invoicelines.forEach((i) => {
|
||||
if (!!i) {
|
||||
const itemTotal = Dinero({ amount: i.actual_cost * 100 || 0 }).multiply(
|
||||
i.quantity || 1
|
||||
);
|
||||
const itemTotal = Dinero({
|
||||
amount: Math.round((i.actual_cost || 0) * 100) || 0,
|
||||
}).multiply(i.quantity || 1);
|
||||
subtotal = subtotal.add(itemTotal);
|
||||
if (i.applicable_taxes.federal) {
|
||||
console.log("Adding fed tax.");
|
||||
federalTax = federalTax.add(
|
||||
itemTotal.percentage(federal_tax_rate || 0)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user