Changeset 22653
- Timestamp:
- 2013/03/09 22:31:08 (11 years ago)
- Location:
- branches/camp/camp-2_13-tax/data/class
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/camp/camp-2_13-tax/data/class/helper/SC_Helper_TaxRule.php
r22644 r22653 135 135 $arrData = $objQuery->select('*', $table, $where, $arrVal); 136 136 // 日付や条件でこねて選択は、作り中。取りあえずスタブ的にデフォルトを返却 137 return $arrData[0]; 137 // 一旦配列の最後の項目を返すように変更 138 // return $arrData[0]; 139 return $arrData[count($arrData)-1]; 138 140 } 139 141 … … 144 146 * @return 145 147 */ 146 function setTaxRuleForProduct($tax_rate, $tax_adjust=0, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) 147 { 148 // デフォルトの設定取得 149 $arrRet = SC_Helper_TaxRule_Ex::getTaxRule(); 148 function setTaxRuleForProduct($tax_rate, $product_id = 0, $product_class_id = 0, $tax_adjust=0, $pref_id = 0, $country_id = 0) 149 { 150 150 // 税情報を設定 151 SC_Helper_TaxRule_Ex::setTaxRule($arrRet['calc_rule'], 152 $tax_rate, 153 $arrRet['apply_date'], 151 SC_Helper_TaxRule_Ex::setTaxRule($tax_rate, 154 152 $tax_adjust, 155 153 $product_id, … … 160 158 161 159 /** 162 * 税金設定情報を登録する(仮) 160 * 税金設定情報を登録する(仮)リファクタする(memo:規格設定後に商品編集を行うと消費税が0になるのを対応が必要) 163 161 * 164 162 * @param 165 163 * @return 166 164 */ 167 function setTaxRule($ calc_rule, $tax_rate, $apply_date, $tax_adjust=0, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0)165 function setTaxRule($tax_rate, $tax_adjust=0, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) 168 166 { 169 167 // デフォルトの設定とtax_rateの値が同じ場合は登録しない … … 172 170 return; 173 171 } 174 // 税情報を設定 175 $objQuery =& SC_Query_Ex::getSingletonInstance(); 176 $table = 'dtb_tax_rule'; 177 $arrValues = array(); 178 // todo idを計算して設定する必要あり 179 $arrValues['tax_rule_id'] = 1; 180 $arrValues['country_id'] = $country_id; 181 $arrValues['pref_id'] = $pref_id; 182 $arrValues['product_id'] = $product_id; 183 $arrValues['product_class_id'] = $product_class_id; 184 $arrValues['calc_rule'] = $calc_rule; 185 $arrValues['tax_rate'] = $tax_rate; 186 $arrValues['tax_adjust'] = $tax_adjust; 187 $arrValues['apply_date'] = $apply_date; 188 $arrValues['create_date'] = 'CURRENT_TIMESTAMP'; 189 $arrValues['update_date'] = 'CURRENT_TIMESTAMP'; 172 // 新規か更新か? 173 $objQuery =& SC_Query_Ex::getSingletonInstance(); 174 $where = 'product_id=? and product_class_id=? and pref_id=? and country_id=?'; 175 $arrVal = array($product_id, $product_class_id, $pref_id, $country_id); 176 $arrCheck = $objQuery->select('*', 'dtb_tax_rule', $where, $arrVal); 190 177 191 $objQuery->insert($table, $arrValues); 178 if(empty($arrCheck)) { 179 // 税情報を新規 180 $table = 'dtb_tax_rule'; 181 $arrValues = array(); 182 // todo idを計算して設定する必要あり(nextvalに変更?) 183 $arrTaxruleid = $objQuery->select('max(tax_rule_id)', 'dtb_tax_rule'); 184 $arrValues['tax_rule_id'] = $arrTaxruleid[0]['max(tax_rule_id)']+1; 185 $arrValues['country_id'] = $country_id; 186 $arrValues['pref_id'] = $pref_id; 187 $arrValues['product_id'] = $product_id; 188 $arrValues['product_class_id'] = $product_class_id; 189 $arrValues['calc_rule'] = $arrRet['calc_rule']; 190 $arrValues['tax_rate'] = $tax_rate; 191 $arrValues['tax_adjust'] = $tax_adjust; 192 $arrValues['apply_date'] = $arrRet['apply_date']; 193 $arrValues['create_date'] = 'CURRENT_TIMESTAMP'; 194 $arrValues['update_date'] = 'CURRENT_TIMESTAMP'; 195 196 $objQuery->insert($table, $arrValues); 197 } else { 198 // 税情報を更新 199 $objQuery->update('dtb_tax_rule', array('tax_rate' => $tax_rate), $where, $arrVal); 200 } 192 201 } 193 202 -
branches/camp/camp-2_13-tax/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
r22638 r22653 1142 1142 1143 1143 // 税情報設定 1144 SC_Helper_TaxRule_Ex::setTaxRuleForProduct($arrList['tax_rate'], 0,$arrList['product_id'], $arrList['product_class_id']);1144 SC_Helper_TaxRule_Ex::setTaxRuleForProduct($arrList['tax_rate'], $arrList['product_id'], $arrList['product_class_id']); 1145 1145 1146 1146 // 関連商品登録 -
branches/camp/camp-2_13-tax/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php
r22567 r22653 217 217 $objFormParam->addParam(NORMAL_PRICE_TITLE, 'price01', PRICE_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); 218 218 $objFormParam->addParam(SALE_PRICE_TITLE, 'price02', PRICE_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); 219 $objFormParam->addParam('消費税率', 'tax_rate', PERCENTAGE_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); 219 220 $objFormParam->addParam('商品種別', 'product_type_id', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); 220 221 $objFormParam->addParam('削除フラグ', 'del_flg', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); … … 294 295 295 296 $objQuery->insert('dtb_products_class', $arrPC); 297 298 // 税情報登録/更新 299 SC_Helper_TaxRule_Ex::setTaxRuleForProduct($arrList['tax_rate'][$i], $arrPC['product_id'], $arrPC['product_class_id']); 296 300 } 297 301 … … 361 365 ) { 362 366 $arrErr['stock'][$i] = '※ 在庫数が入力されていません。<br />'; 367 } 368 /* 369 * 消費税率の必須チェック 370 */ 371 if (SC_Utils_Ex::isBlank($arrValues['tax_rate'][$i])) 372 { 373 $arrErr['tax_rate'][$i] = '※ 消費税率が入力されていません。<br />'; 363 374 } 364 375 /* … … 482 493 'classcategory_name1', 'classcategory_name2', 'stock', 483 494 'stock_unlimited', 'price01', 'price02', 484 'product_type_id', 'down_filename', 'down_realfilename', 'upload_index', 495 'product_type_id', 'down_filename', 'down_realfilename', 'upload_index', 'tax_rate' 485 496 ); 486 497 $arrFormValues = $objFormParam->getSwapArray($arrKeys); … … 506 517 $arrValues['del_flg'] = '0'; 507 518 } 519 // 消費税率を設定 520 $arrRet = SC_Helper_TaxRule_Ex::getTaxRule($arrValues['product_id'], $arrValues['product_class_id']); 521 $arrValues['tax_rate'] = $arrRet['tax_rate']; 522 508 523 $arrMergeProductsClass[] = $arrValues; 509 524 }
Note: See TracChangeset
for help on using the changeset viewer.