Files
crm.twinpol.com/modules/EcmPaymentStates/PDFTemplate/content.php

249 lines
5.9 KiB
PHP
Raw Normal View History

2025-05-12 15:44:39 +00:00
<?php
$w = "35"; // first column width
$w3 = "35";
$w2 = "15"; // second column width
$content = '<p style="text-align: center;"><b>Nota odsetkowa nr '.generatenumber().'</b></p>
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>ODBIORCA</b>
</td>
<td style="width: ' . $w3 . '%">';
if($focus->parent_shipping_address_name!=''){
$content.= '<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>';
}
$content.= '</td>
<td style="width: ' . $w2 . '%"></td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
'.$a->parent_shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%"></td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $a->register_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $a->parent_shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">';
$content.= '</td>
<td style="text-align: right">
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
'. $a->register_address_postalcode . ' ' . $a->register_address_city;
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
$content.=', '.$a->register_address_country;
$content.='
</td>
<td style="width: ' . $w3 . '%">
'. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
$content.=', '.$focus->parent_shipping_address_country;
$content.='
</td>
<td style="width: ' . $w2 . '%">
</td>
<td style="text-align: right">
</td>
</tr>';
$content.='
<tr>
<td valign="top" style="width: ' . $w . '%">NIP: '.$a->to_vatid;
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_shipping_nip) && $focus->parent_shipping_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_shipping_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
}
$content.='
</td>
<td valign="top" style="width: ' . $w2 . '%"></td>
<td colspan="0" valign="top" style="text-align: right">
</td>
</tr>';
$content.='
</table>
';
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:right;vertical-align:top;">
<tr><td width="11%" >Data dokumentu:<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'</td>
<td style="text-align: left;" width="20%"><b>' . $focus->register_date . '</b><br><b>' . $focus->sell_date . '</b></td>
<td rowspan="2" style="text-align: left;vertical-align:top;">';
if($focus->order_no!=''){
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':<br>';
}
$content.='</td>
<td rowspan="2" style="vertical-align:top;">';
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',
),
'label' => 'Nazwa',
'align' => 'left'
);
$columns ['total2'] = array (
'field' => array (
'paid'
),
'label' => 'Kwota',
'align' => 'right'
);
$columns ['qty'] = array (
'field' => array (
'from',
),
'label' => 'Termin płatności',
'align' => 'right'
);
$columns ['price_netto'] = array (
'field' => array (
'to'
),
'label' => 'Data zapłaty',
'align' => 'right'
);
$columns ['total_vat'] = array (
'field' => array (
'days'
),
'label' => 'Dni po<br>Terminie',
'align' => 'right'
);
$columns ['total'] = array (
'field' => array (
'total'
),
'label' => 'Wartość<br>odsetek',
'align' => 'right'
);
// set widths
$totals = array ();
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '41';
$columns ['total2'] ['width'] = '10';
$columns ['qty'] ['width'] = '10';
$columns ['price_netto'] ['width'] = '10';
$columns ['total_vat'] ['width'] = '10';
$columns ['total'] ['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'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$counter=1;
foreach ( $positions as $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;
unset ( $c );
$content .= '
<br>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
';
$content .= '
<tr>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
<b>Razem odsetki</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total).'</b>
</td></tr>';
$content .= '
</table>';
//echo $content; die();