Changeset 17862 for branches/comu-ver2/data/class/util/SC_Utils.php
- Timestamp:
- 2009/03/03 21:15:46 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/util/SC_Utils.php
r17605 r17862 629 629 630 630 /* 税金計算 */ 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 632 649 $real_tax = $tax / 100; 633 650 $ret = $price * $real_tax; … … 654 671 655 672 /* 税金付与 */ 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); 679 675 } 680 676
Note: See TracChangeset
for help on using the changeset viewer.