We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in the InvoiceForm.js handleCalculationTotal() is not calculate total for 2or more items.
The text was updated successfully, but these errors were encountered:
try this instead: handleCalculateTotal() { const { items, taxRate, discountRate } = this.state;
let subTotal = items.reduce((acc, item) => { return acc + parseFloat(item.price) * parseInt(item.quantity); }, 0);
// Ensure subTotal is a floating point number with two decimal places subTotal = parseFloat(subTotal.toFixed(2));
const taxAmmount = parseFloat((subTotal * (taxRate / 100)).toFixed(2)); const discountAmmount = parseFloat((subTotal * (discountRate / 100)).toFixed(2)); const total = parseFloat((subTotal - discountAmmount + taxAmmount).toFixed(2));
this.setState({ subTotal, taxAmmount, discountAmmount, total }); }
Sorry, something went wrong.
No branches or pull requests
in the InvoiceForm.js handleCalculationTotal() is not calculate total for 2or more items.
The text was updated successfully, but these errors were encountered: