Changeset 18110
- Timestamp:
- 2009/06/15 17:51:40 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_4/data/class/util/SC_Utils.php
r17895 r18110 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 (is_null($CONF) && (is_null($tax) || is_null($tax_rule))) { 635 $CONF = SC_Helper_DB_Ex::sf_getBasisData(); 636 } 637 if (is_null($tax)) { 638 $tax = $CONF['tax']; 639 } 640 if (is_null($tax_rule)) { 641 $tax_rule = $CONF['tax_rule']; 642 } 643 632 644 $real_tax = $tax / 100; 633 645 $ret = $price * $real_tax; … … 654 666 655 667 /* 税金付与 */ 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; 668 function sfPreTax($price, $tax = null, $tax_rule = null) { 669 return $price + SC_Utils_Ex::sfTax($price, $tax, $tax_rule); 679 670 } 680 671
Note: See TracChangeset
for help on using the changeset viewer.