Skip to content

Fix handleCalculateTotal function to correctly calculate totals for multiple items. issue #20 - #25

Open
DivyarajChudasama wants to merge 1 commit into
johnuberbacher:masterfrom
DivyarajChudasama:master
Open

Fix handleCalculateTotal function to correctly calculate totals for multiple items. issue #20#25
DivyarajChudasama wants to merge 1 commit into
johnuberbacher:masterfrom
DivyarajChudasama:master

Conversation

@DivyarajChudasama

Copy link
Copy Markdown

Description

This pull request addresses an issue in the handleCalculateTotal function of the InvoiceForm.js file, where the total was not correctly calculated for multiple items. The changes ensure that the subtotal, tax amount, discount amount, and total are computed accurately when there are two or more items in the invoice.

Changes Made

  • Fixed the calculation of subTotal in the handleCalculateTotal function to correctly sum up the prices of all items.
  • Updated the calculation logic to ensure taxAmmount, discountAmmount, and total are computed correctly based on the updated subTotal.

Testing

  • Tested with multiple items to ensure the subtotal, tax, discount, and total amounts are calculated correctly.
  • Verified that the calculations update dynamically when items are added, removed, or edited.

Additional Notes

  • This fix ensures the integrity of the invoice calculations, improving the accuracy and reliability of the application.
  • No other parts of the code were affected by these changes.

Please review the changes and let me know if there are any questions or further adjustments needed. Thank you!

@netlify

netlify Bot commented Jun 30, 2024

Copy link
Copy Markdown

Deploy Preview for invoice-generator-react ready!

Name Link
🔨 Latest commit d8d63c3
🔍 Latest deploy log https://app.netlify.com/sites/invoice-generator-react/deploys/66814d583c5be2000815a63d
😎 Deploy Preview https://deploy-preview-25--invoice-generator-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@codeCraft-Ritik codeCraft-Ritik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on this fix! Correcting the subtotal calculation for multiple invoice items and ensuring tax, discount, and final total are derived from the updated subtotal addresses an important accuracy issue. Nice work! 👏

Really nice fix. Invoice calculations need to be reliable, and handling multiple items correctly while keeping updates dynamic when items are added, removed, or edited is an important improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants