Ignore:
Timestamp:
2013/03/09 18:44:36 (11 years ago)
Author:
maeken
Message:

商品登録(編集)で税情報テーブルへの読み書き対応

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/camp/camp-2_13-tax/data/class/helper/SC_Helper_TaxRule.php

    r22628 r22638  
    134134        $objQuery->setOrder($order); 
    135135        $arrData = $objQuery->select('*', $table, $where, $arrVal); 
     136        print_r($arrData); 
    136137        // 日付や条件でこねて選択は、作り中。取りあえずスタブ的にデフォルトを返却 
    137138        return $arrData[0]; 
    138139    } 
    139140 
    140  
     141    /** 
     142     * 税金設定情報を登録する(商品管理用) 
     143     * 
     144     * @param 
     145     * @return 
     146     */ 
     147    function setTaxRuleForProduct($tax_rate, $tax_adjust=0, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) 
     148    { 
     149        // デフォルトの設定取得 
     150        $arrRet = SC_Helper_TaxRule_Ex::getTaxRule(); 
     151        // 税情報を設定 
     152        SC_Helper_TaxRule_Ex::setTaxRule($arrRet['calc_rule'], 
     153                                         $tax_rate, 
     154                                         $arrRet['apply_date'], 
     155                                         $tax_adjust, 
     156                                         $product_id, 
     157                                         $product_class_id, 
     158                                         $pref_id, 
     159                                         $country_id); 
     160    } 
     161 
     162    /** 
     163     * 税金設定情報を登録する(仮) 
     164     * 
     165     * @param 
     166     * @return 
     167     */ 
     168    function setTaxRule($calc_rule, $tax_rate, $apply_date, $tax_adjust=0, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) 
     169    { 
     170        // デフォルトの設定とtax_rateの値が同じ場合は登録しない 
     171        $arrRet = SC_Helper_TaxRule_Ex::getTaxRule(); 
     172        if( $arrRet['tax_rate'] == $tax_rate ) { 
     173            return; 
     174        } 
     175        // 税情報を設定 
     176        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
     177        $table = 'dtb_tax_rule'; 
     178        $arrValues = array(); 
     179        // todo idを計算して設定する必要あり 
     180        $arrValues['tax_rule_id'] = 1; 
     181        $arrValues['country_id'] = $country_id; 
     182        $arrValues['pref_id'] = $pref_id; 
     183        $arrValues['product_id'] = $product_id; 
     184        $arrValues['product_class_id'] = $product_class_id; 
     185        $arrValues['calc_rule'] = $calc_rule; 
     186        $arrValues['tax_rate'] = $tax_rate; 
     187        $arrValues['tax_adjust'] = $tax_adjust; 
     188        $arrValues['apply_date'] = $apply_date; 
     189        $arrValues['create_date'] = 'CURRENT_TIMESTAMP'; 
     190        $arrValues['update_date'] = 'CURRENT_TIMESTAMP'; 
     191         
     192        $objQuery->insert($table, $arrValues); 
     193    } 
     194     
     195     
    141196    function getTaxRuleList($has_disable = false) 
    142197    { 
Note: See TracChangeset for help on using the changeset viewer.