$tbl .= fn_price_list_print_product_data($product, $selected_fields, $style, $price_schema); $fill = !$fill; } $counter->out(); } $tbl .= '</table>'; $counter->out(); Pdf::batchAdd($tbl); } } } //Close and output PDF document $temp_filename = fn_create_temp_file(); $imp_filename = $temp_filename . '.pdf'; fn_rename($temp_filename, $imp_filename); Pdf::batchRender($imp_filename, true); Storage::instance('assets')->put($filename, array('file' => $imp_filename, 'caching' => true)); fn_echo('<br />' . __('done')); } /** * * Adds product data in HTML format to price list table * @param array $product Product data * @param array $selected_fields Product fields that should be in price list * @param string $style Product row style (similar to the HTML style attribute, e.g.: style="background-color: #EEEEEE") * @param array $price_schema Price list columns scheme * @param array $options_variants Product options variants * * @return string Product data row in HTML format */ function fn_price_list_print_product_data($product, $selected_fields, $style, $price_schema, $options_variants = array())
$order_info['str_total'] = CART_SECONDARY_CURRENCY == 'RUB' ? RusInvoicePayment::clearDoit($order_info['total']) : ""; $order_info['path_stamp'] = fn_get_image_pairs($order_info['payment_id'], 'stamp', 'M', true, true, DESCR_SL); $order_info['text_invoice_payment'] = __("addons.rus_payments.text_invoice_payment", array('[number_account]' => $order_info['order_id'], '[invoice_data]' => $invoice_date)); $view = Tygh::$app['view']; //fn_set_notification('I','view>',print_r($view)); $view->assign('total_print', $total_print); $view->assign('order_info', $order_info); $view->assign('fonts_path', fn_get_theme_path('[relative]/[theme]/media/fonts')); if ($order_info['shipping_cost'] != 0) { $view->assign('shipping_cost', true); } if ($mode == "send_account_payment") { if (!empty($order_info['email'])) { fn_disable_live_editor_mode(); $html = array($view->displayMail('addons/rus_payments/print_invoice_payment.tpl', false, 'C')); Pdf::render($html, fn_get_files_dir_path() . 'account_payment.pdf', 'save'); $data = array('order_info' => $order_info, 'total_print' => $total_print, 'fonts_path' => fn_get_theme_path('[relative]/[theme]/media/fonts')); Mailer::sendMail(array('to' => $order_info['email'], 'from' => 'default_company_orders_department', 'data' => $data, 'attachments' => array(fn_get_files_dir_path() . 'account_payment.pdf'), 'tpl' => 'addons/rus_payments/print_invoice_payment.tpl', 'is_html' => true), 'A'); fn_set_notification('N', __('notice'), __('text_email_sent')); } } else { $view->assign('show_print_button', true); $view->displayMail('addons/rus_payments/print_invoice_payment.tpl', true, 'C'); } exit; } elseif ($mode == 'get_stamp') { Header("Content-Type: image/png"); Header("Content-Type: image/jpg"); Header("Content-Type: image/jpeg"); Header("Content-Type: image/gif"); $path_stamp = fn_get_image_pairs($_REQUEST['payment_id'], 'stamp', 'M', true, true, DESCR_SL);
function fn_print_order_packing_slips($order_ids, $pdf = false, $lang_code = CART_LANGUAGE) { $view = Registry::get('view'); $html = array(); if (!is_array($order_ids)) { $order_ids = array($order_ids); } foreach ($order_ids as $order_id) { $order_info = fn_get_order_info($order_id, false, true, false, true); if (empty($order_info)) { continue; } $view->assign('order_info', $order_info); if ($pdf == true) { fn_disable_live_editor_mode(); $html[] = $view->displayMail('orders/print_packing_slip.tpl', false, 'A', $order_info['company_id'], $lang_code); } else { $view->displayMail('orders/print_packing_slip.tpl', true, 'A', $order_info['company_id'], $lang_code); } if ($order_id != end($order_ids)) { echo "<div style='page-break-before: always;'> </div>"; } } if ($pdf == true) { Pdf::render($html, __('packing_slip') . '-' . implode('-', $order_ids)); } return true; }
function fn_print_order_invoices($order_ids, $pdf = false, $area = AREA, $lang_code = CART_LANGUAGE) { $view = Registry::get('view'); $html = array(); $view->assign('order_status_descr', fn_get_simple_statuses(STATUSES_ORDER, true, true)); $view->assign('profile_fields', fn_get_profile_fields('I')); if (!is_array($order_ids)) { $order_ids = array($order_ids); } foreach ($order_ids as $order_id) { $order_info = fn_get_order_info($order_id, false, true, false, true); if (empty($order_info)) { continue; } if (fn_allowed_for('MULTIVENDOR')) { $view->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($order_info['products'])); } list($shipments) = fn_get_shipments_info(array('order_id' => $order_info['order_id'], 'advanced_info' => true)); $use_shipments = !fn_one_full_shipped($shipments); $view->assign('order_info', $order_info); $view->assign('shipments', $shipments); $view->assign('use_shipments', $use_shipments); $view->assign('payment_method', fn_get_payment_data(!empty($order_info['payment_method']['payment_id']) ? $order_info['payment_method']['payment_id'] : 0, $order_info['order_id'], $lang_code)); $view->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $lang_code, $order_info['company_id'])); $view->assign('status_settings', fn_get_status_params($order_info['status'])); $view->assign('company_data', fn_get_company_placement_info($order_info['company_id'], $lang_code)); if ($pdf == true) { fn_disable_live_editor_mode(); $html[] = $view->displayMail('orders/print_invoice.tpl', false, $area, $order_info['company_id'], $lang_code); } else { $view->displayMail('orders/print_invoice.tpl', true, $area, $order_info['company_id'], $lang_code); if ($order_id != end($order_ids)) { echo "<div style='page-break-before: always;'> </div>"; } } } if ($pdf == true) { Pdf::render($html, __('invoices') . '-' . implode('-', $order_ids)); } return true; }
function fn_print_spsr_invoice($invoice_ids, $pdf = false, $lang_code = CART_LANGUAGE) { $view = Tygh::$app['view']; $html = array(); if (!is_array($invoice_ids)) { $invoice_ids = array($invoice_ids); } $spsr_settings = Registry::get('addons.rus_spsr'); $info_barcode = array('width' => $spsr_settings['width'], 'height' => $spsr_settings['height'], 'type' => 'C128B'); $view->assign('info_barcode', $info_barcode); foreach ($invoice_ids as $invoice_id) { list($invoice_info, $pieces) = fn_get_spsr_invoice_info($invoice_id); $order_info = fn_get_order_info($invoice_info['order_id'], false, true, false, true); if (empty($invoice_info) && empty($order_info)) { continue; } $view->assign('order_info', $order_info); $view->assign('invoice_info', $invoice_info); $view->assign('pieces', $pieces); if ($pdf == true) { fn_disable_translation_mode(); $html[] = $view->displayMail('orders/print_packing_slip.tpl', false, 'A', $invoice_info['company_id'], $lang_code); } else { $view->displayMail('addons/rus_spsr/print_invoice.tpl', true, 'A', $invoice_info['company_id'], $lang_code); } if ($invoice_id != end($invoice_ids)) { echo "<div style='page-break-before: always;'> </div>"; } } if ($pdf == true) { Pdf::render($html, __('packing_slip') . '-' . implode('-', $order_ids)); } return true; }
function fn_qwintry_save_order_invoice($order_id, $area = AREA, $lang_code = CART_LANGUAGE) { $view = Tygh::$app['view']; $html = array(); $view->assign('order_status_descr', fn_get_simple_statuses(STATUSES_ORDER, true, true)); $view->assign('profile_fields', fn_get_profile_fields('I')); $order_info = fn_get_order_info($order_id, false, true, false, true); if (empty($order_info)) { return; } if (fn_allowed_for('MULTIVENDOR')) { $view->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($order_info['products'])); } list($shipments) = fn_get_shipments_info(array('order_id' => $order_info['order_id'], 'advanced_info' => true)); $use_shipments = !fn_one_full_shipped($shipments); $view->assign('order_info', $order_info); $view->assign('shipments', $shipments); $view->assign('use_shipments', $use_shipments); $view->assign('payment_method', fn_get_payment_data(!empty($order_info['payment_method']['payment_id']) ? $order_info['payment_method']['payment_id'] : 0, $order_info['order_id'], $lang_code)); $view->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $lang_code, $order_info['company_id'])); $view->assign('status_settings', fn_get_status_params($order_info['status'])); $view->assign('company_data', fn_get_company_placement_info($order_info['company_id'], $lang_code)); fn_disable_live_editor_mode(); $html[] = $view->displayMail('orders/print_invoice.tpl', false, $area, $order_info['company_id'], $lang_code); $filename = QWINTRY_DIR_INVOICES . $order_id . '.pdf'; if (Pdf::render($html, $filename, true)) { return $filename; } return false; }
$html[] = $view->displayMail('addons/rus_russianpost/blank_116_pdf.tpl', false, AREA, $order_info['company_id'], $lang_code); } else { $view->displayMail('addons/rus_russianpost/blank_116.tpl', true, AREA, $order_info['company_id'], $lang_code); } } if ($action == 'blank_107') { if ($params['print_pdf'] == 'Y') { $pdf_params = array('page_width' => '293mm', 'page_height' => '210mm', 'margin_left' => '0mm', 'margin_right' => '0mm', 'margin_top' => '0mm', 'margin_bottom' => '0mm'); $blanks = array(1); $html[] = $view->displayMail('addons/rus_russianpost/blank_107_pdf.tpl', false, AREA, $order_info['company_id'], $lang_code); } else { $view->displayMail('addons/rus_russianpost/blank_107.tpl', true, AREA, $order_info['company_id'], $lang_code); } } if ($params['print_pdf'] == 'Y') { Pdf::render($html, __("addons.rus_russianpost.{$action}") . ' #' . $order_info['order_id'] . '-' . implode('-', $blanks), false, $pdf_params); } } exit; } } if ($mode == 'edit') { $tabs = array('settings' => array('title' => __('settings'), 'js' => true), 'recipient' => array('title' => __('recipient'), 'js' => true), 'sender' => array('title' => __('sender'), 'js' => true)); Registry::set('navigation.tabs', $tabs); $order_id = $_REQUEST['order_id']; $order_info = fn_get_order_info($order_id, false, true, false, true); if (CART_PRIMARY_CURRENCY != 'RUB') { $currencies = Registry::get('currencies'); if (!empty($currencies['RUB'])) { $currency = $currencies['RUB']; if (!empty($currency)) {
} else { $view->displayMail('addons/rus_russianpost/7-p.tpl', true, AREA, $order_info['company_id'], $lang_code); } } if ($action == '7b') { if ($params['print_pdf'] == 'Y') { $pdf_params = array('page_width' => '148mm', 'page_height' => '105mm', 'margin_left' => '0mm', 'margin_right' => '0mm', 'margin_top' => '0mm', 'margin_bottom' => '0mm'); $blanks = array(1); $html[] = $view->displayMail('addons/rus_russianpost/7-b_pdf.tpl', false, AREA, $order_info['company_id'], $lang_code); } else { $view->displayMail('addons/rus_russianpost/7-b.tpl', true, AREA, $order_info['company_id'], $lang_code); } } } if ($params['print_pdf'] == 'Y') { Pdf::render($html, __("rus_post_blank.{$action}") . ' #' . $order_info['order_id'] . '-' . implode('-', $blanks), false, $pdf_params); } exit; } } if ($mode == 'edit') { // [Page sections] $tabs = array('settings' => array('title' => __('settings'), 'js' => true), 'recipient' => array('title' => __('recipient'), 'js' => true), 'sender' => array('title' => __('sender'), 'js' => true)); Registry::set('navigation.tabs', $tabs); // [/Page sections] $order_id = $_REQUEST['order_id']; $order_info = fn_get_order_info($order_id, false, true, false, true); if (CART_PRIMARY_CURRENCY != 'RUB') { $currencies = Registry::get('currencies'); if (!empty($currencies['RUB'])) { $currency = $currencies['RUB'];
protected function printFooter() { RenderPdf::batchAdd('</table></body></html>'); RenderPdf::batchRender($this->getFileName(), true); }
function fn_print_shipment_packing_slips($shipment_ids, $pdf = false, $lang_code = CART_LANGUAGE) { $view = Tygh::$app['view']; $month = array(1 => 'Января', 2 => 'Февраля', 3 => 'Марта', 4 => 'Апреля', 5 => 'Мая', 6 => 'Июня', 7 => 'Июля', 8 => 'Августа', 9 => 'Сентября', 10 => 'Октября', 11 => 'Ноября', 12 => 'Декабря'); foreach ($shipment_ids as $shipment_id) { list($shipment, $order_info) = fn_get_packing_info($shipment_id); $order_info_ = fn_get_order_info($order_info['order_id']); if (empty($shipment)) { continue; } $total_weight = 0; // foreach($order_info['products'] as $pi=>$pv) // { // $total_weight+=$pv['weight']; // } $order_info['payment_info'] = $order_info_['payment_info']; $order_info['payment_method'] = $order_info_['payment_method']; $order_info['timestamp'] = $order_info_['timestamp']; $order_info['info_customer'] = ""; $n_month = (int) date("m", $order_info['timestamp']); $invoice_date = date("d", $order_info['timestamp']) . ' ' . $month[$n_month] . ' ' . date("Y", $order_info['timestamp']); $order_info['text_invoice_payment'] = __("addons.rus_payments.text_invoice_payment", array('[number_account]' => $order_info['order_id'], '[invoice_data]' => $invoice_date)); $order_info['invoice_date'] = $invoice_date; $products = fn_load_products_extra_data($order_info['products'], array('only_short_fields' => true), 'ru'); $total_amount = 0; //var_dump($products); die(); foreach ($products as $pi => $pv) { $weights[$pi] = $pv['weight']; $total_weight += $pv['weight'] * $pv['shipped_amount']; $total_amount += $pv['shipped_amount']; //var_dump($pv['amount'],'<br/>'); } $order_info['weights'] = $weights; $order_info['total_cnt'] = $total_amount; $order_info['str_count'] = RusInvoicePayment::clearDoit($total_amount); $order_info['str_count'] = str_replace('Один', 'Одно', $order_info['str_count']); $order_info['str_count'] = str_replace(array(' 00 копеек', 'рублей', 'рубль', 'рубля'), '', $order_info['str_count']); $order_info['total_weight'] = RusInvoicePayment::clearDoit($total_weight); $order_info['total_weight'] = str_replace(array('рублей', 'рубль'), 'килограмм', $order_info['total_weight']); $order_info['total_weight'] = str_replace('рубля', 'килограмма', $order_info['total_weight']); $order_info['total_weight'] = str_replace('копеек', 'грамм', $order_info['total_weight']); $order_info['str_total'] = RusInvoicePayment::clearDoit($order_info['display_subtotal']); if (!empty($order_info['payment_info'])) { if (!empty($order_info['payment_info']['organization_customer'])) { $order_info['info_customer'] .= $order_info['payment_info']['organization_customer'] . ' '; } if (!empty($order_info['payment_info']['inn_customer'])) { $order_info['info_customer'] .= __("inn_customer") . ': ' . $order_info['payment_info']['inn_customer'] . ' '; } if (!empty($order_info['payment_info']['kpp_customer'])) { $order_info['info_customer'] .= __("kpp_customer") . ': ' . $order_info['payment_info']['kpp_customer'] . ' '; } if (!empty($order_info['payment_info']['ogrn_customer'])) { $order_info['info_customer'] .= __("ogrn_customer") . ': ' . $order_info['payment_info']['ogrn_customer'] . ' '; } if (!empty($order_info['payment_info']['phone'])) { $order_info['info_customer'] .= __("phone") . ': ' . $order_info['payment_info']['phone'] . ' '; } if (!empty($order_info['payment_info']['zip_postal_code'])) { $order_info['info_customer'] .= __("zip_postal_code") . ': ' . $order_info['payment_info']['zip_postal_code'] . ' '; } if (!empty($order_info['payment_info']['address'])) { $order_info['info_customer'] .= __("address") . ': ' . $order_info['payment_info']['address'] . ' '; } if (!empty($order_info['payment_info']['bank_details'])) { $order_info['info_customer'] .= __("addons.rus_payments.bank_details") . ': ' . $order_info['payment_info']['bank_details']; } } $order_info['info_supplier'] = ""; $data_payment = $order_info['payment_method']['processor_params']; if (!empty($data_payment)) { if (!empty($data_payment['account_recepient_name'])) { $order_info['info_supplier'] .= $data_payment['account_recepient_name'] . '; '; } if (!empty($data_payment['account_address'])) { $order_info['info_supplier'] .= __("address") . ': ' . $data_payment['account_address'] . '; '; } if (!empty($data_payment['account_inn'])) { $order_info['info_supplier'] .= __("inn_customer") . ': ' . $data_payment['account_inn'] . ' / '; } if (!empty($data_payment['account_kpp'])) { $order_info['info_supplier'] .= __("addons.rus_payments.account_kpp") . ': ' . $data_payment['account_kpp'] . '; '; } if (!empty($data_payment['account_ogrn'])) { $order_info['info_supplier'] .= __("ogrn_customer") . ': ' . $data_payment['account_ogrn'] . '; '; } if (!empty($data_payment['account_bank'])) { $order_info['info_supplier'] .= "Банк" . ': ' . $data_payment['account_bank'] . ' '; } if (!empty($data_payment['account_current'])) { $order_info['info_supplier'] .= "р/с" . ': ' . $data_payment['account_current'] . '; '; } if (!empty($data_payment['account_cor'])) { $order_info['info_supplier'] .= "к/с" . ': ' . $data_payment['account_cor'] . '; '; } if (!empty($data_payment['account_bik'])) { $order_info['info_supplier'] .= "БИК" . ': ' . $data_payment['account_bik'] . '; '; } // if (!empty($data_payment['account_phone'])) { // $order_info['info_supplier'] .= __("phone") . ': ' . $data_payment['account_phone'] . ' '; // } } $view->assign('order_info', $order_info); $view->assign('shipment', $shipment); if ($pdf == true) { fn_disable_live_editor_mode(); $html[] = $view->displayMail('orders/print_packing_slip.tpl', false, 'A', $order_info['company_id'], $lang_code); } else { $view->displayMail('orders/print_packing_slip.tpl', true, 'A', $order_info['company_id'], $lang_code); if ($shipment_id != end($shipment_ids)) { echo "<div style='page-break-before: always;'> </div>"; } } } if ($pdf == true) { Pdf::render($html, __('shipments') . '-' . implode('-', $shipment_ids)); } return true; }
function fn_print_shipment_packing_slips($shipment_ids, $pdf = false, $lang_code = CART_LANGUAGE) { $view = Tygh::$app['view']; foreach ($shipment_ids as $shipment_id) { list($shipment, $order_info) = fn_get_packing_info($shipment_id); if (empty($shipment)) { continue; } $view->assign('order_info', $order_info); $view->assign('shipment', $shipment); if ($pdf == true) { fn_disable_live_editor_mode(); $html[] = $view->displayMail('orders/print_packing_slip.tpl', false, 'A', $order_info['company_id'], $lang_code); } else { $view->displayMail('orders/print_packing_slip.tpl', true, 'A', $order_info['company_id'], $lang_code); if ($shipment_id != end($shipment_ids)) { echo "<div style='page-break-before: always;'> </div>"; } } } if ($pdf == true) { Pdf::render($html, __('shipments') . '-' . implode('-', $shipment_ids)); } return true; }