Jump to content

[solved]Bug on AT (Austrian) tax invoice block after upgrade PS 1.5.6.1 to 1.6.0.9


Recommended Posts

I've already added my problem to the bug-tracker. It is assigned to one developer, but there is no solution for it till now.

 

Perhaps somebody of the forum can give a hand and fix the problem ?

 

http://forge.prestashop.com/browse/PSCSX-3717

 

 

Since I've upgraded with 1-click module my shop from 1.6.0.6. to 1.6.09. the tax-block on all invoices is calculating a wrong, non existing, tax fee for Geolocalization Austria (AT). We have 20% tax (and 10% if applied), but all invoices on the tax block now are showing a 40% tax and wrong calculated taxes. S. screens attached to bug-report on bug-tracker. Total of invoice and taxes on cart are correct. Only the tax-block has "crazy" values not added anywhere to database...

 

For the time being I commented the block from the form, to don't be blocked on tax bureaux monthly reports, but I need an urgent fix for this, cause I have now to calculated the taxes from each invoice manually and a part from the invoice form.

 

Anybody knows how to fix ?

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

There is no problem with database. Simply the form or the script changed something. I don't have any taxes with 40% in database. You can see this on the screens added. There are only available 20, 10 and 0 percent. This problem is coming from the upgrade PS 1.5.6.1 to PS 1.6.0.9. All invoices have on the tax section now 40% instead of the 20% also the old invoices written with PS 1.5.6.1.

The cart is calculating the taxes without any problems, only the section taxes on invoces is crazy... See the cart calculation and the difference on the tax section on the invoice attached on bug tracker.

The same invoice PS 1.5.6.1 and PS 1.6.0.9 when I'm printing now. The correct tax was Euro 8,31 in total (Cart and tax section). On invoice of PS 1.6.09. Cart total tax 8,31 in total and tax section on invoice 15,80 instead of 8,31. So there is no explanation for the difference and sorry cannot be in the database too, cause the base, which is the cart was calculated correctly. ;)

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

I attach screens of the invoice and the screen of PS-order_invoice. As you can see nothing wrong on database. There are the correct values in it, but when I print this invoice with PS 1.6.0.9 the tax section is completely wrong. The problem is on printing or forming of file to be printed.

post-741527-0-08352900-1415304961_thumb.jpg

post-741527-0-91304300-1415304981_thumb.jpg

post-741527-0-24845400-1415304999_thumb.jpg

post-741527-0-05839800-1415305178_thumb.jpg

post-741527-0-85518400-1415305847_thumb.jpg

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

I still think that the problem is in data (or code, of course).

 

Tax rates in the tax breakdown are prepared in /classes/OrderInvoice.php/getProductTaxesBreakdown() method. As you can see, in some cases is SUM(t.`rate`) AS rate calculated. This would be the root of the problems.

 

A small note at the end. The M4 PDF Extensions module doesn't have this problem, because all invoices are created just from orders (invoice tables are not used) and the possibility of working with erroneous data is reduced.

Edited by tuk66 (see edit history)
Link to comment
Share on other sites

I don't know what it is, but the problem is a great one. Take a look into the screens.

 

Correct invoice:

Total cart: 2.674,60, total VAT = 231,82

thereof 10% VAT on 2.002,27 = 200,39

thereof 20% VAT on190,43 = 38,08

__________________________________

 

New Invoice PS 1.6.0.9 Displaying:

Total cart: 2.674,60, total VAT = 231,82

- thereof 10%  VAT - SHOULD BE THERE 10% written and not 20%!!! so inverted displaying - on 2.002,27 = 400,78

- thereof  20% VAT  - variable name disappeared for products 20% - which is now displaying 40% on 190,43 = 76,16

 

IN THIS CASE TOTAL OF VAT should be 476,94, which in real and correct is 231,82

 

Totally non-sense and not really comprehensible. I faced also that not all invoices have this problem. And it is independent of the payment method, so here I can also not find a common match. Total of Cart is correct in all invoices and also the total of VAT, but the splitting is totally crazy...

I was also thinking about an error on custormer groups, but in this case the cart should be too wrong, and it's not.

post-741527-0-56746300-1415351213_thumb.jpg

post-741527-0-90897000-1415351224_thumb.jpg

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

For to have my invoices correct displaying I was also thinking to prepare another clone of my PS 1.5.6.1 and import all new orders directly from one DB to another to PS 1.5.6.1.

As you can see it is a great difference and problem if invoice displays a tax due to the VAT tax bureaux of 400 or 200 !! Besides it is a case for investigation, if I'm not able to write correct invoices. Sorry, but this blame and troubles I will pope for myself. For the time being I commented the whole block, but it is a work extra to now calculate each position, besides Prestashop invoices also don't show the tax-classes on the resumée of the product-line.

Link to comment
Share on other sites

Tax rates in the tax breakdown are prepared in /classes/OrderInvoice.php/getProductTaxesBreakdown() method. As you can see, in some cases is SUM(t.`rate`) AS rate calculated. This would be the root of the problems.

 

Where is this file in ps 1.5.6.1 and 16.0.9. exactly ? I cannot find it there. I want to give a try to replace it and also comment on invocie.tax-tab.tpl the break-down to see if it solves the problem for now...

Link to comment
Share on other sites

finally found it on /classes/order. replaced and no change... It is really tedious to have a shop half broken... Normally I'm very carefull when i upgrade and release the shop to live. Cause I know Prestashop's problems... In this case I didn't checked if invoices are correct displaying, I only check the basics... If cart is working, orders are not empty, etc, etc... I never had any problem in the past with invoicing.

Link to comment
Share on other sites

I think I found the problem. The upgrade duplicated all data in table ps_order_detail_tax. I found out, that on database PS 1.5.6.1. ps_order_detail_tax lines are only once added. On database of PS 1.6.0.9. all lines are duplicated. As lines are duplicated the tax are also added (20+20 = 40). As the carriers are on another table, they were never affected from this problem and correct displayed on the tax section of the invoice.

 

Seems to be a bug from 1-click-upgrade module...

Link to comment
Share on other sites

BINGO. By deleting all duplicate entries the invoices are now again correct.

 

Prestashop should be create a fall-back option for such possibility (duplicate entries during upgrade) on the 1-click module. It is not really "prickly" to spent your time on such trivial upgrade errors, besides it is not visible at first.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...