293 lines
8.6 KiB
PHP
Executable File
293 lines
8.6 KiB
PHP
Executable File
<?php
|
|
$w = "40"; // first column width
|
|
$w2 = "30"; // second column width
|
|
$w3= "20";
|
|
$br='<br>';
|
|
|
|
if($focus->name!=''){
|
|
$imps2=$br.'<b>'.$focus->name.'</b>';
|
|
$imps=$br.'Do faktury: ';
|
|
}
|
|
if($focus->date_fk!=''){
|
|
$imps2.=$br.'<b>'. date("d.m.Y", strtotime($focus->date_fk)).'</b>';
|
|
$imps.=$br.'Data faktury: ';
|
|
}
|
|
if($focus->date_fk_p!=''){
|
|
$imps2.=$br.'<b>'. date("d.m.Y", strtotime($focus->date_fk_p)).'</b>';
|
|
$imps.=$br.'Termin płatności: ';
|
|
}
|
|
$content = '
|
|
<p style="text-align: center;font-size: 12pt;"><b>'.$labels['LBL_PDF_CONTENT_NAME'].' '.$focus->document_no.'</b></center>
|
|
<table style="width: 100%; font-size: 8pt;">
|
|
<tr>
|
|
|
|
<td style="width: ' . $w . '%">
|
|
<b>'.$labels['LBL_PDF_DELIVERY_NAME'].'</b>
|
|
</td>
|
|
<td style="width: ' . $w2 . '%">
|
|
</td>
|
|
<td style="width: ' . $w3 . '%">
|
|
</td>
|
|
<td style="text-align: right">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
|
|
<td style="width: ' . $w . '%; vertical-align: top;">
|
|
'.$focus->parent_name.'<br>'.$focus->parent_address_street.'<br>'.$focus->parent_address_postalcode.' '.$focus->parent_address_city.'<br>'.$labels['LBL_PDF_PARENT_NIP'].': '.$focus->parent_nip.'
|
|
</td>
|
|
<td style="width: ' . $w2 . '%; vertical-align: top;">
|
|
|
|
</td>
|
|
<td style="width: ' . $w3 . '%; vertical-align: top;">
|
|
</td>
|
|
<td style="text-align: right; vertical-align: top;">
|
|
</td>
|
|
</tr>
|
|
</table><br>
|
|
';
|
|
if($focus->name!=''){
|
|
$fl=$labels['LBL_NAME'].':<br>';
|
|
$ft='<b>' . $focus->name . '</b><br>';
|
|
}
|
|
$content .= '<table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
|
<tr><td width="20%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].':<br>'.$fl.''.$labels['LBL_PDF_FK_DATE'].':<br>'.$labels['LBL_PDF_MAGAZINE'].':</td>
|
|
<td style="text-align: left;" width="20%"><b>' . $focus->register_date . '</b><br>'.$ft.'<b>' . $focus->date_fk . '</b><br><b>' . $focus->stock_name . '</b></td>
|
|
<td rowspan="2" style="text-align: left;vertical-align:top;">';
|
|
if($focus->wz_name!=''){
|
|
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'].':<br>';
|
|
}
|
|
if($focus->order_no!=''){
|
|
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':<br>';
|
|
}
|
|
|
|
$content.='</td>
|
|
<td rowspan="2" style="vertical-align:top;">';
|
|
if($focus->wz_name!=''){
|
|
$content.='<b>' . $focus->wz_name.'</b><br>';
|
|
}
|
|
if($focus->order_no!=''){
|
|
$content.='<b>' . $focus->order_no.'</b><br>';
|
|
}
|
|
|
|
$content.='</td></tr></table><br>';
|
|
|
|
// 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<br>Indeks',
|
|
'align' => 'left'
|
|
);
|
|
$columns ['ecmvat_name'] = array (
|
|
'field' => array (
|
|
'ecmvat_name'
|
|
),
|
|
'label' => 'VAT (%)',
|
|
'align' => 'right'
|
|
);
|
|
|
|
$columns ['qty'] = array (
|
|
'field' => array (
|
|
'quantity',
|
|
'unit_name'
|
|
),
|
|
'label' => 'Ilość<br>J.m.',
|
|
'align' => 'right'
|
|
);
|
|
|
|
$columns ['price'] = array (
|
|
'field' => array (
|
|
'price'
|
|
),
|
|
'label' => 'Cena netto',
|
|
'align' => 'right'
|
|
);
|
|
|
|
$columns ['total'] = array (
|
|
'field' => array (
|
|
'total'
|
|
),
|
|
'label' => 'Wartość netto',
|
|
'align' => 'right'
|
|
);
|
|
|
|
// set widths
|
|
$totals = array ();
|
|
|
|
$columns ['position'] ['width'] = '5';
|
|
$columns ['name'] ['width'] = '55';
|
|
$columns ['qty'] ['width'] = '10';
|
|
$columns ['price'] ['width'] = '15';
|
|
$columns ['ecmvat_name'] ['width'] = '5';
|
|
$columns ['total'] ['width'] = '15';
|
|
|
|
// rysujemy :)
|
|
$content .= '
|
|
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse"><thead>
|
|
<tr>
|
|
';
|
|
|
|
foreach ( $columns as $col ) {
|
|
$content .= '
|
|
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background: rgb(233,233,233);">' . $col ['label'] . '</th>
|
|
';
|
|
}
|
|
$content .= '
|
|
</tr></thead><tbody>
|
|
';
|
|
|
|
|
|
foreach ( $positions as $pos ) {
|
|
if ($pos['part_no'] && $pos['part_no']!='.')
|
|
$pos['product_code'].= '<br>'.$pos['part_no'];
|
|
//die(serialize($pos));
|
|
$content .= '<tr>';
|
|
foreach ( $columns as $col ) {
|
|
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
|
foreach ( $col ['field'] as $f ) {
|
|
if (! $pos [$f] || $pos [$f] == '')
|
|
$pos [$f] = '-';
|
|
$content .= $pos [$f] . '<br>';
|
|
}
|
|
$content .= '</td>';
|
|
}
|
|
$content .= '</tr>';
|
|
}
|
|
|
|
$content .= '
|
|
</tbody></table>
|
|
';
|
|
// summary table
|
|
// get currency symbol
|
|
$c = new Currency ();
|
|
$c->retrieve ( $focus->currency_id );
|
|
$symbol = $c->symbol;
|
|
|
|
$symbol ='PLN';
|
|
if($focus->kind=='import'){
|
|
$c->retrieve ( $focus->currency_id );
|
|
|
|
$symbol2 = $c->iso4217;
|
|
if($focus->foreign_transport_cur_id!='PLN'){$c->retrieve ($focus->foreign_transport_cur_id);
|
|
$focus->foreign_transport_cur_id=$c->name;
|
|
}
|
|
if($focus->country_transport_cur_id!='PLN'){ $c->retrieve ($focus->country_transport_cur_id);
|
|
$focus->country_transport_cur_id=$c->name;}
|
|
if($focus->addition_cost_cur_id!='PLN'){$c->retrieve ($focus->addition_cost_cur_id);
|
|
$focus->addition_cost_cur_id=$c->name;}
|
|
$content.=' <br><br><table style="font-size: 7pt; border: 0.5 solid black; border-collapse: collapse; width: 445px; margin-right: 30%">';
|
|
$content.='<tr>
|
|
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 30%;">
|
|
Transport zagraniczny:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'.format_number($focus->foreign_transport_val).' '.$focus->foreign_transport_cur_id.'
|
|
</td>
|
|
<td style="background: rgb(233,233,233);border: 0.5 solid black; text-align: right; width: 12%;">
|
|
Kurs:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'.format_number($focus->foreign_transport_cur_val).'
|
|
</td>
|
|
</tr><tr>
|
|
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 30%;">
|
|
Transport krajowy:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'.format_number($focus->country_transport_val).' '.$focus->country_transport_cur_id.'
|
|
</td>
|
|
<td style="background: rgb(233,233,233);border: 0.5 solid black; text-align: right; width: 12%;">
|
|
Kurs:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'.format_number($focus->country_transport_cur_val).'
|
|
</td>
|
|
</tr><tr>
|
|
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 30%;">
|
|
Koszty dodatkowe:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'.format_number($focus->addition_cost_val).' '.$focus->addition_cost_cur_id.'
|
|
</td>
|
|
<td style="background: rgb(233,233,233);border: 0.5 solid black; text-align: right; width: 12%;">
|
|
Kurs:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'.format_number($focus->addition_cost_cur_val).'
|
|
</td>
|
|
</tr></table><br><table style="font-size: 7pt; border: 0.5 solid black; border-collapse: collapse; width: 270px; margin-right: 30%"><tr>
|
|
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 30%;">
|
|
Waluta:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'.$symbol2.'
|
|
</td>
|
|
</tr><tr><td style="background: rgb(233,233,233);border: 0.5 solid black; text-align: left; width: 12%;">
|
|
Kurs:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'. number_format($focus->currency_value,4,',','.').'
|
|
</td>
|
|
</tr><tr><td style="background: rgb(233,233,233);border: 0.5 solid black; text-align: left; width: 12%;">
|
|
Kurs SAD:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right; width: 25%;">
|
|
'. number_format($focus->currency_sad_value,4,',','.').'
|
|
</td>
|
|
</tr>';
|
|
$content.='</table>';
|
|
}
|
|
unset ( $c );
|
|
$content .= '
|
|
<br><br>
|
|
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 215px; margin-left: 70%">
|
|
';
|
|
$content.='
|
|
<tr>
|
|
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
|
|
Razem ilość:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right;">
|
|
'.format_number($quantity).'
|
|
</td>
|
|
</tr>';
|
|
$content.='
|
|
<tr>
|
|
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
|
|
Suma netto:
|
|
</td>
|
|
<td style="border: 0.5 solid black; text-align: right;">
|
|
'.format_number($focus->total_netto).' '.$symbol.'
|
|
</td>
|
|
</tr>';
|
|
|
|
$content .= '
|
|
</table><br><p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
|
|
<br><br>
|
|
' . $focus->pdf_text . '
|
|
';
|
|
|
|
//echo $content; die();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|