Files
crm.twinpol.com/modules/EcmStockDocInsideOuts/PDFTemplate/content.php
2025-05-12 15:44:39 +00:00

195 lines
3.7 KiB
PHP
Executable File

<?php
$w = "70"; // first column width
$w2 = "15"; // second column width
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b><h1>Rozchód Wewnętrzny</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 . '%">
Z magazynu:
</td>
<td style="text-align: right">
<b>' . $focus->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'
);
$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 :)
$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>
';
$counter=1;
foreach ( $positions as $pos ) {
if ($pos['part_no'] && $pos['part_no']!='.')
$pos['product_code'].= '<br>'.$pos['part_no'];
$content .= '<tr>';
foreach ( $columns as $col ) {
if($pos['ecmproductcategory_id']=='d7f876b0-1a3d-43a1-7c9b-511ba40df3d1')continue;
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
var_dump($col ['field']);
if($f=='position'){
echo $pos [$f]=$counter;
$counter++;
}
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>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 215px; margin-left: 70%">
';
$content .= '
<tr>
<td style="border: 0.5 solid black; width: 50%;">
Suma
</td>
<td style="border: 0.5 solid black; text-align: right;">
' . format_number ( $focus->total) . ' ' . $symbol . '
</td>
</tr>
';
$content .= '
</table>
<br><br>
' . $focus->pdf_text . '
';
//echo $content; die();