Exemple #1
0
         $order_info['info_supplier'] .= __("ogrn_customer") . ': ' . $data_payment['account_ogrn'] . ' ';
     }
     if (!empty($data_payment['account_kpp'])) {
         $order_info['info_supplier'] .= __("addons.rus_payments.account_kpp") . ': ' . $data_payment['account_kpp'] . ' ';
     }
     if (!empty($data_payment['account_address'])) {
         $order_info['info_supplier'] .= __("address") . ': ' . $data_payment['account_address'] . ' ';
     }
     if (!empty($data_payment['account_phone'])) {
         $order_info['info_supplier'] .= __("phone") . ': ' . $data_payment['account_phone'] . ' ';
     }
 }
 $str_date = "";
 $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['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');
Exemple #2
0
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;'>&nbsp;</div>";
            }
        }
    }
    if ($pdf == true) {
        Pdf::render($html, __('shipments') . '-' . implode('-', $shipment_ids));
    }
    return true;
}