Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View File

@@ -0,0 +1,317 @@
<?php
$w = "35"; // first column width
$w3 = "35";
$w2 = "15"; // second column width
if($focus->type=='normal')$text='Nota nr';
if($focus->type=='corect')$text='Faktura korygująca nr';
$content = '<p style="text-align: center;"><b>'.$text.' '.$focus->document_no.'</b></p>
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>'.$labels['LBL_PDF_CONTENT_INVOICE_FOR'].'</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 . '%">
'.$focus->parent_shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%"></td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->parent_shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">';
$content.= '</td>
<td style="text-align: right">
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
$content.=', '.$focus->parent_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 . '%">';
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_nip;
$nip = true;
}
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_iln;
}
$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>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:right;vertical-align:top;">
<tr><td width="44%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'</td>
<td style="text-align: left;" width="20%"><b>' . $focus->register_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',
'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_netto'] = array (
'field' => array (
'price_netto'
),
'label' => 'Cena',
'align' => 'right'
);
$columns ['total_netto'] = array (
'field' => array (
'total_netto'
),
'label' => 'Wartość',
'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';
// 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;
if($focus->type=='normal'){
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>';
}
} else {
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] == '') && $f!='quantity')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr><tr>';
// old correct item
$pos['name'] = 'było';
$pos['total_netto'] = $pos['old_total_netto'];
$pos['total_brutto'] = $pos['old_total_brutto'];
$pos['total_vat'] = $pos['old_total_vat'];
$pos['price_netto'] = $pos['old_price_netto'];
$pos['quantity'] = $pos['old_quantity'];
$pos['position']='';
$pos['product_code']=' ';
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%">
';
// totals
$content .= '
<tr>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
<b>Razem</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #ffffff;">
<b>'.format_number($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_netto).'</b>
</td>
</tr>';
$left_to_paid=$focus->total_brutto-$focus->paid_val;
$content .= '
</table>
<table style="font-size: 7pt;">
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr>';
if($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20'){
$left_to_paid='0';
$content .= '<tr><td>Przedpłata</td><td style="text-align: right;"><b>8.610,00 '.$symbol.'</b> </td><td>Nr FK 001/14</td></tr>';
}
if($focus->paid_val!='' && $focus->id!='c2d7473a-c0b8-6718-0947-54993423de20'){
if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
$content .= '<tr><td>'.$labels['LBL_PDF_PAID'].'</td><td style="text-align: right;"><b>'.format_number($focus->paid_val).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
}
if($focus->ecmpaymentcondition_id!=''){
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
$r=$db->fetchByAssoc($q);
$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
} else {
if($focus->payment_date!=''){
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
}
}
$content .= '<tr><td>'.$labels['LBL_PDF_LEFT_TO_PAID'].'</td><td style="text-align: right;"><b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr>
</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();

View File

@@ -0,0 +1,100 @@
<?php
$w = "62"; //first column width
$w2 = "12"; //second column width
$footer = '
<hr>
<table style="width: 100%; font-size: 7pt;">
<tr>
<td style="width: '.$w.'%">
e5 Polska Sp. z o.o
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_KRS'].'</b>
</td>
<td style="text-align: right">
28207
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
ul. Wąwozowa 11
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_NIP'].'</b>
</td>
<td style="text-align: right">
PL 525-21-73-990
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
02-796 Warszawa
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_REGON'].'</b>
</td>
<td style="text-align: right">
016280234
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
Tel: +48 (22) 228 20 90
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_BANK'].'</b>
</td>
<td style="text-align: right">
';
if ($bank=='milenium')
$footer.='BANK MILLENIUM';
if ($bank=='mbank')
$footer.='MBANK';
$footer.='
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
Fax: +48 (56) 674 60 47
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_BANK_ACCOUNT'].'</b>
</td>
<td style="text-align: right">
';
if ($bank=='milenium')
$footer.='PL36116022020000000064080587';
if ($bank=='mbank')
$footer.='PL96114010100000548212001002';
$footer.='
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
'.$user->email1.'
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_SWIFT'].'</b>
</td>
<td style="text-align: right">
';
if ($bank=='milenium')
$footer.='BIGBPLPW';
if ($bank=='mbank')
$footer.='BREXPLPW';
$footer.='
</td>
</tr>
</table>
<br>
<table style="width: 100%; font-size: 7pt;">
<tr>
<td style="width: 50%;">
{PAGENO}/{nb}
</td>
<td style="width: 50%; text-align: right">
<b>'.$focus->document_no.'</b>
</td>
</tr>
</table>
';

View File

@@ -0,0 +1,95 @@
<?php
$w = "62"; //first column width
$w2 = "12"; //second column width
$footer = '
<hr>
<table style="width: 100%; font-size: 7pt;">
<tr>
<td style="width: '.$w.'%">
e5 Polska Sp. z o.o
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_KRS'].'</b>
</td>
<td style="text-align: right">
28207
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
ul. Wąwozowa 11
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_NIP'].'</b>
</td>
<td style="text-align: right">
PL 525-21-73-990
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
02-796 Warszawa
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_REGON'].'</b>
</td>
<td style="text-align: right">
016280234
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
Tel: +48 (22) 228 20 90
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_BANK'].'</b>
</td>
<td style="text-align: right">
';
if ($bank=='milenium')
$footer.='BANK MILLENIUM';
if ($bank=='mbank')
$footer.='MBANK';
$footer.='
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
Fax: +48 (56) 674 60 47
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_BANK_ACCOUNT'].'</b>
</td>
<td style="text-align: right">
';
if ($bank=='milenium')
$footer.='35 1160 2202 0000 0000 6408 0411';
if ($bank=='mbank')
$footer.='26 1140 1010 0000 5482 1200 1001';
$footer.='
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
'.$user->email1.'
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_GIOS'].'</b>
</td>
<td style="text-align: right">
E0006254W
</td>
</tr>
</table>
<br>
<table style="width: 100%; font-size: 7pt;">
<tr>
<td style="width: 50%;">
{PAGENO}/{nb}
</td>
<td style="width: 50%; text-align: right">
<b>'.$focus->document_no.'</b>
</td>
</tr>
</table>
';

View File

@@ -0,0 +1,19 @@
<?php
$header = '
<table style="font-size: 8pt; width: 100%"><tr>
<td width="15%">
<img style="width: 70px;" src="modules/EcmSales/PDFTemplate/saas.jpg"/>
</td>
<td width="45%" style="text-align: left; vertical-align: top;">
<b>WYSTAWCA</b><br />
Saas SystemS Sp. z o.o.<br />
ul. Lipnowska 21-23<br />
87-100 Toruń<br />
NIP: 9562307719
</td>
<td style="text-align: left; vertical-align: top;">
</td>
<td style="text-align: right; vertical-align: top;"></td>
</tr></table>
<hr>
';

View File

@@ -0,0 +1,49 @@
<?php
function formatPDFPositions($positions, $focus) {
$result = array();
foreach ($positions as $pos) {
$pos['position'] = intval($pos['position'])+1;
$pos['quantity'] = $pos['quantity'];
$pos['price_netto']=format_number($pos['price_netto']);
$pos['total_vat']=format_number($pos['total_vat']);
$pos['ecmvat_value']=format_number($pos['ecmvat_value']);
$pos['total_brutto']=format_number($pos['total_brutto']);
$pos['total_netto']=format_number($pos['total_netto']);
$result[] = $pos;
}
return $result;
}
function formatPDFPositionsCorrect($pos, $focus) {
$pos['position'] = intval($pos['position'])+1;
$pos['quantity'] = $pos['quantity'];
$pos['price_netto']=format_number($pos['price_netto']);
$pos['total_vat']=format_number($pos['total_vat']);
$pos['ecmvat_value']=format_number($pos['ecmvat_value']);
$pos['total_brutto']=format_number($pos['total_brutto']);
$pos['total_netto']=format_number($pos['total_netto']);
return $pos;
}
function mysql_escape_gpc($dirty)
{
if (ini_get('magic_quotes_gpc'))
{
return $dirty;
}
else
{
return mysql_real_escape_string($dirty);
}
}