57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
|
|
$lang = getVal('lang');
|
|
if ($lang) {
|
|
switchLanguage($lang);
|
|
loadLanguage('printOrder', $lang);
|
|
}
|
|
|
|
$smarty = createSmarty(true, true);
|
|
|
|
if (empty($ID_ITEM)) {
|
|
$ID_ITEM = getVal('ID');
|
|
}
|
|
|
|
$order = new Order($ID_ITEM);
|
|
$order->createFromDB($ID_ITEM, true, true, true);
|
|
$order->fetchItems();
|
|
|
|
global $dbcfg, $cfg;
|
|
if (getVal('rate')) {
|
|
$dbcfg['currency'] = '€';
|
|
$dbcfg['rate'] = (float) str_replace(',', '.', getVal('rate'));
|
|
} else {
|
|
$dbcfg['rate'] = 1; // CNB::getCurrency('EUR');
|
|
}
|
|
|
|
if (!$order->date_handle) {
|
|
$order->date_handle = new DateTime();
|
|
}
|
|
|
|
$order['date_payment'] = clone $order->date_handle;
|
|
|
|
$order['date_payment'] = $order['date_payment']->modify(' + '.($dbcfg['shop_due_days'] ?: '0').' days'); // $order->date_handle->modify("+{$dbcfg['shop_due_days']} days");//new DateTime($order->date_handle. ' + '.$dbcfg['shop_due_days'].' days');
|
|
$smarty->assign([
|
|
'order' => $order,
|
|
'dbcfg' => $dbcfg,
|
|
'cfg' => $cfg,
|
|
]);
|
|
|
|
$template_name = getVal('template');
|
|
if ($template_name == 'invoiceSimple') {
|
|
$smarty->assign([
|
|
'slovy' => PrintCenter::prepisSlovne(roundPrice($order->getRemainingPayment(), -1, 'DB', 0)),
|
|
]);
|
|
}
|
|
|
|
$template = 'printCenter/'.$template_name.'.tpl';
|
|
|
|
if ($smarty->templateExists($template)) {
|
|
$smarty->display($template);
|
|
} else {
|
|
$smarty->display('printCenter/invoiceForeign.tpl');
|
|
}
|
|
|
|
switchLanguage(null, true);
|
|
loadLanguage('printOrder', null);
|