1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
pdf.php
См. документацию.
1<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();?><?
2$ORDER_ID = IntVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"]);
3if (!is_array($arOrder))
4 $arOrder = CSaleOrder::GetByID($ORDER_ID);
5
7 die();
8
9$pdf = new CSalePdf('P', 'pt', 'A4');
10
12{
13 $pdf->SetBackground(
15 CSalePaySystemAction::GetParamValue('BACKGROUND_STYLE')
16 );
17}
18
19$pageWidth = $pdf->GetPageWidth();
20$pageHeight = $pdf->GetPageHeight();
21
22$pdf->AddFont('Font', '', 'pt_sans-regular.ttf', true);
23$pdf->AddFont('Font', 'B', 'pt_sans-bold.ttf', true);
24
25$fontFamily = 'Font';
26$fontSize = 10.5;
27
29 'top' => intval(CSalePaySystemAction::GetParamValue('MARGIN_TOP') ?: 15) * 72/25.4,
30 'right' => intval(CSalePaySystemAction::GetParamValue('MARGIN_RIGHT') ?: 15) * 72/25.4,
31 'bottom' => intval(CSalePaySystemAction::GetParamValue('MARGIN_BOTTOM') ?: 15) * 72/25.4,
32 'left' => intval(CSalePaySystemAction::GetParamValue('MARGIN_LEFT') ?: 20) * 72/25.4
33);
34
35$width = $pageWidth - $margin['left'] - $margin['right'];
36
37$pdf->SetDisplayMode(100, 'continuous');
38$pdf->SetMargins($margin['left'], $margin['top'], $margin['right']);
39$pdf->SetAutoPageBreak(true, $margin['bottom']);
40
41$pdf->AddPage();
42
43
44$y0 = $pdf->GetY();
47
48if (CSalePaySystemAction::GetParamValue('PATH_TO_LOGO'))
49{
50 list($imageHeight, $imageWidth) = $pdf->GetImageSize(CSalePaySystemAction::GetParamValue('PATH_TO_LOGO'));
51
52 $logoHeight = $imageHeight + 5;
53 $logoWidth = $imageWidth + 5;
54
55 $pdf->Image(CSalePaySystemAction::GetParamValue('PATH_TO_LOGO'), $pdf->GetX(), $pdf->GetY());
56}
57
58$pdf->SetFont($fontFamily, 'B', $fontSize);
59
60$pdf->SetX($pdf->GetX() + $logoWidth);
62$pdf->Ln();
63
64if (CSalePaySystemAction::GetParamValue("SELLER_ADDRESS"))
65{
66 $pdf->SetX($pdf->GetX() + $logoWidth);
68 $pdf->Ln();
69}
70
71if (CSalePaySystemAction::GetParamValue("SELLER_PHONE"))
72{
73 $pdf->SetX($pdf->GetX() + $logoWidth);
74 $pdf->Write(15, CSalePdf::prepareToPdf(sprintf("Tel.: %s", CSalePaySystemAction::GetParamValue("SELLER_PHONE"))));
75 $pdf->Ln();
76}
77
78$pdf->Ln();
79$pdf->SetY(max($y0 + $logoHeight, $pdf->GetY()));
80$pdf->Ln();
81
82
83$pdf->SetFont($fontFamily, 'B', $fontSize*2);
84$pdf->Cell(0, 15, CSalePdf::prepareToPdf('Invoice'), 0, 0, 'C');
85
86$pdf->Ln();
87$pdf->Ln();
88$pdf->Ln();
89
90$pdf->SetFont($fontFamily, 'B', $fontSize);
91
93{
94 $pdf->Write(15, CSalePdf::prepareToPdf('To'));
95}
96
97$pdf->SetFont($fontFamily, '', $fontSize);
98
99$invoiceNo = CSalePdf::prepareToPdf($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ACCOUNT_NUMBER"]);
100$invoiceNoWidth = $pdf->GetStringWidth($invoiceNo);
101
104
107
109
110$pdf->Cell(0, 15, $invoiceNo, 0, 0, 'R');
111
112$pdf->SetFont($fontFamily, 'B', $fontSize);
113
115$titleWidth = $pdf->GetStringWidth($title);
116$pdf->SetX($pdf->GetX() - $invoiceInfoWidth - $titleWidth - 6);
117$pdf->Write(15, $title, 0, 0, 'R');
118$pdf->Ln();
119
120$pdf->SetFont($fontFamily, '', $fontSize);
121
123{
125}
126
127$pdf->Cell(0, 15, $invoiceDate, 0, 0, 'R');
128
129$pdf->SetFont($fontFamily, 'B', $fontSize);
130
131$title = CSalePdf::prepareToPdf('Issue Date: ');
132$titleWidth = $pdf->GetStringWidth($title);
133$pdf->SetX($pdf->GetX() - $invoiceInfoWidth - $titleWidth - 6);
134$pdf->Write(15, $title, 0, 0, 'R');
135$pdf->Ln();
136
137$pdf->SetFont($fontFamily, '', $fontSize);
138
140{
141 if (CSalePaySystemAction::GetParamValue("BUYER_ADDRESS"))
142 {
144 }
145}
146
147if (CSalePaySystemAction::GetParamValue("DATE_PAY_BEFORE"))
148{
149 $pdf->Cell(0, 15, $invoiceDueDate, 0, 0, 'R');
150
151 $pdf->SetFont($fontFamily, 'B', $fontSize);
152
153 $title = CSalePdf::prepareToPdf('Due Date: ');
154 $titleWidth = $pdf->GetStringWidth($title);
155 $pdf->SetX($pdf->GetX() - $invoiceInfoWidth - $titleWidth - 6);
156 $pdf->Write(15, $title, 0, 0, 'R');
157}
158
159$pdf->Ln();
160$pdf->Ln();
161$pdf->Ln();
162
163
164$pdf->SetFont($fontFamily, '', $fontSize);
165
166// Список товаров
168 array("NAME" => "ASC"),
169 array("ORDER_ID" => $ORDER_ID)
170);
171if ($arBasket = $dbBasket->Fetch())
172{
173 $arColsCaption = array(
174 1 => CSalePdf::prepareToPdf('#'),
175 CSalePdf::prepareToPdf('Item / Description'),
177 CSalePdf::prepareToPdf('Units'),
178 CSalePdf::prepareToPdf('Unit Price'),
181 );
182 $arCells = array();
183 $arProps = array();
184 $arRowsWidth = array(1 => 0, 0, 0, 0, 0, 0, 0);
185
186 for ($i = 1; $i <= 7; $i++)
187 $arRowsWidth[$i] = max($arRowsWidth[$i], $pdf->GetStringWidth($arColsCaption[$i]));
188
189 $n = 0;
190 $sum = 0.00;
191 $vat = 0;
192 $vats = array();
193 do
194 {
195 // props in busket product
196 $arProdProps = array();
197 $dbBasketProps = CSaleBasket::GetPropsList(
198 array("SORT" => "ASC", "ID" => "DESC"),
199 array(
200 "BASKET_ID" => $arBasket["ID"],
201 "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")
202 ),
203 false,
204 false,
205 array("ID", "BASKET_ID", "NAME", "VALUE", "CODE", "SORT")
206 );
207 while ($arBasketProps = $dbBasketProps->GetNext())
208 {
209 if (!empty($arBasketProps) && $arBasketProps["VALUE"] != "")
210 $arProdProps[] = $arBasketProps;
211 }
212 $arBasket["PROPS"] = $arProdProps;
213
214 // @TODO: replace with real vatless price
215 $arBasket["VATLESS_PRICE"] = roundEx($arBasket["PRICE"] / (1 + $arBasket["VAT_RATE"]), SALE_VALUE_PRECISION);
216
217 $arCells[++$n] = array(
219 CSalePdf::prepareToPdf($arBasket["NAME"]),
220 CSalePdf::prepareToPdf(roundEx($arBasket["QUANTITY"], SALE_VALUE_PRECISION)),
222 CSalePdf::prepareToPdf(SaleFormatCurrency($arBasket["VATLESS_PRICE"], $arBasket["CURRENCY"], true)),
223 CSalePdf::prepareToPdf(roundEx($arBasket["VAT_RATE"]*100, SALE_VALUE_PRECISION)."%"),
225 $arBasket["VATLESS_PRICE"] * $arBasket["QUANTITY"],
226 $arBasket["CURRENCY"],
227 true
228 ))
229 );
230
231 $arProps[$n] = array();
232 foreach ($arBasket["PROPS"] as $vv)
233 $arProps[$n][] = CSalePdf::prepareToPdf(sprintf("%s: %s", $vv["NAME"], $vv["VALUE"]));
234
235 for ($i = 1; $i <= 7; $i++)
236 $arRowsWidth[$i] = max($arRowsWidth[$i], $pdf->GetStringWidth($arCells[$n][$i]));
237
238 $sum += doubleval($arBasket["VATLESS_PRICE"] * $arBasket["QUANTITY"]);
239 $vat = max($vat, $arBasket["VAT_RATE"]);
240 if ($arBasket["VAT_RATE"] > 0)
241 {
242 if (!isset($vats[$arBasket["VAT_RATE"]]))
243 $vats[$arBasket["VAT_RATE"]] = 0;
244 $vats[$arBasket["VAT_RATE"]] += ($arBasket["PRICE"] - $arBasket["VATLESS_PRICE"]) * $arBasket["QUANTITY"];
245 }
246 }
247 while ($arBasket = $dbBasket->Fetch());
248
249 if (DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE_DELIVERY"]) > 0)
250 {
251 $arDelivery_tmp = CSaleDelivery::GetByID($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DELIVERY_ID"]);
252
253 $sDeliveryItem = "Shipping";
254 if (strlen($arDelivery_tmp["NAME"]) > 0)
255 $sDeliveryItem .= sprintf(" (%s)", $arDelivery_tmp["NAME"]);
256 $arCells[++$n] = array(
258 CSalePdf::prepareToPdf($sDeliveryItem),
262 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE_DELIVERY"] / (1 + $vat),
263 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"],
264 true
265 )),
268 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE_DELIVERY"] / (1 + $vat),
269 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"],
270 true
271 ))
272 );
273
274 for ($i = 1; $i <= 7; $i++)
275 $arRowsWidth[$i] = max($arRowsWidth[$i], $pdf->GetStringWidth($arCells[$n][$i]));
276
277 $sum += roundEx(
278 doubleval($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE_DELIVERY"] / (1 + $vat)),
280 );
281
282 if ($vat > 0)
283 $vats[$vat] += roundEx(
284 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE_DELIVERY"] * $vat / (1 + $vat),
286 );
287 }
288
289 $items = $n;
290
291 if ($sum < $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE"])
292 {
293 $arCells[++$n] = array(
294 1 => null,
295 null,
296 null,
297 null,
298 null,
299 CSalePdf::prepareToPdf("Subtotal:"),
300 CSalePdf::prepareToPdf(SaleFormatCurrency($sum, $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], true))
301 );
302
303 $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
304 }
305
306
307 if (!empty($vats))
308 {
309 // @TODO: remove on real vatless price implemented
310 $delta = intval(roundEx(
311 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["PRICE"] - $sum - array_sum($vats),
313 ) * pow(10, SALE_VALUE_PRECISION));
314 if ($delta)
315 {
316 $vatRates = array_keys($vats);
317 rsort($vatRates);
318
319 while (abs($delta) > 0)
320 {
321 foreach ($vatRates as $vatRate)
322 {
323 $vats[$vatRate] += abs($delta)/$delta / pow(10, SALE_VALUE_PRECISION);
324 $delta -= abs($delta)/$delta;
325
326 if ($delta == 0)
327 break 2;
328 }
329 }
330 }
331
332 foreach ($vats as $vatRate => $vatSum)
333 {
334 $arCells[++$n] = array(
335 1 => null,
336 null,
337 null,
338 null,
339 null,
341 "Sales Tax (%s%%):",
342 roundEx($vatRate * 100, SALE_VALUE_PRECISION)
343 )),
345 $vatSum,
346 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"],
347 true
348 ))
349 );
350
351 $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
352 }
353 }
354 else
355 {
356 $dbTaxList = CSaleOrderTax::GetList(
357 array("APPLY_ORDER" => "ASC"),
358 array("ORDER_ID" => $ORDER_ID)
359 );
360
361 while ($arTaxList = $dbTaxList->Fetch())
362 {
363 $arCells[++$n] = array(
364 1 => null,
365 null,
366 null,
367 null,
368 null,
370 "%s%s%s:",
371 ($arTaxList["IS_IN_PRICE"] == "Y") ? "Included " : "",
372 $arTaxList["TAX_NAME"],
373 sprintf(' (%s%%)', roundEx($arTaxList["VALUE"],SALE_VALUE_PRECISION))
374 )),
376 $arTaxList["VALUE_MONEY"],
377 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"],
378 true
379 ))
380 );
381
382 $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
383 }
384 }
385
386 if (DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SUM_PAID"]) > 0)
387 {
388 $arCells[++$n] = array(
389 1 => null,
390 null,
391 null,
392 null,
393 null,
394 CSalePdf::prepareToPdf("Payment made:"),
396 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SUM_PAID"],
397 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"],
398 true
399 ))
400 );
401
402 $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
403 }
404
405 if (DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DISCOUNT_VALUE"]) > 0)
406 {
407 $arCells[++$n] = array(
408 1 => null,
409 null,
410 null,
411 null,
412 null,
413 CSalePdf::prepareToPdf("Discount:"),
415 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DISCOUNT_VALUE"],
416 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"],
417 true
418 ))
419 );
420
421 $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
422 }
423
424 $arCells[++$n] = array(
425 1 => null,
426 null,
427 null,
428 null,
429 null,
430 CSalePdf::prepareToPdf("Total:"),
432 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"],
433 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"],
434 true
435 ))
436 );
437
438 $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
439
440 for ($i = 1; $i <= 7; $i++)
441 $arRowsWidth[$i] += 10;
442 if ($vat <= 0)
443 $arRowsWidth[6] = 0;
444 $arRowsWidth[2] = $width - (array_sum($arRowsWidth)-$arRowsWidth[2]);
445}
446$pdf->Ln();
447
448$x0 = $pdf->GetX();
449$y0 = $pdf->GetY();
450
451for ($i = 1; $i <= 7; $i++)
452{
453 if ($vat > 0 || $i != 6)
454 $pdf->Cell($arRowsWidth[$i], 20, $arColsCaption[$i], 0, 0, 'C');
455 ${"x$i"} = $pdf->GetX();
456}
457
458$pdf->Ln();
459
460$y5 = $pdf->GetY();
461
462$pdf->Line($x0, $y0, $x7, $y0);
463for ($i = 0; $i <= 7; $i++)
464{
465 if ($vat > 0 || $i != 6)
466 $pdf->Line(${"x$i"}, $y0, ${"x$i"}, $y5);
467}
468$pdf->Line($x0, $y5, $x7, $y5);
469
471for ($n = 1; $n <= $rowsCnt; $n++)
472{
473 $arRowsWidth_tmp = $arRowsWidth;
474 $accumulated = 0;
475 for ($j = 1; $j <= 7; $j++)
476 {
477 if (is_null($arCells[$n][$j]))
478 {
479 $accumulated += $arRowsWidth_tmp[$j];
480 $arRowsWidth_tmp[$j] = null;
481 }
482 else
483 {
484 $arRowsWidth_tmp[$j] += $accumulated;
485 $accumulated = 0;
486 }
487 }
488
489 $x0 = $pdf->GetX();
490 $y0 = $pdf->GetY();
491
492 $pdf->SetFont($fontFamily, '', $fontSize);
493
494 if (!is_null($arCells[$n][2]))
495 {
496 $text = $arCells[$n][2];
497 $cellWidth = $arRowsWidth_tmp[2];
498 }
499 else
500 {
501 $text = $arCells[$n][6];
502 $cellWidth = $arRowsWidth_tmp[6];
503 }
504
505 for ($l = 0; $pdf->GetStringWidth($text) > 0; $l++)
506 {
507 $pos = ($pdf->GetStringWidth($text) > $cellWidth)
508 ? strrpos(substr($text, 0, strlen($text)*$cellWidth/$pdf->GetStringWidth($text)), ' ')
509 : strlen($text);
510 if (!$pos)
511 $pos = strlen($text);
512
513 if (!is_null($arCells[$n][1]))
514 $pdf->Cell($arRowsWidth_tmp[1], 15, ($l == 0) ? $arCells[$n][1] : '', 0, 0, 'C');
515 if ($l == 0)
516 $x1 = $pdf->GetX();
517
518 if (!is_null($arCells[$n][2]))
519 $pdf->Cell($arRowsWidth_tmp[2], 15, substr($text, 0, $pos));
520 if ($l == 0)
521 $x2 = $pdf->GetX();
522
523 if (!is_null($arCells[$n][3]))
524 $pdf->Cell($arRowsWidth_tmp[3], 15, ($l == 0) ? $arCells[$n][3] : '', 0, 0, 'R');
525 if ($l == 0)
526 $x3 = $pdf->GetX();
527
528 if (!is_null($arCells[$n][4]))
529 $pdf->Cell($arRowsWidth_tmp[4], 15, ($l == 0) ? $arCells[$n][4] : '', 0, 0, 'R');
530 if ($l == 0)
531 $x4 = $pdf->GetX();
532
533 if (!is_null($arCells[$n][5]))
534 $pdf->Cell($arRowsWidth_tmp[5], 15, ($l == 0) ? $arCells[$n][5] : '', 0, 0, 'R');
535 if ($l == 0)
536 $x5 = $pdf->GetX();
537
538 if (!is_null($arCells[$n][6])) {
539 if (is_null($arCells[$n][2]))
540 $pdf->Cell($arRowsWidth_tmp[6], 15, substr($text, 0, $pos), 0, 0, 'R');
541 else if ($vat > 0)
542 $pdf->Cell($arRowsWidth_tmp[6], 15, ($l == 0) ? $arCells[$n][6] : '', 0, 0, 'R');
543 }
544 if ($l == 0)
545 $x6 = $pdf->GetX();
546
547 if (!is_null($arCells[$n][7]))
548 $pdf->Cell($arRowsWidth_tmp[7], 15, ($l == 0) ? $arCells[$n][7] : '', 0, 0, 'R');
549 if ($l == 0)
550 $x7 = $pdf->GetX();
551
552 $pdf->Ln();
553
554 $text = trim(substr($text, $pos));
555 }
556
557 if (isset($arProps[$n]) && is_array($arProps[$n]))
558 {
559 $pdf->SetFont($fontFamily, '', $fontSize-2);
560 foreach ($arProps[$n] as $property)
561 {
562 $pdf->Cell($arRowsWidth_tmp[1], 12, '');
563 $pdf->Cell($arRowsWidth_tmp[2], 12, $property);
564 $pdf->Cell($arRowsWidth_tmp[3], 12, '');
565 $pdf->Cell($arRowsWidth_tmp[4], 12, '');
566 $pdf->Cell($arRowsWidth_tmp[5], 12, '');
567 if ($vat > 0)
568 $pdf->Cell($arRowsWidth_tmp[6], 12, '');
569 $pdf->Cell($arRowsWidth_tmp[7], 12, '', 0, 1);
570 }
571 }
572
573 $y5 = $pdf->GetY();
574
575 if ($y0 > $y5)
576 $y0 = $margin['top'];
577 for ($i = (is_null($arCells[$n][1])) ? 6 : 0; $i <= 7; $i++)
578 {
579 if ($vat > 0 || $i != 5)
580 $pdf->Line(${"x$i"}, $y0, ${"x$i"}, $y5);
581 }
582
583 $pdf->Line((!is_null($arCells[$n][1])) ? $x0 : $x6, $y5, $x7, $y5);
584}
585$pdf->Ln();
586$pdf->Ln();
587$pdf->Ln();
588$pdf->Ln();
589
590
591$pdf->SetFont($fontFamily, 'B', $fontSize);
592
594{
595 $pdf->Write(15, CSalePdf::prepareToPdf('Terms & Conditions'));
596 $pdf->Ln();
597
598 $pdf->SetFont($fontFamily, '', $fontSize);
599
601 {
602 $pdf->Write(15, HTMLToTxt(preg_replace(
603 array('#</div>\s*<div[^>]*>#i', '#</?div>#i'), array('<br>', '<br>'),
605 ), '', array(), 0));
606 $pdf->Ln();
607 $pdf->Ln();
608 }
609
611 {
612 $pdf->Write(15, HTMLToTxt(preg_replace(
613 array('#</div>\s*<div[^>]*>#i', '#</?div>#i'), array('<br>', '<br>'),
615 ), '', array(), 0));
616 $pdf->Ln();
617 $pdf->Ln();
618 }
619}
620
621$pdf->Ln();
622$pdf->Ln();
623$pdf->Ln();
624
625if (CSalePaySystemAction::GetParamValue('PATH_TO_STAMP'))
626 $pdf->Image(CSalePaySystemAction::GetParamValue('PATH_TO_STAMP'), $margin['left']+$width/2+45, $pdf->GetY());
627
628
629$y0 = $pdf->GetY();
630
634
636{
637 $pdf->SetFont($fontFamily, 'B', $fontSize);
638
639 $pdf->Write(15, CSalePdf::prepareToPdf("Bank Details"));
640 $pdf->Ln();
641
642 $pdf->SetFont($fontFamily, '', $fontSize);
643
644 $bankDetails = '';
645
646 if (CSalePaySystemAction::GetParamValue("SELLER_NAME"))
647 {
648 $bankDetails .= CSalePdf::prepareToPdf(sprintf(
649 "Account Name: %s\n",
651 ));
652 }
653
654 $bankDetails .= CSalePdf::prepareToPdf(sprintf("Account #: %s\n", $bankAccNo));
655
657 $bankAddr = CSalePaySystemAction::GetParamValue("SELLER_BANK_ADDR");
658 $bankPhone = CSalePaySystemAction::GetParamValue("SELLER_BANK_PHONE");
659
660 if ($bank || $bankAddr || $bankPhone)
661 {
662 $bankDetails .= CSalePdf::prepareToPdf("Bank Name and Address: ");
663 if ($bank)
664 $bankDetails .= CSalePdf::prepareToPdf($bank);
665 $bankDetails .= CSalePdf::prepareToPdf("\n");
666
667 if ($bankAddr)
668 $bankDetails .= CSalePdf::prepareToPdf(sprintf("%s\n", $bankAddr));
669
670 if ($bankPhone)
671 {
672 $bankDetails .= CSalePdf::prepareToPdf(sprintf("%s\n", $bankPhone));
673 }
674 }
675
676 $bankDetails .= CSalePdf::prepareToPdf(sprintf("Bank's routing number: %s\n", $bankRouteNo));
677 $bankDetails .= CSalePdf::prepareToPdf(sprintf("Bank SWIFT: %s\n", $bankSwift));
678
679 $pdf->MultiCell($width/2, 15, $bankDetails, 0, 'L');
680}
681
682$pdf->SetY($y0 + 15);
684{
685 $isDirSign = false;
686 if (CSalePaySystemAction::GetParamValue('SELLER_DIR_SIGN'))
687 {
688 list($signHeight, $signWidth) = $pdf->GetImageSize(CSalePaySystemAction::GetParamValue('SELLER_DIR_SIGN'));
689
690 if ($signHeight && $signWidth)
691 {
692 $ratio = min(37.5/$signHeight, 150/$signWidth);
693 $signHeight = $ratio * $signHeight;
694 $signWidth = $ratio * $signWidth;
695
696 $isDirSign = true;
697 }
698 }
699
700 if (CSalePaySystemAction::GetParamValue("SELLER_DIR"))
701 {
702 $pdf->SetX($pdf->GetX() + $width/2 + 15);
704 $pdf->Ln();
705 $pdf->Ln();
706 }
707
708 $pdf->SetX($pdf->GetX() + $width/2 + 15);
709 $pdf->Write(15, CSalePdf::prepareToPdf('The Director '));
710
711 $pdf->Cell(0, 15, '', 'B');
712
713 if ($isDirSign)
714 {
715 $pdf->Image(
716 CSalePaySystemAction::GetParamValue('SELLER_DIR_SIGN'),
717 $pdf->GetX() - 150, $pdf->GetY() - $signHeight + 15,
718 $signWidth, $signHeight
719 );
720 }
721
722 $pdf->Ln();
723 $pdf->Ln();
724}
725
727{
728 $isAccSign = false;
729 if (CSalePaySystemAction::GetParamValue('SELLER_ACC_SIGN'))
730 {
731 list($signHeight, $signWidth) = $pdf->GetImageSize(CSalePaySystemAction::GetParamValue('SELLER_ACC_SIGN'));
732
733 if ($signHeight && $signWidth)
734 {
735 $ratio = min(37.5/$signHeight, 150/$signWidth);
736 $signHeight = $ratio * $signHeight;
737 $signWidth = $ratio * $signWidth;
738
739 $isAccSign = true;
740 }
741 }
742
743 if (CSalePaySystemAction::GetParamValue("SELLER_ACC"))
744 {
745 $pdf->SetX($pdf->GetX() + $width/2 + 15);
747 $pdf->Ln();
748 $pdf->Ln();
749 }
750
751 $pdf->SetX($pdf->GetX() + $width/2 + 15);
752 $pdf->Write(15, CSalePdf::prepareToPdf('The Accountant '));
753
754 $pdf->Cell(0, 15, '', 'B');
755
756 if ($isAccSign)
757 {
758 $pdf->Image(
759 CSalePaySystemAction::GetParamValue('SELLER_ACC_SIGN'),
760 $pdf->GetX() - 150, $pdf->GetY() - $signHeight + 15,
761 $signWidth, $signHeight
762 );
763 }
764
765 $pdf->Ln();
766}
767
768
769$dest = 'I';
770if ($_REQUEST['GET_CONTENT'] == 'Y')
771 $dest = 'S';
772else if ($_REQUEST['DOWNLOAD'] == 'Y')
773 $dest = 'D';
774
775return $pdf->Output(
776 sprintf(
777 'Invoice # %s (Issue Date %s).pdf',
778 $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ACCOUNT_NUMBER"],
779 ConvertDateTime($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DATE_INSERT"], 'YYYY-MM-DD')
780 ), $dest
781);
$sum
Определения checkout.php:6
static GetByID($ID)
Определения delivery.php:249
static GetParamValue($key, $defaultValue=null)
Определения pay_system_action.php:76
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения basket.php:33
static GetPropsList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения basket.php:317
static GetList($arOrder=array("TAX_NAME"=> "ASC"), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения order_tax.php:7
Определения pdf.php:312
static isPdfAvailable()
Определения pdf.php:316
static prepareToPdf($string)
Определения pdf.php:324
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
const FORMAT_DATE
Определения include.php:63
$l
Определения options.php:783
ConvertDateTime($datetime, $to_format=false, $from_site=false, $bSearchInSitesOnly=false)
Определения tools.php:724
roundEx($value, $prec=0)
Определения tools.php:4635
HTMLToTxt($str, $strSiteUrl="", $aDelete=[], $maxlen=70)
Определения tools.php:2587
$delta
Определения prolog_main_admin.php:363
die
Определения quickway.php:367
$invoiceDueDate
Определения template_pdf.php:172
$invoiceDate
Определения template_pdf.php:169
$invoiceDateWidth
Определения template_pdf.php:170
$invoiceInfoWidth
Определения template_pdf.php:178
$invoiceNo
Определения template_pdf.php:166
$invoiceDueDateWidth
Определения template_pdf.php:176
$text
Определения template_pdf.php:79
$invoiceNoWidth
Определения template_pdf.php:167
for( $i=0, $max=count( $arBasketIDs);$i< $max;$i++) if($arOrder['DELIVERY_VAT_RATE'] > 0) if(is_array( $arBasketOrder) &&!empty( $arBasketOrder)) if(floatval($arOrder["DISCOUNT_VALUE"]) > 0) $arTaxList
Определения factura.php:640
$i
Определения factura.php:643
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$ORDER_ID
Определения html.php:2
$pageWidth
Определения html.php:24
if( $arBasket=$dbBasket->Fetch()) if($vat > 0) $rowsCnt
Определения html.php:430
$width
Определения html.php:68
$bankSwift
Определения html.php:594
if(CSalePaySystemAction::GetParamValue("DATE_PAY_BEFORE", false)) $dbBasket
Определения html.php:162
if(!empty($sellerData)) $bankAccNo
Определения html.php:591
$bank
Определения html.php:595
if(CSalePaySystemAction::GetParamValue('BACKGROUND', false)) $margin
Определения html.php:61
$pageHeight
Определения html.php:25
$logoWidth
Определения pdf.php:49
$y5
Определения pdf.php:464
$logoHeight
Определения pdf.php:48
if(!empty($sellerData)) $dest
Определения pdf.php:818
$fontSize
Определения pdf.php:30
$pdf
Определения pdf.php:13
$fontFamily
Определения pdf.php:29
$x0
Определения pdf.php:452
$y0
Определения pdf.php:47
$vat
Определения template.php:273
$bankRouteNo
Определения template.php:566
$arCells
Определения template.php:223
$items
Определения template.php:224
SaleFormatCurrency($fSum, $strCurrency, $OnlyValue=false, $withoutFormat=false)
Определения include.php:142
const SALE_VALUE_PRECISION
Определения include.php:46
$titleWidth
Определения pdf.php:124
$title
Определения pdf.php:123
$x4
Определения pdf.php:128
$x2
Определения pdf.php:124
$x3
Определения pdf.php:126
$isAccSign
Определения pdf.php:601
$GLOBALS['_____370096793']
Определения update_client.php:1
$n
Определения update_log.php:107
$arRowsWidth
Определения template_pdf.php:446
$vatRates
Определения yandex_detail.php:156
$x1
Определения template_pdf.php:419