Handling discount and taxes, help needed!

Of course, InvoicePlane-it is the Italian fork.

What I mean is that we are prob. going to anticipate these fixes into 1.5.10, and they are going to be used and tested.

So whenever works for 1.6.0 will start, it can be a base for 1.6.0 for the international version. Just that.
I can make a second PR for the 1.6.0 branch myself when I finish on the other end.

1 Like

I’ve merged master on branch v1.6.0, and added both before and after-tax calculation based on a switch in settings. I’ve noticed there was a switch already there called ‘default_invoice_tax_rate_placement’ connected apparently to nothing, and I’ve used it for this.

To a first comparison, the numbers should be ok for both cases, we need to check the total invoice numbers, that are still wrong. Let’s go by steps. I don’t want to push too much stuff all at once.
I’ll make another commit fixing the total.

In the meantime,
lets’ all check the numbers together and make sure we all agree they are correct.

I’ve made a couple of invoices to check the calculation, but I don’t use the “after-tax” day-by-day, so please do a test and check.

1 Like

Got finally around to fixing totals, now they are correct.

I’ve made tests using the following scenarios:

Case 1:

Item price: 100 euro
Item discount: 10 euro
Item tax: 19% VAT

Before-Tax:

subprice: 90 euro
tax amount: 17.10 euro
discount: 10 euro
total: 107.10 euro

After-Tax:

subprice: 91.59 euro
tax amount: 17.41 euro
discount: 10 euro
total: 109 euro

Case 2:

Item price: 105 euro
Item quantity: 2
Item discount: 12 + 5% euro
Item tax: 19% VAT

Before-Tax:

subprice: 175.50 euro
tax amount: 33.34 euro
discount: 34.50 euro
total: 208.84 euro

After-Tax:

subprice: 168.84 euro
tax amount: 32.08 euro
discount: 48.98 euro
total 200.92 euro

To me it’s correct, consider merging in 1.6.0 when someone can.

1 Like

Befor merging I would like to publish a Test-Release for v1.6.0 made of your Fork (LINK) to give the community the opportunity to test it and to give some feedback.

Therefor I just build a “TaxTestv1.6.0” release which is just for testing purposes and should not be installed on any productive System, but on Testing/Dev System.

I have not tested it yet but will do so soon.
Here is the Test-Release:

Identifier Value
name: TaxTestv1.6.0.zip
md5: 0eb0db1a3ba5779a52dcbd99bdfbe5fb
sha256: b0c2ff61f5d5e8b1754e367e3f9b4d1389080f118424220c5895cbecc1a3a12a
size: 13.801 MiB
dl file (com): https://dl.invoiceplane.com/TaxTestv1.6.0.zip
txt sums (com): https://dl.invoiceplane.com/TaxTestv1.6.0.zip.txt
dl file (org): https://dl.invoiceplane.org/TaxTestv1.6.0.zip
txt sums (org): https://dl.invoiceplane.org/TaxTestv1.6.0.zip.txt

NOTE: This TestBuild is probably just PHP 7.0-7.2 compatible, so pls do not test with PHP 7.3 or PHP 7.4 yet

Pls report after testing if everything was like expected or not.
Have fun testing!

@Luca_Pellizzari
thank for the screenshot, i now understan and thanks to Martin and you for solving this in 1.6.
regards Jan