Dokument KS
|
Numer:
|
' . $focus->document_no . '
|
|
|
Data wystawienia:
|
' . $focus->register_date . '
|
|
|
Wystawił:
|
' . $user->full_name . '
|
|
|
Magazyn:
|
' . $focus->stock_name . '
|
|
|
Typ:
|
' . $app_list_strings['ecmstockdoccorrects_type_dom'][$focus->type] . '
|
';
if ($focus->name && $focus->name != '') {
$content .= '
';
}
$content .= '
';
// start items table
$columns = array ();
if($focus->type == '6ed5b076-ddd1-9809-b236-54e5b2bcbd97'){
//Przecena
$columns ['position'] = array (
'field' => array (
'position',
),
'label' => 'Lp.',
'align' => 'center',
);
$columns ['name'] = array (
'field' => array (
'name',
'product_code',
),
'label' => 'Nazwa
Indeks',
'align' => 'left'
);
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name',
),
'label' => 'Ilość
J.m.',
'align' => 'right'
);
$columns ['price'] = array (
'field' => array (
'price',
'old_price',
),
'label' => 'Cena',
'align' => 'right'
);
$columns ['total'] = array (
'field' => array (
'total',
'old_total',
'total_diff',
),
'label' => '
| Wartość |
| Jest |
Było |
Różnica |
',
'align' => 'right',
);
}else{
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => 'Lp.',
'align' => 'center'
);
$columns ['name'] = array (
'field' => array (
'name',
'product_code'
),
'label' => 'Nazwa
Indeks / Partia',
'align' => 'left'
);
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => 'Ilość
J.m.',
'align' => 'right'
);
$columns ['price'] = array (
'field' => array (
'price',
),
'label' => 'Cena',
'align' => 'right'
);
$columns ['total'] = array (
'field' => array (
'total',
),
'label' => 'Wartość',
'align' => 'right'
);
}
// set widths
$totals = array ();
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '45';
$columns ['qty'] ['width'] = '10';
$columns ['price'] ['width'] = '20';
$columns ['total'] ['width'] = '20';
// rysujemy :)
if($focus->type == '7bb903d0-c296-7d1b-6e50-54c209e30850' || $focus->type == '8a6b804b-fac7-5cc2-de19-54c209116b19'){
//Korekta plus i minus
$content .= '
';
foreach ( $columns as $col ) {
$content .= '
| ' . $col ['label'] . ' | ';
}
$content .= '
';
foreach ( $positions as $pos ) {
//var_dump($pos); die();
if ($pos['product_consignment_doc'])
$pos['product_code'].= ' ' . $pos['product_consignment_doc'];
$content .= '';
foreach ( $columns as $col ) {
$content .= '';
foreach ( $col ['field'] as $f ) {
$content .= $pos [$f] . ' ';
}
$content .= ' | ';
}
$content .= '
';
}
$content .= '
';
// summary table
// get currency symbol
$c = new Currency ();
$c->retrieve ( $focus->currency_id );
$symbol = $c->symbol;
unset ( $c );
$content .= '
|
Suma
|
' . format_number ( $focus->total) . ' ' . $symbol . '
|
';
}else if($focus->type == '6ed5b076-ddd1-9809-b236-54e5b2bcbd97'){
//PRZECENA
$smarty = new Sugar_Smarty ();
$smarty->assign("positions", $positions);
//$smarty->assign("app_list_strings", $app_list_strings);
$content .= $smarty->fetch('modules/EcmStockDocCorrects/PDFTemplate/przecena_lista_pozycji.tpl');
// summary table
// get currency symbol
$c = new Currency ();
$c->retrieve ( $focus->currency_id );
$symbol = $c->symbol;
unset ( $c );
$content .= '
|
Suma
|
' . format_number ( $focus->total) . ' ' . $symbol . '
|
';
}
$content .= '
' . $focus->pdf_text;
//echo $content; die();