Jump to content
Dementu

Problem z zaokrąglaniem Vatu

Recommended Posts

Witam,

nie mogę zmusić prestę aby prawidłowo zaokrąglała podatek Vat. Zasada jest taka, że zaokrągla w górę(zalecane) i ma zaokrąglać każdy produkt. Niestety jak widać na załączonych screenach zaokrągla tylko do drugiego miejsca po przecinku. 

Prawidłowa kwota podatku w tym przypadku powinna być 1.37 natomiast liczbę 1,365 zaokrągla do 1,36

Proszę o pomoc.

2_liczby.jpg

3_liczby.jpg

Share this post


Link to post
Share on other sites

Jeżeli dobrze zrozumiałem to błąd znajduje się w szablonie wykupionym z template monster?

Share this post


Link to post
Share on other sites

Dziękuję za odpowiedź, to już sprawdzałem. Tak jak wcześniej wspominałem, problemem jest to, że presta zaokrągla tylko do drugiej cyfry po przecinku. W tym przykładzie 1.365 po zaokrągleniu powinno być na fakturze 1,37 a jest 1,36

Share this post


Link to post
Share on other sites

Spróbuj w classes/Tools.php wiersz 1765
zmienić z

    /**
     * returns the rounded value of $value to specified precision, according to your configuration;
     *
     * @note : PHP 5.3.0 introduce a 3rd parameter mode in round function
     *
     * @param float $value
     * @param int $precision
     * @return float
     */
    public static function ps_round($value, $precision = 0, $round_mode = null)
    {
        if ($round_mode === null) {
            if (Tools::$round_mode == null) {
                Tools::$round_mode = (int)Configuration::get('PS_PRICE_ROUND_MODE');
            }
            $round_mode = Tools::$round_mode;
        }
        switch ($round_mode) {
            case PS_ROUND_UP:
                return Tools::ceilf($value, $precision);
            case PS_ROUND_DOWN:
                return Tools::floorf($value, $precision);
            case PS_ROUND_HALF_DOWN:
            case PS_ROUND_HALF_EVEN:
            case PS_ROUND_HALF_ODD:
                return Tools::math_round($value, $precision, $round_mode);
            case PS_ROUND_HALF_UP:
            default:
                return Tools::math_round($value, $precision, PS_ROUND_HALF_UP);
        }
    }

Na:
 

    /**
     * returns the rounded value of $value to specified precision, according to your configuration;
     *
     * @note : PHP 5.3.0 introduce a 3rd parameter mode in round function
     *
     * @param float $value
     * @param int $precision
     * @return float
     */
    public static function ps_round($value, $precision = 0, $round_mode = null)
    {
        if ($round_mode === null) {
            if (Tools::$round_mode == null) {
                Tools::$round_mode = (int)Configuration::get('PS_PRICE_ROUND_MODE');
            }
            $round_mode = Tools::$round_mode;
        }
        switch ($round_mode) {
            case PS_ROUND_UP:
                return Tools::ceilf($value, $precision);
            case PS_ROUND_DOWN:
                return Tools::floorf($value, $precision);
            case PS_ROUND_HALF_DOWN:
                return round($value, $precision, PHP_ROUND_HALF_DOWN);
            case PS_ROUND_HALF_EVEN:
            case PS_ROUND_HALF_ODD:
                return Tools::math_round($value, $precision, $round_mode);
            case PS_ROUND_HALF_UP:
                return round($value, $precision, PHP_ROUND_HALF_UP);
            default:
                return round($value, $precision, PHP_ROUND_HALF_UP);
        }
    }

 

Share this post


Link to post
Share on other sites
Class 'Tools' not found in /home/admin/domains/xxx/public_html/config/config.inc.php on line 80\n'

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More