帳票については、さらに機能を充実させたこちらもご覧ください。購入商品となっております。
ここでは、「見積書」を追加。
見積書の使い方としては下記のようなことが考えられる。
————————————–
・ 受注管理>受注登録で、注文者情報や商品等の登録を行うことで、受注管理>受注管理の検索一覧に表示される。
・ 帳票の出力で、見積書を選択してPDFファイルを作成し、お客様に提示する。
・ 受注登録した日が受注日として登録されるが、これがそのまま見積日として表示される。
・ 受注日は管理画面上で変更できない。変更したい場合は、データベースのdtb_orderテーブルのcreate_dateを修正するといい。
————————————–
1 マスターテーブルに追加
マスターテーブルを修正することで、帳票のタイトル変更が可能になる。
なお、タイトルは固定された枠の中に収める形となるので、枠の中央にタイトル名を配置したいときは、文字間に全角・半角のスペースを入れて調整する。
(1)■データベースに新しいテーブルを作成する
名前:mtb_fpdf
フィールド数:3
↓
○フィールド:id 種別:smallint インデックス:primary
○フィールド:name 種別:text NULL
○フィールド:rank 種別:smallint デフォルト値:0
(2)システム設定>マスターデータ管理でデータの登録
① mtb_fpdfを選択
② データを入力
—————————————
ID:0 値:選択してください
ID:1 値:お買上げ明細書(納品書)
ID:2 値: 見 積 書
—————————————
2 ■/data/class/pages/admin/order/LC_Page_Admin_Oder_Pdf.php
(1)27行目あたりの
require_once CLASS_REALDIR . ‘SC_Fpdf.php';の下に追加
require_once CLASS_REALDIR . 'SC_Fpdf_estimate.php';
(2)59行目あたりの
$this->arrType[0] = “納品書”;の下に追加
$this->arrType[1] = "見積書";
(3)64行目あたり、function init()メソッド内に追加
$masterData = new SC_DB_MasterData_Ex(); $this->arrTitle = $masterData->getMasterData('mtb_fpdf');
(4)124行目あたり、コメントアウトまたは削除
// タイトルをセット // $arrForm['title'] = "お買上げ明細書(納品書)";
(5)136行目あたりに追加
$arrForm['msg4'] = '下記の通り御見積申し上げます。'; $arrForm['msg5'] = ''; $arrForm['msg6'] = ''; $arrForm['msg7'] = ''; $arrForm['msg8'] = ''; $arrForm['msg9'] = '';
(6) function createPdf(&$objFormParam)メソッドを下記に書き換え
function createPdf(&$objFormParam){ $arrErr = $this->lfCheckError($objFormParam); $arrRet = $objFormParam->getHashArray(); $this->arrForm = $arrRet; // エラー入力なし if (count($arrErr) == 0) { //納品書の発行 if($arrRet['type'] == 0) { $objFpdf = new SC_Fpdf($arrRet['download'], $arrRet['title']); foreach ($arrRet['order_id'] AS $key => $val) { $arrPdfData = $arrRet; $arrPdfData['order_id'] = $val; $objFpdf->setData($arrPdfData); } $objFpdf->createPdf(); return true; } //見積書の発行 elseif($arrRet['type'] == 1) { $objFpdf = new SC_Fpdf_estimate($arrRet['download'], $arrRet['title']); foreach ($arrRet['order_id'] AS $key => $val) { $arrPdfData = $arrRet; $arrPdfData['order_id'] = $val; $objFpdf->setData($arrPdfData); } $objFpdf->createPdf(); return true; } }else{ return $arrErr; } }
(7) function lfInitParam(&$objFormParam)メソッドに追加
$objFormParam->addParam("見積もり1行目", "msg4", STEXT_LEN*3/5, 'KVa', array("MAX_LENGTH_CHECK")); $objFormParam->addParam("件名", "msg5", STEXT_LEN*3/5, 'KVa', array("MAX_LENGTH_CHECK")); $objFormParam->addParam("納入期限", "msg6", STEXT_LEN*3/5, 'KVa', array("MAX_LENGTH_CHECK")); $objFormParam->addParam("納入場所", "msg7", STEXT_LEN*3/5, 'KVa', array("MAX_LENGTH_CHECK")); $objFormParam->addParam("取引方法", "msg8", STEXT_LEN*3/5, 'KVa', array("MAX_LENGTH_CHECK")); $objFormParam->addParam("有効期限", "msg9", STEXT_LEN*3/5, 'KVa', array("MAX_LENGTH_CHECK"));
4 ■data/Smarty/templates/admin/order/pdf_input.tpl
(1)帳票タイトルの箇所を変更
帳票タイトル <!--{if $arrErr.title}--><!--{/if}--> <select name="title"><!--{html_options options=$arrTitle}--></select>
(2)帳票メッセージの箇所を変更(見積書用の行を追加)
帳票メッセージ (納品書)<!--{if $arrErr.msg1}--><!--{/if}--> 1行目:<input type="text" name="msg1" value="<!--{$arrForm.msg1|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" /> <!--{if $arrErr.msg2}--><!--{/if}--> 2行目:<input type="text" name="msg2" value="<!--{$arrForm.msg2|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" /> <!--{if $arrErr.msg3}--><!--{/if}--> 3行目:<input type="text" name="msg3" value="<!--{$arrForm.msg3|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" /> 帳票メッセージ (見積書)<!--{if $arrErr.msg4}--><!--{/if}--> 1行目 :<input type="text" name="msg4" value="<!--{$arrForm.msg4|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" /> <!--{if $arrErr.msg5}--><!--{/if}--> 件 名 :<input type="text" name="msg5" value="<!--{$arrForm.msg5|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" /> <!--{if $arrErr.msg6}--><!--{/if}--> 納入期限:<input type="text" name="msg6" value="<!--{$arrForm.msg6|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" /> <!--{if $arrErr.msg7}--><!--{/if}--> 納入場所:<input type="text" name="msg7" value="<!--{$arrForm.msg7|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" /> <!--{if $arrErr.msg8}--><!--{/if}--> 取引方法:<input type="text" name="msg8" value="<!--{$arrForm.msg8|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" /> <!--{if $arrErr.msg9}--><!--{/if}--> 有効期限:<input type="text" name="msg9" value="<!--{$arrForm.msg9|h}-->" size="40" maxlength="<!--{$smarty.const.STEXT_LEN*3/5}-->" />
5 ■data/class/SC_Fpdf.php
(1)44行目あたり、
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData(‘mtb_pref’);
の下に追加
$this->arrTitle = $masterData->getMasterData('mtb_fpdf');
(2)40行目あたり、
「$this->tpl_title = $title;」を下記に変更し、(1)で追加した「$this->arrTitle = $masterData->getMasterData(‘mtb_fpdf’);」より下に置く。
$this->label_cell[] = $this->lfConvSjis(“商品名 / 商品コード / [ 規格 ]”);の上あたりでよい。
$this->tpl_title = $this->arrTitle[$title];
6 ■data/class/SC_Fpdf_estimate.phpを新規作成(SC_Fpdf.phpをコピーして作成)
(1) 冒頭部分の、下記2行を削除
require(DATA_REALDIR . 'module/fpdf/fpdf.php'); require(DATA_REALDIR . 'module/fpdi/japanese.php');
(2) 33行目あたり、「SC_Fpdf」を「SC_Fpdf_estimate」に変更(2カ所)・「nouhinsyo2.pdf」に変更
class SC_Fpdf_estimate extends PDF_Japanese { function SC_Fpdf_estimate($download, $title, $tpl_pdf = 'nouhinsyo2.pdf') {
(3)54行目あたり、$this->arrMessage = array内を変更
'下記の通り御見積申し上げます。', '', '', '', '', ''
(4)function setMessageData()を変更
// メッセージ $this->lfText(28, 67, $this->arrData['msg4'], 9); //メッセージ1 $this->lfText(46, 72, $this->arrData['msg5'], 9); //件名 $this->lfText(46, 77, $this->arrData['msg6'], 9); //納入期限 $this->lfText(46, 82, $this->arrData['msg7'], 9); //納入場所 $this->lfText(46, 87, $this->arrData['msg8'], 9); //取引方法 $this->lfText(46, 92, $this->arrData['msg9'], 9); //有効期限 $text = "作成日: ".$this->arrData['year']."年".$this->arrData['month']."月".$this->arrData['day']."日"; $this->lfText(158, 288, $text, 8); //作成日
7 nouhinsyo2.pdfを下記フォルダに置く。
■data/Smarty/templates/admin/pdf