Files
2025-05-12 15:44:39 +00:00

179 lines
3.3 KiB
PHP

<?php
$w = "70"; // first column width
$w2 = "10"; // second column width
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b><h1>Przyjęcie produkcyjne</h1></b>
</td>
<td style="width: ' . $w2 . '%">
Numer:
</td>
<td style="text-align: right">
<b>' . $focus->document_no . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
</b>Data wystawienia:</b>
</td>
<td style="text-align: right">
<b>' . $focus->register_date . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
Wystawił:
</td>
<td style="text-align: right">
<b>' . $user->full_name . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
Magazyn RW:
</td>
<td style="text-align: right">
<b>' . $focus->rw_stock_name . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
Magazyn PW:
</td>
<td style="text-align: right">
<b>' . $focus->pw_stock_name . '</b>
</td>
</tr>
</table><br>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
$content .= '<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 ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => 'Ilość<br>J.m.',
'align' => 'right'
);
// set widths
$totals = array ();
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '45';
$columns ['qty'] ['width'] = '10';
// 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'] . '%;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$pos_i=0;
$pos_comp=0;
foreach ( $positions as $pos ) {
if($pos['product_component']==1) {$pos_comp++; $color=''; } else
if($pos['product_component']==0){ $pos_i++;$pos_comp=0;$color='background-color:#D4D9DB;'; }
$content .= '<tr>';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';'.$color.'">';
foreach ( $col ['field'] as $f ) {
if($col['label']=='Lp.' && $pos['product_component']==0) {
$pos [$f]=$pos_i;$color='';
}
if($col['label']=='Lp.' && $pos['product_component']==1) {
$pos [$f]=$pos_i.'.'.$pos_comp;$color='';
}
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;
unset ( $c );
$content .= '
<br><br>
' . $focus->pdf_text . '
';
//echo $content; die();