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

Wrong tax totals per vat and also wrong gross total #63

Open
charkoulis opened this issue Sep 20, 2024 · 2 comments
Open

Wrong tax totals per vat and also wrong gross total #63

charkoulis opened this issue Sep 20, 2024 · 2 comments

Comments

@charkoulis
Copy link

charkoulis commented Sep 20, 2024

Scenario
2 products with 1.96 unit price including tax 13% -> 1.73 without tax
2 products with 0.04 unit price including tax 24% -> 0.03 without tax

$line->setName('Product 1')
            ->setPrice(1.73)
            ->setVatRate(13)
            ->setQuantity(2);
$line->setName('Product 2')
            ->setPrice(0.03)
            ->setVatRate(24)
            ->setQuantity(2);

The totals should be equal to 4 but it is calculated as 3.98.
It seems that it loses 0.01 per tax rate because the rounding is being applied at the total and not on each unit price separately.

image

@josemmo
Copy link
Owner

josemmo commented Sep 22, 2024

Hi, @charkoulis!

For better or worse, that's how rounding works in the specification.

To account for these issues, you can make use of the rounding amount field (BT-114):

// [...]
$invoice->setRoundingAmount(0.02);

@charkoulis
Copy link
Author

Hi @josemmo

Even if i fix the total amount with the setRoundingAmount function, the taxAmount for each VAT will still be wrong.

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

No branches or pull requests

2 participants