PluginProbe
Welcart e-Commerce / 1.3.2
Welcart e-Commerce v1.3.2
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.2, at includes/order_print.php

636 lines 25.3 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(201, 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
42 $pagecount = $pdf->setSourceFile($tplfile);
43 $tplidx = $pdf->ImportPage(1);
44 $pdf->SetLeftMargin(0);
45 $pdf->SetTopMargin(0);
46 $pdf->addPage();
47 //$pdf->useTemplate($tplidx);
48 $pdf->AddMBFont(GOTHIC, 'EUC-JP');
49 $pdf->AddMBFont(MINCHO, 'EUC-JP');
50
51 // 文書�
52 報設定
53 $pdf->SetCreator('Welcart');
54 $pdf->SetAuthor('Collne Inc.');
55 switch ($_REQUEST['type'] ){
56 case 'mitumori':
57 $pdf->SetTitle('estimate');
58 $filename = 'estimate_' . usces_get_deco_order_id( $data->order['ID'] ) . '.pdf';
59 break;
60
61 case 'nohin':
62 $pdf->SetTitle('invoice');
63 $filename = 'invoice_' . usces_get_deco_order_id( $data->order['ID'] ) . '.pdf';
64 break;
65
66 case 'receipt':
67 $pdf->SetTitle('receipt');
68 $filename = 'receipt_' . usces_get_deco_order_id( $data->order['ID'] ) . '.pdf';
69 break;
70
71 case 'bill':
72 $pdf->SetTitle('bill');
73 $filename = 'bill_' . usces_get_deco_order_id( $data->order['ID'] ) . '.pdf';
74 break;
75 }
76
77 //表示モードを指定する。
78 $pdf->SetDisplayMode('real', 'continuous');
79
80 // 総ページ数のエイリアスを定義する。
81 // エイリアスはドキュメントをクローズするときに置換する。
82 // '{nb}' で総ページ数が得られる
83 $pdf->AliasNbPages();
84
85 //自動改ページモード
86 $pdf->SetAutoPageBreak(true , 5);
87
88 $pdf->SetFillColor(255, 255, 255);
89
90
91 //**************************************************************
92 $page = 1;//ページ数の初期化
93
94 //--------------------------------------------------------------
95 usces_pdfSetHeader($pdf, $data, $page);
96 //$pdf->SetDrawColor(255,0,0);
97 $border = 0;
98
99 $pdf->SetLeftMargin(19.8);
100 $x = 15.8;
101 $y = 101;
102 $onep = apply_filters( 'usces_filter_pdf_page_height', 190 );
103 $pdf->SetXY($x, $y);
104 $next_y = $y;
105 $line_x = array();
106 for ( $index = 0; $index < count($data->cart); $index++ ) {
107 $cart_row = $data->cart[$index];
108 //if ($cnt > $pageRec-1) {//ページが変わるときの処理
109 if ( $onep < $next_y ) {//ページが変わるときの処理
110
111 $pdf->addPage();
112 //$pdf->useTemplate($tplidx);
113
114 //-----------------------------------------------------
115 usces_pdfSetHeader($pdf, $data, $page);
116
117 $x = 15.8;
118 $y = 101;
119 $pdf->SetXY($x, $y);
120 $next_y = $y;
121 }
122
123 //---------------------------------------------------------
124 $post_id = $cart_row['post_id'];
125 $sku = urldecode($cart_row['sku']);
126 $cartItemName = $usces->getCartItemName($post_id, $sku);
127 $optstr = '';
128 if( is_array($cart_row['options']) && count($cart_row['options']) > 0 ){
129 $optstr = '';
130 foreach($cart_row['options'] as $key => $value){
131 //20110629ysk start 0000190
132 //if( !empty($key) )
133 // $optstr .= esc_html($key) . ' = ' . esc_html(urldecode($value)) . "\n";
134 if( !empty($key) ) {
135 $key = urldecode($key);
136 if(is_array($value)) {
137 $c = '';
138 $optstr .= esc_html($key) . ' = ';
139 foreach($value as $v) {
140 $optstr .= $c.esc_html(urldecode($v));
141 $c = ', ';
142 }
143 $optstr .= "\n";
144 } else {
145 $optstr .= esc_html($key) . ' = ' . esc_html(urldecode($value)) . "\n";
146 }
147 }
148 //20110629ysk end
149 }
150 $optstr = apply_filters( 'usces_filter_option_pdf', $optstr, $cart_row['options']);
151 }
152 $optstr = apply_filters( 'usces_filter_all_option_pdf', $optstr, $cart_row['options'], $post_id, $sku, $cart_row['advance']);
153
154 $line_y[$index] = $next_y;
155
156 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
157 $pdf->SetFont(GOTHIC, '', $fontsize);
158 $pdf->SetXY($x-0.2, $line_y[$index]);
159 $pdf->MultiCell(3.6, $lineheight, '*', $border, 'C');
160 $pdf->SetXY($x+3.0, $line_y[$index]);
161 $pdf->MultiCell(84.6, $lineheight, usces_conv_euc($cartItemName), $border, 'L');
162 if( 'receipt' != $_REQUEST['type'] ){
163 list($fontsize, $lineheight, $linetop) = usces_set_font_size(8);
164 $pdf->SetFont(GOTHIC, '', $fontsize);
165 $pdf->SetXY($x+6.0, $pdf->GetY()+$linetop);
166 $pdf->MultiCell(81.6, $lineheight-0.2, usces_conv_euc($optstr), $border, 'L');
167 }
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 // Output
204 //*****************************************************************
205 header('Pragma:');
206 header('Cache-Control: application/octet-stream');
207 header("Content-type: application/pdf");
208 header('Content-Length: '.strlen($pdf->buffer));
209 $pdf->Output($filename, 'I');
210 }
211
212 //Header
213 function usces_pdfSetHeader($pdf, $data, $page) {
214 global $usces;
215 $border = 0;//border of cells
216
217 switch ( $_REQUEST['type'] ){
218 case 'mitumori':
219 $title = __('Estimate', 'usces');
220 $message = sprintf(__("Thank you for choosing '%s' we send you following estimate. ", 'usces'),
221 apply_filters('usces_filter_publisher', get_option('blogname')));
222 $message = apply_filters('usces_filter_pdf_estimate_message', $message, $data);
223 $juchubi = __('Valid:7days', 'usces');
224 $siharai = ' ';
225 $sign_image = apply_filters('usces_filter_pdf_estimate_sign', NULL);
226 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['date']));
227 break;
228
229 case 'nohin':
230 $title = __('Delivery Statement', 'usces');
231 $message = sprintf(__("Thak you for choosing '%s'. We deliver your items as following.", 'usces'),
232 apply_filters('usces_filter_publisher', get_option('blogname')));
233 $message = apply_filters('usces_filter_pdf_invoice_message', $message, $data);
234 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
235 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
236 $sign_image = apply_filters('usces_filter_pdf_invoice_sign', NULL);
237 //20120801ysk 0000510 start
238 //if( empty($data->order['delidue_date']) ){
239 // $effective_date = ' ';
240 if( !empty($data->order['delidue_date']) && '#none#' != $data->order['delidue_date'] ){
241 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['delidue_date']));
242 }else{
243 if( empty($data->order['modified']) )
244 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
245 else
246 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['modified']));
247 }
248 $effective_date = apply_filters('usces_filter_pdf_effective_date', $effective_date);
249 //20120801ysk end
250 break;
251
252 case 'receipt':
253 $title = __('Receipt', 'usces');
254 $message = apply_filters('usces_filter_pdf_receipt_message', __("Your payment has been received.", 'usces'), $data);
255 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
256 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
257 $sign_image = apply_filters('usces_filter_pdf_receipt_sign', NULL);
258 $receipted_date = $usces->get_order_meta_value('receipted_date', $data->order['ID']);
259 if( empty($receipted_date) )
260 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
261 else
262 $effective_date = date(__('M j, Y', 'usces'), strtotime($receipted_date));
263
264 break;
265
266 case 'bill':
267 $title = __('Invoice', 'usces');
268 $message = apply_filters('usces_filter_pdf_bill_message', __("Please remit payment at your earliest convenience.", 'usces'), $data);
269 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
270 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
271 $sign_image = apply_filters('usces_filter_pdf_bill_sign', NULL);
272 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
273 break;
274 }
275 $effective_date = apply_filters('usces_filter_pdf_effective_date', $effective_date, $_REQUEST['type'], $data);
276
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
406 $y = $pdf->GetY() + $linetop;
407 $pdf->SetLineWidth(0.1);
408 $pdf->Line($leftside, $y, $leftside+$width+5, $y);
409
410
411 // Message
412 $y = 77;
413 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
414 $pdf->SetFont(GOTHIC, '', $fontsize);
415 $pdf->SetXY($leftside, $y);
416 $pdf->MultiCell($width+70, $lineheight, usces_conv_euc($message), $border, 'L');
417
418 // Order date
419 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
420 $pdf->SetFont(GOTHIC, '', $fontsize);
421 $y = 89.7;
422 $pdf->SetXY($leftside, $y);
423 $pdf->MultiCell(75, $lineheight, usces_conv_euc($juchubi), $border, 'L');
424
425 // Payment method
426 $pdf->SetXY($leftside+76, $y);
427 $pdf->MultiCell(75, $lineheight, usces_conv_euc($siharai), $border, 'L');
428 }
429
430 // My company
431 if( !empty($sign_image) ){
432 $sign_data = apply_filters( 'usces_filter_pdf_sign_data', array(140, 40, 25, 25));
433 $pdf->Image($sign_image, $sign_data[0], $sign_data[1], $sign_data[2], $sign_data[3]);
434 }
435 $x = 110;
436 $y = 45;
437 $pdf->SetLeftMargin($x);
438 list($fontsize, $lineheight, $linetop) = usces_set_font_size(11);
439 $pdf->SetFont(GOTHIC, '', $fontsize);
440 $pdf->SetXY($x, $y);
441 $pdf->MultiCell(60, $lineheight, usces_conv_euc(apply_filters('usces_filter_publisher', get_option('blogname'))), 0, 'L');
442 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
443 $pdf->SetFont(GOTHIC, '', $fontsize);
444 $pdf->MultiCell(60, $lineheight, usces_conv_euc(apply_filters('usces_filter_pdf_mycompany', $usces->options['company_name'])), 0, 'L');
445 usces_get_pdf_myaddress($pdf, $lineheight );
446 $pdf->MultiCell(60, $lineheight, usces_conv_euc('TEL:'.$usces->options['tel_number']), 0, 'L');
447 $pdf->MultiCell(60, $lineheight, usces_conv_euc('FAX:'.$usces->options['fax_number']), 0, 'L');
448
449
450
451 }
452 //Footer
453 function usces_pdfSetFooter($pdf, $data) {
454 global $usces;
455 $border = 0;
456
457
458 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
459 $pdf->SetFont(GOTHIC, '', $fontsize);
460
461 // Body label
462 $pdf->SetXY(15.5, 94.9);
463 $pdf->MultiCell(87.8, $lineheight, usces_conv_euc(__('item name','usces')), $border, 'C');
464 $pdf->SetXY(103.7, 94.9);
465 $pdf->MultiCell(11.4, $lineheight, usces_conv_euc(__('Quant','usces')), $border, 'C');
466 $pdf->SetXY(115.8, 94.9);
467 $pdf->MultiCell(11.0, $lineheight, usces_conv_euc(__('Unit', 'usces')), $border, 'C');
468 $pdf->SetXY(127.2, 94.9);
469 $pdf->MultiCell(15.0, $lineheight, usces_conv_euc(__('Price','usces')), $border, 'C');
470 $pdf->SetXY(142.9, 94.9);
471 $pdf->MultiCell(22.4, $lineheight, usces_conv_euc(__('Amount','usces').'('.usces_crcode('return').')'), $border, 'C');
472
473 // Footer label
474 $pdf->SetXY(104.3, 198.8);
475 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(__('total items', 'usces')), $border, 'C');
476 $pdf->SetXY(104.3, 204.8);
477 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_point_label', __('Used points', 'usces'))), $border, 'C');
478 $pdf->SetXY(104.3, 210.8);
479 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_disnount_label', __('Campaign disnount', 'usces'))), $border, 'C');
480 $pdf->SetXY(104.3, 216.7);
481 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_shipping_label', __('Shipping', 'usces'))), $border, 'C');
482 $pdf->SetXY(104.3, 222.7);
483 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_cod_label', __('COD fee', 'usces'))), $border, 'C');
484 $pdf->SetXY(104.3, 228.6);
485 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_tax_label', __('consumption tax', 'usces'))), $border, 'C');
486 $pdf->SetXY(104.3, 235.8);
487 $pdf->MultiCell(37.77, $lineheight, usces_conv_euc(__('Total Amount', 'usces')), $border, 'C');
488
489 list($fontsize, $lineheight, $linetop) = usces_set_font_size(8);
490 $pdf->SetFont(GOTHIC, '', $fontsize);
491 // Footer value
492 $pdf->SetXY(16.1, 198.8);
493 $pdf->MultiCell(86.6, $lineheight, usces_conv_euc( apply_filters('usces_filter_pdf_note', $data->order['note'], $data, $_REQUEST['type'])), $border, 'J');
494 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
495 $pdf->SetFont(GOTHIC, '', $fontsize);
496 $pdf->SetXY(142.9, 198.8);
497 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc($usces->get_currency($data->order['item_total_price'])), $border, 'R');
498 $pdf->SetXY(142.9, 204.8);
499 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_point_vlue', $usces->get_currency($data->order['usedpoint']))), $border, 'R');
500 $pdf->SetXY(142.9, 210.8);
501 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_disnount_vlue', $usces->get_currency($data->order['discount']))), $border, 'R');
502 $pdf->SetXY(142.9, 216.7);
503 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_shipping_vlue', $usces->get_currency($data->order['shipping_charge']))), $border, 'R');
504 $pdf->SetXY(142.9, 222.7);
505 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_cod_vlue', $usces->get_currency($data->order['cod_fee']))), $border, 'R');
506
507 if( empty($usces->options['tax_rate']) ){
508 $tax = '('.__('In tax', 'usces').')'.$usces->get_currency($data->order['tax']);
509 }else{
510 $tax = $usces->get_currency($data->order['tax']);
511 }
512 $pdf->SetXY(142.9, 228.6);
513 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_tax_vlue', $tax, $data)), $border, 'R');
514 $pdf->SetXY(142.9, 235.8);
515 $pdf->MultiCell(22.67, $lineheight, usces_conv_euc($usces->get_currency($data->order['total_full_price'])), $border, 'R');
516
517 do_action( 'usces_action_order_print_footer', $pdf, $data);
518 }
519 //Line
520 function usces_pdfSetLine($pdf) {
521
522 $pdf->Rect(14, 197.8, 153, 45, 'F');//Footer field
523 $line_top = 93.5;
524 $line_left = 15.4;
525 $line_right = $line_left + 150.1;
526 $line_bottom = $line_top + 147.9;
527 $line_footertop = 197.5;
528
529 // Horizontal lines
530 $pdf->SetLineWidth(0.5);
531 $pdf->Line($line_left, $line_top, $line_right, $line_top);
532 $pdf->Line($line_left, $line_top+6.5, $line_right, $line_top+6.5);
533 $pdf->Line($line_left, $line_top+104.0, $line_right, $line_top+104.0);
534 $pdf->SetLineWidth(0.04);
535 $pdf->Line(103.5, $line_footertop+5.9, $line_right, $line_footertop+5.9);
536 $pdf->Line(103.5, $line_footertop+5.9*2, $line_right, $line_footertop+5.9*2);
537 $pdf->Line(103.5, $line_footertop+5.9*3, $line_right, $line_footertop+5.9*3);
538 $pdf->Line(103.5, $line_footertop+5.9*4, $line_right, $line_footertop+5.9*4);
539 $pdf->SetLineWidth(0.5);
540 $pdf->Line(103.5, $line_footertop+5.9*5, $line_right, $line_footertop+5.9*5);
541 $pdf->Line(103.5, $line_footertop+5.9*6, $line_right, $line_footertop+5.9*6);
542 $pdf->Line($line_left, $line_bottom, $line_right, $line_bottom);
543
544 // Perpendicular lines
545 $pdf->SetLineWidth(0.5);
546 $pdf->Line($line_left, $line_top, $line_left, $line_bottom);
547 $pdf->SetLineWidth(0.04);
548 $pdf->Line(103.5, $line_top, 103.5, $line_footertop);
549 $pdf->SetLineWidth(0.5);
550 $pdf->Line(103.5, $line_footertop, 103.5, $line_bottom);
551 $pdf->SetLineWidth(0.04);
552 $pdf->Line(115.5, $line_top, 115.5, $line_footertop);
553 $pdf->Line(127, $line_top, 127, $line_footertop);
554 $pdf->Line(142.5, $line_top, 142.5, $line_bottom);
555 $pdf->SetLineWidth(0.5);
556 $pdf->Line($line_right, $line_top, $line_right, $line_bottom);
557
558 }
559 function usces_set_font_size( $size ){
560 $lineheight = $size / 2.6;
561 $linetop = $lineheight / 12;
562 return array($size, $lineheight, $linetop);
563 }
564
565 function usces_get_pdf_name( $data ){
566 global $usces, $usces_settings;
567 $options = get_option('usces');
568 $applyform = usces_get_apply_addressform($options['system']['addressform']);
569 $name = '';
570 switch ($applyform){
571 case 'JP':
572 $name = $data->customer['name1'] . ' ' . $data->customer['name2'];
573 break;
574 case 'US':
575 default:
576 $name = $data->customer['name2'] . ' ' . $data->customer['name1'];
577 }
578 return $name;
579 }
580
581 function usces_get_pdf_address(&$pdf, $data, $y, $linetop, $leftside, $width, $lineheight){
582 $options = get_option('usces');
583 $applyform = usces_get_apply_addressform($options['system']['addressform']);
584 $name = '';
585 $border = '';
586 switch ($applyform){
587 case 'JP':
588 $pdf->SetXY($leftside, $y);
589 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("zip code", 'usces') . ' ' . $data->customer['zip']), $border, 'L');
590 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['pref'] . $data->customer['address1'] . $data->customer['address2']), $border, 'L');
591
592 if( !empty($data->customer['address3']) ){
593 $y = $pdf->GetY() + $linetop;
594 $pdf->SetXY($leftside, $y);
595 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address3']), $border, 'L');
596 }
597 break;
598
599 case 'US':
600 default:
601 $pdf->SetXY($leftside, $y);
602 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address2'] . ' ' . $data->customer['address3']), $border, 'L');
603
604 $y = $pdf->GetY() + $linetop;
605 $pdf->SetXY($leftside, $y);
606 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address1'] . $data->customer['pref'] . $data->customer['country']), $border, 'L');
607
608 $y = $pdf->GetY() + $linetop;
609 $pdf->SetXY($leftside, $y);
610 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("zip code", 'usces') . ' ' . $data->customer['zip']), $border, 'L');
611 break;
612 }
613 }
614
615 function usces_get_pdf_myaddress(&$pdf, $lineheight){
616 global $usces;
617 $options = get_option('usces');
618 $applyform = usces_get_apply_addressform($options['system']['addressform']);
619 $name = '';
620 switch ($applyform){
621 case 'JP':
622 $address = ( empty($usces->options['address2']) ) ? $usces->options['address1'] : $usces->options['address1'] . "\n" . $usces->options['address2'];
623 $pdf->MultiCell(60, $lineheight, usces_conv_euc(__('zip code', 'usces').' '.$usces->options['zip_code']), 0, 'L');
624 $pdf->MultiCell(60, $lineheight, usces_conv_euc($address), 0, 'L');
625 break;
626
627 case 'US':
628 default:
629 $address = ( empty($usces->options['address2']) ) ? $usces->options['address1'] : $usces->options['address2'] . "\n" . $usces->options['address1'];
630 $pdf->MultiCell(60, $lineheight, usces_conv_euc($address), 0, 'L');
631 $pdf->MultiCell(60, $lineheight, usces_conv_euc(__('zip code', 'usces').' '.$usces->options['zip_code']), 0, 'L');
632 break;
633 }
634 }
635 ?>
636