$pdf->Ln(); if (CSalePaySystemAction::GetParamValue("SELLER_ADDRESS")) { $pdf->SetX($pdf->GetX() + $logoWidth); $pdf->Write(15, CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("SELLER_ADDRESS"))); $pdf->Ln(); } if (CSalePaySystemAction::GetParamValue("SELLER_PHONE")) { $pdf->SetX($pdf->GetX() + $logoWidth); $pdf->Write(15, CSalePdf::prepareToPdf(sprintf("Tel.: %s", CSalePaySystemAction::GetParamValue("SELLER_PHONE")))); $pdf->Ln(); } $pdf->Ln(); $pdf->SetY(max($y0 + $logoHeight, $pdf->GetY())); $pdf->Ln(); $pdf->SetFont($fontFamily, 'B', $fontSize * 2); $pdf->Cell(0, 15, CSalePdf::prepareToPdf('Invoice'), 0, 0, 'C'); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont($fontFamily, 'B', $fontSize); if (CSalePaySystemAction::GetParamValue("BUYER_NAME")) { $pdf->Write(15, CSalePdf::prepareToPdf('To')); } $pdf->SetFont($fontFamily, '', $fontSize); $invoiceNo = CSalePdf::prepareToPdf($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ACCOUNT_NUMBER"]); $invoiceNoWidth = $pdf->GetStringWidth($invoiceNo); $invoiceDate = CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("DATE_INSERT")); $invoiceDateWidth = $pdf->GetStringWidth($invoiceDate); $invoiceDueDate = CSalePdf::prepareToPdf(ConvertDateTime(CSalePaySystemAction::GetParamValue("DATE_PAY_BEFORE"), FORMAT_DATE)); $invoiceDueDateWidth = $pdf->GetStringWidth($invoiceDueDate); $invoiceInfoWidth = max($invoiceNoWidth, $invoiceDateWidth, $invoiceDueDateWidth);
$pdf->Ln(10); $pdf->SetFont($fontFamily, 'B', $fontSize * 3); $pdf->SetX($pdf->GetX() + $logoWidth); $pdf->MultiCell(0, 30, CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("SELLER_NAME", false)), 0, 'L'); $pdf->Ln(); $pdf->SetY(max($y0 + $logoHeight, $pdf->GetY())); $pdf->Ln(10); $pdf->SetFont($fontFamily, 'B', $fontSize - 2); $seller = CSalePaySystemAction::GetParamValue("SELLER_NAME", false); if (CSalePaySystemAction::GetParamValue("SELLER_ADDRESS", false)) { $seller .= ' - '; $seller .= CSalePaySystemAction::GetParamValue("SELLER_ADDRESS", false); $seller .= ' '; } $seller = CSalePdf::prepareToPdf($seller); $pdf->Cell($pdf->GetStringWidth($seller), 10, $seller, 'B'); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont($fontFamily, 'B', $fontSize); if (CSalePaySystemAction::GetParamValue("BUYER_NAME", false)) { $pdf->Write(15, CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("BUYER_NAME", false))); $pdf->Ln(); if (CSalePaySystemAction::GetParamValue("BUYER_ADDRESS", false)) { $pdf->Write(15, CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("BUYER_ADDRESS", false))); } $pdf->Ln(); } $pdf->Ln(); $pdf->Ln(); $pdf->Ln();
} $pdf->Ln(); $pdf->SetY(max($y0 + $logoHeight, $pdf->GetY())); if (CSalePaySystemAction::GetParamValue("SELLER_BANK", false)) { $sellerBank = sprintf("%s %s", CSalePaySystemAction::GetParamValue("SELLER_BANK", false), CSalePaySystemAction::GetParamValue("SELLER_BCITY", false)); $sellerRs = CSalePaySystemAction::GetParamValue("SELLER_RS", false); } else { $rsPattern = '/\\s*\\d{10,100}\\s*/'; $sellerBank = trim(preg_replace($rsPattern, ' ', CSalePaySystemAction::GetParamValue("SELLER_RS", false))); preg_match($rsPattern, CSalePaySystemAction::GetParamValue("SELLER_RS", false), $matches); $sellerRs = trim($matches[0]); } $pdf->SetFont($fontFamily, '', $fontSize); $x0 = $pdf->GetX(); $y0 = $pdf->GetY(); $pdf->Cell(150, 18, CSalePaySystemAction::GetParamValue("SELLER_INN", false) ? CSalePdf::prepareToPdf(sprintf("ИНН %s", CSalePaySystemAction::GetParamValue("SELLER_INN", false))) : ''); $x1 = $pdf->GetX(); $pdf->Cell(150, 18, CSalePaySystemAction::GetParamValue("SELLER_KPP", false) ? CSalePdf::prepareToPdf(sprintf("КПП %s", CSalePaySystemAction::GetParamValue("SELLER_KPP", false))) : ''); $x2 = $pdf->GetX(); $pdf->Cell(50, 18); $x3 = $pdf->GetX(); $pdf->Cell(0, 18); $x4 = $pdf->GetX(); $pdf->Line($x0, $y0, $x4, $y0); $pdf->Ln(); $y1 = $pdf->GetY(); $pdf->Line($x1, $y0, $x1, $y1); $pdf->Cell(300, 18, CSalePdf::prepareToPdf('Получатель')); $pdf->Cell(50, 18); $pdf->Cell(0, 18); $pdf->Line($x0, $y1, $x2, $y1);
$GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ACCOUNT_NUMBER"], CSalePaySystemAction::GetParamValue("DATE_INSERT") ))); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont($fontFamily, '', $fontSize); $title = CSalePdf::prepareToPdf('Постачальник: '); $title_width = $pdf->GetStringWidth($title); $pdf->Write(15, $title); $pdf->Write(15, CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("SELLER_NAME"))); $pdf->Ln(); $pdf->Cell($title_width, 15, ''); $pdf->MultiCell(0, 15, CSalePdf::prepareToPdf(sprintf( 'Р/р %s, Банк %s, МФО %s', CSalePaySystemAction::GetParamValue("SELLER_RS"), CSalePaySystemAction::GetParamValue("SELLER_BANK"), CSalePaySystemAction::GetParamValue("SELLER_MFO") ))); $pdf->Cell($title_width, 15, ''); $pdf->MultiCell(0, 15, CSalePdf::prepareToPdf(sprintf( 'Юридична адреса: %s, тел.: %s', CSalePaySystemAction::GetParamValue("SELLER_ADDRESS"), CSalePaySystemAction::GetParamValue("SELLER_PHONE") ))); $pdf->Cell($title_width, 15, '');
$y0 = $pdf->GetY(); $logoHeight = 0; $logoWidth = 0; if (CSalePaySystemAction::GetParamValue('PATH_TO_LOGO', false)) { list($imageHeight, $imageWidth) = $pdf->GetImageSize(CSalePaySystemAction::GetParamValue('PATH_TO_LOGO', false)); $imgDpi = intval(CSalePaySystemAction::GetParamValue('LOGO_DPI', false)) ?: 96; $imgZoom = 96 / $imgDpi; $logoHeight = $imageHeight * $imgZoom + 5; $logoWidth = $imageWidth * $imgZoom + 5; $pdf->Image(CSalePaySystemAction::GetParamValue('PATH_TO_LOGO', false), $pdf->GetX(), $pdf->GetY(), -$imgDpi, -$imgDpi); } $pdf->SetFont($fontFamily, 'B', $fontSize); $sellerName = CSalePaySystemAction::GetParamValue("SELLER_NAME", false); if ($sellerName) { list($string, $text) = $pdf->splitString(CSalePdf::prepareToPdf($sellerName), $width - 10); $pdf->Cell($width, 15, $string, 0, 0, 'R'); $pdf->Ln(); } $sellerAddress = CSalePaySystemAction::GetParamValue("SELLER_ADDRESS", false); if ($sellerAddress) { list($string, $text) = $pdf->splitString(CSalePdf::prepareToPdf($sellerAddress), $width - 10); $pdf->Cell($width, 15, $string, 0, 0, 'R'); $pdf->Ln(); } $sellerPhone = CSalePaySystemAction::GetParamValue("SELLER_PHONE", false); if ($sellerPhone) { $sellerPhone = sprintf("Тел.: %s", $sellerPhone); $pdf->Cell($width, 15, $pdf->prepareToPdf($sellerPhone), 0, 0, 'R'); $pdf->Ln(); } $sellerEmail = CSalePaySystemAction::GetParamValue("SELLER_EMAIL", false);
$pathToLogo = CSalePaySystemAction::GetParamValue('PATH_TO_LOGO', false); if ($pathToLogo) { list($imageHeight, $imageWidth) = $pdf->GetImageSize($pathToLogo); $imgDpi = intval(CSalePaySystemAction::GetParamValue('LOGO_DPI', false)) ?: 96; $imgZoom = 96 / $imgDpi; $logoHeight = $imageHeight * $imgZoom + 5; $logoWidth = $imageWidth * $imgZoom + 5; $pdf->Image($pathToLogo, $pdf->GetX(), $pdf->GetY(), -$imgDpi, -$imgDpi); } unset($pathToLogo); $pdf->SetY(max($y0 + $logoHeight, $pdf->GetY())); $pdf->Ln(10); $sellerName = CSalePaySystemAction::GetParamValue("SELLER_NAME", false); if ($sellerName) { $pdf->SetFont($fontFamily, 'B', $fontSize); $pdf->Cell($width, 15, $pdf->prepareToPdf($sellerName), 0, 0, 'L'); $pdf->Ln(); } $pdf->SetFont($fontFamily, '', $fontSize); $sellerAddress = CSalePaySystemAction::GetParamValue("SELLER_ADDRESS", false); if ($sellerAddress) { $sellerAddress = $pdf->prepareToPdf($sellerAddress); $pdf->Cell($width, 15, $sellerAddress, 0, 0, 'L'); $pdf->Ln(); } $sellerPhone = CSalePaySystemAction::GetParamValue("SELLER_PHONE", false); if ($sellerPhone) { $sellerPhone = sprintf("Phone: %s", $sellerPhone); $pdf->Cell($width, 15, $pdf->prepareToPdf($sellerPhone), 0, 0, 'L'); $pdf->Ln(); }
$pdf->SetX($pdf->GetX() + $logoWidth); $pdf->Write(15, CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("SELLER_NAME"))); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->SetY(max($y0 + $logoHeight, $pdf->GetY())); $pdf->Ln(); $pdf->SetFont($fontFamily, 'B', $fontSize - 2); $seller = CSalePaySystemAction::GetParamValue("SELLER_NAME"); if (CSalePaySystemAction::GetParamValue("SELLER_ADDRESS")) { $seller .= ' – '; $seller .= CSalePaySystemAction::GetParamValue("SELLER_ADDRESS"); $seller .= ' '; } $seller = CSalePdf::prepareToPdf($seller); $pdf->Cell($pdf->GetStringWidth($seller), 10, $seller, 'B'); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont($fontFamily, 'B', $fontSize); if (CSalePaySystemAction::GetParamValue("BUYER_NAME")) { $pdf->Write(15, CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("BUYER_NAME"))); $pdf->Ln(); if (CSalePaySystemAction::GetParamValue("BUYER_ADDRESS")) { $pdf->Write(15, CSalePdf::prepareToPdf(CSalePaySystemAction::GetParamValue("BUYER_ADDRESS"))); } $pdf->Ln(); } $pdf->Ln(); $pdf->Ln(); $pdf->Ln();