2if (!defined(
"B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !==
true)
13if (
$params[
'BILLDE_BACKGROUND'])
17 $params[
'BILLDE_BACKGROUND_STYLE']
24$pdf->AddFont(
'Font',
'',
'pt_sans-regular.ttf',
true);
25$pdf->AddFont(
'Font',
'B',
'pt_sans-bold.ttf',
true);
31 'top' => intval(
$params[
'BILLDE_MARGIN_TOP'] ?: 15) * 72/25.4,
32 'right' => intval(
$params[
'BILLDE_MARGIN_RIGHT'] ?: 15) * 72/25.4,
33 'bottom' => intval(
$params[
'BILLDE_MARGIN_BOTTOM'] ?: 15) * 72/25.4,
34 'left' => intval(
$params[
'BILLDE_MARGIN_LEFT'] ?: 20) * 72/25.4
39$pdf->SetDisplayMode(100,
'continuous');
49if (
$params[
'BILLDE_PATH_TO_LOGO'])
51 list($imageHeight, $imageWidth) =
$pdf->GetImageSize(
$params[
'BILLDE_PATH_TO_LOGO']);
53 $imgDpi = intval(
$params[
'BILLDE_LOGO_DPI']) ?: 96;
54 $imgZoom = 96 / $imgDpi;
61 $imgDpi = 96 * $imageWidth/(
$width*0.6 + 5);
62 $imgZoom = 96 / $imgDpi;
68 $pdf->Image(
$params[
'BILLDE_PATH_TO_LOGO'],
$pdf->GetX(),
$pdf->GetY(), -$imgDpi, -$imgDpi);
72if (
$params[
"SELLER_COMPANY_NAME"])
86if (
$params[
"SELLER_COMPANY_ADDRESS"])
104 $pdf->Cell(
$pdf->GetStringWidth($string), 10, $string,
'B');
112if (
$params[
"BUYER_PERSON_COMPANY_NAME"])
118 if (
$params[
"BUYER_PERSON_COMPANY_PAYER_NAME"])
123 $buyerAddress =
$params[
"BUYER_PERSON_COMPANY_ADDRESS"];
126 if(is_string($buyerAddress))
128 $buyerAddress = explode(
"\n", str_replace(
array(
"\r\n",
"\n",
"\r"),
"\n", $buyerAddress));
129 if (
count($buyerAddress) === 1)
130 $buyerAddress = $buyerAddress[0];
132 if (is_array($buyerAddress))
134 if (!empty($buyerAddress))
136 foreach ($buyerAddress as $item)
163if (
$params[
'BILLDE_HEADER_SHOW'] ===
'Y')
168 $params[
'BILLDE_HEADER'].
' Nr. %s',
172 if (
$params[
"BUYER_PERSON_COMPANY_ID"])
176 $params[
"BUYER_PERSON_COMPANY_ID"]
186 if (
$params[
"DATE_PAY_BEFORE"])
209 if (
$params[
'BILLDE_COLUMN_'.$column.
'_SHOW'] ==
'Y')
213 'SORT' =>
$params[
'BILLDE_COLUMN_'.$column.
'_SORT']
224 'SORT' =>
$val[
'SORT']
229uasort(
$arCols,
function (
$a, $b) {
return (
$a[
'SORT'] < $b[
'SORT']) ? -1 : 1;});
244 foreach (
$params[
'BASKET_ITEMS'] as $basketItem)
247 if ($basketItem[
'IS_VAT_IN_PRICE'])
250 $vatLessPrice = $basketItem[
'PRICE'];
252 $productName = $basketItem[
'NAME'];
253 if ($productName ==
"OrderDelivery")
254 $productName =
"Schifffahrt";
255 else if ($productName ==
"OrderDiscount")
256 $productName =
"Rabatt";
259 foreach (
$arCols as $columnId => $cols)
267 $arCols[$columnId][
'IS_DIGIT'] =
true;
274 $arCols[$columnId][
'IS_DIGIT'] =
true;
278 $arCols[$columnId][
'IS_DIGIT'] =
true;
282 $arCols[$columnId][
'IS_DIGIT'] =
true;
286 $arCols[$columnId][
'IS_DIGIT'] =
true;
290 $arCols[$columnId][
'IS_DIGIT'] =
true;
293 if (preg_match(
'/[^0-9 ,\.]/', $basketItem[$columnId]) === 0)
295 if (!array_key_exists(
'IS_DIGIT',
$arCols[$columnId]))
296 $arCols[$columnId][
'IS_DIGIT'] =
true;
300 $arCols[$columnId][
'IS_DIGIT'] =
false;
310 foreach ($basketItem[
'PROPS'] as $basketPropertyItem)
312 if ($basketPropertyItem[
'CODE'] ==
'CATALOG.XML_ID' || $basketPropertyItem[
'CODE'] ==
'PRODUCT.XML_ID')
314 $arProps[
$n][] =
htmlspecialcharsbx(sprintf(
"%s: %s", $basketPropertyItem[
"NAME"], $basketPropertyItem[
"VALUE"]));
317 $sum += doubleval($vatLessPrice * $basketItem[
'QUANTITY']);
318 $vat = max(
$vat, $basketItem[
'VAT_RATE']);
319 if ($basketItem[
'VAT_RATE'] > 0)
321 if (!isset($vats[$basketItem[
'VAT_RATE']]))
322 $vats[$basketItem[
'VAT_RATE']] = 0;
324 if ($basketItem[
'IS_VAT_IN_PRICE'])
325 $vats[$basketItem[
'VAT_RATE']] += ($basketItem[
'PRICE'] - $vatLessPrice) * $basketItem[
'QUANTITY'];
327 $vats[$basketItem[
'VAT_RATE']] += ($basketItem[
'PRICE']*(1 + $basketItem[
'VAT_RATE']) - $vatLessPrice) * $basketItem[
'QUANTITY'];
340 if (
$params[
'DELIVERY_PRICE'] > 0)
342 $sDeliveryItem =
"Schifffahrt";
343 if (
$params[
'DELIVERY_NAME'] <>
'')
344 $sDeliveryItem .= sprintf(
" (%s)",
$params[
'DELIVERY_NAME']);
346 foreach (
$arCols as $columnId => $caption)
393 if (
$params[
'BILLDE_TOTAL_SHOW'] ===
'Y')
431 foreach ($vats as $vatRate => $vatSum)
445 foreach (
$params[
'TAXES'] as $tax)
453 ($tax[
"IS_IN_PRICE"] ==
"Y") ?
"inkl." :
"zzgl.",
503 foreach (
$arCols as $columnId => $column)
506 if (
$vat > 0 || $columnId !==
'VAT_RATE')
509 if (
$arCols[$columnId][
'NAME'])
516 ${
"x".($i+1)} =
$pdf->GetX();
539 $accumulatedContent = 0;
540 foreach (
$arCols as $columnId => $column)
544 $accumulated += $arRowsWidth_tmp[$columnId];
545 $arRowsWidth_tmp[$columnId] =
null;
546 $accumulatedContent += $arRowsContentWidth_tmp[$columnId];
547 $arRowsContentWidth_tmp[$columnId] =
null;
551 $arRowsWidth_tmp[$columnId] += $accumulated;
552 $arRowsContentWidth_tmp[$columnId] += $accumulatedContent;
554 $accumulatedContent = 0;
567 foreach (
$arCols as $columnId => $column)
571 list($string,
$arCells[
$n][$columnId]) =
$pdf->splitString(
$arCells[
$n][$columnId], $arRowsContentWidth_tmp[$columnId]);
573 $rowWidth = $arRowsWidth_tmp[$columnId];
575 if (in_array($columnId,
array(
'QUANTITY',
'MEASURE',
'PRICE',
'SUM')))
579 $pdf->Cell($rowWidth, 15, $string, 0, 0,
'R');
582 elseif ($columnId ==
'NUMBER')
585 $pdf->Cell($rowWidth, 15, (
$l == 0) ? $string :
'', 0, 0,
'C');
587 elseif ($columnId ==
'NAME')
590 $pdf->Cell($rowWidth, 15, $string, 0, 0, (
$n >
$items) ?
'R' :
'');
592 elseif ($columnId ==
'VAT_RATE')
595 $pdf->Cell($rowWidth, 15, $string, 0, 0,
'R');
601 $pdf->Cell($rowWidth, 15, $string, 0, 0, (
$n >
$items) ?
'R' :
'L');
608 ${
'x'.($pos+1)} =
$pdf->GetX();
620 if (
$params[
'BILLDE_COLUMN_NAME_SHOW'] ==
'Y')
622 if (isset($arProps[
$n]) && is_array($arProps[
$n]))
625 foreach ($arProps[
$n] as $property)
629 foreach (
$arCols as $columnId => $col)
634 if ($columnId ==
'NAME')
635 $pdf->Cell($arRowsWidth_tmp[$columnId], 12, $property, 0, $line);
637 $pdf->Cell($arRowsWidth_tmp[$columnId], 12,
'', 0, $line);
666 if (
$params[
"BILLDE_COMMENT1"])
669 array(
'#</div>\s*<div[^>]*>#i',
'#</?div>#i'),
array(
'<br>',
'<br>'),
676 if (
$params[
"BILLDE_COMMENT2"])
679 array(
'#</div>\s*<div[^>]*>#i',
'#</?div>#i'),
array(
'<br>',
'<br>'),
691 list($stampHeight, $stampWidth) =
$pdf->GetImageSize(
$params[
'BILLDE_PATH_TO_STAMP']);
693 if ($stampHeight && $stampWidth)
695 if ($stampHeight > 120 || $stampWidth > 120)
697 $ratio = 120 / max($stampHeight, $stampWidth);
698 $stampHeight = $ratio * $stampHeight;
699 $stampWidth = $ratio * $stampWidth;
703 $params[
'BILLDE_PATH_TO_STAMP'],
705 $stampWidth, $stampHeight
710if (
$params[
"SELLER_COMPANY_DIRECTOR_POSITION"])
715 list($signHeight, $signWidth) =
$pdf->GetImageSize(
$params[
'SELLER_COMPANY_DIR_SIGN']);
717 if ($signHeight && $signWidth)
719 $ratio = min(37.5/$signHeight, 150/$signWidth);
720 $signHeight = $ratio * $signHeight;
721 $signWidth = $ratio * $signWidth;
728 if ($isDirSign &&
$pdf->GetStringWidth($sellerDirPos) <= 160)
729 $pdf->SetY(
$pdf->GetY() + min($signHeight, 30) - 15);
730 $pdf->MultiCell(150, 15, $sellerDirPos, 0,
'L');
736 $params[
'SELLER_COMPANY_DIR_SIGN'],
737 $pdf->GetX() + 80 - $signWidth/2,
$pdf->GetY() - $signHeight + 15,
738 $signWidth, $signHeight
743 $pdf->Cell(160, 15,
'');
746 if (
$params[
"SELLER_COMPANY_DIRECTOR_NAME"])
756if (
$params[
"SELLER_COMPANY_ACCOUNTANT_POSITION"])
761 list($signHeight, $signWidth) =
$pdf->GetImageSize(
$params[
'SELLER_COMPANY_ACC_SIGN']);
763 if ($signHeight && $signWidth)
765 $ratio = min(37.5/$signHeight, 150/$signWidth);
766 $signHeight = $ratio * $signHeight;
767 $signWidth = $ratio * $signWidth;
775 $pdf->SetY(
$pdf->GetY() + min($signHeight, 30) - 15);
776 $pdf->MultiCell(150, 15, $sellerAccPos, 0,
'L');
782 $params[
'SELLER_COMPANY_ACC_SIGN'],
783 $pdf->GetX() + 80 - $signWidth/2,
$pdf->GetY() - $signHeight + 15,
784 $signWidth, $signHeight
792 if (
$params[
"SELLER_COMPANY_ACCOUNTANT_NAME"])
827 $pdf->Cell(0, 15, $string, 0, 0,
'C');
849 $pdf->Cell(0, 15, $string, 0, 0,
'C');
880 $pdf->Cell(0, 15, $string, 0, 0,
'C');
916 'Rechnung Nr. %s (Datum %s).pdf',
919 chr(0), chr(1), chr(2), chr(3), chr(4), chr(5), chr(6), chr(7), chr(8), chr(9), chr(10), chr(11),
920 chr(12), chr(13), chr(14), chr(15), chr(16), chr(17), chr(18), chr(19), chr(20), chr(21), chr(22),
921 chr(23), chr(24), chr(25), chr(26), chr(27), chr(28), chr(29), chr(30), chr(31),
922 '"',
'*',
'/',
':',
'<',
'>',
'?',
'\\',
'|'
925 strval(
$params[
"ACCOUNT_NUMBER"])
static prepareToPdf($string)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
ConvertDateTime($datetime, $to_format=false, $from_site=false, $bSearchInSitesOnly=false)
HTMLToTxt($str, $strSiteUrl="", $aDelete=[], $maxlen=70)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
</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."%"
if( $arBasket=$dbBasket->Fetch()) if($vat > 0) $rowsCnt
if(!empty($sellerData)) $bankAccNo
if(!empty($bankData)) $sellerEuInn
if(CSalePaySystemAction::GetParamValue('BACKGROUND', false)) $margin
for($n=1; $n<=$rowsCnt; $n++) if(CSalePaySystemAction::GetParamValue("COMMENT1", false)||CSalePaySystemAction::GetParamValue("COMMENT2", false)) if(! $blank) if(CSalePaySystemAction::GetParamValue("SELLER_DIR_POS", false)) if(CSalePaySystemAction::GetParamValue("SELLER_ACC_POS", false)) $sellerName
if(!empty($sellerData)) $sellerPhone
if(!empty($sellerData)) $dest
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
SaleFormatCurrency($fSum, $strCurrency, $OnlyValue=false, $withoutFormat=false)
const SALE_VALUE_PRECISION