Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11
    Join Date
    Sep 2008
    Posts
    20
    Plugin Contributions
    0

    Default Re: How to round TAX/VAT the swiss way?

    Works for me !!! Big thanks.

    In effect the rounding is applied to all number calculations. I just needed to final VAT field to behave. I wonder if there is a more elegant way of resolving rounding.

  2. #12
    Join Date
    Jan 2010
    Posts
    31
    Plugin Contributions
    0

    Default Re: Europe : rounding tax to nearest .5 cents (eliminate pennies)

    Quote Originally Posted by tino.schlegel View Post
    If you want to have all currencies round to 5 cents its the easiest when you change the zen_round() function in

    /includes/functions/functions_general.php

    line 173 - 179

    Code:
    // Wrapper function for round()
      function zen_round($number, $precision) {
    /// fix rounding error on GVs etc.
        $number = round($number / 5, $precision) * 5;
    
        return $number;
      }
    Replace the entire function or add the highlighted sections.

    this is helpful. prices in website are showing correctly as well as invoice to customers. however, invoice in admin is showing without rounding to nearest 5 cents. any solution?

  3. #13
    Join Date
    Jan 2010
    Posts
    31
    Plugin Contributions
    0

    Default Sale Price: Round off to nearest 5 cents

    // Wrapper function for round()
    function zen_round($number, $precision) {
    /// fix rounding error on GVs etc.
    $number = round($number / 5, $precision) * 5;

    return $number;
    }

    I have done the above to /includes/functions/functions_general.php
    and it shows correctly in my website.

    However, the invoice at admin>order is showing without rounding off.

    I then add the above to the file myadmin/includes/functions/functions_general.php, the Price (inc) is showing with round off but Price (ex) is not.

    FYI I don't set tax for my products.

    Please advise.

  4. #14
    Join Date
    Jan 2010
    Posts
    31
    Plugin Contributions
    0

    Default Re: Europe : rounding tax to nearest .5 cents (eliminate pennies)

    another problem i found is, after rounding off to nearest 5 cents, the total value might be incorrect.

    eg.
    subtotal 23.40 (actual 23.39)
    shipping 8.65 (actual 8.63)
    total 32.00 (actual 32.02)

    any solution?

  5. #15
    Join Date
    Apr 2013
    Location
    eglisau switzerland
    Posts
    567
    Plugin Contributions
    0

    Default Re: Europe : rounding tax to nearest .5 cents (eliminate pennies)

    Quote Originally Posted by tino.schlegel View Post
    If you want to have all currencies round to 5 cents its the easiest when you change the zen_round() function in

    /includes/functions/functions_general.php

    line 173 - 179

    Code:
    // Wrapper function for round()
      function zen_round($number, $precision) {
    /// fix rounding error on GVs etc.
        $number = round($number / 5, $precision) * 5;
    
        return $number;
      }
    Replace the entire function or add the highlighted sections.
    Just did this change in 155d and it seems to work fine.
    In this 155 version the code to change is on lines 214 - 220!

    I am curious that the change has the variable $number whereas the code to be replaced has $value; could this change cause unexpected consequences?

    Thanks for any advice!

  6. #16
    Join Date
    Apr 2013
    Location
    eglisau switzerland
    Posts
    567
    Plugin Contributions
    0

    Default Re: Europe : rounding tax to nearest .5 cents (eliminate pennies)

    Quote Originally Posted by marton_1 View Post
    Just did this change in 155d and it seems to work fine.
    In this 155 version the code to change is on lines 214 - 220!

    I am curious that the change has the variable $number whereas the code to be replaced has $value; could this change cause unexpected consequences?

    Thanks for any advice!
    I just noticed when a customer pays with PayPal then they pay the correct "unrounded" amount. So if, for example, the unrounded amount is 50.03 and the invoice shows 50.05 then they pay 50.03.

    It would be nice for the customer to pay the invoice amount especially as in Switzerland prices in cents have to be multiples of 5; so 5, 10, 15 etc.
    I just have to find the correct file to insert
    Code:
     $number = round($number / 5, $precision) * 5;
    
        return $number;
    Having said that PayPal works OK with these "illegal" amounts.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v138a SQL: Rounding Up All prices to nearest pound
    By MeltDown in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 2
    Last Post: 9 Jun 2012, 09:20 AM
  2. Sale Price: Round off to nearest 5 cents
    By cocolala in forum Setting Up Specials and SaleMaker
    Replies: 2
    Last Post: 9 Jan 2012, 03:57 AM
  3. Can I round prices to the nearest 5 cents?
    By xeontranq in forum General Questions
    Replies: 0
    Last Post: 3 May 2010, 04:47 AM
  4. Rounding tax rates, result wrong tax.
    By Swech in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 1
    Last Post: 7 Jul 2009, 02:22 PM
  5. Aust Post Module not rounding up to 5 cents.
    By Lollyworld in forum Addon Shipping Modules
    Replies: 0
    Last Post: 20 Aug 2008, 05:56 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR