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

Update tax.lib.php #32041

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open

Conversation

le-reparateur
Copy link
Contributor

When expensereport for a month and for a tax rate contains more than 1 line (n lines), the tax report contains n identical lines and total are impacted with those n values.
In this exemple ER2409-0045 contains 7 different payments (2 payments with 20% tva, 2 payments with 10% tva and 3 payments with 5.5% tva -> the picture).
The lines are copied 7 times for the same value in the report.

Capture d'écran 2024-11-21 152725

Add GROUP BY in SELECT sql request solve the problem.

Francis

When expensereport for a month and for a tax rate contains more than 1 line (n lines), the tax report contains n identical lines and total are impacted with those n values.
@eldy
Copy link
Member

eldy commented Nov 21, 2024

What is the url or menu to use to reach the page with the screenshot ?

@eldy eldy added the Bug or PR need more information This bug or PR needs more information (answer to a question or more accurate description) label Nov 21, 2024
@le-reparateur
Copy link
Contributor Author

le-reparateur commented Nov 21, 2024

url : .../htdocs/compta/tva/quadri_detail.php
Then left menu -> month report -> select a period -> select a month -> click on a rate in supplier list to obtain all lines...
Capture du 2024-11-21 23-24-44

@eldy
Copy link
Member

eldy commented Nov 22, 2024

This does not look to be a bug: The goal of report is to show the detail of vat for each payment part. So if there is 7 payments, you should have 7 lines, each lines

For example, a report for an expense report with 2 payments show the detail of vat part of each couple expensereport line/payment. On v20, we see the amount of expense report (8.33 euros) but also the amount of payment and the part of vat for this related payment.
image

for example on last line, amount if 8.33 HT (so 10 TTC), the payment is 1 euros, so 10% of total, so the part paid for this line is 0.833 and the VAT part among this part paid is 0.17. Payment may have been done at different date, so we have no other choice to calculate using a detail for each payment.
A think that could be interesting to avoid confusion is to add the date of payment (with hour min sec) so we can see that lines are not duplicates but a detailed list

@eldy eldy added Discussion Some questions or discussions are opened and wait answers of author or other people to be processed and removed Bug or PR need more information This bug or PR needs more information (answer to a question or more accurate description) labels Nov 22, 2024
@le-reparateur
Copy link
Contributor Author

le-reparateur commented Nov 22, 2024

Problem is not in that way... sorry !

If you have an expense report (for august a real one!) with 8 different lines (different kind of expenses) and 7 paiements.

Capture d'écran 2024-11-22 162000

The 8 lines of expense have different tax rate : 3 for 20%, 2 for 10% and 3 for 5.5%.

When we look at the tax report for august, then we have

Capture d'écran 2024-11-22 162250

For the rate 20% we can see 7 identical lines for the 3 expenses realised at a rate of 20%

The same for 10% 2 lines repeated 7 times each...

Capture d'écran 2024-11-22 162314

And for 5.5% 3 lines repeated 7 times.

Capture d'écran 2024-11-22 162353

And for each total corresponding to a rate, the result is bad. And of course total of total !

So with my proposal, same screnshots give

Capture d'écran 2024-11-22 162605

Capture d'écran 2024-11-22 162623

Capture d'écran 2024-11-22 162637

And totals are good and my VAT declaration too !
Francis

@eldy
Copy link
Member

eldy commented Nov 26, 2024

I think the bug is nit in duplicate.
If we have 7 payments on an expense report with 8 lines, we should get 56 lines in the detail.
The pb here seems in total. The first colum of amount in your screenshot is the total of line so because we show detail of vat payment part for each line, leach line is outpu 7 times, so we must not make sum on this column, or we will count 7 times the same. Sum must be visible only for the column of the part that is the detail for couple expense line/paylent. It seems this is correctly done on v20.so i suggest to get a fix on this branch to try a backport of code in v20 branch instead.

@le-reparateur
Copy link
Contributor Author

On a specific rate we have the list of all lines (supplier invoices, expense report) which impact the total of VAT for that rate.
We need the exact total of that sum to declare the VAT. I do that way because I don't use accounting part for that details.
For my use, I solve the problem this way. I check that this function is only used for the vat report, no other impact on my Dolibarr.
In the near future I will test that in my V20 ... I have now included that point in my checklist !
I can also test that point on a V19... I quickly have a look on V18 and it seems we have the same problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants