Skip to content
New issue

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

feat - Refactor tax calculation logic in invoice payload to handle identical items #11

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

maniamartial
Copy link
Contributor

  • Overview:
    This commit refactors the tax calculation logic within the build_invoice_payload function to improve the handling of taxation types. The new approach aggregates taxable amounts, tax rates, and net totals for identical items on a sales invoice.

  • Changes Made:

    • Implemented a dictionary-based approach to store tax information for different taxation types (A, B, C, D, E), ensuring accurate calculations even when multiple identical items are present in the invoice.
    • Adjusted the calculation logic to dynamically aggregate the taxable amounts and tax rates based on the taxation type, which resolves issues related to incorrect totals when identical items are invoiced.
    • Enhanced the payload structure to utilize the newly calculated tax data directly from the aggregated results, improving the overall integrity of the invoice payload.
  • Benefits:

    • The new method simplifies the code by consolidating tax calculations and improving maintainability.
    • This change enhances the accuracy of tax reporting and compliance with regulations by ensuring that identical items are correctly accounted for in the tax calculations.
    • The improvements also contribute to better performance when processing invoices with multiple identical items, as calculations are more efficient.
  • Next Steps:

    • Testing will be conducted to ensure that the refactored logic works as expected across various invoice scenarios.
    • Further refinements may be implemented based on feedback and any edge cases identified during testing.

@maniamartial
Copy link
Contributor Author

Did the same changes to purchase invoice.

@maniamartial maniamartial merged commit 2fcd8c8 into develop Nov 6, 2024
1 check failed
@maniamartial maniamartial deleted the dev2 branch November 29, 2024 06:38
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.

1 participant