Changeset 18609 for tmp/version-2_5-test/data/class/SC_Fpdf.php
- Timestamp:
- 2010/03/11 10:35:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tmp/version-2_5-test/data/class/SC_Fpdf.php
r18562 r18609 28 28 */ 29 29 30 require(DATA_PATH . ' module/pdf/japanese.php');31 define('PDF_ IMG_DIR', HTML_PATH. USER_DIR. USER_PACKAGE_DIR. TEMPLATE_NAME. '/img/pdf/');30 require(DATA_PATH . 'pdf/japanese.php'); 31 define('PDF_TEMPLATE_DIR', DATA_PATH . 'pdf/'); 32 32 33 33 class SC_Fpdf { 34 34 function SC_Fpdf($download, $title, $tpl_pdf = "template_nouhin01.pdf") { 35 $this->arrData = $arrData;36 35 // デフォルトの設定 37 $this->tpl_pdf = PDF_ DIR . $tpl_pdf; // テンプレートファイル36 $this->tpl_pdf = PDF_TEMPLATE_DIR . $tpl_pdf; // テンプレートファイル 38 37 $this->pdf_download = $download; // PDFのダウンロード形式(0:表示、1:ダウンロード) 39 38 $this->tpl_title = $title; … … 49 48 50 49 $this->arrMessage = array( 51 'このたびはお買上げいただきありがとうございます。',52 '下記の内容にて納品させていただきます。',53 'ご確認いただきますよう、お願いいたします。'50 'このたびはお買上げいただきありがとうございます。', 51 '下記の内容にて納品させていただきます。', 52 'ご確認いただきますよう、お願いいたします。' 54 53 ); 55 54 … … 69 68 } 70 69 71 72 70 function setData($arrData) { 73 71 $this->arrData = $arrData; … … 82 80 $this->pdf->SetDisplayMode($this->tpl_dispmode); 83 81 84 if (SC_Utils_Ex::sfIsInt($arrData['order_id'])) {85 $this->disp_mode = true;86 $order_id = $arrData['order_id'];82 if (SC_Utils_Ex::sfIsInt($arrData['order_id'])) { 83 $this->disp_mode = true; 84 $order_id = $arrData['order_id']; 87 85 } 88 86 … … 113 111 114 112 $text = "TEL: ".$arrInfo['law_tel01']."-".$arrInfo['law_tel02']."-".$arrInfo['law_tel03']; 115 if ( strlen($arrInfo['law_fax01']) > 0 && strlen($arrInfo['law_fax02']) > 0 && strlen($arrInfo['law_fax03']) > 0 ) { 113 //FAX番号が存在する場合、表示する 114 if (strlen($arrInfo['law_fax01']) > 0) { 116 115 $text .= " FAX: ".$arrInfo['law_fax01']."-".$arrInfo['law_fax02']."-".$arrInfo['law_fax03']; 117 116 } … … 124 123 125 124 //ロゴ画像 126 $logo_file = PDF_ IMG_DIR . 'logo.png';125 $logo_file = PDF_TEMPLATE_DIR . 'logo.png'; 127 126 $this->pdf->Image($logo_file, 124, 46, 40); 128 127 } … … 138 137 139 138 function setOrderData() { 140 // ショップ情報141 $objInfo = new SC_SiteInfo();142 $arrInfo = $objInfo->data;143 139 // DBから受注情報を読み込む 144 140 $this->lfGetOrderData($this->arrData['order_id']); … … 176 172 177 173 $monetary_unit = $this->sjis_conv("円"); 178 $point_unit = $this->sjis_conv(" pt");174 $point_unit = $this->sjis_conv("Pt"); 179 175 180 176 // 購入商品情報 181 177 for ($i = 0; $i < count($this->arrDisp['quantity']); $i++) { 182 178 183 // 購入数量 184 $data[0] = $this->arrDisp['quantity'][$i]; 185 186 // 税込金額(単価) 187 $data[1] = SC_Utils_Ex::sfPreTax($this->arrDisp['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']); 188 189 // 小計(商品毎) 190 $data[2] = $data[0] * $data[1]; 191 192 $arrOrder[$i][0] = $this->sjis_conv($this->arrDisp['product_name'][$i]." / "); 193 $arrOrder[$i][0] .= $this->sjis_conv($this->arrDisp['product_code'][$i]." / "); 194 if($this->arrDisp['classcategory_name1'][$i]) { 195 $arrOrder[$i][0] .= $this->sjis_conv(" [ ".$this->arrDisp['classcategory_name1'][$i]); 196 if($this->arrDisp['classcategory_name2'][$i] == "") { 197 $arrOrder[$i][0] .= " ]"; 198 } else { 199 $arrOrder[$i][0] .= $this->sjis_conv(" * ".$this->arrDisp['classcategory_name2'][$i]." ]"); 179 // 購入数量 180 $data[0] = $this->arrDisp['quantity'][$i]; 181 182 // 税込金額(単価) 183 $data[1] = SC_Helper_DB_Ex::sfPreTax($this->arrDisp['price'][$i]); 184 185 // 小計(商品毎) 186 $data[2] = $data[0] * $data[1]; 187 188 $arrOrder[$i][0] = $this->sjis_conv($this->arrDisp['product_name'][$i]." / "); 189 $arrOrder[$i][0] .= $this->sjis_conv($this->arrDisp['product_code'][$i]." / "); 190 if ($this->arrDisp['classcategory_name1'][$i]) { 191 $arrOrder[$i][0] .= $this->sjis_conv(" [ ".$this->arrDisp['classcategory_name1'][$i]); 192 if ($this->arrDisp['classcategory_name2'][$i] == "") { 193 $arrOrder[$i][0] .= " ]"; 194 } else { 195 $arrOrder[$i][0] .= $this->sjis_conv(" * ".$this->arrDisp['classcategory_name2'][$i]." ]"); 196 } 200 197 } 201 } 202 $arrOrder[$i][1] = number_format($data[0]); 203 $arrOrder[$i][2] = number_format($data[1]).$monetary_unit; 204 $arrOrder[$i][3] = number_format($data[2]).$monetary_unit; 198 $arrOrder[$i][1] = number_format($data[0]); 199 $arrOrder[$i][2] = number_format($data[1]).$monetary_unit; 200 $arrOrder[$i][3] = number_format($data[2]).$monetary_unit; 205 201 206 202 } … … 241 237 $arrOrder[$i][3] = number_format($this->arrDisp['payment_total']).$monetary_unit; 242 238 243 $i++;244 $arrOrder[$i][0] = "";245 $arrOrder[$i][1] = "";246 $arrOrder[$i][2] = "";247 $arrOrder[$i][3] = "";248 249 239 // ポイント表記 250 240 if ($this->arrData['disp_point'] && $this->arrDisp['customer_id']) { 251 $i++; 252 $arrOrder[$i][0] = ""; 253 $arrOrder[$i][1] = ""; 254 $arrOrder[$i][2] = $this->sjis_conv("利用ポイント"); 255 $arrOrder[$i][3] = number_format($this->arrDisp['use_point']).$point_unit; 256 257 $i++; 258 $arrOrder[$i][0] = ""; 259 $arrOrder[$i][1] = ""; 260 $arrOrder[$i][2] = $this->sjis_conv("加算ポイント"); 261 $arrOrder[$i][3] = number_format($this->arrDisp['add_point']).$point_unit; 262 263 $i++; 264 $arrOrder[$i][0] = ""; 265 $arrOrder[$i][1] = ""; 266 $arrOrder[$i][2] = $this->sjis_conv("所有ポイント"); 267 $arrOrder[$i][3] = number_format($this->arrDisp['point']).$point_unit; 241 $i++; 242 $arrOrder[$i][0] = ""; 243 $arrOrder[$i][1] = ""; 244 $arrOrder[$i][2] = ""; 245 $arrOrder[$i][3] = ""; 246 247 $i++; 248 $arrOrder[$i][0] = ""; 249 $arrOrder[$i][1] = ""; 250 $arrOrder[$i][2] = $this->sjis_conv("利用ポイント"); 251 $arrOrder[$i][3] = number_format($this->arrDisp['use_point']).$point_unit; 252 253 $i++; 254 $arrOrder[$i][0] = ""; 255 $arrOrder[$i][1] = ""; 256 $arrOrder[$i][2] = $this->sjis_conv("加算ポイント"); 257 $arrOrder[$i][3] = number_format($this->arrDisp['add_point']).$point_unit; 258 259 $i++; 260 $arrOrder[$i][0] = ""; 261 $arrOrder[$i][1] = ""; 262 $arrOrder[$i][2] = $this->sjis_conv("所有ポイント"); 263 $arrOrder[$i][3] = number_format($this->arrDisp['point']).$point_unit; 268 264 } 269 265 … … 282 278 function createPdf() { 283 279 // PDFをブラウザに送信 284 ob_clean(); 285 if ($this->pdf->PageNo() == 1) { 286 $filename = "nouhinsyo-No".$this->arrData['order_id'].".pdf"; 287 } else { 288 $filename = "nouhinsyo.pdf"; 289 } 290 $this->pdf->Output($this->sjis_conv($filename), D); 280 ob_clean(); 281 if ($this->pdf_download == 1) { 282 if ($this->pdf->PageNo() == 1) { 283 $filename = "nouhinsyo-No".$this->arrData['order_id'].".pdf"; 284 } else { 285 $filename = "nouhinsyo.pdf"; 286 } 287 $this->pdf->Output($this->sjis_conv($filename), D); 288 } else { 289 $this->pdf->Output(); 290 } 291 291 292 292 // 入力してPDFファイルを閉じる … … 301 301 $this->pdf->Text($x, $y, $text); 302 302 } 303 304 303 305 304 // 受注データの取得 … … 310 309 $where = "order_id = ?"; 311 310 $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id)); 312 #$objFormParam->setParam($arrRet[0]);313 list($point, $total_point) = SC_Helper_DB_Ex::sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']);314 #$objFormParam->setValue('total_point', $total_point);315 #$objFormParam->setValue('point', $point);316 $arrRet[0]['total_point'] = $total_point;317 $arrRet[0]['point'] = $point;318 311 $this->arrDisp = $arrRet[0]; 312 list($point) = SC_Helper_DB_Ex::sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']); 313 $this->arrDisp['point'] = $point; 319 314 320 315 // 受注詳細データの取得 … … 338 333 // 受注詳細データの取得 339 334 function lfGetOrderDetail($order_id) { 340 $objQuery = new SC_Query();341 $col = "product_id, classcategory_id1, classcategory_id2, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";342 $where = "order_id = ?";343 $objQuery->setorder("classcategory_id1, classcategory_id2");344 $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));345 return $arrRet;335 $objQuery = new SC_Query(); 336 $col = "product_id, classcategory_id1, classcategory_id2, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate"; 337 $where = "order_id = ?"; 338 $objQuery->setorder("classcategory_id1, classcategory_id2"); 339 $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id)); 340 return $arrRet; 346 341 } 347 342 348 343 // 文字コードSJIS変換 -> japanese.phpで使用出来る文字コードはSJISのみ 349 344 function sjis_conv($conv_str) { 350 return (mb_convert_encoding($conv_str, "SJIS", CHAR_CODE)); 351 } 352 345 return (mb_convert_encoding($conv_str, "SJIS", CHAR_CODE)); 346 } 353 347 354 348 }
Note: See TracChangeset
for help on using the changeset viewer.