Rozchód Wewnętrzny
|
Numer:
|
' . $focus->document_no . '
|
|
|
Data wystawienia:
|
' . $focus->register_date . '
|
|
|
Wystawił:
|
' . $user->full_name . '
|
|
|
Z magazynu:
|
' . $focus->stock_name . '
|
';
if ($focus->name && $focus->name != '') {
$content .= '
';
}
$content .= '
';
// start items table
$columns = array ();
$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_netto'] = array (
'field' => array (
'price_netto'
),
'label' => 'Cena netto',
'align' => 'right'
);
$columns ['total_netto'] = array (
'field' => array (
'total_netto'
),
'label' => 'Wartość
netto',
'align' => 'right'
);
$columns ['ecmvat_value'] = array (
'field' => array (
'ecmvat_value'
),
'label' => 'VAT
(%)',
'align' => 'center'
);
$columns ['total_vat'] = array (
'field' => array (
'total_vat'
),
'label' => 'Wartość
VAT',
'align' => 'right'
);
$columns ['total_brutto'] = array (
'field' => array (
'total_brutto'
),
'label' => 'Wartość
brutto',
'align' => 'right'
);
// set widths
$totals = array ();
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '41';
$columns ['qty'] ['width'] = '10';
$columns ['price_netto'] ['width'] = '10';
$columns ['total_netto'] ['width'] = '10';
$columns ['ecmvat_value'] ['width'] = '4';
$columns ['total_vat'] ['width'] = '10';
$columns ['total_brutto'] ['width'] = '10';
// rysujemy :)
$content .= '
';
foreach ( $columns as $col ) {
$content .= '
| ' . $col ['label'] . ' |
';
}
$content .= '
';
$counter=1;
if($focus->type=='normal'){
foreach ( $positions as $pos ) {
$content .= '';
foreach ( $columns as $col ) {
$content .= '';
foreach ( $col ['field'] as $f ) {
if (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . ' ';
}
$content .= ' | ';
}
$content .= '
';
}
} else {
foreach ( $positions as $pos ) {
$content .= '';
$pos2= formatPDFPositionsCorrect ($focus->getCorrectedPosition($pos['ecminvoiceoutitem_id']), $focus );
$pos2['name']='było';
$pos2['position']='';
$pos2['product_code']=' ';
foreach ( $columns as $col ) {
$content .= '';
foreach ( $col ['field'] as $f ) {
if (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . ' ';
}
$content .= ' | ';
}
$content .= '
';
// old correct item
foreach ( $columns as $col ) {
$content .= '';
foreach ( $col ['field'] as $f ) {
if (! $pos2 [$f] || $pos2 [$f] == '')
$pos2 [$f] = '-';
$content .= $pos2 [$f] . ' ';
}
$content .= ' | ';
}
$content .= '
';
}
}
$content .= '
';
// summary table
// get currency symbol
$c = new Currency ();
$c->retrieve ( $focus->currency_id );
$symbol = $c->symbol;
unset ( $c );
$content .= '
';
$content .= '
|
VAT (%)
|
Wartość netto
|
Wartość VAT
|
Wartość brutto
| ';
$content.='
';
$vats = explode(",", $focus->vats_summary);
foreach ($vats as $v){
if($v=='')continue;
$v2 = explode(":", $v);
$content .= '
|
'.$v2[0].'
|
'.format_number($v2[1]).'
|
'.format_number($v2[2]).'
|
'.format_number($v2[3]).'
|
';
}
// totals
$content .= '
|
Razem
|
'.format_number($focus->total_netto).'
|
'.format_number($focus->total_vat).'
|
'.format_number($focus->total_brutto).'
|
';
$content .= '
' . $focus->pdf_text . '
';
//echo $content; die();