PluginProbe
Welcart e-Commerce / 1.3.3
Welcart e-Commerce v1.3.3
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.3, at includes/order_print.php

638 lines 25.6 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 @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
266 break;
267
268 case 'bill':
269 $title = apply_filters( 'usces_filter_pdf_bill_title', __('Invoice', 'usces'), $data );
270 $message = apply_filters('usces_filter_pdf_bill_message', __("Please remit payment at your earliest convenience.", 'usces'), $data);
271 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
272 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
273 $sign_image = apply_filters('usces_filter_pdf_bill_sign', NULL);
274 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
275 break;
276 }
277 $effective_date = apply_filters('usces_filter_pdf_effective_date', $effective_date, $_REQUEST['type'], $data);
278
279
280 // $pdf->Rect(14, 24, 152, 61, 'F');//Label field of customer
281 // $pdf->Rect(14, 93, 153, 105, 'F');//Body field
282 $pdf->SetLineWidth(0.4);
283 $pdf->Line(65, 23, 110, 23);
284 $pdf->SetLineWidth(0.1);
285 $pdf->Line(124, 19, 167, 19);
286 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
287 $pdf->SetFont(GOTHIC, '', $fontsize);
288 $pdf->SetXY(125, 15.0);
289 $pdf->Write(5, 'No.');
290
291 // Title
292 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
293 $pdf->SetFont(GOTHIC, '', $fontsize);
294 $pdf->SetXY(64, 17);
295 $pdf->MultiCell(45.5, $lineheight, usces_conv_euc($title), $border, 'C');
296
297 // Date
298 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
299 $pdf->SetFont(GOTHIC, '', $fontsize);
300 $pdf->SetXY(64, 24.2);
301 $pdf->MultiCell(45.5, $lineheight, usces_conv_euc($effective_date), $border, 'C');
302
303 // Order No.
304 $pdf->SetXY(131, 15.4);
305 $pdf->MultiCell(36, $lineheight, usces_get_deco_order_id( $data->order['ID'] ), $border, 'R');
306
307 // Page No.
308 list($fontsize, $lineheight, $linetop) = usces_set_font_size(13);
309 $pdf->SetFont(GOTHIC, '', $fontsize);
310 $pdf->SetXY(15.5, 15.4);
311 $pdf->MultiCell(20, 7, $page.'/{nb}', 1, 'C');
312
313 $width = 80;
314 $leftside = 15;
315 $pdf->SetLeftMargin($leftside);
316
317 $person_honor = ( 'JP' == $usces->options['system']['currency'] ) ? "" : '';
318 $company_honor = ( 'JP' == $usces->options['system']['currency'] ) ? "御中" : '';
319 $currency_post = ( 'JP' == $usces->options['system']['currency'] ) ? "-" : '';
320
321 if( 'receipt' == $_REQUEST['type'] ){
322 $top = 40;
323 // Name of customer
324 $company = $usces->get_order_meta_value('cscs_company', $data->order['ID']);
325 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
326 $pdf->SetFont(GOTHIC, '', $fontsize);
327 $pdf->SetXY($leftside, $top);
328 if( empty($company) ){
329 $pdf->MultiCell($width, $lineheight, usces_conv_euc(usces_get_pdf_name( $data )), $border, 'L');
330 $x = $leftside + $width;
331 $y = $pdf->GetY() - $lineheight;
332 $pdf->SetXY($x, $y);
333 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_person_honor', $person_honor) ));
334 }else{
335 $pdf->MultiCell($width, $lineheight, usces_conv_euc($company), $border, 'L');
336 $x = $leftside + $width;
337 $y = $pdf->GetY() - $lineheight;
338 $pdf->SetXY($x, $y);
339 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_company_honor', $company_honor) ));
340 }
341 $y = $pdf->GetY() + $lineheight + $linetop;
342 $pdf->SetLineWidth(0.1);
343 $pdf->Line($leftside, $y, $leftside+$width+7, $y);
344
345 //Total
346 $y = $pdf->GetY() + $lineheight + 7;
347 list($fontsize, $lineheight, $linetop) = usces_set_font_size(20);
348 $pdf->SetFont(GOTHIC, '', $fontsize);
349 $pdf->SetXY($leftside+2, $y);
350 $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');
351
352 // Message
353 $y = $pdf->GetY() + $lineheight;
354 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
355 $pdf->SetFont(GOTHIC, '', $fontsize);
356 $pdf->SetXY($leftside, $y);
357 $pdf->MultiCell($width+70, $lineheight, usces_conv_euc($message), $border, 'L');
358
359 // Label
360 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
361 $pdf->SetFont(GOTHIC, '', $fontsize);
362 $y = 89.7;
363 $pdf->SetXY($leftside, $y);
364 $pdf->MultiCell(75, $lineheight, usces_conv_euc(__('Statement', 'usces')), $border, 'L');
365 }else{
366 $top = 35;
367 // Name of customer
368 $company = $usces->get_order_meta_value('cscs_company', $data->order['ID']);
369 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
370 $pdf->SetFont(GOTHIC, '', $fontsize);
371 $pdf->SetXY($leftside, $top);
372 if( empty($company) ){
373 $pdf->MultiCell($width, $lineheight, usces_conv_euc(usces_get_pdf_name( $data )), $border, 'L');
374 $x = $leftside + $width;
375 $y = $pdf->GetY() - $lineheight;
376 $pdf->SetXY($x, $y);
377 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_person_honor', $person_honor) ));
378 $y = $pdf->GetY() + $lineheight + $linetop + 2;
379 }else{
380 $pdf->MultiCell($width, $lineheight, usces_conv_euc($company), $border, 'L');
381 $x = $leftside + $width;
382 $y = $pdf->GetY() - $lineheight;
383 $pdf->SetXY($x, $y);
384 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_company_honor', $company_honor) ));
385 $y = $pdf->GetY() + $lineheight + $linetop;
386 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
387 $pdf->SetFont(GOTHIC, '', $fontsize);
388 $pdf->SetXY($leftside, $y);
389 $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');
390 $y = $pdf->GetY() + $linetop + 2;
391 }
392
393 // Address
394 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
395 $pdf->SetFont(GOTHIC, '', $fontsize);
396
397 usces_get_pdf_address($pdf, $data, $y, $linetop, $leftside, $width, $lineheight);
398
399 $pdf->MultiCell($width, $lineheight, usces_conv_euc('TEL ' . $data->customer['tel']), $border, 'L');
400
401 if( !empty($data->customer['fax']) ){
402 $y = $pdf->GetY() + $linetop;
403 $pdf->SetXY($leftside, $y);
404 $pdf->MultiCell($width, $lineheight, usces_conv_euc('FAX ' . $data->customer['fax']), $border, 'L');
405 }
406
407
408 $y = $pdf->GetY() + $linetop;
409 $pdf->SetLineWidth(0.1);
410 $pdf->Line($leftside, $y, $leftside+$width+5, $y);
411
412
413 // Message
414 $y = 77;
415 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
416 $pdf->SetFont(GOTHIC, '', $fontsize);
417 $pdf->SetXY($leftside, $y);
418 $pdf->MultiCell($width+70, $lineheight, usces_conv_euc($message), $border, 'L');
419
420 // Order date
421 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
422 $pdf->SetFont(GOTHIC, '', $fontsize);
423 $y = 89.7;
424 $pdf->SetXY($leftside, $y);
425 $pdf->MultiCell(75, $lineheight, usces_conv_euc($juchubi), $border, 'L');
426
427 // Payment method
428 $pdf->SetXY($leftside+76, $y);
429 $pdf->MultiCell(75, $lineheight, usces_conv_euc($siharai), $border, 'L');
430 }
431
432 // My company
433 if( !empty($sign_image) ){
434 $sign_data = apply_filters( 'usces_filter_pdf_sign_data', array(140, 40, 25, 25));
435 $pdf->Image($sign_image, $sign_data[0], $sign_data[1], $sign_data[2], $sign_data[3]);
436 }
437 $x = 110;
438 $y = 45;
439 $pdf->SetLeftMargin($x);
440 list($fontsize, $lineheight, $linetop) = usces_set_font_size(11);
441 $pdf->SetFont(GOTHIC, '', $fontsize);
442 $pdf->SetXY($x, $y);
443 $pdf->MultiCell(60, $lineheight, usces_conv_euc(apply_filters('usces_filter_publisher', get_option('blogname'))), 0, 'L');
444 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
445 $pdf->SetFont(GOTHIC, '', $fontsize);
446 $pdf->MultiCell(60, $lineheight, usces_conv_euc(apply_filters('usces_filter_pdf_mycompany', $usces->options['company_name'])), 0, 'L');
447 usces_get_pdf_myaddress($pdf, $lineheight );
448 $pdf->MultiCell(60, $lineheight, usces_conv_euc('TEL:'.$usces->options['tel_number']), 0, 'L');
449 $pdf->MultiCell(60, $lineheight, usces_conv_euc('FAX:'.$usces->options['fax_number']), 0, 'L');
450
451
452
453 }
454 //Footer
455 function usces_pdfSetFooter($pdf, $data) {
456 global $usces;
457 $border = 0;
458
459
460 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
461 $pdf->SetFont(GOTHIC, '', $fontsize);
462
463 // Body label
464 $pdf->SetXY(15.5, 94.9);
465 $pdf->MultiCell(87.8, $lineheight, usces_conv_euc(__('item name','usces')), $border, 'C');
466 $pdf->SetXY(103.7, 94.9);
467 $pdf->MultiCell(11.4, $lineheight, usces_conv_euc(__('Quant','usces')), $border, 'C');
468 $pdf->SetXY(115.8, 94.9);
469 $pdf->MultiCell(11.0, $lineheight, usces_conv_euc(__('Unit', 'usces')), $border, 'C');
470 $pdf->SetXY(127.2, 94.9);
471 $pdf->MultiCell(15.0, $lineheight, usces_conv_euc(__('Price','usces')), $border, 'C');
472 $pdf->SetXY(142.9, 94.9);
473 $pdf->MultiCell(22.4, $lineheight, usces_conv_euc(__('Amount','usces').'('.usces_crcode('return').')'), $border, 'C');
474
475 // Footer label
476 $pdf->SetXY(104.3, 198.8);
477 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(__('total items', 'usces')), $border, 'C');
478 $pdf->SetXY(104.3, 204.8);
479 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_point_label', __('Used points', 'usces'))), $border, 'C');
480 $pdf->SetXY(104.3, 210.8);
481 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_disnount_label', __('Campaign disnount', 'usces'))), $border, 'C');
482 $pdf->SetXY(104.3, 216.7);
483 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_shipping_label', __('Shipping', 'usces'))), $border, 'C');
484 $pdf->SetXY(104.3, 222.7);
485 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_cod_label', __('COD fee', 'usces'))), $border, 'C');
486 $pdf->SetXY(104.3, 228.6);
487 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_tax_label', __('consumption tax', 'usces'))), $border, 'C');
488 $pdf->SetXY(104.3, 235.8);
489 $pdf->MultiCell(37.77, $lineheight, usces_conv_euc(__('Total Amount', 'usces')), $border, 'C');
490
491 list($fontsize, $lineheight, $linetop) = usces_set_font_size(8);
492 $pdf->SetFont(GOTHIC, '', $fontsize);
493 // Footer value
494 $pdf->SetXY(16.1, 198.8);
495 $pdf->MultiCell(86.6, $lineheight, usces_conv_euc( apply_filters('usces_filter_pdf_note', $data->order['note'], $data, $_REQUEST['type'])), $border, 'J');
496 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
497 $pdf->SetFont(GOTHIC, '', $fontsize);
498 $pdf->SetXY(142.9, 198.8);
499 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc($usces->get_currency($data->order['item_total_price'])), $border, 'R');
500 $pdf->SetXY(142.9, 204.8);
501 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_point_vlue', $usces->get_currency($data->order['usedpoint']))), $border, 'R');
502 $pdf->SetXY(142.9, 210.8);
503 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_disnount_vlue', $usces->get_currency($data->order['discount']))), $border, 'R');
504 $pdf->SetXY(142.9, 216.7);
505 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_shipping_vlue', $usces->get_currency($data->order['shipping_charge']))), $border, 'R');
506 $pdf->SetXY(142.9, 222.7);
507 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_cod_vlue', $usces->get_currency($data->order['cod_fee']))), $border, 'R');
508
509 if( empty($usces->options['tax_rate']) ){
510 $tax = '('.__('In tax', 'usces').')'.$usces->get_currency($data->order['tax']);
511 }else{
512 $tax = $usces->get_currency($data->order['tax']);
513 }
514 $pdf->SetXY(142.9, 228.6);
515 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_tax_vlue', $tax, $data)), $border, 'R');
516 $pdf->SetXY(142.9, 235.8);
517 $pdf->MultiCell(22.67, $lineheight, usces_conv_euc($usces->get_currency($data->order['total_full_price'])), $border, 'R');
518
519 do_action( 'usces_action_order_print_footer', $pdf, $data);
520 }
521 //Line
522 function usces_pdfSetLine($pdf) {
523
524 $pdf->Rect(14, 197.8, 153, 45, 'F');//Footer field
525 $line_top = 93.5;
526 $line_left = 15.4;
527 $line_right = $line_left + 150.1;
528 $line_bottom = $line_top + 147.9;
529 $line_footertop = 197.5;
530
531 // Horizontal lines
532 $pdf->SetLineWidth(0.5);
533 $pdf->Line($line_left, $line_top, $line_right, $line_top);
534 $pdf->Line($line_left, $line_top+6.5, $line_right, $line_top+6.5);
535 $pdf->Line($line_left, $line_top+104.0, $line_right, $line_top+104.0);
536 $pdf->SetLineWidth(0.04);
537 $pdf->Line(103.5, $line_footertop+5.9, $line_right, $line_footertop+5.9);
538 $pdf->Line(103.5, $line_footertop+5.9*2, $line_right, $line_footertop+5.9*2);
539 $pdf->Line(103.5, $line_footertop+5.9*3, $line_right, $line_footertop+5.9*3);
540 $pdf->Line(103.5, $line_footertop+5.9*4, $line_right, $line_footertop+5.9*4);
541 $pdf->SetLineWidth(0.5);
542 $pdf->Line(103.5, $line_footertop+5.9*5, $line_right, $line_footertop+5.9*5);
543 $pdf->Line(103.5, $line_footertop+5.9*6, $line_right, $line_footertop+5.9*6);
544 $pdf->Line($line_left, $line_bottom, $line_right, $line_bottom);
545
546 // Perpendicular lines
547 $pdf->SetLineWidth(0.5);
548 $pdf->Line($line_left, $line_top, $line_left, $line_bottom);
549 $pdf->SetLineWidth(0.04);
550 $pdf->Line(103.5, $line_top, 103.5, $line_footertop);
551 $pdf->SetLineWidth(0.5);
552 $pdf->Line(103.5, $line_footertop, 103.5, $line_bottom);
553 $pdf->SetLineWidth(0.04);
554 $pdf->Line(115.5, $line_top, 115.5, $line_footertop);
555 $pdf->Line(127, $line_top, 127, $line_footertop);
556 $pdf->Line(142.5, $line_top, 142.5, $line_bottom);
557 $pdf->SetLineWidth(0.5);
558 $pdf->Line($line_right, $line_top, $line_right, $line_bottom);
559
560 }
561 function usces_set_font_size( $size ){
562 $lineheight = $size / 2.6;
563 $linetop = $lineheight / 12;
564 return array($size, $lineheight, $linetop);
565 }
566
567 function usces_get_pdf_name( $data ){
568 global $usces, $usces_settings;
569 $options = get_option('usces');
570 $applyform = usces_get_apply_addressform($options['system']['addressform']);
571 $name = '';
572 switch ($applyform){
573 case 'JP':
574 $name = $data->customer['name1'] . ' ' . $data->customer['name2'];
575 break;
576 case 'US':
577 default:
578 $name = $data->customer['name2'] . ' ' . $data->customer['name1'];
579 }
580 return $name;
581 }
582
583 function usces_get_pdf_address(&$pdf, $data, $y, $linetop, $leftside, $width, $lineheight){
584 $options = get_option('usces');
585 $applyform = usces_get_apply_addressform($options['system']['addressform']);
586 $name = '';
587 $border = '';
588 switch ($applyform){
589 case 'JP':
590 $pdf->SetXY($leftside, $y);
591 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("zip code", 'usces') . ' ' . $data->customer['zip']), $border, 'L');
592 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['pref'] . $data->customer['address1'] . $data->customer['address2']), $border, 'L');
593
594 if( !empty($data->customer['address3']) ){
595 $y = $pdf->GetY() + $linetop;
596 $pdf->SetXY($leftside, $y);
597 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address3']), $border, 'L');
598 }
599 break;
600
601 case 'US':
602 default:
603 $pdf->SetXY($leftside, $y);
604 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address2'] . ' ' . $data->customer['address3']), $border, 'L');
605
606 $y = $pdf->GetY() + $linetop;
607 $pdf->SetXY($leftside, $y);
608 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address1'] . $data->customer['pref'] . $data->customer['country']), $border, 'L');
609
610 $y = $pdf->GetY() + $linetop;
611 $pdf->SetXY($leftside, $y);
612 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("zip code", 'usces') . ' ' . $data->customer['zip']), $border, 'L');
613 break;
614 }
615 }
616
617 function usces_get_pdf_myaddress(&$pdf, $lineheight){
618 global $usces;
619 $options = get_option('usces');
620 $applyform = usces_get_apply_addressform($options['system']['addressform']);
621 $name = '';
622 switch ($applyform){
623 case 'JP':
624 $address = ( empty($usces->options['address2']) ) ? $usces->options['address1'] : $usces->options['address1'] . "\n" . $usces->options['address2'];
625 $pdf->MultiCell(60, $lineheight, usces_conv_euc(__('zip code', 'usces').' '.$usces->options['zip_code']), 0, 'L');
626 $pdf->MultiCell(60, $lineheight, usces_conv_euc($address), 0, 'L');
627 break;
628
629 case 'US':
630 default:
631 $address = ( empty($usces->options['address2']) ) ? $usces->options['address1'] : $usces->options['address2'] . "\n" . $usces->options['address1'];
632 $pdf->MultiCell(60, $lineheight, usces_conv_euc($address), 0, 'L');
633 $pdf->MultiCell(60, $lineheight, usces_conv_euc(__('zip code', 'usces').' '.$usces->options['zip_code']), 0, 'L');
634 break;
635 }
636 }
637 ?>
638