Beispiel #1
0
     ?>
             </td>
         </tr>
     <?php 
 }
 ?>
     <?php 
 if (!$this->config->hide_tax) {
     ?>
         <?php 
     foreach ($this->tax_list as $percent => $value) {
         ?>
             <tr class="tax">
                 <td class = "name">
                     <?php 
         print displayTotalCartTaxName();
         ?>
                     <?php 
         if ($this->show_percent_tax) {
             print formattax($percent) . "%";
         }
         ?>
                 </td>
                 <td class = "value">
                     <?php 
         print formatprice($value);
         print $this->_tmp_ext_tax[$percent];
         ?>
                 </td>
             </tr>
         <?php 
function generatePDF($order)
{
    $jshopConfig = JSFactory::getConfig();
    $vendorinfo = $order->getVendorInfo();
    $pdf = new JorderPDF();
    JPluginHelper::importPlugin('jshoppingorder');
    $dispatcher = JDispatcher::getInstance();
    $dispatcher->trigger('onBeforeCreatePdfOrder', array(&$order, &$vendorinfo, &$pdf));
    $pdf->_vendorinfo = $vendorinfo;
    $pdf->SetFont('freesans', '', 8);
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->SetMargins(0, 0, 0);
    $pdf->addNewPage();
    $pdf->SetXY(20, 55);
    $pdf->setfontsize(6);
    $pdf->SetTextColor($pdf->pdfcolors[0][0], $pdf->pdfcolors[0][1], $pdf->pdfcolors[0][2]);
    $pdf->MultiCell(80, 3, $vendorinfo->company_name . ", " . $vendorinfo->adress . ", " . $vendorinfo->zip . " " . $vendorinfo->city, 0, 'L');
    $pdf->SetXY(110, 55);
    $pdf->SetFont('freesansb', '', 11);
    $pdf->SetTextColor($pdf->pdfcolors[0][0], $pdf->pdfcolors[0][1], $pdf->pdfcolors[0][2]);
    $pdf->MultiCell(80, 3, _JSHOP_EMAIL_BILL, 0, 'R');
    $pdf->SetFont('freesans', '', 11);
    $pdf->SetXY(20, 60);
    $pdf->MultiCell(80, 4.5, $order->firma_name . "\n" . $order->f_name . " " . $order->l_name . " " . $order->m_name . "\n" . $order->street . " " . $order->home . " " . $order->apartment . "\n" . $order->zip . " " . $order->city . "\n" . $order->country, 0, 'L');
    $pdf->SetFont('freesansi', '', 11);
    $pdf->SetXY(110, 65);
    $pdf->MultiCell(80, 4.5, _JSHOP_ORDER_SHORT_NR . " " . $order->order_number . "\n" . _JSHOP_ORDER_FROM . " " . $order->order_date, 0, 'R');
    if ($jshopConfig->date_invoice_in_invoice) {
        $pdf->SetXY(110, 77);
        $pdf->MultiCell(80, 4.5, _JSHOP_INVOICE_DATE . " " . strftime($jshopConfig->store_date_format, strtotime($order->invoice_date)), 0, 'R');
    }
    $pdf->SetDrawColor($pdf->pdfcolors[0][0], $pdf->pdfcolors[0][1], $pdf->pdfcolors[0][2]);
    $pdf->SetFont('freesans', '', 7);
    if ($vendorinfo->identification_number) {
        $pdf->SetXY(115, 102);
        $pdf->MultiCell(35, 4, _JSHOP_IDENTIFICATION_NUMBER, 1, 'L');
        $pdf->SetXY(150, 102);
        $pdf->MultiCell(40, 4, $vendorinfo->identification_number, 1, 'R');
    }
    if ($vendorinfo->tax_number) {
        $pdf->SetXY(115, 106);
        $pdf->MultiCell(35, 4, _JSHOP_TAX_NUMBER, 1, 'L');
        $pdf->SetXY(150, 106);
        $pdf->MultiCell(40, 4, $vendorinfo->tax_number, 1, 'R');
    }
    $width_filename = 65;
    if (!$jshopConfig->show_product_code_in_order) {
        $width_filename = 87;
    }
    $pdf->setfillcolor($pdf->pdfcolors[1][0], $pdf->pdfcolors[1][1], $pdf->pdfcolors[1][2]);
    $pdf->Rect(20, 116, 170, 4, 'F');
    $pdf->SetFont('freesansb', '', 7.5);
    $pdf->SetXY(20, 116);
    $pdf->MultiCell($width_filename, 4, _JSHOP_NAME_PRODUCT, 1, 'L');
    if ($jshopConfig->show_product_code_in_order) {
        $pdf->SetXY(85, 116);
        $pdf->MultiCell(22, 4, _JSHOP_EAN_PRODUCT, 1, 'L');
    }
    $pdf->SetXY(107, 116);
    $pdf->MultiCell(18, 4, _JSHOP_QUANTITY, 1, 'L');
    $pdf->SetXY(125, 116);
    $pdf->MultiCell(25, 4, _JSHOP_SINGLEPRICE, 1, 'L');
    $pdf->SetXY(150, 116);
    $pdf->MultiCell(40, 4, _JSHOP_TOTAL, 1, 'R');
    $y = 120;
    foreach ($order->products as $prod) {
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y + 2);
        $pdf->MultiCell($width_filename, 4, $prod->product_name, 0, 'L');
        if ($prod->manufacturer != '') {
            $pdf->SetXY(20, $pdf->getY());
            $pdf->MultiCell($width_filename, 4, _JSHOP_MANUFACTURER . ": " . $prod->manufacturer, 0, 'L');
        }
        if ($prod->product_attributes != "" || $prod->product_freeattributes != "" || $prod->delivery_time || $prod->extra_fields != '') {
            if ($prod->delivery_time) {
                $pdt = _JSHOP_DELIVERY_TIME . ": " . $prod->delivery_time;
            } else {
                $pdt = "";
            }
            $pdf->SetXY(23, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $attribute = sprintAtributeInOrder($prod->product_attributes, "pdf");
            $attribute .= sprintFreeAtributeInOrder($prod->product_freeattributes, "pdf");
            $attribute .= sprintExtraFiledsInOrder($prod->extra_fields, "pdf");
            $attribute .= $prod->_ext_attribute;
            $attribute .= $pdt;
            $pdf->MultiCell(62, 4, $attribute, 0, 'L');
            $pdf->SetFont('freesans', '', 7);
        }
        $y2 = $pdf->getY() + 2;
        if ($jshopConfig->show_product_code_in_order) {
            $pdf->SetXY(85, $y + 2);
            $pdf->MultiCell(22, 4, $prod->product_ean, 0, 'L');
            $y3 = $pdf->getY() + 2;
        } else {
            $y3 = $pdf->getY();
        }
        $pdf->SetXY(107, $y + 2);
        $pdf->MultiCell(18, 4, formatqty($prod->product_quantity) . $prod->_qty_unit, 0, 'L');
        $y4 = $pdf->getY() + 2;
        $pdf->SetXY(125, $y + 2);
        $pdf->MultiCell(25, 4, formatprice($prod->product_item_price, $order->currency_code), 0, 'L');
        if ($prod->_ext_price) {
            $pdf->SetXY(125, $pdf->getY());
            $pdf->MultiCell(25, 4, $prod->_ext_price, 0, 'R');
        }
        if ($jshopConfig->show_tax_product_in_cart && $prod->product_tax > 0) {
            $pdf->SetXY(125, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $text = productTaxInfo($prod->product_tax, $order->display_price);
            $pdf->MultiCell(25, 4, $text, 0, 'L');
        }
        if ($jshopConfig->cart_basic_price_show && $prod->basicprice > 0) {
            $pdf->SetXY(125, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $text = _JSHOP_BASIC_PRICE . ": " . sprintBasicPrice($prod);
            $pdf->MultiCell(25, 4, $text, 0, 'L');
        }
        $y5 = $pdf->getY() + 2;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(150, $y + 2);
        $pdf->MultiCell(40, 4, formatprice($prod->product_quantity * $prod->product_item_price, $order->currency_code), 0, 'R');
        if ($prod->_ext_price_total) {
            $pdf->SetXY(150, $pdf->getY());
            $pdf->MultiCell(40, 4, $prod->_ext_price_total, 0, 'R');
        }
        if ($jshopConfig->show_tax_product_in_cart && $prod->product_tax > 0) {
            $pdf->SetXY(150, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $text = productTaxInfo($prod->product_tax, $order->display_price);
            $pdf->MultiCell(40, 4, $text, 0, 'R');
        }
        $y6 = $pdf->getY() + 2;
        $yn = max($y2, $y3, $y4, $y5, $y6);
        $pdf->Rect(20, $y, 170, $yn - $y);
        $pdf->Rect(20, $y, 130, $yn - $y);
        if ($jshopConfig->show_product_code_in_order) {
            $pdf->line(85, $y, 85, $yn);
        }
        $pdf->line(107, $y, 107, $yn);
        $pdf->line(125, $y, 125, $yn);
        $y = $yn;
        if ($y > 260) {
            $pdf->addNewPage();
            $y = 60;
        }
    }
    if ($y > 240) {
        $pdf->addNewPage();
        $y = 60;
    }
    $pdf->SetFont('freesans', '', 10);
    if (($jshopConfig->hide_tax || count($order->order_tax_list) == 0) && $order->order_discount == 0 && $order->order_payment == 0 && $jshopConfig->without_shipping) {
        $hide_subtotal = 1;
    } else {
        $hide_subtotal = 0;
    }
    if (!$hide_subtotal) {
        $pdf->SetXY(20, $y);
        $pdf->Rect(20, $y, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_SUBTOTAL, '1', 'R');
        $pdf->SetXY(150, $y);
        $pdf->MultiCell(40, 5, formatprice($order->order_subtotal, $order->currency_code) . $order->_pdf_ext_subtotal, '1', 'R');
    } else {
        $y = $y - 5;
    }
    if ($order->order_discount > 0) {
        $y = $y + 5;
        $pdf->SetXY(20, $y);
        $pdf->Rect(20, $y, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_RABATT_VALUE, '1', 'R');
        $pdf->SetXY(150, $y);
        $pdf->MultiCell(40, 5, "-" . formatprice($order->order_discount, $order->currency_code) . $order->_pdf_ext_discount, '1', 'R');
    }
    if (!$jshopConfig->without_shipping) {
        $pdf->SetXY(20, $y + 5);
        $pdf->Rect(20, $y + 5, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_SHIPPING_PRICE, '1', 'R');
        $pdf->SetXY(150, $y + 5);
        $pdf->MultiCell(40, 5, formatprice($order->order_shipping, $order->currency_code) . $order->_pdf_ext_shipping, '1', 'R');
        if ($order->order_package > 0 || $jshopConfig->display_null_package_price) {
            $y = $y + 5;
            $pdf->SetXY(20, $y + 5);
            $pdf->Rect(20, $y + 5, 170, 5, 'F');
            $pdf->MultiCell(130, 5, _JSHOP_PACKAGE_PRICE, '1', 'R');
            $pdf->SetXY(150, $y + 5);
            $pdf->MultiCell(40, 5, formatprice($order->order_package, $order->currency_code) . $order->_pdf_ext_shipping_package, '1', 'R');
        }
    } else {
        $y = $y - 5;
    }
    if ($order->order_payment != 0) {
        $y = $y + 5;
        $pdf->SetXY(20, $y + 5);
        $pdf->Rect(20, $y + 5, 170, 5, 'F');
        $pdf->MultiCell(130, 5, $order->payment_name, '1', 'R');
        $pdf->SetXY(150, $y + 5);
        $pdf->MultiCell(40, 5, formatprice($order->order_payment, $order->currency_code) . $order->_pdf_ext_payment, '1', 'R');
    }
    $show_percent_tax = 0;
    if (count($order->order_tax_list) > 1 || $jshopConfig->show_tax_in_product) {
        $show_percent_tax = 1;
    }
    if ($jshopConfig->hide_tax) {
        $show_percent_tax = 0;
    }
    $dispatcher->trigger('onBeforeCreatePdfOrderBeforeEndTotal', array(&$order, &$pdf, &$y));
    if (!$jshopConfig->hide_tax) {
        foreach ($order->order_tax_list as $percent => $value) {
            $pdf->SetXY(20, $y + 10);
            $pdf->Rect(20, $y + 10, 170, 5, 'F');
            $text = displayTotalCartTaxName($order->display_price);
            if ($show_percent_tax) {
                $text = $text . " " . formattax($percent) . "%";
            }
            $pdf->MultiCell(130, 5, $text, '1', 'R');
            $pdf->SetXY(150, $y + 10);
            $pdf->MultiCell(40, 5, formatprice($value, $order->currency_code) . $order->_pdf_ext_tax[$percent], '1', 'R');
            $y = $y + 5;
        }
    }
    $text_total = _JSHOP_ENDTOTAL;
    if (($jshopConfig->show_tax_in_product || $jshopConfig->show_tax_product_in_cart) && count($order->order_tax_list) > 0) {
        $text_total = _JSHOP_ENDTOTAL_INKL_TAX;
    }
    $pdf->SetFont('freesansb', '', 10);
    $pdf->SetXY(20, $y + 10);
    $pdf->Rect(20, $y + 10, 170, 5.1, 'F');
    $pdf->MultiCell(130, 5, $text_total, '1', 'R');
    $pdf->SetXY(150, $y + 10);
    $pdf->MultiCell(40, 5, formatprice($order->order_total, $order->currency_code) . $order->_pdf_ext_total, '1', 'R');
    if ($jshopConfig->display_tax_id_in_pdf && $order->tax_number) {
        $y = $y + 5.2;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y + 10);
        $pdf->MultiCell(170, 4, _JSHOP_TAX_NUMBER . ": " . $order->tax_number, '1', 'L');
    }
    $dispatcher->trigger('onBeforeCreatePdfOrderAfterEndTotal', array(&$order, &$pdf, &$y));
    $y = $y + 10;
    if ($jshopConfig->show_delivery_time_checkout && ($order->delivery_times_id || $order->delivery_time)) {
        if ($y > 250) {
            $pdf->addNewPage();
            $y = 60;
        }
        $deliverytimes = JSFactory::getAllDeliveryTime();
        $delivery = $deliverytimes[$order->delivery_times_id];
        if ($delivery == "") {
            $delivery = $order->delivery_time;
        }
        $y = $y + 8;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_ORDER_DELIVERY_TIME . ": " . $delivery, '0', 'L');
    }
    if ($jshopConfig->show_delivery_date && !datenull($order->delivery_date)) {
        if ($y > 250) {
            $pdf->addNewPage();
            $y = 60;
        }
        $delivery_date_f = formatdate($order->delivery_date);
        $y = $y + 6;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_DELIVERY_DATE . ": " . $delivery_date_f, '0', 'L');
    }
    if ($jshopConfig->weight_in_invoice) {
        if ($y > 250) {
            $pdf->addNewPage();
            $y = 60;
        }
        $y = $y + 6;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_WEIGHT_PRODUCTS . ": " . formatweight($order->weight), '0', 'L');
    }
    if (!$jshopConfig->without_payment && $jshopConfig->payment_in_invoice) {
        if ($y > 240) {
            $pdf->addNewPage();
            $y = 60;
        }
        $y = $y + 6;
        $pdf->SetFont('freesansb', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_PAYMENT_INFORMATION, '0', 'L');
        $y = $y + 4;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, $order->payment_name, '0', 'L');
        $payment_descr = trim(trim($order->payment_information) . "\n" . $order->payment_description);
        if ($payment_descr != '') {
            $y = $y + 4;
            $pdf->SetXY(20, $y);
            $pdf->MultiCell(170, 4, strip_tags($payment_descr), '0', 'L');
            $y = $pdf->getY() - 4;
        }
    }
    if (!$jshopConfig->without_shipping && $jshopConfig->shipping_in_invoice) {
        if ($y > 250) {
            $pdf->addNewPage();
            $y = 60;
        }
        $y = $y + 6;
        $pdf->SetFont('freesansb', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, _JSHOP_SHIPPING_INFORMATION, '0', 'L');
        $y = $y + 4;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y);
        $pdf->MultiCell(170, 4, $order->shipping_information, '0', 'L');
    }
    $y = $y + 20;
    if ($y > 240) {
        $pdf->addNewPage();
        $y = 60;
    }
    $pdf->SetFont('freesans', '', 7);
    $y2 = 0;
    if ($vendorinfo->benef_bank_info || $vendorinfo->benef_bic || $vendorinfo->benef_conto || $vendorinfo->benef_payee || $vendorinfo->benef_iban || $vendorinfo->benef_swift) {
        $pdf->SetXY(115, $y);
        $pdf->Rect(115, $y, 75, 4, 'F');
        $pdf->MultiCell(75, 4, _JSHOP_BANK, '1', 'L');
    }
    if ($vendorinfo->benef_bank_info) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_BANK_NAME, '1', 'L');
    }
    if ($vendorinfo->benef_bic) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_BIC, '1', 'L');
    }
    if ($vendorinfo->benef_conto) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_CONTO, '1', 'L');
    }
    if ($vendorinfo->benef_payee) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_PAYEE, '1', 'L');
    }
    if ($vendorinfo->benef_iban) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_IBAN, '1', 'L');
    }
    if ($vendorinfo->benef_swift) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_BENEF_SWIFT, '1', 'L');
    }
    if ($vendorinfo->interm_name || $vendorinfo->interm_swift) {
        $y2 += 4;
        $pdf->Rect(115, $y2 + $y, 75, 4, 'F');
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_INTERM_BANK, '1', 'L');
    }
    if ($vendorinfo->interm_name) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_INTERM_NAME, '1', 'L');
    }
    if ($vendorinfo->interm_swift) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, _JSHOP_INTERM_SWIFT, '1', 'L');
    }
    $y2 = 0;
    if ($vendorinfo->benef_bank_info) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_bank_info, '0', 'R');
    }
    if ($vendorinfo->benef_bic) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_bic, '0', 'R');
    }
    if ($vendorinfo->benef_conto) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_conto, '0', 'R');
    }
    if ($vendorinfo->benef_payee) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_payee, '0', 'R');
    }
    if ($vendorinfo->benef_iban) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_iban, '0', 'R');
    }
    if ($vendorinfo->benef_swift) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->benef_swift, '0', 'R');
    }
    $y2 += 4;
    if ($vendorinfo->interm_name) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->interm_name, '0', 'R');
    }
    if ($vendorinfo->interm_swift) {
        $y2 += 4;
        $pdf->SetXY(115, $y2 + $y);
        $pdf->MultiCell(75, 4, $vendorinfo->interm_swift, '0', 'R');
    }
    if ($vendorinfo->additional_information) {
        if ($y2 + $y > 240) {
            $pdf->addNewPage();
            $y = 50;
            $y2 = 0;
        }
        $y2 += 6;
        $pdf->SetXY(20, $y2 + $y);
        $pdf->MultiCell(170, 4, $vendorinfo->additional_information, '0', 'L');
    }
    $name_pdf = $order->order_id . "_" . md5(uniqid(rand(0, 100))) . ".pdf";
    $dispatcher->trigger('onBeforeCreatePdfOrderEnd', array(&$order, &$pdf, &$name_pdf));
    $pdf->Output($jshopConfig->pdf_orders_path . "/" . $name_pdf, 'F');
    return $name_pdf;
}
Beispiel #3
0
        ?>
</td>
         </tr>
         <?php 
    }
    ?>
         <?php 
    if (!$this->config->hide_tax) {
        ?>
                           
         <?php 
        foreach ($this->order->order_tax_list as $percent => $value) {
            ?>
         <tr>
           <td colspan="4" align="right" style="padding-right:15px;"><?php 
            print displayTotalCartTaxName($order->display_price);
            if ($this->show_percent_tax) {
                print " " . formattax($percent) . "%";
            }
            ?>
:</td>
             <td class="price"><?php 
            print formatprice($value, $order->currency_code);
            print $this->_tmp_ext_tax[$percent];
            ?>
</td>
         </tr>
         <?php 
        }
        ?>
         <?php 
 function onBeforeCreatePdfOrderEnd($order, &$pdf, $name_pdf)
 {
     $addon_config = self::get_seting();
     $jshopConfig = JSFactory::getConfig();
     $vendorinfo = $order->getVendorInfo();
     $pdf = new JorderPDF();
     $pdf->_vendorinfo = $vendorinfo;
     $pdf->SetFont('freesans', '', 10);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetMargins(0, 0, 0);
     self::addNewPage($pdf);
     //		$pdf->SetXY(14,35);
     //		$pdf->setfontsize(8);
     //		$pdf->MultiCell(181,1,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_FELLOW_THE_FORM,0,"C");
     //		$pdf->Rect(14, 40, 181, 34 );
     //		$pdf->text(16,45,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_INN.' '.$vendorinfo->benef_swift);
     //		$pdf->line(14,48,120,48);
     //		$pdf->line(65,40,65,48);
     //		$pdf->text(67,45,$vendorinfo->benef_iban);
     //		$pdf->line(120,40,120,74);
     //		$pdf->text(16,52,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_RECIPIENT);
     //		$pdf->text(16,58,$vendorinfo->benef_payee);//$vendorinfo->shop_name
     //		$pdf->text(122,58,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_MF_NUM);
     //		$pdf->line(135,40,135,74);
     //		$pdf->text(137,58,$vendorinfo->benef_conto);//_JSHOP_ADDON_RUS_INVOICES_PAYMENT_KPP.' '.$vendorinfo->benef_payee
     //		$pdf->line(14,60,195,60);
     //		$pdf->text(16,65,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_PAYEES_BANK);
     //		$pdf->text(16,71,''.$vendorinfo->benef_bank_info);
     //		$pdf->text(122,65,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_BIK);
     //		$pdf->line(120,67,135,67);
     //		$pdf->text(122,71,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_MF_NUM);
     //		$pdf->text(137,65,$vendorinfo->benef_bic);
     //		if($addon_config->account_correspondent){$pdf->text(137,71,$addon_config->account_correspondent);}//_JSHOP_ADDON_RUS_INVOICES_PAYMENT_INN.' '.$vendorinfo->benef_conto
     // --------- ----------------
     //заголовок
     $pdf->SetXY(14, 50);
     $pdf->SetFont('freesans', '', 12);
     $pdf->MultiCell(181, 1, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_ACCOUNT_NUMBER . $order->order_number . _JSHOP_ADDON_RUS_INVOICES_PAYMENT_OT . self::rdate($order->order_date) . _JSHOP_ADDON_RUS_INVOICES_PAYMENT_PR_YEAR, 0, "C");
     // грузополучатель и чё то там ещё
     //		$pdf->SetFont('freesans','',8);
     //		$adress=array();
     //		if($order->firma_name)$adress[]=$order->firma_name;
     //		if($order->firma_code)$adress[]=_JSHOP_ADDON_RUS_INVOICES_PAYMENT_INN." ".$order->firma_code;
     //		if($order->city)$adress[] = _JSHOP_ADDON_RUS_INVOICES_PAYMENT_PRE_CITY.$order->city;
     //		if($order->street)$adress[] = $order->street;
     //		if($order->home)$adress[] = $order->home;
     //		$pdf->text(13,93,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_PAYER.implode(", ",$adress));
     //		$adress=array();
     //		if($order->d_firma_name)$adress[]=$order->firma_name;
     //		if($order->firma_code)$adress[]=_JSHOP_ADDON_RUS_INVOICES_PAYMENT_INN." ".$order->firma_code;
     //		if($order->d_city)$adress[] = _JSHOP_ADDON_RUS_INVOICES_PAYMENT_PRE_CITY.$order->city;
     //		if($order->d_street)$adress[] = $order->street;
     //		if($order->d_home)$adress[] = $order->home;
     //		$pdf->text(13,98,_JSHOP_ADDON_RUS_INVOICES_PAYMENT_CUSTOMER.implode(", ",$adress));
     // шапка таблицы
     $y = 65;
     $pdf->Rect(14, $y, 181, 10);
     $pdf->line(22, $y, 22, $y + 10);
     $pdf->line(102, $y, 102, $y + 10);
     $pdf->line(122, $y, 122, $y + 10);
     $pdf->line(140, $y, 140, $y + 10);
     $pdf->line(165, $y, 165, $y + 10);
     $pdf->SetFont('freesans', '', 8);
     $pdf->SetXY(14, $y + 3);
     $pdf->MultiCell(8, 1, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_NUMBBER, 0, 'C');
     $pdf->SetXY(22, $y + 4);
     $pdf->MultiCell(70, 1, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_NAME_OF_THE_PRODUCT, 0, 'C');
     $pdf->SetXY(102, $y + 3);
     $pdf->MultiCell(20, 1, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_UNIT, 0, 'C');
     $pdf->SetXY(122, $y + 1);
     $pdf->MultiCell(18, 2, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_COUNT, 0, 'C');
     $pdf->SetXY(140, $y + 3);
     $pdf->MultiCell(25, 1, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_PRICE, 0, 'C');
     $pdf->SetXY(165, $y + 3);
     $pdf->MultiCell(30, 1, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_SUMM, 0, 'C');
     $y = 73;
     $y = $pdf->getY() + 2.7;
     $num = 0;
     foreach ($order->products as $prod) {
         $num++;
         $width_filename = 80;
         $pdf->SetFont('freesans', '', 8);
         $pdf->SetXY(14, $y + 1);
         $pdf->MultiCell(8, 4, $num, 0, 'C');
         $pdf->SetXY(23, $y + 1);
         $pdf->MultiCell($width_filename, 4, $prod->product_name, 0, 'L');
         if ($prod->manufacturer != '') {
             $pdf->SetXY(23, $pdf->getY());
             $pdf->MultiCell($width_filename, 4, _JSHOP_MANUFACTURER . ": " . $prod->manufacturer, 0, 'L');
         }
         if ($prod->product_attributes != "" || $prod->product_freeattributes != "" || $prod->delivery_time || $prod->extra_fields != '') {
             if ($prod->delivery_time) {
                 $pdt = _JSHOP_DELIVERY_TIME . ": " . $prod->delivery_time;
             } else {
                 $pdt = "";
             }
             $pdf->SetXY(26, $pdf->getY());
             $pdf->SetFont('freesans', '', 8);
             $attribute = sprintAtributeInOrder($prod->product_attributes, "pdf");
             $attribute .= sprintFreeAtributeInOrder($prod->product_freeattributes, "pdf");
             $attribute .= sprintExtraFiledsInOrder($prod->extra_fields, "pdf");
             $attribute .= $prod->_ext_attribute;
             $attribute .= $pdt;
             $pdf->MultiCell(62, 4, $attribute, 0, 'L');
             $pdf->SetFont('freesans', '', 8);
         }
         //$y2 = $pdf->getY() + 1;
         $y2 = $pdf->getY();
         if ($jshopConfig->show_product_code_in_order && 0) {
             $pdf->SetXY(85, $y + 1);
             $pdf->MultiCell(22, 4, $prod->product_ean, 0, 'L');
             $y3 = $pdf->getY() + 1;
         } else {
             $y3 = $pdf->getY();
         }
         $pdf->SetXY(102, $y + 1);
         $pdf->MultiCell(20, 1, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_CHT, 0, 'C');
         $pdf->SetXY(122, $y + 1);
         $pdf->MultiCell(16, 4, formatqty($prod->product_quantity) . $prod->_qty_unit, 0, 'R');
         //$y4 = $pdf->getY() + 1;
         $y4 = $pdf->getY();
         $pdf->SetXY(140, $y + 1);
         //$pdf->MultiCell(25, 4, formatprice($prod->product_item_price, $order->currency_code), 0 , 'L');
         $pdf->MultiCell(23, 4, $this->formatprice($prod->product_item_price), 0, 'R');
         if ($prod->_ext_price) {
             $pdf->SetXY(150, $pdf->getY());
             $pdf->MultiCell(40, 4, $prod->_ext_price, 0, 'R');
         }
         if ($jshopConfig->show_tax_product_in_cart && $prod->product_tax > 0) {
             $pdf->SetXY(125, $pdf->getY());
             $pdf->SetFont('freesans', '', 6);
             $text = productTaxInfo($prod->product_tax, $order->display_price);
             $pdf->MultiCell(25, 4, $text, 0, 'L');
         }
         //$y5 = $pdf->getY() + 1;
         $y5 = $pdf->getY();
         $pdf->SetFont('freesans', '', 8);
         $pdf->SetXY(165, $y + 1);
         //$pdf->MultiCell(40, 4, formatprice($prod->product_quantity * $prod->product_item_price, $order->currency_code), 0 , 'R');
         $pdf->MultiCell(28, 4, $this->formatprice($prod->product_quantity * $prod->product_item_price, 0), 0, 'R');
         if ($prod->_ext_price_total) {
             $pdf->SetXY(150, $pdf->getY());
             $pdf->MultiCell(40, 4, $prod->_ext_price_total, 0, 'R');
         }
         if ($jshopConfig->show_tax_product_in_cart && $prod->product_tax > 0) {
             $pdf->SetXY(150, $pdf->getY());
             $pdf->SetFont('freesans', '', 6);
             $text = productTaxInfo($prod->product_tax, $order->display_price);
             $pdf->MultiCell(40, 4, $text, 0, 'R');
         }
         //$y6 = $pdf->getY() + 1;
         $y6 = $pdf->getY();
         $yn = max($y2, $y3, $y4, $y5, $y6);
         // line
         $pdf->Rect(14, $y, 181, $yn - $y);
         //$pdf->Rect(20, $y, 130, $yn - $y );
         $pdf->line(22, $y, 22, $yn);
         $pdf->line(102, $y, 102, $yn);
         if ($jshopConfig->show_product_code_in_order && 0) {
             $pdf->line(85, $y, 85, $yn);
         }
         $pdf->line(122, $y, 122, $yn);
         $pdf->line(140, $y, 140, $yn);
         $pdf->line(165, $y, 165, $yn);
         $y = $yn;
         if ($y > 260) {
             self::addNewPage($pdf);
             $y = 45;
         }
     }
     //--- endforeach
     if ($y > 230) {
         self::addNewPage($pdf);
         $y = 45;
     }
     $pdf->SetFont('freesans', '', 8);
     if (($jshopConfig->hide_tax || count($order->order_tax_list) == 0) && $order->order_discount == 0 && $order->order_payment == 0 && $jshopConfig->without_shipping) {
         $hide_subtotal = 1;
     } else {
         $hide_subtotal = 0;
     }
     if (!$hide_subtotal) {
         $pdf->Rect(165, $y, 30, 5);
         $pdf->SetXY(20, $y);
         $pdf->MultiCell(143, 5, _JSHOP_SUBTOTAL, '0', 'R');
         $pdf->SetXY(165, $y);
         $pdf->MultiCell(28, 5, $this->formatprice($order->order_subtotal) . $order->_pdf_ext_subtotal, '0', 'R');
     } else {
         $y = $y - 5;
     }
     if ($order->order_discount > 0) {
         $y = $y + 5;
         $pdf->Rect(165, $y, 30, 5);
         $pdf->SetXY(20, $y);
         $pdf->MultiCell(143, 5, _JSHOP_RABATT_VALUE, '0', 'R');
         $pdf->SetXY(165, $y);
         $pdf->MultiCell(28, 5, "-" . $this->formatprice($order->order_discount) . $order->_pdf_ext_discount, '0', 'R');
     }
     if (!$jshopConfig->without_shipping) {
         $pdf->Rect(165, $y + 5, 30, 5);
         $pdf->SetXY(20, $y + 5);
         $pdf->MultiCell(143, 5, _JSHOP_SHIPPING_PRICE, '0', 'R');
         $pdf->SetXY(165, $y + 5);
         //$pdf->MultiCell(28,5,formatprice($order->order_shipping, $order->currency_code).$order->_pdf_ext_shipping,'0','R');
         $pdf->MultiCell(28, 5, $this->formatprice($order->order_shipping) . $order->_pdf_ext_shipping, '0', 'R');
         if ($order->order_package > 0 || $jshopConfig->display_null_package_price) {
             $y = $y + 5;
             $pdf->SetXY(20, $y + 5);
             $pdf->Rect(165, $y + 5, 30, 5);
             $pdf->MultiCell(143, 5, _JSHOP_PACKAGE_PRICE, '0', 'R');
             $pdf->SetXY(165, $y + 5);
             //$pdf->MultiCell(28,5,formatprice($order->order_package, $order->currency_code).$order->_pdf_ext_shipping_package,'0','R');
             $pdf->MultiCell(28, 5, $this->formatprice($order->order_package) . $order->_pdf_ext_shipping_package, '0', 'R');
         }
     } else {
         $y = $y - 5;
     }
     if ($order->order_payment != 0) {
         $y = $y + 5;
         $pdf->SetXY(20, $y + 5);
         $pdf->Rect(165, $y + 5, 30, 5);
         $pdf->MultiCell(143, 5, $order->payment_name, '0', 'R');
         $pdf->SetXY(165, $y + 5);
         //$pdf->MultiCell(40,5, formatprice($order->order_payment, $order->currency_code).$order->_pdf_ext_payment, '1','R');
         $pdf->MultiCell(28, 5, $this->formatprice($order->order_payment) . $order->_pdf_ext_payment, '0', 'R');
     }
     $show_percent_tax = 1;
     if ($jshopConfig->hide_tax) {
         $show_percent_tax = 0;
     }
     if (!$jshopConfig->hide_tax) {
         foreach ($order->order_tax_list as $percent => $value) {
             $pdf->SetXY(20, $y + 10);
             $pdf->Rect(165, $y + 10, 30, 5);
             $text = displayTotalCartTaxName($order->display_price);
             if ($show_percent_tax) {
                 $text = $text . " " . formattax($percent) . "%";
             }
             $pdf->MultiCell(143, 5, $text, '0', 'R');
             $pdf->SetXY(165, $y + 10);
             //$pdf->MultiCell(40,5,formatprice($value, $order->currency_code).$order->_pdf_ext_tax[$percent],'1','R');
             $pdf->MultiCell(28, 5, $this->formatprice($value) . $order->_pdf_ext_tax[$percent], '0', 'R');
             $y = $y + 5;
         }
     }
     $text_total = _JSHOP_ENDTOTAL;
     if (($jshopConfig->show_tax_in_product || $jshopConfig->show_tax_product_in_cart) && count($order->order_tax_list) > 0) {
         $text_total = _JSHOP_ENDTOTAL_INKL_TAX;
     }
     $pdf->SetFont('freesansb', '', 8);
     $pdf->SetXY(20, $y + 10);
     $pdf->Rect(165, $y + 10, 30, 5.1);
     $pdf->MultiCell(143, 5, $text_total, '0', 'R');
     $pdf->SetXY(165, $y + 10);
     //$pdf->MultiCell(40,5,formatprice($order->order_total, $order->currency_code).$order->_pdf_ext_total,'1','R');
     $pdf->MultiCell(28, 5, $this->formatprice($order->order_total, $order->currency_code) . $order->_pdf_ext_total, '0', 'R');
     if ($jshopConfig->display_tax_id_in_pdf && $order->tax_number) {
         $y = $y + 5.2;
         $pdf->SetFont('freesans', '', 7);
         $pdf->SetXY(20, $y + 10);
         $pdf->MultiCell(143, 4, _JSHOP_TAX_NUMBER . ": " . $order->tax_number, '0', 'L');
     }
     $y = $pdf->getY() + 15;
     //сумма всего текстом
     $pdf->SetFont('freesans', '', 8);
     $pdf->SetXY(13, $y);
     $pdf->MultiCell(180, 1, _JSHOP_ADDON_RUS_INVOICES_PAYMENT_TOTAL_ITEMS . $num . ", " . _JSHOP_ADDON_RUS_INVOICES_PAYMENT_THE_AMOUNT . $this->formatprice($order->order_total) . " руб.", '0', 'L');
     $pdf->SetFont('freesansb', '', 8);
     $pdf->SetXY(13, $y + 5);
     $pdf->MultiCell(180, 1, $this->mb_ucfirst($this->SumProp($this->formatprice($order->order_total))) . " руб.", '0', 'L');
     $y = $y + 20;
     //мой текст
     //		$pdf->SetFont('freesans','',8);
     //		$text = "Мой супер магазин";
     //		$pdf->text(14,$y,$text);
 }
    	</td>
  	</tr>
  	<?php 
}
?>
  
  	<?php 
if (!$this->config->hide_tax) {
    ?>
  	<?php 
    foreach ($this->tax_list as $percent => $value) {
        ?>
  	<tr class="tax">
    	<td class="name">
      		<?php 
        echo displayTotalCartTaxName();
        ?>
      		<?php 
        if ($this->show_percent_tax) {
            echo formattax($percent) . "%";
        }
        ?>
    	</td>
    	<td class="value">
      		<?php 
        echo formatprice($value);
        echo $this->_tmp_ext_tax[$percent];
        ?>
    	</td>
  	</tr>
  	<?php 
function generatePDF($order)
{
    $jshopConfig = JSFactory::getConfig();
    $vendorinfo = $order->getVendorInfo();
    JPluginHelper::importPlugin('jshoppingorder');
    $dispatcher = JDispatcher::getInstance();
    $dispatcher->trigger('onBeforeCreatePdfOrder', array(&$order, &$vendorinfo));
    $pdf = new JorderPDF();
    $pdf->_vendorinfo = $vendorinfo;
    $pdf->SetFont('freesans', '', 8);
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->SetMargins(0, 0, 0);
    $pdf->addNewPage();
    /************************* Начало тела PDF *****************************/
    $pdf->SetXY(32, 5);
    $pdf->setfontsize(8);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->Cell(150, 0, 'Внимание! Оплата данного счета означает согласие с условиями поставки товара. Уведомление об оплате');
    $pdf->SetXY(32, 9);
    $pdf->Cell(150, 0, 'обязательно, в противном случае не гарантируется наличие товара на складе. Товар отпускается по факту');
    $pdf->SetXY(46, 13);
    $pdf->Cell(150, 0, 'прихода денег на р\\сч Поставщика, самовывозом при наличии доверенности и паспорта.');
    $pdf->setfontsize(10);
    $pdf->SetXY(20, 20);
    $pdf->Cell(95, 15, '', '1', 'L');
    $pdf->SetXY(115, 20);
    $pdf->Cell(15, 5, '', '1', 'L');
    $pdf->SetXY(115, 20);
    $pdf->Cell(15, 5, '', '1', 'L');
    $pdf->SetXY(130, 20);
    $pdf->Cell(60, 15, '', '1', 'L');
    $pdf->SetXY(20, 35);
    $pdf->Cell(48, 5, '', '1', 'L');
    $pdf->SetXY(68, 35);
    $pdf->Cell(47, 5, '', '1', 'L');
    $pdf->SetXY(20, 40);
    $pdf->Cell(95, 15, '', '1', 'L');
    $pdf->SetXY(130, 35);
    $pdf->Cell(60, 20, '', '1', 'L');
    $pdf->SetXY(115, 35);
    $pdf->Cell(15, 20, '', '1', 'L');
    $pdf->SetXY(20, 20);
    $pdf->Cell(95, 10, $vendorinfo->benef_bank_info, '0', 'L');
    //Наименование банка
    $pdf->SetXY(20, 30);
    $pdf->Cell(95, 5, 'Банк получателя', '0', 'L');
    $pdf->SetXY(115, 20);
    $pdf->Cell(15, 5, 'БИК', '0', 'L');
    $pdf->SetXY(130, 20);
    $pdf->Cell(60, 5, $vendorinfo->benef_bic, '0', 'L');
    // БИК
    $pdf->SetXY(115, 25);
    $pdf->Cell(15, 5, 'р/с', '0', 'L');
    $pdf->SetXY(130, 25);
    $pdf->Cell(60, 5, $vendorinfo->benef_conto, '0', 'L');
    // Кор. сч.
    $pdf->SetXY(20, 35);
    $pdf->Cell(48, 5, 'ИНН', '0', 'L');
    $pdf->SetXY(30, 35);
    $pdf->Cell(38, 5, $vendorinfo->benef_swift, '0', 'L');
    // ИНН
    $pdf->SetXY(68, 35);
    $pdf->Cell(47, 5, 'КПП', '0', 'L');
    $pdf->SetXY(78, 35);
    $pdf->Cell(47, 5, $vendorinfo->benef_iban, '0', 'L');
    //КПП
    $pdf->SetXY(20, 40);
    $pdf->Cell(90, 10, $vendorinfo->company_name, '0', 'L');
    // Получатель платежа
    $pdf->SetXY(20, 50);
    $pdf->Cell(90, 5, 'Получатель', '0', 'L');
    $pdf->SetXY(115, 35);
    $pdf->Cell(15, 5, 'к/с', '0', 'L');
    $pdf->SetXY(130, 35);
    $pdf->Cell(60, 5, $vendorinfo->identification_number, '0', 'L');
    //Р.сч
    $pdf->SetXY(25, 60);
    $pdf->SetFont('freesansb', '', 11);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->Cell(60, 6, 'Счет на оплату', 0, 'R');
    $pdf->SetXY(40, 60);
    $pdf->MultiCell(65, 60, "N " . $order->order_number . " от " . $order->order_date, 0, 'R');
    if ($jshopConfig->date_invoice_in_invoice) {
        $pdf->SetXY(40, 60);
        $pdf->MultiCell(65, 90, _JSHOP_INVOICE_DATE . " " . strftime($jshopConfig->store_date_format, strtotime(date("Y-m-d H:i:s"))), 0, 'R');
    }
    $pdf->SetXY(20, 70);
    $pdf->Cell(170, 0.2, '', 1, 'L');
    $pdf->SetXY(20, 75);
    $pdf->SetFont('freesans', '', 10);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->Cell(20, 5, 'Поставщик:', 0, 'R');
    $pdf->SetXY(20, 90);
    $pdf->Cell(20, 5, 'Покупатель:', 0, 'R');
    $pdf->SetFont('freesansb', '', 10);
    $pdf->SetXY(45, 75);
    $pdf->MultiCell(150, 3, $vendorinfo->company_name . ",ИНН " . $vendorinfo->benef_swift . ",КПП" . $vendorinfo->benef_iban . ", " . $vendorinfo->zip . ", " . $vendorinfo->city . ", " . $vendorinfo->adress, "Тел.: " . $vendorinfo->phone, "Факс: " . $vendorinfo->fax, 0, 'L');
    $pdf->SetXY(45, 90);
    if ($order->zip) {
        $zip_code = $order->zip . ", ";
    } else {
        $zip_code = "";
    }
    $pdf->MultiCell(150, 3, $order->firma_name . " " . $order->f_name . " " . $order->l_name . ", " . $order->street . ", " . $zip_code . "" . $order->city . ", " . $order->country, 0, 'L');
    $pdf->SetDrawColor(0, 0, 0);
    $pdf->SetFont('freesans', '', 7);
    if ($vendorinfo->tax_number) {
        $pdf->SetXY(115, 106);
        $pdf->MultiCell(35, 4, _JSHOP_TAX_NUMBER, 1, 'L');
        $pdf->SetXY(150, 106);
        $pdf->MultiCell(40, 4, $vendorinfo->tax_number, 1, 'R');
    }
    $width_filename = 65;
    if (!$jshopConfig->show_product_code_in_order) {
        $width_filename = 87;
    }
    $pdf->setfillcolor(200, 200, 200);
    $pdf->Rect(20, 116, 170, 4, 'F');
    $pdf->SetFont('freesansb', '', 7.5);
    $pdf->SetXY(20, 116);
    $pdf->MultiCell($width_filename, 4, 'Товары (работы,услуги)', 1, 'L');
    if ($jshopConfig->show_product_code_in_order) {
        $pdf->SetXY(85, 116);
        $pdf->MultiCell(22, 4, _JSHOP_EAN_PRODUCT, 1, 'L');
    }
    $pdf->SetXY(107, 116);
    $pdf->MultiCell(18, 4, _JSHOP_QUANTITY, 1, 'L');
    $pdf->SetXY(125, 116);
    $pdf->MultiCell(25, 4, _JSHOP_SINGLEPRICE, 1, 'L');
    $pdf->SetXY(150, 116);
    $pdf->MultiCell(40, 4, _JSHOP_TOTAL, 1, 'R');
    $y = 120;
    $prodtot = 0;
    foreach ($order->products as $prod) {
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y + 2);
        $pdf->MultiCell($width_filename, 4, $prod->product_name, 0, 'L');
        if ($prod->manufacturer != '') {
            $pdf->SetXY(20, $pdf->getY());
            $pdf->MultiCell($width_filename, 4, _JSHOP_MANUFACTURER . ": " . $prod->manufacturer, 0, 'L');
        }
        if ($prod->product_attributes != "" || $prod->product_freeattributes != "" || $prod->delivery_time || $prod->extra_fields != '') {
            if ($prod->delivery_time) {
                $pdt = _JSHOP_DELIVERY_TIME . ": " . $prod->delivery_time;
            } else {
                $pdt = "";
            }
            $pdf->SetXY(23, $pdf->getY());
            $pdf->SetFont('freesans', '', 6);
            $attribute = sprintAtributeInOrder($prod->product_attributes, "pdf");
            $attribute .= sprintFreeAtributeInOrder($prod->product_freeattributes, "pdf");
            $attribute .= sprintExtraFiledsInOrder($prod->extra_fields, "pdf");
            $attribute .= $pdt;
            $pdf->MultiCell(62, 4, $attribute, 0, 'L');
            $pdf->SetFont('freesans', '', 7);
        }
        $y2 = $pdf->getY() + 2;
        if ($jshopConfig->show_product_code_in_order) {
            $pdf->SetXY(85, $y + 2);
            $pdf->MultiCell(22, 4, $prod->product_ean, 0, 'L');
            $y3 = $pdf->getY() + 2;
        } else {
            $y3 = $pdf->getY();
        }
        $pdf->SetXY(107, $y + 2);
        $pdf->MultiCell(18, 4, formatqty($prod->product_quantity) . ' ' . $prod->product_qty_unit, 0, 'L');
        $y4 = $pdf->getY() + 2;
        $pdf->SetXY(125, $y + 2);
        $pdf->MultiCell(25, 4, formatprice($prod->product_item_price, $order->currency_code), 0, 'L');
        if ($jshopConfig->show_tax_product_in_cart && $prod->product_tax > 0) {
            $pdf->SetXY(125, $y + 6);
            $pdf->SetFont('freesans', '', 6);
            $text = productTaxInfo($prod->product_tax, $order->display_price);
            $pdf->MultiCell(25, 4, $text, 0, 'L');
        }
        $y5 = $pdf->getY() + 2;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(150, $y + 2);
        $pdf->MultiCell(40, 4, formatprice($prod->product_quantity * $prod->product_item_price, $order->currency_code), 0, 'R');
        if ($jshopConfig->show_tax_product_in_cart && $prod->product_tax > 0) {
            $pdf->SetXY(150, $y + 6);
            $pdf->SetFont('freesans', '', 6);
            $text = productTaxInfo($prod->product_tax, $order->display_price);
            $pdf->MultiCell(40, 4, $text, 0, 'R');
        }
        $y6 = $pdf->getY() + 2;
        $yn = max($y2, $y3, $y4, $y5, $y6);
        $pdf->Rect(20, $y, 170, $yn - $y);
        $pdf->Rect(20, $y, 130, $yn - $y);
        if ($jshopConfig->show_product_code_in_order) {
            $pdf->line(85, $y, 85, $yn);
        }
        $pdf->line(107, $y, 107, $yn);
        $pdf->line(125, $y, 125, $yn);
        $y = $yn;
        if ($y > 260) {
            $pdf->addNewPage();
            $y = 60;
        }
        $prodtot = $prodtot + 1;
    }
    if ($y > 240) {
        $pdf->addNewPage();
        $y = 60;
    }
    $pdf->SetFont('freesans', '', 10);
    if (($jshopConfig->hide_tax || count($order->order_tax_list) == 0) && $order->order_discount == 0 && $order->order_payment == 0 && $jshopConfig->without_shipping) {
        $hide_subtotal = 1;
    } else {
        $hide_subtotal = 0;
    }
    if (!$hide_subtotal) {
        $pdf->SetXY(20, $y);
        $pdf->Rect(20, $y, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_SUBTOTAL, '1', 'R');
        $pdf->SetXY(150, $y);
        $pdf->MultiCell(40, 5, formatprice($order->order_subtotal, $order->currency_code), '1', 'R');
    } else {
        $y = $y - 5;
    }
    if ($order->order_discount > 0) {
        $y = $y + 5;
        $pdf->SetXY(20, $y);
        $pdf->Rect(20, $y, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_RABATT_VALUE, '1', 'R');
        $pdf->SetXY(150, $y);
        $pdf->MultiCell(40, 5, "-" . formatprice($order->order_discount, $order->currency_code), '1', 'R');
    }
    if (!$jshopConfig->without_shipping) {
        $pdf->SetXY(20, $y + 5);
        $pdf->Rect(20, $y + 5, 170, 5, 'F');
        $pdf->MultiCell(130, 5, _JSHOP_SHIPPING_PRICE, '1', 'R');
        $pdf->SetXY(150, $y + 5);
        $pdf->MultiCell(40, 5, formatprice($order->order_shipping, $order->currency_code), '1', 'R');
    } else {
        $y = $y - 5;
    }
    if ($order->order_payment != 0) {
        $y = $y + 5;
        $pdf->SetXY(20, $y + 5);
        $pdf->Rect(20, $y + 5, 170, 5, 'F');
        $pdf->MultiCell(130, 5, $order->payment_name, '1', 'R');
        $pdf->SetXY(150, $y + 5);
        $pdf->MultiCell(40, 5, formatprice($order->order_payment, $order->currency_code), '1', 'R');
    }
    $show_percent_tax = 0;
    if (count($order->order_tax_list) > 1 || $jshopConfig->show_tax_in_product) {
        $show_percent_tax = 1;
    }
    if ($jshopConfig->hide_tax) {
        $show_percent_tax = 0;
    }
    if (!$jshopConfig->hide_tax) {
        foreach ($order->order_tax_list as $percent => $value) {
            $pdf->SetXY(20, $y + 10);
            $pdf->Rect(20, $y + 10, 170, 5, 'F');
            $text = displayTotalCartTaxName($order->display_price);
            if ($show_percent_tax) {
                $text = $text . " " . formattax($percent) . "%";
            }
            $pdf->MultiCell(130, 5, $text, '1', 'R');
            $pdf->SetXY(150, $y + 10);
            $pdf->MultiCell(40, 5, formatprice($value, $order->currency_code), '1', 'R');
            $y = $y + 5;
        }
    }
    $pdf->SetXY(20, $y + 20);
    $pdf->Cell(50, 5, 'Всего наименований ' . $prodtot . ' на сумму: ' . formatprice($order->order_total, $order->currency_code), '0', 'L');
    $m = new money2str();
    $m = $m->work($order->order_total, true);
    $afm = mb_substr(trim($m), 0, 1, 'UTF-8');
    switch ($afm) {
        case 'о':
            $afm = 'О';
            break;
        case 'д':
            $afm = 'Д';
            break;
        case 'т':
            $afm = 'Т';
            break;
        case 'ч':
            $afm = 'Ч';
            break;
        case 'п':
            $afm = 'П';
            break;
        case 'ш':
            $afm = 'Ш';
            break;
        case 'с':
            $afm = 'С';
            break;
        case 'в':
            $afm = 'В';
            break;
        case 'м':
            $afm = 'М';
            break;
        default:
            $afm = '';
    }
    $pdf->SetXY(20, $y + 25);
    $text_summa = substr_replace(trim($m), $afm, 0, 2);
    $pdf->MultiCell(170, 5, $text_summa, '0', '');
    $text_total = _JSHOP_ENDTOTAL;
    if (($jshopConfig->show_tax_in_product || $jshopConfig->show_tax_product_in_cart) && count($order->order_tax_list) > 0) {
        $text_total = _JSHOP_ENDTOTAL_INKL_TAX;
    }
    $pdf->SetFont('freesansb', '', 10);
    $pdf->SetXY(20, $y + 10);
    $pdf->Rect(20, $y + 10, 170, 5.1, 'F');
    $pdf->MultiCell(130, 5, $text_total, '1', 'R');
    $pdf->SetXY(150, $y + 10);
    $pdf->MultiCell(40, 5, formatprice($order->order_total, $order->currency_code), '1', 'R');
    if ($jshopConfig->display_tax_id_in_pdf && $order->tax_number) {
        $y = $y + 5.2;
        $pdf->SetFont('freesans', '', 7);
        $pdf->SetXY(20, $y + 10);
        $pdf->MultiCell(170, 4, _JSHOP_TAX_NUMBER . ": " . $order->tax_number, '1', 'L');
    }
    $y = $y + 30;
    $pdf->SetXY(20, $y);
    $pdf->Cell(170, 0.2, '', 1, 'L');
    $pdf->SetXY(20, $y + 10);
    $pdf->Image($jshopConfig->path . 'images/footer.jpg', 10, $y - 10, $jshopConfig->pdf_footer_width, $jshopConfig->pdf_footer_height);
    $pdf->Cell(170, 5, 'Руководитель _________________ Смирнов С.М.     Бухгалтер __________________ Смирнов С.М.', '0', 'L');
    $y = $y + 20;
    if ($y > 240) {
        $pdf->addNewPage();
        $y = 60;
    }
    /*********************************** Конец тела PDF ****************************************/
    $name_pdf = $order->order_id . "_" . md5(uniqid(rand(0, 100))) . ".pdf";
    $dispatcher->trigger('onBeforeCreatePdfOrderEnd', array(&$order, &$pdf, &$name_pdf));
    $pdf->Output($jshopConfig->pdf_orders_path . "/" . $name_pdf, 'F');
    return $name_pdf;
}