Created
September 2, 2012 16:16
-
-
Save nanasess/3601035 to your computer and use it in GitHub Desktop.
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
=== modified file 'data/class/SC_Fpdf.php' | |
--- data/class/SC_Fpdf.php 2012-06-19 18:01:38.000000000 +0900 | |
+++ data/class/SC_Fpdf.php 2012-09-03 01:13:31.000000000 +0900 | |
@@ -39,7 +39,7 @@ | |
$this->tpl_dispmode = 'real'; // 表示モード | |
$masterData = new SC_DB_MasterData_Ex(); | |
$this->arrPref = $masterData->getMasterData('mtb_pref'); | |
- $this->width_cell = array(110.3,12,21.7,24.5); | |
+ $this->width_cell = array(115.3,12,21.7,22.5); | |
$this->label_cell[] = '商品名 / 商品コード / [ 規格 ]'; | |
$this->label_cell[] = '数量'; | |
@@ -63,7 +63,7 @@ | |
$this->SetMargins(15, 20); | |
// PDFを読み込んでページ数を取得 | |
- $this->pageno = $this->setSourceFile($this->tpl_pdf); | |
+ $pageno = $this->setSourceFile($this->tpl_pdf); | |
} | |
function setData($arrData) { | |
@@ -80,6 +80,7 @@ | |
if (SC_Utils_Ex::sfIsInt($arrData['order_id'])) { | |
$this->disp_mode = true; | |
+ $order_id = $arrData['order_id']; | |
} | |
// テンプレート内容の位置、幅を調整 ※useTemplateに引数を与えなければ100%表示がデフォルト | |
@@ -95,86 +96,153 @@ | |
function setShopData() { | |
// ショップ情報 | |
- $objDb = new SC_Helper_DB_Ex(); | |
- $arrInfo = $objDb->sfGetBasisData(); | |
+ $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); | |
- // ショップ名 | |
- $this->lfText(125, 60, $arrInfo['shop_name'], 8, 'B'); | |
- // URL | |
- $this->lfText(125, 63, $arrInfo['law_url'], 8); | |
- // 会社名 | |
- $this->lfText(125, 68, $arrInfo['law_company'], 8); | |
- // 郵便番号 | |
- $text = '〒 ' . $arrInfo['law_zip01'] . ' - ' . $arrInfo['law_zip02']; | |
- $this->lfText(125, 71, $text, 8); | |
- // 都道府県+所在地 | |
- $text = $this->arrPref[$arrInfo['law_pref']] . $arrInfo['law_addr01']; | |
- $this->lfText(125, 74, $text, 8); | |
- $this->lfText(125, 77, $arrInfo['law_addr02'], 8); | |
+ $this->lfText(125, 15, $arrInfo['shop_name'], 8, 'B'); //ショップ名 | |
+ $this->lfText(125, 18, $arrInfo['law_url'], 8); //URL | |
+ $this->lfText(125, 23, $arrInfo['law_company'], 8); //会社名 | |
+ $text = "〒 ".$arrInfo['law_zip01']." - ".$arrInfo['law_zip02']; | |
+ $this->lfText(125, 26, $text, 8); //郵便番号 | |
+ $text = $this->arrPref[$arrInfo['law_pref']].$arrInfo['law_addr01']; | |
+ $this->lfText(125, 29, $text, 8); //都道府県+住所1 | |
+ $this->lfText(125, 32, $arrInfo['law_addr02'], 8); //住所2 | |
- $text = 'TEL: '.$arrInfo['law_tel01'].'-'.$arrInfo['law_tel02'].'-'.$arrInfo['law_tel03']; | |
+ $text = "TEL: ".$arrInfo['law_tel01']."-".$arrInfo['law_tel02']."-".$arrInfo['law_tel03']; | |
//FAX番号が存在する場合、表示する | |
if (strlen($arrInfo['law_fax01']) > 0) { | |
- $text .= ' FAX: '.$arrInfo['law_fax01'].'-'.$arrInfo['law_fax02'].'-'.$arrInfo['law_fax03']; | |
+ $text .= " FAX: ".$arrInfo['law_fax01']."-".$arrInfo['law_fax02']."-".$arrInfo['law_fax03']; | |
} | |
- $this->lfText(125, 80, $text, 8); //TEL・FAX | |
+ $this->lfText(125, 36, $text, 8); //TEL・FAX | |
- if (strlen($arrInfo['law_email']) > 0) { | |
- $text = 'Email: '.$arrInfo['law_email']; | |
- $this->lfText(125, 83, $text, 8); //Email | |
+ if ( strlen($arrInfo['law_email']) > 0 ) { | |
+ $text = "Email: ".$arrInfo['law_email']; | |
+ $this->lfText(125, 39, $text, 8); //Email | |
} | |
//ロゴ画像 | |
- $logo_file = PDF_TEMPLATE_REALDIR . 'logo.png'; | |
- $this->Image($logo_file, 124, 46, 40); | |
+// $logo_file = PDF_TEMPLATE_REALDIR . 'logo.png'; | |
+// $this->Image($logo_file, 124, 46, 40); | |
} | |
function setMessageData() { | |
// メッセージ | |
- $this->lfText(27, 70, $this->arrData['msg1'], 8); //メッセージ1 | |
- $this->lfText(27, 74, $this->arrData['msg2'], 8); //メッセージ2 | |
- $this->lfText(27, 78, $this->arrData['msg3'], 8); //メッセージ3 | |
- $text = '作成日: '.$this->arrData['year'].'年'.$this->arrData['month'].'月'.$this->arrData['day'].'日'; | |
- $this->lfText(158, 288, $text, 8); //作成日 | |
+ $this->lfText(23, 35, $this->arrData['msg1'], 9); //メッセージ1 | |
+ $this->lfText(23, 39, $this->arrData['msg2'], 9); //メッセージ2 | |
+ $this->lfText(23, 43, $this->arrData['msg3'], 9); //メッセージ3 | |
+ $text = "作成日: ".$this->arrData['year']."年".$this->arrData['month']."月".$this->arrData['day']."日"; | |
+ $this->lfText(130, 288, $text, 8); //作成日 | |
} | |
function setOrderData() { | |
- $arrOrder = array(); | |
// DBから受注情報を読み込む | |
$this->lfGetOrderData($this->arrData['order_id']); | |
+ //納品書タイトル | |
+ $this->SetFont('', 'B', 10); | |
+ $this->Cell(0, -15, $this->tpl_title, 0, 2, 'a', 0, ''); //文書タイトル(納品書・請求書) | |
+ $this->Cell(0, 45, '', 0, 2, 'R', 0, ''); | |
+ $this->Cell(5, 0, '', 0, 0, 'R', 0, ''); | |
+ | |
+ | |
// 購入者情報 | |
- $text = '〒 '.$this->arrDisp['order_zip01'].' - '.$this->arrDisp['order_zip02']; | |
- $this->lfText(23, 43, $text, 10); //購入者郵便番号 | |
- $text = $this->arrPref[$this->arrDisp['order_pref']] . $this->arrDisp['order_addr01']; | |
- $this->lfText(27, 47, $text, 10); //購入者都道府県+住所1 | |
- $this->lfText(27, 51, $this->arrDisp['order_addr02'], 10); //購入者住所2 | |
- $text = $this->arrDisp['order_name01'].' '.$this->arrDisp['order_name02'].' 様'; | |
- $this->lfText(27, 59, $text, 11); //購入者氏名 | |
+ $text = $this->arrDisp['order_kana01']." ".$this->arrDisp['order_kana02']; | |
+ $this->lfText(18, 20, $text, 8); //購入者フリガナ(会社名) | |
+ $text = $this->arrDisp['order_name01']." ".$this->arrDisp['order_name02']." 様"; | |
+ $this->lfText(18, 25, $text, 10); //購入者氏名 | |
+ | |
+ | |
// お届け先情報 | |
- $this->SetFont('SJIS', '', 10); | |
- $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 | |
- $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 | |
- | |
- $this->SetFont('Gothic', 'B', 15); | |
- $this->Cell(0, 10, $this->tpl_title, 0, 2, 'C', 0, ''); //文書タイトル(納品書・請求書) | |
- $this->Cell(0, 66, '', 0, 2, 'R', 0, ''); | |
- $this->Cell(5, 0, '', 0, 0, 'R', 0, ''); | |
- $this->SetFont('SJIS', 'B', 15); | |
- $this->Cell(67, 8, number_format($this->arrDisp['payment_total']).' 円', 0, 2, 'R', 0, ''); | |
- $this->Cell(0, 45, '', 0, 2, '', 0, ''); | |
+ $this->SetFontSize(10); | |
+// $this->lfText(25, 94, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 | |
+// $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 | |
+ | |
+ // 届先情報 <ここから> | |
+ $objShip = new SC_Helper_Purchase_Ex(); | |
+ $this->arrShip = $objShip->getShippings($this->arrDisp['order_id']); | |
+ | |
+ $y = 76; // お届け先開始y軸位置 | |
+ | |
+ $count = count($this->arrShip); | |
+ $i = 0; // 配列のindex | |
+ $j = 0; // 届け先取り出し数 | |
+ | |
+ do { | |
+ if ($j == $count) { | |
+ break; | |
+ } | |
+ if ($this->arrShip[$i]['shipping_id'] != "") { | |
+ $y += $j * 4 * 3; // 届け先 * 高さ * 要素数 | |
+ | |
+ | |
+ $y += 4; | |
+ $text = "〒". $this->arrShip[$i]['shipping_zip01']. "-" . $this->arrShip[$i]['shipping_zip02']; | |
+ $this->lfText(20, $y, $text, 9); | |
+ | |
+ | |
+ $y += 4; | |
+ $text = $this->arrShip[$i]['shipping_addr01'].$this->arrShip[$i]['shipping_addr02']; | |
+ $this->lfText(20, $y, $text, 9); | |
+ | |
+ $y += 4; | |
+ $text = "TEL:" . $this->arrShip[$i]['shipping_tel01']. "-" . $this->arrShip[$i]['shipping_tel02']. "-" . $this->arrShip[$i]['shipping_tel03']; | |
+ $this->lfText(20, $y+1, $text, 11); | |
+ | |
+ $y += 4; | |
+ $text = $this->arrShip[$i]['shipping_name01']. " " .$this->arrShip[$i]['shipping_name02'] . " 様"; | |
+ $this->lfText(20, $y+2, $text, 9); | |
+ | |
+ $y += 4; | |
+ $text = "【お届け時間】:".$this->arrShip[$i]['shipping_time'] ." " .substr($this->arrShip[$i]["shipping_date"],5,2) . "/" . substr($this->arrShip[$i]["shipping_date"],8,2); | |
+ $this->lfText(130, 90, $text, 9); | |
+ | |
+ | |
+ $j += 1; | |
+ } | |
+ | |
+ $i += 1; | |
+ } while (true); | |
+ // <ここまで> | |
+ | |
+ $text = "【ご注文日】:".SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']); | |
+ $this->lfText(130, 75, $text, 9); //ご注文日 | |
+ | |
+ $text = "【注文番号】:".$this->arrDisp['order_id']; | |
+ $this->lfText(130, 80, $text, 9); //注文番号 | |
+ | |
+ $text = "【支払方法】:".$this->arrDisp['payment_method']; | |
+ $this->lfText(130, 85, $text, 9); //お支払方法 | |
+ | |
+ $text = "【お客様のご要望】:".$this->arrDisp['message']; | |
+ $size=65; | |
+ for($i=0;$i<=mb_strlen($text,"utf-8")/$size;$i++){$result=mb_substr($text,$i*$size,$size,"utf-8")."\r\n"; | |
+ $this->lfText(15, 100+($i*3), $result, 8); | |
+} | |
+ $text =$this->arrDisp['note']; | |
+ $size=65; | |
+ for($i=0;$i<=mb_strlen($text,"utf-8")/$size;$i++){$result=mb_substr($text,$i*$size,$size,"utf-8")."\r\n"; | |
+ $this->lfText(15, 106+($i*3), $result, 8); | |
+} | |
+ | |
+ | |
- $this->SetFont('SJIS', '', 8); | |
+ $this->SetFont('', 'B', 15); | |
+ $this->Cell(60, 10, number_format($this->arrDisp['payment_total'])." 円", 0, 2, 'R', 0, '');//総合金額 | |
+ $this->Cell(0, 50, '', 0, 2, '', 0, ''); //商品ブロックの位置情報 | |
- $monetary_unit = '円'; | |
+ $this->SetFontSize(8); | |
+ | |
+ $monetary_unit = "円"; | |
$point_unit = 'Pt'; | |
+ $kosu = 0; | |
+ | |
// 購入商品情報 | |
for ($i = 0; $i < count($this->arrDisp['quantity']); $i++) { | |
// 購入数量 | |
$data[0] = $this->arrDisp['quantity'][$i]; | |
+ $kosu = $kosu+$this->arrDisp['quantity'][$i]; | |
// 税込金額(単価) | |
$data[1] = SC_Helper_DB_Ex::sfCalcIncTax($this->arrDisp['price'][$i]); | |
@@ -205,7 +273,7 @@ | |
$i++; | |
$arrOrder[$i][0] = ''; | |
- $arrOrder[$i][1] = ''; | |
+ $arrOrder[$i][1] = $kosu; | |
$arrOrder[$i][2] = '商品合計'; | |
$arrOrder[$i][3] = number_format($this->arrDisp['subtotal']).$monetary_unit; | |
@@ -258,12 +326,12 @@ | |
} | |
function setEtcData() { | |
- $this->Cell(0, 10, '', 0, 1, 'C', 0, ''); | |
- $this->SetFont('Gothic', 'B', 9); | |
- $this->MultiCell(0, 6, '< 備 考 >', 'T', 2, 'L', 0, ''); //備考 | |
+/* $this->Cell(0, 10, '', 0, 1, 'C', 0, ''); | |
+ $this->SetFontSize(9); | |
+ $this->MultiCell(0, 6, "< 備 考 >", 'T', 2, 'L', 0, ''); //備考 | |
$this->Ln(); | |
- $this->SetFont('SJIS', '', 8); | |
- $this->MultiCell(0, 4, $this->arrData['etc1']."\n".$this->arrData['etc2']."\n".$this->arrData['etc3'], '', 2, 'L', 0, ''); //備考 | |
+ $this->SetFontSize(8); | |
+ $this->MultiCell(0, 4, $this->arrData['etc1']."\n".$this->arrData['etc2']."\n".$this->arrData['etc3'], '', 2, 'L', 0, ''); //備考*/ | |
} | |
function createPdf() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://daihachi.sub.jp/archives/555 の 2.12 向けパッチ