Created
July 27, 2012 03:07
-
-
Save yokotak0527/3185974 to your computer and use it in GitHub Desktop.
welcart 価格の配列を返すやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 使い方は | |
// $arr = priceArr(usces_the_firstPrice('return')); | |
// みたいな感じ。 | |
// 返り値は配列。 | |
// 管理画面で税率は必ず指定しておくこと! | |
function priceArr($price=0){ | |
global $usces; | |
$pos = $usces->options; | |
$tax = (100+$pos['tax_rate'])/100; | |
$taxMethod = $pos['tax_method']; | |
switch($taxMethod){ | |
case 'cutting' : // 切り下げ | |
$incTax = floor($price * $tax) >> 0; | |
break; | |
case 'bring' : // 切り上げ | |
$incTax = ceil($price * $tax) >> 0; | |
break; | |
case 'rounding' : // 四捨五入 | |
$incTax = round($price * $tax) >> 0; | |
break; | |
} | |
return array($price,$incTax,$taxMethod,$pos['tax_rate'],$tax); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment