PluginProbe
Welcart e-Commerce / 1.3.4
Welcart e-Commerce v1.3.4
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.4, at includes/order_print.php

634 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(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 $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 $optstr = '';
128 foreach($cart_row['options'] as $key => $value){
129 //20110629ysk start 0000190
130 //if( !empty($key) )
131 // $optstr .= esc_html($key) . ' = ' . esc_html(urldecode($value)) . "\n";
132 if( !empty($key) ) {
133 $key = urldecode($key);
134 if(is_array($value)) {
135 $c = '';
136 $optstr .= esc_html($key) . ' = ';
137 foreach($value as $v) {
138 $optstr .= $c.esc_html(urldecode($v));
139 $c = ', ';
140 }
141 $optstr .= "\n";
142 } else {
143 $optstr .= esc_html($key) . ' = ' . esc_html(urldecode($value)) . "\n";
144 }
145 }
146 //20110629ysk end
147 }
148 $optstr = apply_filters( 'usces_filter_option_pdf', $optstr, $cart_row['options']);
149 }
150 $optstr = apply_filters( 'usces_filter_all_option_pdf', $optstr, $cart_row['options'], $post_id, $sku, $cart_row['advance']);
151
152 $line_y[$index] = $next_y;
153
154 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
155 $pdf->SetFont(GOTHIC, '', $fontsize);
156 $pdf->SetXY($x-0.2, $line_y[$index]);
157 $pdf->MultiCell(3.6, $lineheight, '*', $border, 'C');
158 $pdf->SetXY($x+3.0, $line_y[$index]);
159 $pdf->MultiCell(84.6, $lineheight, usces_conv_euc($cartItemName), $border, 'L');
160 if( 'receipt' != $_REQUEST['type'] ){
161 list($fontsize, $lineheight, $linetop) = usces_set_font_size(8);
162 $pdf->SetFont(GOTHIC, '', $fontsize);
163 $pdf->SetXY($x+6.0, $pdf->GetY()+$linetop);
164 $pdf->MultiCell(81.6, $lineheight-0.2, usces_conv_euc($optstr), $border, 'L');
165 }
166
167 $pdf_args = compact( 'page', 'x', 'y', 'onep', 'next_y', 'line_x', 'border', 'index', 'cart_row' );
168 do_action( 'usces_action_order_print_cart_row', $pdf, $data, $pdf_args );
169
170 $next_y = $pdf->GetY()+2;
171 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
172 $pdf->SetFont(GOTHIC, '', $fontsize);
173 $pdf->SetXY($x+88.0, $line_y[$index]);
174 $pdf->MultiCell(11.5, $lineheight, usces_conv_euc($cart_row['quantity']), $border, 'R');
175 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
176 $pdf->SetFont(GOTHIC, '', $fontsize);
177 $pdf->SetXY($x+99.6, $line_y[$index]);
178 $pdf->MultiCell(11.5, $lineheight, usces_conv_euc($usces->getItemSkuUnit($post_id, urldecode($cart_row['sku']))), $border, 'C');
179 $pdf->SetXY($x+111.5, $line_y[$index]);
180 list($fontsize, $lineheight, $linetop) = usces_set_font_size(7);
181 $pdf->SetFont(GOTHIC, '', $fontsize);
182 $pdf->MultiCell(15.2, $lineheight, usces_conv_euc($usces->get_currency($cart_row['price'])), $border, 'R');
183 $pdf->SetXY($x+126.9, $line_y[$index]);
184 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
185 $pdf->SetFont(GOTHIC, '', $fontsize);
186 $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');
187
188 if( $onep < $next_y && 0 < $index ){
189 $pdf->Rect($x, $line_y[$index]-0.4, 149.5, 197.4-$line_y[$index], 'F');
190
191 $pdf->SetXY($x, 193);
192 $pdf->MultiCell(88, $lineheight, usces_conv_euc(__('It continues to next.', 'usces')), $border, 'C');
193
194 usces_pdfSetLine($pdf);
195 usces_pdfSetFooter($pdf, $data);
196 $index--;
197 $page++;
198 }
199 }
200
201 usces_pdfSetLine($pdf);
202 usces_pdfSetFooter($pdf, $data);
203
204 @ob_end_clean();
205
206 // Output
207 //*****************************************************************
208 header('Pragma:');
209 header('Cache-Control: application/octet-stream');
210 header("Content-type: application/pdf");
211 header('Content-Length: '.strlen($pdf->buffer));
212 $pdf->Output($filename, 'I');
213 }
214
215 //Header
216 function usces_pdfSetHeader($pdf, $data, $page) {
217 global $usces;
218 $border = 0;//border of cells
219
220 switch ( $_REQUEST['type'] ){
221 case 'mitumori':
222 $title = apply_filters( 'usces_filter_pdf_estimate_title', __('Estimate', 'usces'), $data );
223 $message = sprintf(__("Thank you for choosing '%s' we send you following estimate. ", 'usces'),
224 apply_filters('usces_filter_publisher', get_option('blogname')));
225 $message = apply_filters('usces_filter_pdf_estimate_message', $message, $data);
226 $juchubi = __('Valid:7days', 'usces');
227 $siharai = ' ';
228 $sign_image = apply_filters('usces_filter_pdf_estimate_sign', NULL);
229 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['date']));
230 break;
231
232 case 'nohin':
233 $title = apply_filters( 'usces_filter_pdf_invoice_title', __('Delivery Statement', 'usces'), $data );
234 $message = sprintf(__("Thak you for choosing '%s'. We deliver your items as following.", 'usces'),
235 apply_filters('usces_filter_publisher', get_option('blogname')));
236 $message = apply_filters('usces_filter_pdf_invoice_message', $message, $data);
237 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
238 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
239 $sign_image = apply_filters('usces_filter_pdf_invoice_sign', NULL);
240 //20120801ysk 0000510 start
241 //if( empty($data->order['delidue_date']) ){
242 // $effective_date = ' ';
243 if( !empty($data->order['delidue_date']) && '#none#' != $data->order['delidue_date'] ){
244 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['delidue_date']));
245 }else{
246 if( empty($data->order['modified']) )
247 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
248 else
249 $effective_date = date(__('M j, Y', 'usces'), strtotime($data->order['modified']));
250 }
251 $effective_date = apply_filters('usces_filter_pdf_effective_date', $effective_date);
252 //20120801ysk end
253 break;
254
255 case 'receipt':
256 $title = apply_filters( 'usces_filter_pdf_receipt_title', __('Receipt', 'usces'), $data );
257 $message = apply_filters('usces_filter_pdf_receipt_message', __("Your payment has been received.", 'usces'), $data);
258 $juchubi = __('date of receiving the order', 'usces').' : '.date(__('M j, Y', 'usces'), strtotime($data->order['date']));
259 $siharai = __('payment division', 'usces').' : ' . apply_filters('usces_filter_pdf_payment_name', $data->order['payment_name'], $data);
260 $sign_image = apply_filters('usces_filter_pdf_receipt_sign', NULL);
261 $receipted_date = $usces->get_order_meta_value('receipted_date', $data->order['ID']);
262 if( empty($receipted_date) )
263 $effective_date = date(__('M j, Y', 'usces'), current_time('timestamp', 0));
264 else
265 $effective_date = date(__('M j, Y', 'usces'), strtotime($receipted_date));
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 // $pdf->Rect(14, 24, 152, 61, 'F');//Label field of customer
280 // $pdf->Rect(14, 93, 153, 105, 'F');//Body field
281 $pdf->SetLineWidth(0.4);
282 $pdf->Line(65, 23, 110, 23);
283 $pdf->SetLineWidth(0.1);
284 $pdf->Line(124, 19, 167, 19);
285 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
286 $pdf->SetFont(GOTHIC, '', $fontsize);
287 $pdf->SetXY(125, 15.0);
288 $pdf->Write(5, 'No.');
289
290 // Title
291 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
292 $pdf->SetFont(GOTHIC, '', $fontsize);
293 $pdf->SetXY(64, 17);
294 $pdf->MultiCell(45.5, $lineheight, usces_conv_euc($title), $border, 'C');
295
296 // Date
297 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
298 $pdf->SetFont(GOTHIC, '', $fontsize);
299 $pdf->SetXY(64, 24.2);
300 $pdf->MultiCell(45.5, $lineheight, usces_conv_euc($effective_date), $border, 'C');
301
302 // Order No.
303 $pdf->SetXY(131, 15.4);
304 $pdf->MultiCell(36, $lineheight, usces_get_deco_order_id( $data->order['ID'] ), $border, 'R');
305
306 // Page No.
307 list($fontsize, $lineheight, $linetop) = usces_set_font_size(13);
308 $pdf->SetFont(GOTHIC, '', $fontsize);
309 $pdf->SetXY(15.5, 15.4);
310 $pdf->MultiCell(20, 7, $page.'/{nb}', 1, 'C');
311
312 $width = 80;
313 $leftside = 15;
314 $pdf->SetLeftMargin($leftside);
315
316 $person_honor = ( 'JP' == $usces->options['system']['currency'] ) ? "" : '';
317 $company_honor = ( 'JP' == $usces->options['system']['currency'] ) ? "御中" : '';
318 $currency_post = ( 'JP' == $usces->options['system']['currency'] ) ? "-" : '';
319
320 if( 'receipt' == $_REQUEST['type'] ){
321 $top = 40;
322 // Name of customer
323 $company = $usces->get_order_meta_value('cscs_company', $data->order['ID']);
324 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
325 $pdf->SetFont(GOTHIC, '', $fontsize);
326 $pdf->SetXY($leftside, $top);
327 if( empty($company) ){
328 $pdf->MultiCell($width, $lineheight, usces_conv_euc(usces_get_pdf_name( $data )), $border, 'L');
329 $x = $leftside + $width;
330 $y = $pdf->GetY() - $lineheight;
331 $pdf->SetXY($x, $y);
332 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_person_honor', $person_honor) ));
333 }else{
334 $pdf->MultiCell($width, $lineheight, usces_conv_euc($company), $border, 'L');
335 $x = $leftside + $width;
336 $y = $pdf->GetY() - $lineheight;
337 $pdf->SetXY($x, $y);
338 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_company_honor', $company_honor) ));
339 }
340 $y = $pdf->GetY() + $lineheight + $linetop;
341 $pdf->SetLineWidth(0.1);
342 $pdf->Line($leftside, $y, $leftside+$width+7, $y);
343
344 //Total
345 $y = $pdf->GetY() + $lineheight + 7;
346 list($fontsize, $lineheight, $linetop) = usces_set_font_size(20);
347 $pdf->SetFont(GOTHIC, '', $fontsize);
348 $pdf->SetXY($leftside+2, $y);
349 $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');
350
351 // Message
352 $y = $pdf->GetY() + $lineheight;
353 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
354 $pdf->SetFont(GOTHIC, '', $fontsize);
355 $pdf->SetXY($leftside, $y);
356 $pdf->MultiCell($width+70, $lineheight, usces_conv_euc($message), $border, 'L');
357
358 // Label
359 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
360 $pdf->SetFont(GOTHIC, '', $fontsize);
361 $y = 89.7;
362 $pdf->SetXY($leftside, $y);
363 $pdf->MultiCell(75, $lineheight, usces_conv_euc(__('Statement', 'usces')), $border, 'L');
364 }else{
365 $top = 35;
366 // Name of customer
367 $company = $usces->get_order_meta_value('cscs_company', $data->order['ID']);
368 list($fontsize, $lineheight, $linetop) = usces_set_font_size(15);
369 $pdf->SetFont(GOTHIC, '', $fontsize);
370 $pdf->SetXY($leftside, $top);
371 if( empty($company) ){
372 $pdf->MultiCell($width, $lineheight, usces_conv_euc(usces_get_pdf_name( $data )), $border, 'L');
373 $x = $leftside + $width;
374 $y = $pdf->GetY() - $lineheight;
375 $pdf->SetXY($x, $y);
376 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_person_honor', $person_honor) ));
377 $y = $pdf->GetY() + $lineheight + $linetop + 2;
378 }else{
379 $pdf->MultiCell($width, $lineheight, usces_conv_euc($company), $border, 'L');
380 $x = $leftside + $width;
381 $y = $pdf->GetY() - $lineheight;
382 $pdf->SetXY($x, $y);
383 $pdf->Write($lineheight ,usces_conv_euc( apply_filters( 'usces_filters_pdf_company_honor', $company_honor) ));
384 $y = $pdf->GetY() + $lineheight + $linetop;
385 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
386 $pdf->SetFont(GOTHIC, '', $fontsize);
387 $pdf->SetXY($leftside, $y);
388 $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');
389 $y = $pdf->GetY() + $linetop + 2;
390 }
391
392 // Address
393 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
394 $pdf->SetFont(GOTHIC, '', $fontsize);
395
396 usces_get_pdf_address($pdf, $data, $y, $linetop, $leftside, $width, $lineheight);
397
398 $pdf->MultiCell($width, $lineheight, usces_conv_euc('TEL ' . $data->customer['tel']), $border, 'L');
399
400 if( !empty($data->customer['fax']) ){
401 $y = $pdf->GetY() + $linetop;
402 $pdf->SetXY($leftside, $y);
403 $pdf->MultiCell($width, $lineheight, usces_conv_euc('FAX ' . $data->customer['fax']), $border, 'L');
404 }
405
406 $y = $pdf->GetY() + $linetop;
407 $pdf->SetLineWidth(0.1);
408 $pdf->Line($leftside, $y, $leftside+$width+5, $y);
409
410 // Message
411 $y = 77;
412 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
413 $pdf->SetFont(GOTHIC, '', $fontsize);
414 $pdf->SetXY($leftside, $y);
415 $pdf->MultiCell($width+70, $lineheight, usces_conv_euc($message), $border, 'L');
416
417 // Order date
418 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
419 $pdf->SetFont(GOTHIC, '', $fontsize);
420 $y = 89.7;
421 $pdf->SetXY($leftside, $y);
422 $pdf->MultiCell(75, $lineheight, usces_conv_euc($juchubi), $border, 'L');
423
424 // Payment method
425 $pdf->SetXY($leftside+76, $y);
426 $pdf->MultiCell(75, $lineheight, usces_conv_euc($siharai), $border, 'L');
427 }
428
429 // My company
430 if( !empty($sign_image) ){
431 $sign_data = apply_filters( 'usces_filter_pdf_sign_data', array(140, 40, 25, 25));
432 $pdf->Image($sign_image, $sign_data[0], $sign_data[1], $sign_data[2], $sign_data[3]);
433 }
434 $x = 110;
435 $y = 45;
436 $pdf->SetLeftMargin($x);
437 list($fontsize, $lineheight, $linetop) = usces_set_font_size(11);
438 $pdf->SetFont(GOTHIC, '', $fontsize);
439 $pdf->SetXY($x, $y);
440 $pdf->MultiCell(60, $lineheight, usces_conv_euc(apply_filters('usces_filter_publisher', get_option('blogname'))), 0, 'L');
441 list($fontsize, $lineheight, $linetop) = usces_set_font_size(10);
442 $pdf->SetFont(GOTHIC, '', $fontsize);
443 $pdf->MultiCell(60, $lineheight, usces_conv_euc(apply_filters('usces_filter_pdf_mycompany', $usces->options['company_name'])), 0, 'L');
444 usces_get_pdf_myaddress($pdf, $lineheight );
445 $pdf->MultiCell(60, $lineheight, usces_conv_euc('TEL:'.$usces->options['tel_number']), 0, 'L');
446 $pdf->MultiCell(60, $lineheight, usces_conv_euc('FAX:'.$usces->options['fax_number']), 0, 'L');
447 }
448
449 //Footer
450 function usces_pdfSetFooter($pdf, $data) {
451 global $usces;
452 $border = 0;
453
454 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
455 $pdf->SetFont(GOTHIC, '', $fontsize);
456
457 // Body label
458 $pdf->SetXY(15.5, 94.9);
459 $pdf->MultiCell(87.8, $lineheight, usces_conv_euc(__('item name','usces')), $border, 'C');
460 $pdf->SetXY(103.7, 94.9);
461 $pdf->MultiCell(11.4, $lineheight, usces_conv_euc(__('Quant','usces')), $border, 'C');
462 $pdf->SetXY(115.8, 94.9);
463 $pdf->MultiCell(11.0, $lineheight, usces_conv_euc(__('Unit', 'usces')), $border, 'C');
464 $pdf->SetXY(127.2, 94.9);
465 $pdf->MultiCell(15.0, $lineheight, usces_conv_euc(__('Price','usces')), $border, 'C');
466 $pdf->SetXY(142.9, 94.9);
467 $pdf->MultiCell(22.4, $lineheight, usces_conv_euc(__('Amount','usces').'('.usces_crcode('return').')'), $border, 'C');
468
469 // Footer label
470 $pdf->SetXY(104.3, 198.8);
471 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(__('total items', 'usces')), $border, 'C');
472 $pdf->SetXY(104.3, 204.8);
473 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_point_label', __('Used points', 'usces'))), $border, 'C');
474 $pdf->SetXY(104.3, 210.8);
475 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_disnount_label', __('Campaign disnount', 'usces'))), $border, 'C');
476 $pdf->SetXY(104.3, 216.7);
477 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_shipping_label', __('Shipping', 'usces'))), $border, 'C');
478 $pdf->SetXY(104.3, 222.7);
479 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_cod_label', __('COD fee', 'usces'))), $border, 'C');
480 $pdf->SetXY(104.3, 228.6);
481 $pdf->MultiCell(37.7, $lineheight, usces_conv_euc(apply_filters('usces_filter_tax_label', __('consumption tax', 'usces'))), $border, 'C');
482 $pdf->SetXY(104.3, 235.8);
483 $pdf->MultiCell(37.77, $lineheight, usces_conv_euc(__('Total Amount', 'usces')), $border, 'C');
484
485 list($fontsize, $lineheight, $linetop) = usces_set_font_size(8);
486 $pdf->SetFont(GOTHIC, '', $fontsize);
487 // Footer value
488 $pdf->SetXY(16.1, 198.8);
489 $pdf->MultiCell(86.6, $lineheight, usces_conv_euc( apply_filters('usces_filter_pdf_note', $data->order['note'], $data, $_REQUEST['type'])), $border, 'J');
490 list($fontsize, $lineheight, $linetop) = usces_set_font_size(9);
491 $pdf->SetFont(GOTHIC, '', $fontsize);
492 $pdf->SetXY(142.9, 198.8);
493 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc($usces->get_currency($data->order['item_total_price'])), $border, 'R');
494 $pdf->SetXY(142.9, 204.8);
495 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_point_vlue', $usces->get_currency($data->order['usedpoint']))), $border, 'R');
496 $pdf->SetXY(142.9, 210.8);
497 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_disnount_vlue', $usces->get_currency($data->order['discount']))), $border, 'R');
498 $pdf->SetXY(142.9, 216.7);
499 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_shipping_vlue', $usces->get_currency($data->order['shipping_charge']))), $border, 'R');
500 $pdf->SetXY(142.9, 222.7);
501 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_cod_vlue', $usces->get_currency($data->order['cod_fee']))), $border, 'R');
502
503 if( empty($usces->options['tax_rate']) ){
504 $tax = '('.__('In tax', 'usces').')'.$usces->get_currency($data->order['tax']);
505 }else{
506 $tax = $usces->get_currency($data->order['tax']);
507 }
508 $pdf->SetXY(142.9, 228.6);
509 $pdf->MultiCell(22.6, $lineheight, usces_conv_euc(apply_filters('usces_filter_tax_vlue', $tax, $data)), $border, 'R');
510 $pdf->SetXY(142.9, 235.8);
511 $pdf->MultiCell(22.67, $lineheight, usces_conv_euc($usces->get_currency($data->order['total_full_price'])), $border, 'R');
512
513 do_action( 'usces_action_order_print_footer', $pdf, $data);
514 }
515
516 //Line
517 function usces_pdfSetLine($pdf) {
518
519 $pdf->Rect(14, 197.8, 153, 45, 'F');//Footer field
520 $line_top = 93.5;
521 $line_left = 15.4;
522 $line_right = $line_left + 150.1;
523 $line_bottom = $line_top + 147.9;
524 $line_footertop = 197.5;
525
526 // Horizontal lines
527 $pdf->SetLineWidth(0.5);
528 $pdf->Line($line_left, $line_top, $line_right, $line_top);
529 $pdf->Line($line_left, $line_top+6.5, $line_right, $line_top+6.5);
530 $pdf->Line($line_left, $line_top+104.0, $line_right, $line_top+104.0);
531 $pdf->SetLineWidth(0.04);
532 $pdf->Line(103.5, $line_footertop+5.9, $line_right, $line_footertop+5.9);
533 $pdf->Line(103.5, $line_footertop+5.9*2, $line_right, $line_footertop+5.9*2);
534 $pdf->Line(103.5, $line_footertop+5.9*3, $line_right, $line_footertop+5.9*3);
535 $pdf->Line(103.5, $line_footertop+5.9*4, $line_right, $line_footertop+5.9*4);
536 $pdf->SetLineWidth(0.5);
537 $pdf->Line(103.5, $line_footertop+5.9*5, $line_right, $line_footertop+5.9*5);
538 $pdf->Line(103.5, $line_footertop+5.9*6, $line_right, $line_footertop+5.9*6);
539 $pdf->Line($line_left, $line_bottom, $line_right, $line_bottom);
540
541 // Perpendicular lines
542 $pdf->SetLineWidth(0.5);
543 $pdf->Line($line_left, $line_top, $line_left, $line_bottom);
544 $pdf->SetLineWidth(0.04);
545 $pdf->Line(103.5, $line_top, 103.5, $line_footertop);
546 $pdf->SetLineWidth(0.5);
547 $pdf->Line(103.5, $line_footertop, 103.5, $line_bottom);
548 $pdf->SetLineWidth(0.04);
549 $pdf->Line(115.5, $line_top, 115.5, $line_footertop);
550 $pdf->Line(127, $line_top, 127, $line_footertop);
551 $pdf->Line(142.5, $line_top, 142.5, $line_bottom);
552 $pdf->SetLineWidth(0.5);
553 $pdf->Line($line_right, $line_top, $line_right, $line_bottom);
554 }
555
556 function usces_set_font_size( $size ){
557 $lineheight = $size / 2.6;
558 $linetop = $lineheight / 12;
559 return array($size, $lineheight, $linetop);
560 }
561
562 function usces_get_pdf_name( $data ){
563 global $usces, $usces_settings;
564 $options = get_option('usces');
565 $applyform = usces_get_apply_addressform($options['system']['addressform']);
566 $name = '';
567 switch ($applyform){
568 case 'JP':
569 $name = $data->customer['name1'] . ' ' . $data->customer['name2'];
570 break;
571 case 'US':
572 default:
573 $name = $data->customer['name2'] . ' ' . $data->customer['name1'];
574 }
575 return $name;
576 }
577
578 function usces_get_pdf_address(&$pdf, $data, $y, $linetop, $leftside, $width, $lineheight){
579 $options = get_option('usces');
580 $applyform = usces_get_apply_addressform($options['system']['addressform']);
581 $name = '';
582 $border = '';
583 $pref = ( __( '-- Select --','usces') == $data->customer['pref'] ) ? '' : $data->customer['pref'];
584 switch ($applyform){
585 case 'JP':
586 $pdf->SetXY($leftside, $y);
587 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("zip code", 'usces') . ' ' . $data->customer['zip']), $border, 'L');
588 $pdf->MultiCell($width, $lineheight, usces_conv_euc($pref . $data->customer['address1'] . $data->customer['address2']), $border, 'L');
589
590 if( !empty($data->customer['address3']) ){
591 $y = $pdf->GetY() + $linetop;
592 $pdf->SetXY($leftside, $y);
593 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address3']), $border, 'L');
594 }
595 break;
596
597 case 'US':
598 default:
599 $pdf->SetXY($leftside, $y);
600 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address2'] . ' ' . $data->customer['address3']), $border, 'L');
601
602 $y = $pdf->GetY() + $linetop;
603 $pdf->SetXY($leftside, $y);
604 $pdf->MultiCell($width, $lineheight, usces_conv_euc($data->customer['address1'] . $pref . $data->customer['country']), $border, 'L');
605
606 $y = $pdf->GetY() + $linetop;
607 $pdf->SetXY($leftside, $y);
608 $pdf->MultiCell($width, $lineheight, usces_conv_euc(__("zip code", 'usces') . ' ' . $data->customer['zip']), $border, 'L');
609 break;
610 }
611 }
612
613 function usces_get_pdf_myaddress(&$pdf, $lineheight){
614 global $usces;
615 $options = get_option('usces');
616 $applyform = usces_get_apply_addressform($options['system']['addressform']);
617 $name = '';
618 switch ($applyform){
619 case 'JP':
620 $address = ( empty($usces->options['address2']) ) ? $usces->options['address1'] : $usces->options['address1'] . "\n" . $usces->options['address2'];
621 $pdf->MultiCell(60, $lineheight, usces_conv_euc(__('zip code', 'usces').' '.$usces->options['zip_code']), 0, 'L');
622 $pdf->MultiCell(60, $lineheight, usces_conv_euc($address), 0, 'L');
623 break;
624
625 case 'US':
626 default:
627 $address = ( empty($usces->options['address2']) ) ? $usces->options['address1'] : $usces->options['address2'] . "\n" . $usces->options['address1'];
628 $pdf->MultiCell(60, $lineheight, usces_conv_euc($address), 0, 'L');
629 $pdf->MultiCell(60, $lineheight, usces_conv_euc(__('zip code', 'usces').' '.$usces->options['zip_code']), 0, 'L');
630 break;
631 }
632 }
633 ?>
634