Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Oct 2007
    Posts
    2
    Plugin Contributions
    0

    Default Sales Report / Tax Issue

    The sales report in my build of zen cart sets the decimal places in the tax to 00 regardles of the actual tax:



    I am having an issue in the sales report section. The figures aren't adding up. I have set it up for Australia with a GST of 10% and separate GST for freight of 10% as described in another thread. I have tried a fresh install. None of these measures have worked for me. I have tried editing the PHP file myself and casting the quantity to be a float as I thought that perhaps multiplication involving an int would truncate the decimals altogether, only to be readded when formatted as currency. However, fiddling around with this has yielded not only no positive results but no changes whatsoever. If anyone can help me before I tear my hair completely out I would be stoked.

    Cheers,

    Kai

    PS, my version details are as follows.


    Zen Cart 1.3.7
    Database Patch Level: 1.3.7
    v1.3.7 [2007-04-30 14:51:42] (Fresh Installation)

    PHP Version 4.4.7

    System Windows NT WIN9 5.2 build 3790
    Build Date May 3 2007 10:02:27
    Server API CGI/FastCGI
    Virtual Directory Support enabled
    Configuration File (php.ini) Path E:\hshome\echo0\electronicsnow.com.au\php.ini
    PHP API 20020918
    PHP Extension 20020429
    Zend Extension 20050606
    Debug Build no
    Zend Memory Manager enabled
    Thread Safety enabled
    Registered PHP Streams php, http, ftp, compress.zlib

  2. #2
    Join Date
    Oct 2007
    Posts
    12
    Plugin Contributions
    0

    Default Re: Sales Report / Tax Issue

    Kai,

    I just installed the Sales Reports module and noticed the same thing.

    What I have discovered is as follows:

    in {root}\includes\functions\general.php there is a function:

    function zen_calculate_tax($price, $tax) {
    global $currencies;
    return zen_round($price * $tax / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
    }

    Now, it seems that the problem is that the currencies[DEFAULT_CURRENCY]['decimal_places'] is blank instead of having 2 (which is what is in the database table) and after testing I find that if you pass a blank to the zen_round function it rounds to 00 (which is what you'd expect).

    The sales report shows the correct tax if you change the above call to:
    return zen_round($price * $tax / 100, 2);

    Now, I cant figure out why the default currency is returning blank, but at least we are progressing.

    Any ideas ?

    Murray (also in Oz)

  3. #3
    Join Date
    Oct 2007
    Posts
    12
    Plugin Contributions
    0

    Default Re: Sales Report / Tax Issue SOLUTION

    OK,

    I seem to have solved the tax rounding problem (but there are still problems with the calculation of the tax allowing for coupons and freight?? More on that later, I hope.)

    In the template \admin\stats_sales_report.php at line 592 you will find:

    Code:
    require(DIR_WS_CLASSES . 'currencies.php');
    $currencies = new currencies();
    Move those two lines to the top of the page (c line 33) after
    require('includes/application_top.php');

    so it reads:
    Code:
    require('includes/application_top.php');
    require(DIR_WS_CLASSES . 'currencies.php');
    $currencies = new currencies();
    The problem was that the $currencies variable was not being declared until AFTER the tax was being calculated so it didnt know how many decimal places to round to and therefore rounded it to 0 decimals instead of 2.

    Now.... what is going on with the actual calculations???? Stay tuned.

    Murray

  4. #4
    Join Date
    Oct 2007
    Posts
    2
    Plugin Contributions
    0

    Default Re: Sales Report / Tax Issue

    Murray - you are a legend. I'll add those lines in a minute. As for the actual calculations, it appears to be the issue that it is using the totals stored in the database to add work out the GST for each item, whereas each item is also calculating it's own GST. I think this would be fine except what it appears to be doing is rounding for each item separately when calculating the GST, but then using the total ex GST for the price for the total at the end and calculating the price for that and rounding. This usually results in a difference of a couple of cents at my end. I'm currently checking that out as well, so will post if I get it before you do (If we've got the same issue here).

 

 

Similar Threads

  1. Sales tax Report by State
    By mmwilcox in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 27 Jun 2011, 01:29 PM
  2. Sales Tax Summary Report
    By fred_artemis in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 25 Mar 2008, 02:54 PM
  3. Admin > Reports > Sales Tax Report
    By batteryman in forum General Questions
    Replies: 7
    Last Post: 6 Feb 2008, 08:44 PM
  4. Generating a sales tax report for accounting purposes
    By tqualizer_man in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 1
    Last Post: 10 Jan 2007, 09:47 PM
  5. Sales Tax Report needed - will pay $$
    By harmonyservice in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 10 May 2006, 03:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg