PluginProbe
Welcart e-Commerce / 1.3.9
Welcart e-Commerce v1.3.9
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / includes / order_print.php

order_print.php in Welcart e-Commerce 1.3.9, at includes/order_print.php

633 lines 25.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 global $usces;
3 require_once(USCES_PLUGIN_DIR.'/classes/fpdf/mbfpdi.php');
4 require_once(USCES_PLUGIN_DIR.'/classes/orderData.class.php');
5
6 //用紙サイズ(B5)
7 // MBfpdiクラスのインスタンス生成
8 if(isset($usces->options['print_size']) && $usces->options['print_size'] == 'A4')
9 $pdf = new MBfpdi('P', 'mm', array(210, 297));
10 else
11 $pdf = new MBfpdi('P', 'mm', array(182, 257));
12
13 $usces_pdfo = new orderDataObject($_REQUEST['order_id']);
14
15 usces_pdf_out($pdf, $usces_pdfo);
16 die();
17
18 function usces_conv_euc($str){
19 $str = str_replace(mb_convert_encoding('&yen;','UTF-8','HTML-ENTITIES'),'\\',$str);
20 $str = mb_convert_encoding($str, 'EUC-JP', 'UTF-8');
21 return $str;
22 }
23
24 function usces_pdf_out(&$pdf, $data){
25 global $usces;
26
27 //PDF出力基本設定
28 //******************************************************
29
30 $border = 0;//セルのボーダー初期値
31
32 // EUC-JP -> Shift_JIS 自動変換有効
33 //$GLOBALS['EUC2SJIS'] = true;
34
35 // テンプレートファイル
36 if(isset($usces->options['print_size']) && $usces->options['print_size'] == 'A4')
37 $tplfile = USCES_PLUGIN_DIR."/images/orderform_A4.pdf";
38 else
39 $tplfile = USCES_PLUGIN_DIR."/images/orderform_B5.pdf";
40
41 $pagecount = $pdf->setSourceFile($tplfile);
42 $tplidx = $pdf->ImportPage(1);
43 $pdf->SetLeftMargin(0);
44 $pdf->SetTopMargin(0);
45 $pdf->addPage();
46 //$pdf->useTemplate($tplidx);
47 $pdf->AddMBFont(GOTHIC, 'EUC-JP');
48 $pdf->AddMBFont(MINCHO, 'EUC-JP');
49
50 // 文書�
51 報設定
52 $pdf->SetCreator('Welcart');
53 $pdf->SetAuthor('Collne Inc.');
54 switch ($_REQUEST['type'] ){
55 case 'mitumori':
56 $pdf->SetTitle('estimate');
57 $filename = 'estimate_' . usces_get_deco_order_id( $data->order['ID'] ) . '.pdf';
58 break;
59
60 case 'nohin':
61 $pdf->SetTitle('invoice');
62 $filename = 'invoice_' . usces_get_deco_order_id( $data->order['ID'] ) . '.pdf';
63 break;
64
65 case 'receipt':
66 $pdf->SetTitle('receipt');
67 $filename = 'receipt_' . usces_get_deco_order_id( $data->order['ID'] ) . '.pdf';
68 break;
69
70 case 'bill':
71 $pdf->SetTitle('bill');
72 $filename = 'bill_' . usces_get_deco_order_id( $data->order['ID'] ) . '.pdf';
73 break;
74 }
75
76 //表示モードを指定する。
77 $pdf->SetDisplayMode('real', 'continuous');
78
79 // 総ページ数のエイリアスを定義する。
80 // エイリアスはドキュメントをクローズするときに置換する。
81 // '{nb}' で総ページ数が得られる
82 $pdf->AliasNbPages();
83
84 //自動改ページモード
85 $pdf->SetAutoPageBreak(true , 5);
86
87 $pdf->SetFillColor(255, 255, 255);
88
89 //**************************************************************
90 $page = 1;//ページ数の初期化
91
92 //--------------------------------------------------------------
93 usces_pdfSetHeader($pdf, $data, $page);
94 //$pdf->SetDrawColor(255,0,0);
95 $border = 0;
96
97 $pdf->SetLeftMargin(19.8);
98 $x = 15.8;
99 $y = 101;
100 $onep = apply_filters( 'usces_filter_pdf_page_height', 190 );
101 $pdf->SetXY($x, $y);
102 $next_y = $y;
103 $line_x = array();
104 for ( $index = 0; $index < count($data->cart); $index++ ) {
105 $cart_row = $data->cart[$index];
106 //if ($cnt > $pageRec-1) {//ページが変わるときの処理
107 if ( $onep < $next_y ) {//ページが変わるときの処理
108
109 $pdf->addPage();
110 //$pdf->useTemplate($tplidx);
111
112 //-----------------------------------------------------
113 usces_pdfSetHeader($pdf, $data, $page);
114
115 $x = 15.8;
116 $y = 101;
117 $pdf->SetXY($x, $y);
118 $next_y = $y;
119 }
120
121 //---------------------------------------------------------
122 $post_id = $cart_row['post_id'];
123 $sku = urldecode($cart_row['sku']);
124 $cartItemName = $usces->getCartItemName($post_id, $sku);
125 $optstr = '';
126 if( is_array($cart_row['options']) && count($cart_row['options']) > 0 ){
127 foreach($cart_row['options'] as $key => $value){
128 //20110629ysk start 0000190
129 //if( !empty($key) )
130 // $optstr .= esc_html($key) . ' = ' . esc_html(urldecode($value)) . "\n";
131 if( !empty($key) ) {
132 $key = urldecode($key);
133 if(is_array($value)) {
134 $c = '';
135 $optstr .= esc_html($key) . ' = ';
136 foreach($value as $v) {
137 $optstr .= $c.esc_html(urldecode($v));
138 $c = ', ';
139 }
140 $optstr .= "\n";
141 } else {
142 $optstr .= esc_html($key) . ' = ' . esc_html(urldecode($value)) . "\n";
143 }
144 }
145 //20110629ysk end
146 }
147 $optstr = apply_filters( 'usces_filter_option_pdf', $optstr, $cart_row['options']);
148 }
149 $optstr = apply_filters( 'usces_filter_all_option_pdf', $optstr, $cart_row['options'], $post_id, $sku, $cart_row['advance']);
150
151 $line_y[$index] = $next_y;
152
153 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
154 $pdf->SetFont(GOTHIC, '', $fontsize);
155 $pdf->SetXY($x-0.2, $line_y[$index]);
156 $pdf->MultiCell(3.6, $lineheight, '*', $border, 'C');
157 $pdf->SetXY($x+3.0, $line_y[$index]);
158 $pdf->MultiCell(84.6, $lineheight, usces_conv_euc($cartItemName), $border, 'L');
159 if( 'receipt' != $_REQUEST['type'] ){
160 list($fontsize, $lineheight, $linetop) = usces_set_font_size(8);
161 $pdf->SetFont(GOTHIC, '', $fontsize);
162 $pdf->SetXY($x+6.0, $pdf->GetY()+$linetop);
163 $pdf->MultiCell(81.6, $lineheight-0.2, usces_conv_euc($optstr), $border, 'L');
164 }
165
166 $pdf_args = compact( 'page', 'x', 'y', 'onep', 'next_y', 'line_x', 'border', 'index', 'cart_row' );
167 do_action( 'usces_action_order_print_cart_row', $pdf, $data, $pdf_args );
168
169 $next_y = $pdf->GetY()+2;
170 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
171 $pdf->SetFont(GOTHIC, '', $fontsize);
172 $pdf->SetXY($x+88.0, $line_y[$index]);
173 $pdf->MultiCell(11.5, $lineheight, usces_conv_euc($cart_row['quantity']), $border, 'R');
174 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
175 $pdf->SetFont(GOTHIC, '', $fontsize);
176 $pdf->SetXY($x+99.6, $line_y[$index]);
177 $pdf->MultiCell(11.5, $lineheight, usces_conv_euc($usces->getItemSkuUnit($post_id, urldecode($cart_row['sku']))), $border, 'C');
178 $pdf->SetXY($x+111.5, $line_y[$index]);
179 list($fontsize, $lineheight, $linetop) = usces_set_font_size(7);
180 $pdf->SetFont(GOTHIC, '', $fontsize);
181 $pdf->MultiCell(15.2, $lineheight, usces_conv_euc($usces->get_currency($cart_row['price'])), $border, 'R');
182 $pdf->SetXY($x+126.9, $line_y[$index]);
183 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
184 $pdf->SetFont(GOTHIC, '', $fontsize);
185 $pdf->MultiCell(22.8, $lineheight, apply_filters( 'usces_filter_cart_row_price_pdf', usces_conv_euc($usces->get_currency($cart_row['price']*$cart_row['quantity'])), $cart_row), $border, 'R');
186
187 if( $onep < $next_y && 0 < $index ){
188 $pdf->Rect($x, $line_y[$index]-0.4, 149.5, 197.4-$line_y[$index], 'F');
189
190 $pdf->SetXY($x, 193);
191 $pdf->MultiCell(88, $lineheight, usces_conv_euc(__('It continues to next.', 'usces')), $border, 'C');
192
193 usces_pdfSetLine($pdf);
194 usces_pdfSetFooter($pdf, $data);
195 $index--;
196 $page++;
197 }
198 }
199
200 usces_pdfSetLine($pdf);
201 usces_pdfSetFooter($pdf, $data);
202
203 @ob_end_clean();
204
205 // Output
206 //*****************************************************************
207 header('Pragma:');
208 header('Cache-Control: application/octet-stream');
209 header("Content-type: application/pdf");
210 header('Content-Length: '.strlen($pdf->buffer));
211 $pdf->Output($filename, 'I');
212 }
213
214 //Header
215 function usces_pdfSetHeader($pdf, $data, $page) {
216 global $usces;
217 $border = 0;//border of cells
218
219 switch ( $_REQUEST['type'] ){
220 case 'mitumori':
221 $title = apply_filters( 'usces_filter_pdf_estimate_title', __('Estimate', 'usces'), $data );
222 $message = sprintf(__("Thank you for choosing '%s' we send you following estimate. ", 'usces'),
223 apply_filters('usces_filter_publisher', get_option('blogname')));
224 $message = apply_filters('usces_filter_pdf_estimate_message', $message, $data);
225 $juchubi = __('Valid:7days', 'usces');
226 $siharai = ' ';
227 $sign_image = apply_filters('usces_filter_pdf_estimate_sign', NULL);
228 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['date']));
229 break;
230
231 case 'nohin':
232 $title = apply_filters( 'usces_filter_pdf_invoice_title', __('Delivery Statement', 'usces'), $data );
233 $message = sprintf(__("Thak you for choosing '%s'. We deliver your items as following.", 'usces'),
234 apply_filters('usces_filter_publisher', get_option('blogname')));
235 $message = apply_filters('usces_filter_pdf_invoice_message', $message, $data);
236 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
237 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
238 $sign_image = apply_filters('usces_filter_pdf_invoice_sign', NULL);
239 //20120801ysk 0000510 start
240 //if( empty($data->order['delidue_date']) ){
241 // $effective_date = ' ';
242 if( !empty($data->order['delidue_date']) && '#none#' != $data->order['delidue_date'] ){
243 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['delidue_date']));
244 }else{
245 if( empty($data->order['modified']) )
246 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
247 else
248 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['modified']));
249 }
250 //$effective_date = apply_filters('usces_filter_pdf_effective_date', $effective_date);
251 //20120801ysk end
252 break;
253
254 case 'receipt':
255 $title = apply_filters( 'usces_filter_pdf_receipt_title', __('Receipt', 'usces'), $data );
256 $message = apply_filters('usces_filter_pdf_receipt_message', __("Your payment has been received.", 'usces'), $data);
257 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
258 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
259 $sign_image = apply_filters('usces_filter_pdf_receipt_sign', NULL);
260 $receipted_date = $usces->get_order_meta_value('receipted_date', $data->order['ID']);
261 if( empty($receipted_date) )
262 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
263 else
264 $effective_date = date(__('M j, Y', 'usces'), strtotime($receipted_date));
265 break;
266
267 case 'bill':
268 $title = apply_filters( 'usces_filter_pdf_bill_title', __('Invoice', 'usces'), $data );
269 $message = apply_filters('usces_filter_pdf_bill_message', __("Please remit payment at your earliest convenience.", 'usces'), $data);
270 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
271 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
272 $sign_image = apply_filters('usces_filter_pdf_bill_sign', NULL);
273 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
274 break;
275 }
276 $effective_date = apply_filters('usces_filter_pdf_effective_date', $effective_date, $_REQUEST['type'], $data);
277
278 // $pdf->Rect(14, 24, 152, 61, 'F');//Label field of customer
279 // $pdf->Rect(14, 93, 153, 105, 'F');//Body field
280 $pdf->SetLineWidth(0.4);
281 $pdf->Line(65, 23, 110, 23);
282 $pdf->SetLineWidth(0.1);
283 $pdf->Line(124, 19, 167, 19);
284 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
285 $pdf->SetFont(GOTHIC, '', $fontsize);
286 $pdf->SetXY(125, 15.0);
287 $pdf->Write(5, 'No.');
288
289 // Title
290 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
291 $pdf->SetFont(GOTHIC, '', $fontsize);
292 $pdf->SetXY(64, 17);
293 $pdf->MultiCell(45.5, $lineheight, usces_conv_euc($title), $border, 'C');
294
295 // Date
296 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
297 $pdf->SetFont(GOTHIC, '', $fontsize);
298 $pdf->SetXY(64, 24.2);
299 $pdf->MultiCell(45.5, $lineheight, usces_conv_euc($effective_date), $border, 'C');
300
301 // Order No.
302 $pdf->SetXY(131, 15.4);
303 $pdf->MultiCell(36, $lineheight, usces_get_deco_order_id( $data->order['ID'] ), $border, 'R');
304
305 // Page No.
306 list($fontsize, $lineheight, $linetop) = usces_set_font_size(13);
307 $pdf->SetFont(GOTHIC, '', $fontsize);
308 $pdf->SetXY(15.5, 15.4);
309 $pdf->MultiCell(20, 7, $page.'/{nb}', 1, 'C');
310
311 $width = 80;
312 $leftside = 15;
313 $pdf->SetLeftMargin($leftside);
314
315 $person_honor = ( 'JP' == $usces->options['system']['currency'] ) ? "" : '';
316 $company_honor = ( 'JP' == $usces->options['system']['currency'] ) ? "御中" : '';
317 $currency_post = ( 'JP' == $usces->options['system']['currency'] ) ? "-" : '';
318
319 if( 'receipt' == $_REQUEST['type'] ){
320 $top = 40;
321 // Name of customer
322 $company = $usces->get_order_meta_value('cscs_company', $data->order['ID']);
323 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
324 $pdf->SetFont(GOTHIC, '', $fontsize);
325 $pdf->SetXY($leftside, $top);
326 if( empty($company) ){
327 $pdf->MultiCell($width, $lineheight, usces_conv_euc(usces_get_pdf_name( $data )), $border, 'L');
328 $x = $leftside + $width;
329 $y = $pdf->GetY() - $lineheight;
330 $pdf->SetXY($x, $y);
331 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_person_honor', $person_honor) ));
332 }else{
333 $pdf->MultiCell($width, $lineheight, usces_conv_euc($company), $border, 'L');
334 $x = $leftside + $width;
335 $y = $pdf->GetY() - $lineheight;
336 $pdf->SetXY($x, $y);
337 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_company_honor', $company_honor) ));
338 }
339 $y = $pdf->GetY() + $lineheight + $linetop;
340 $pdf->SetLineWidth(0.1);
341 $pdf->Line($leftside, $y, $leftside+$width+7, $y);
342
343 //Total
344 $y = $pdf->GetY() + $lineheight + 7;
345 list($fontsize, $lineheight, $linetop) = usces_set_font_size(20);
346 $pdf->SetFont(GOTHIC, '', $fontsize);
347 $pdf->SetXY($leftside+2, $y);
348 $pdf->MultiCell($width, $lineheight+2, usces_conv_euc($usces->get_currency($data->order['total_full_price'], true, false) . apply_filters( 'usces_filters_pdf_currency_post', $currency_post)), 1, 'C');
349
350 // Message
351 $y = $pdf->GetY() + $lineheight;
352 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
353 $pdf->SetFont(GOTHIC, '', $fontsize);
354 $pdf->SetXY($leftside, $y);
355 $pdf->MultiCell($width+70, $lineheight, usces_conv_euc($message), $border, 'L');
356
357 // Label
358 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
359 $pdf->SetFont(GOTHIC, '', $fontsize);
360 $y = 89.7;
361 $pdf->SetXY($leftside, $y);
362 $pdf->MultiCell(75, $lineheight, usces_conv_euc(__('Statement', 'usces')), $border, 'L');
363 }else{
364 $top = 35;
365 // Name of customer
366 $company = $usces->get_order_meta_value('cscs_company', $data->order['ID']);
367 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
368 $pdf->SetFont(GOTHIC, '', $fontsize);
369 $pdf->SetXY($leftside, $top);
370 if( empty($company) ){
371 $pdf->MultiCell($width, $lineheight, usces_conv_euc(usces_get_pdf_name( $data )), $border, 'L');
372 $x = $leftside + $width;
373 $y = $pdf->GetY() - $lineheight;
374 $pdf->SetXY($x, $y);
375 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_person_honor', $person_honor) ));
376 $y = $pdf->GetY() + $lineheight + $linetop + 2;
377 }else{
378 $pdf->MultiCell($width, $lineheight, usces_conv_euc($company), $border, 'L');
379 $x = $leftside + $width;
380 $y = $pdf->GetY() - $lineheight;
381 $pdf->SetXY($x, $y);
382 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_company_honor', $company_honor) ));
383 $y = $pdf->GetY() + $lineheight + $linetop;
384 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
385 $pdf->SetFont(GOTHIC, '', $fontsize);
386 $pdf->SetXY($leftside, $y);
387 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("Attn", 'usces') . ' : ' . usces_get_pdf_name( $data ) . apply_filters( 'usces_filters_pdf_person_honor', $person_honor) ), $border, 'L');
388 $y = $pdf->GetY() + $linetop + 2;
389 }
390
391 // Address
392 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
393 $pdf->SetFont(GOTHIC, '', $fontsize);
394
395 usces_get_pdf_address($pdf, $data, $y, $linetop, $leftside, $width, $lineheight);
396
397 $pdf->MultiCell($width, $lineheight, usces_conv_euc('TEL ' . $data->customer['tel']), $border, 'L');
398
399 if( !empty($data->customer['fax']) ){
400 $y = $pdf->GetY() + $linetop;
401 $pdf->SetXY($leftside, $y);
402 $pdf->MultiCell($width, $lineheight, usces_conv_euc('FAX ' . $data->customer['fax']), $border, 'L');
403 }
404
405 $y = $pdf->GetY() + $linetop;
406 $pdf->SetLineWidth(0.1);
407 $pdf->Line($leftside, $y, $leftside+$width+5, $y);
408
409 // Message
410 $y = 77;
411 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
412 $pdf->SetFont(GOTHIC, '', $fontsize);
413 $pdf->SetXY($leftside, $y);
414 $pdf->MultiCell($width+70, $lineheight, usces_conv_euc($message), $border, 'L');
415
416 // Order date
417 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
418 $pdf->SetFont(GOTHIC, '', $fontsize);
419 $y = 89.7;
420 $pdf->SetXY($leftside, $y);
421 $pdf->MultiCell(75, $lineheight, usces_conv_euc($juchubi), $border, 'L');
422
423 // Payment method
424 $pdf->SetXY($leftside+76, $y);
425 $pdf->MultiCell(75, $lineheight, usces_conv_euc($siharai), $border, 'L');
426 }
427
428 // My company
429 if( !empty($sign_image) ){
430 $sign_data = apply_filters( 'usces_filter_pdf_sign_data', array(140, 40, 25, 25));
431 $pdf->Image($sign_image, $sign_data[0], $sign_data[1], $sign_data[2], $sign_data[3]);
432 }
433 $x = 110;
434 $y = 45;
435 $pdf->SetLeftMargin($x);
436 list($fontsize, $lineheight, $linetop) = usces_set_font_size(11);
437 $pdf->SetFont(GOTHIC, '', $fontsize);
438 $pdf->SetXY($x, $y);
439 $pdf->MultiCell(60, $lineheight, usces_conv_euc(apply_filters('usces_filter_publisher', get_option('blogname'))), 0, 'L');
440 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
441 $pdf->SetFont(GOTHIC, '', $fontsize);
442 $pdf->MultiCell(60, $lineheight, usces_conv_euc(apply_filters('usces_filter_pdf_mycompany', $usces->options['company_name'])), 0, 'L');
443 usces_get_pdf_myaddress($pdf, $lineheight );
444 $pdf->MultiCell(60, $lineheight, usces_conv_euc('TEL:'.$usces->options['tel_number']), 0, 'L');
445 $pdf->MultiCell(60, $lineheight, usces_conv_euc('FAX:'.$usces->options['fax_number']), 0, 'L');
446 }
447
448 //Footer
449 function usces_pdfSetFooter($pdf, $data) {
450 global $usces;
451 $border = 0;
452
453 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
454 $pdf->SetFont(GOTHIC, '', $fontsize);
455
456 // Body label
457 $pdf->SetXY(15.5, 94.9);
458 $pdf->MultiCell(87.8, $lineheight, usces_conv_euc(__('item name','usces')), $border, 'C');
459 $pdf->SetXY(103.7, 94.9);
460 $pdf->MultiCell(11.4, $lineheight, usces_conv_euc(__('Quant','usces')), $border, 'C');
461 $pdf->SetXY(115.8, 94.9);
462 $pdf->MultiCell(11.0, $lineheight, usces_conv_euc(__('Unit', 'usces')), $border, 'C');
463 $pdf->SetXY(127.2, 94.9);
464 $pdf->MultiCell(15.0, $lineheight, usces_conv_euc(__('Price','usces')), $border, 'C');
465 $pdf->SetXY(142.9, 94.9);
466 $pdf->MultiCell(22.4, $lineheight, usces_conv_euc(__('Amount','usces').'('.__(usces_crcode( 'return' ), 'usces').')'), $border, 'C');
467
468 // Footer label
469 $pdf->SetXY(104.3, 198.8);
470 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(__('total items', 'usces')), $border, 'C');
471 $pdf->SetXY(104.3, 204.8);
472 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_point_label', __('Used points', 'usces'))), $border, 'C');
473 $pdf->SetXY(104.3, 210.8);
474 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_disnount_label', __('Campaign disnount', 'usces'))), $border, 'C');
475 $pdf->SetXY(104.3, 216.7);
476 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_shipping_label', __('Shipping', 'usces'))), $border, 'C');
477 $pdf->SetXY(104.3, 222.7);
478 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_cod_label', __('COD fee', 'usces'))), $border, 'C');
479 $pdf->SetXY(104.3, 228.6);
480 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_tax_label', __('consumption tax', 'usces'))), $border, 'C');
481 $pdf->SetXY(104.3, 235.8);
482 $pdf->MultiCell(37.77, $lineheight, usces_conv_euc(__('Total Amount', 'usces')), $border, 'C');
483
484 list($fontsize, $lineheight, $linetop) = usces_set_font_size(8);
485 $pdf->SetFont(GOTHIC, '', $fontsize);
486 // Footer value
487 $pdf->SetXY(16.1, 198.8);
488 $pdf->MultiCell(86.6, $lineheight, usces_conv_euc( apply_filters('usces_filter_pdf_note', $data->order['note'], $data, $_REQUEST['type'])), $border, 'J');
489 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
490 $pdf->SetFont(GOTHIC, '', $fontsize);
491 $pdf->SetXY(142.9, 198.8);
492 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc($usces->get_currency($data->order['item_total_price'])), $border, 'R');
493 $pdf->SetXY(142.9, 204.8);
494 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_point_vlue', $usces->get_currency($data->order['usedpoint']))), $border, 'R');
495 $pdf->SetXY(142.9, 210.8);
496 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_disnount_vlue', $usces->get_currency($data->order['discount']))), $border, 'R');
497 $pdf->SetXY(142.9, 216.7);
498 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_shipping_vlue', $usces->get_currency($data->order['shipping_charge']))), $border, 'R');
499 $pdf->SetXY(142.9, 222.7);
500 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_cod_vlue', $usces->get_currency($data->order['cod_fee']))), $border, 'R');
501
502 if( empty($usces->options['tax_rate']) ){
503 $tax = '('.__('In tax', 'usces').')'.$usces->get_currency($data->order['tax']);
504 }else{
505 $tax = $usces->get_currency($data->order['tax']);
506 }
507 $pdf->SetXY(142.9, 228.6);
508 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_tax_vlue', $tax, $data)), $border, 'R');
509 $pdf->SetXY(142.9, 235.8);
510 $pdf->MultiCell(22.67, $lineheight, usces_conv_euc($usces->get_currency($data->order['total_full_price'])), $border, 'R');
511
512 do_action( 'usces_action_order_print_footer', $pdf, $data);
513 }
514
515 //Line
516 function usces_pdfSetLine($pdf) {
517
518 $pdf->Rect(14, 197.8, 153, 45, 'F');//Footer field
519 $line_top = 93.5;
520 $line_left = 15.4;
521 $line_right = $line_left + 150.1;
522 $line_bottom = $line_top + 147.9;
523 $line_footertop = 197.5;
524
525 // Horizontal lines
526 $pdf->SetLineWidth(0.5);
527 $pdf->Line($line_left, $line_top, $line_right, $line_top);
528 $pdf->Line($line_left, $line_top+6.5, $line_right, $line_top+6.5);
529 $pdf->Line($line_left, $line_top+104.0, $line_right, $line_top+104.0);
530 $pdf->SetLineWidth(0.04);
531 $pdf->Line(103.5, $line_footertop+5.9, $line_right, $line_footertop+5.9);
532 $pdf->Line(103.5, $line_footertop+5.9*2, $line_right, $line_footertop+5.9*2);
533 $pdf->Line(103.5, $line_footertop+5.9*3, $line_right, $line_footertop+5.9*3);
534 $pdf->Line(103.5, $line_footertop+5.9*4, $line_right, $line_footertop+5.9*4);
535 $pdf->SetLineWidth(0.5);
536 $pdf->Line(103.5, $line_footertop+5.9*5, $line_right, $line_footertop+5.9*5);
537 $pdf->Line(103.5, $line_footertop+5.9*6, $line_right, $line_footertop+5.9*6);
538 $pdf->Line($line_left, $line_bottom, $line_right, $line_bottom);
539
540 // Perpendicular lines
541 $pdf->SetLineWidth(0.5);
542 $pdf->Line($line_left, $line_top, $line_left, $line_bottom);
543 $pdf->SetLineWidth(0.04);
544 $pdf->Line(103.5, $line_top, 103.5, $line_footertop);
545 $pdf->SetLineWidth(0.5);
546 $pdf->Line(103.5, $line_footertop, 103.5, $line_bottom);
547 $pdf->SetLineWidth(0.04);
548 $pdf->Line(115.5, $line_top, 115.5, $line_footertop);
549 $pdf->Line(127, $line_top, 127, $line_footertop);
550 $pdf->Line(142.5, $line_top, 142.5, $line_bottom);
551 $pdf->SetLineWidth(0.5);
552 $pdf->Line($line_right, $line_top, $line_right, $line_bottom);
553 }
554
555 function usces_set_font_size( $size ){
556 $lineheight = $size / 2.6;
557 $linetop = $lineheight / 12;
558 return array($size, $lineheight, $linetop);
559 }
560
561 function usces_get_pdf_name( $data ){
562 global $usces, $usces_settings;
563 $options = get_option('usces');
564 $applyform = usces_get_apply_addressform($options['system']['addressform']);
565 $name = '';
566 switch ($applyform){
567 case 'JP':
568 $name = $data->customer['name1'] . ' ' . $data->customer['name2'];
569 break;
570 case 'US':
571 default:
572 $name = $data->customer['name2'] . ' ' . $data->customer['name1'];
573 }
574 return $name;
575 }
576
577 function usces_get_pdf_address(&$pdf, $data, $y, $linetop, $leftside, $width, $lineheight){
578 $options = get_option('usces');
579 $applyform = usces_get_apply_addressform($options['system']['addressform']);
580 $name = '';
581 $border = '';
582 $pref = ( __( '-- Select --','usces') == $data->customer['pref'] ) ? '' : $data->customer['pref'];
583 switch ($applyform){
584 case 'JP':
585 $pdf->SetXY($leftside, $y);
586 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("zip code", 'usces') . ' ' . $data->customer['zip']), $border, 'L');
587 $pdf->MultiCell($width, $lineheight, usces_conv_euc($pref . $data->customer['address1'] . $data->customer['address2']), $border, 'L');
588
589 if( !empty($data->customer['address3']) ){
590 $y = $pdf->GetY() + $linetop;
591 $pdf->SetXY($leftside, $y);
592 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address3']), $border, 'L');
593 }
594 break;
595
596 case 'US':
597 default:
598 $pdf->SetXY($leftside, $y);
599 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address2'] . ' ' . $data->customer['address3']), $border, 'L');
600
601 $y = $pdf->GetY() + $linetop;
602 $pdf->SetXY($leftside, $y);
603 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address1'] . ' ' . $pref . ' ' . $data->customer['country']), $border, 'L');
604
605 $y = $pdf->GetY() + $linetop;
606 $pdf->SetXY($leftside, $y);
607 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("zip code", 'usces') . ' ' . $data->customer['zip']), $border, 'L');
608 break;
609 }
610 }
611
612 function usces_get_pdf_myaddress(&$pdf, $lineheight){
613 global $usces;
614 $options = get_option('usces');
615 $applyform = usces_get_apply_addressform($options['system']['addressform']);
616 $name = '';
617 switch ($applyform){
618 case 'JP':
619 $address = ( empty($usces->options['address2']) ) ? $usces->options['address1'] : $usces->options['address1'] . "\n" . $usces->options['address2'];
620 $pdf->MultiCell(60, $lineheight, usces_conv_euc(__('zip code', 'usces').' '.$usces->options['zip_code']), 0, 'L');
621 $pdf->MultiCell(60, $lineheight, usces_conv_euc($address), 0, 'L');
622 break;
623
624 case 'US':
625 default:
626 $address = ( empty($usces->options['address2']) ) ? $usces->options['address1'] : $usces->options['address2'] . "\n" . $usces->options['address1'];
627 $pdf->MultiCell(60, $lineheight, usces_conv_euc($address), 0, 'L');
628 $pdf->MultiCell(60, $lineheight, usces_conv_euc(__('zip code', 'usces').' '.$usces->options['zip_code']), 0, 'L');
629 break;
630 }
631 }
632 ?>
633