Add php files
This commit is contained in:
292
modules/EcmStockDocInss/PDFTemplate/content.php
Executable file
292
modules/EcmStockDocInss/PDFTemplate/content.php
Executable file
@@ -0,0 +1,292 @@
|
||||
<?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>
|
||||
';
|
||||
|
||||
$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>'.$labels['LBL_PDF_FK_DATE'].':<br>'.$labels['LBL_PDF_PAYMENT_DATE'].':<br>'.$labels['LBL_PDF_MAGAZINE'].':</td>
|
||||
<td style="text-align: left;" width="20%"><b>' . $focus->register_date . '</b><br><b>' . $focus->date_fk . '</b><br><b>' . $focus->date_fk_p . '</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 ['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 ['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 ) {
|
||||
$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%;">
|
||||
Suma netto:
|
||||
</td>
|
||||
<td style="border: 0.5 solid black; text-align: right;">
|
||||
'.format_number($focus->total_netto).' '.$symbol.'
|
||||
</td>
|
||||
</tr>';
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
foreach ($vats as $v) {
|
||||
$vats2 = explode(":", $v);
|
||||
if ($vats2[0]=='') continue;
|
||||
$content.='
|
||||
<tr>
|
||||
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
|
||||
'.$vats2[0].'
|
||||
</td>
|
||||
<td style="border: 0.5 solid black; text-align: right;">
|
||||
'.format_number($vats2[1]).' '.$symbol.'
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
$content.='
|
||||
<tr>
|
||||
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
|
||||
Suma brutto:
|
||||
</td>
|
||||
<td style="border: 0.5 solid black; text-align: right;">
|
||||
'.format_number($focus->total_brutto).' '.$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();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
18
modules/EcmStockDocInss/PDFTemplate/header.php
Executable file
18
modules/EcmStockDocInss/PDFTemplate/header.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?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>
|
||||
</tr></table>
|
||||
<hr>
|
||||
';
|
||||
30
modules/EcmStockDocInss/PDFTemplate/helper.php
Executable file
30
modules/EcmStockDocInss/PDFTemplate/helper.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
function formatPDFPositions($positions, $focus) {
|
||||
$result = array();
|
||||
foreach ($positions as $pos) {
|
||||
|
||||
$pos['position'] = intval($pos['position'])+1;
|
||||
|
||||
$pos['quantity'] = $pos['quantity'];
|
||||
$pos['price']=format_number($pos['price']);
|
||||
$pos['total']=format_number($pos['total']);
|
||||
$pos['quantity']=format_number($pos['quantity'],$pos['product_precision'],0);
|
||||
|
||||
|
||||
$result[] = $pos;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function mysql_escape_gpc($dirty)
|
||||
{
|
||||
if (ini_get('magic_quotes_gpc'))
|
||||
{
|
||||
return $dirty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mysql_real_escape_string($dirty);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user