Ignore:
Timestamp:
2009/03/03 21:15:46 (15 years ago)
Author:
Seasoft
Message:

・SC_Utils::sfPreTax() の税額計算で SC_Utils_Ex::sfTax() を利用するように改訂。
・SC_Utils::sfTax() の第2、第3パラメータを省略可能に改訂。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/util/SC_Utils.php

    r17605 r17862  
    629629 
    630630    /* 税金計算 */ 
    631     function sfTax($price, $tax, $tax_rule) { 
     631    function sfTax($price, $tax = null, $tax_rule = null) { 
     632        // 店舗基本情報を取得 
     633        static $CONF; 
     634        if ( 
     635               is_null($CONF) 
     636            && (is_null($tax) || is_null($tax_rule)) 
     637        ) { 
     638            $CONF = SC_Helper_DB_Ex::sf_getBasisData(); 
     639        } 
     640         
     641        if (is_null($tax)) { 
     642            $tax = $CONF['tax']; 
     643        } 
     644         
     645        if (is_null($tax_rule)) { 
     646            $tax_rule = $CONF['tax_rule']; 
     647        } 
     648         
    632649        $real_tax = $tax / 100; 
    633650        $ret = $price * $real_tax; 
     
    654671 
    655672    /* 税金付与 */ 
    656     function sfPreTax($price, $tax, $tax_rule) { 
    657         $real_tax = $tax / 100; 
    658         $ret = $price * (1 + $real_tax); 
    659  
    660         switch($tax_rule) { 
    661         // 四捨五入 
    662         case 1: 
    663             $ret = round($ret); 
    664             break; 
    665         // 切り捨て 
    666         case 2: 
    667             $ret = floor($ret); 
    668             break; 
    669         // 切り上げ 
    670         case 3: 
    671             $ret = ceil($ret); 
    672             break; 
    673         // デフォルト:切り上げ 
    674         default: 
    675             $ret = ceil($ret); 
    676             break; 
    677         } 
    678         return $ret; 
     673    function sfPreTax($price, $tax = null, $tax_rule = null) { 
     674        return $price + SC_Utils_Ex::sfTax($price, $tax, $tax_rule); 
    679675    } 
    680676 
Note: See TracChangeset for help on using the changeset viewer.