Blakewilliams Posted January 14, 2010 Share Posted January 14, 2010 Hi Just posted this on the bug tracker - I woudl love it if anyone could help me with this errorHas anyone esle read it, or had a similar experience?Cheers----Basically the issue that I have is that when the pdf for the order is generated, any item that has had a discount subtracted kicks an incorrect SECOND subtotal.The invoice breakdown::1: Total (tax excl.) - this is correct and has had the discount subtracted (i.e. £10.00 off per 5 items etc)2: Total (tax incl.) - this again is correct and has had the current VAT rate (17.5%) added on to the discounted total3: Shipping (if applies) this is the amount of shipping - if there is no shipping, then this doesn't appear.4: Final subtotal - if there is shipping, then then this final subtotal is the tax incl. plus the shipping. Despite the fact that this looks confusing having 2 subtotals if there is no shipping, *IT IS WRONG*. The second total that shows is the tax incl. BEFORE the discount has been taken off, so there are 2 different subtotals and the latter is incorrect.*Please see included example*On the attached jpg, you can see the 2 subtotals are wrong - there is no shipping to be added on hence there is no shipping on the PDF (even though in my opinion it should say 'shipping = £0.00'). On this test buy I have bought 12 items making it eligible for a £2.51 discount per item - which has been subtracted form the first subtotal :: £461.00 so - The items pre-tax retail is £40.96.I have bought 12 of these in my test buy - this means that this £40.96 will get £2.51 subtracted from each one, so the new pre-tax retail will be £38.45...this means that the re-tax retail is::38.45 * 12 = 461.40 (£461.40 = this is bang on )ADD TAX = (17.5%)461.40 * 1.175 = 542.16 (£542.16 = prestashop is 1 out on the second decimal place (0.01), but this is not the real issue)--NO SHIPPING ADDED-- this is correctSo the second subtotal with tax on the pdf says - £547.42.Subtract mine from this - 547.42 - 542.16 = 5.26 ... £5.26 difference.--I worked this out as - Take the 2.51 discount - multiply this by 12 to get the gross discount and add Tax to it - 2.51 * 12 = 30.12(30.12 / 100) * 17.5 = 5.27 (0.01 out here - strange maybe we're rounding something different) -- I tried my theory on a few different items with discounts and it seems to hold up.Pretty serious error in my opinion and I would find it hard to believe that nobody else has noticed it - but I can't find anything in the forum.I would please like some confirmation that I am correct - I think the PDF id a bit crappy anyways, but I'm not keen on editing the code unless a moderator can confirm and suggest.Maybe this is a really simple error - or somebody has already fixed it?!I look forward to some help and guidance. 000016.pdf Link to comment Share on other sites More sharing options...
supersesam Posted February 5, 2010 Share Posted February 5, 2010 I experience the same problem Link to comment Share on other sites More sharing options...
varod Posted February 7, 2010 Share Posted February 7, 2010 Do you find any solution about that bug ?Thanks Link to comment Share on other sites More sharing options...
supersesam Posted February 8, 2010 Share Posted February 8, 2010 there's a workaround here, but I could not make it show the right currency (shows € and I need DKK)http://www.prestashop.com/forums/viewthread/5479/general_discussion/problem_with_pdf_calculationsApparently, some could make it work... Link to comment Share on other sites More sharing options...
maxhome Posted February 8, 2010 Share Posted February 8, 2010 Hi, in French here please!!!You have the 1.2.5 version?I think this bug is corrected in the svn (1.3) Link to comment Share on other sites More sharing options...
supersesam Posted February 8, 2010 Share Posted February 8, 2010 ok, je m' excuse. J'ai seulement répondu sur ce poste.Est-ce que tu pense ou sais si le problème est fixé dans 1.3 ? J'ai vraiement peur de upgrader (sorry for my yankeefrench :shut: ). Link to comment Share on other sites More sharing options...
maxhome Posted February 8, 2010 Share Posted February 8, 2010 I think but do not use the 1.3 in production Sorry Link to comment Share on other sites More sharing options...
Blakewilliams Posted February 25, 2010 Author Share Posted February 25, 2010 Fixed - after a hell of a lot of frusration and calculations, I manageed to sort it.... I can't remember what line it was on, but I simply located the relevant variables and made sure that I only applied VAT or TAX to the discounted total - NOT the original total.Still no real closure here though and not a word from an admin... I reported this to the bug tracker and it has been in the forum a while now with no real resolve. Link to comment Share on other sites More sharing options...
supersesam Posted February 25, 2010 Share Posted February 25, 2010 ...I can't remember what line it was on... Alôrs là ca devient intéressant! Mais quelle dommâge, qu'il ne souvient pas ce qu'il avait fait I hope you'll share the information when you find out which line it was. Link to comment Share on other sites More sharing options...
Blakewilliams Posted February 25, 2010 Author Share Posted February 25, 2010 Hmm - I can't remember exactly what I did - but it wasnt really a substantial error, the cart equations are correct, it just references a wrong var when it writes the PDF.I have enclosed my pdf class file so you can either use it or examine (i think this is the correct one).Let me know how you get on.) PDF.php Link to comment Share on other sites More sharing options...
supersesam Posted February 25, 2010 Share Posted February 25, 2010 Much more attractive post ;-) Thanks, I will try it.(Hint: actually this is a french forum and now you sure think I'm a pain in the *ss, but in fact I'm very thankful for your effort) Link to comment Share on other sites More sharing options...
Blakewilliams Posted March 3, 2010 Author Share Posted March 3, 2010 out of curiosity did you try it??Blake Link to comment Share on other sites More sharing options...
supersesam Posted March 3, 2010 Share Posted March 3, 2010 No, I dealt with it by deleting the last 2 lines entirely I'm not going to spend time on it until the next job (my boss thinks I've other more important things to do).But I'll surely tell you when I get the opportunity to try... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now