init
This commit is contained in:
200
modules/EcmStockDocCorrectNews/PDFTemplate/content.php
Normal file
200
modules/EcmStockDocCorrectNews/PDFTemplate/content.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
$w = "40"; // first column width
|
||||
$w2 = "30"; // second column width
|
||||
$w3= "20";
|
||||
$br='<br>';
|
||||
|
||||
$content = '
|
||||
<table style="width: 100%; font-size: 10pt;">
|
||||
<tr>
|
||||
<td style="width: 60%; vertical-align: top;text-align:left;">
|
||||
<b><h1>Dokument ' . $focus->document_no . '</h1></b></center>
|
||||
</td>
|
||||
<td style="width: 10%; vertical-align: top;">
|
||||
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
Data wystawienia: <br>Magazyn: <br>Wystawił: '.$imps.'</td>
|
||||
<td style="text-align: right; width: 20%;">
|
||||
<b>' . date("d.m.Y", strtotime($focus->date_entered)) . '</b><br><b>'.$focus->stock_name.'</b><br><b>'.$user->full_name.'</b>'.$imps2.'
|
||||
</td>
|
||||
</tr></table><table style="width: 100%; font-size: 10pt;">
|
||||
<tr>
|
||||
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>WYSTAWCA:</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;">
|
||||
'.$comp['name'].'<br>'.$addr[0].'<br>'.$addr[1].'<br>'.$comp['footer_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 .= '<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'] = '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;
|
||||
unset ( $c );
|
||||
$content .= '
|
||||
<br><br>
|
||||
<table style="font-size: 7pt; 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%;">
|
||||
<b>Suma netto:</b>
|
||||
</td>
|
||||
<td style="border: 0.5 solid black; text-align: right;">
|
||||
' . format_number ( $focus->total_netto) . ' ' . $symbol . '
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
$t=0;
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
foreach ($vats as $v) {
|
||||
$vats2 = explode(":", $v);
|
||||
if ($vats2[0]=='') continue;
|
||||
$t+=$vats2[1];
|
||||
$content.='
|
||||
<tr>
|
||||
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
|
||||
<b>'.$vats2[0].'</b>
|
||||
</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%;">
|
||||
<b>Suma brutto:</b>
|
||||
</td>
|
||||
<td style="border: 0.5 solid black; text-align: right;">
|
||||
' . format_number ( $focus->total_brutto) . ' ' . $symbol . '
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
$content .= '
|
||||
</table>
|
||||
<br><br>
|
||||
' . $focus->pdf_text . '
|
||||
';
|
||||
|
||||
//echo $content; die();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12
modules/EcmStockDocCorrectNews/PDFTemplate/header.php
Normal file
12
modules/EcmStockDocCorrectNews/PDFTemplate/header.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$header = '
|
||||
<table style="font-size: 7pt; width: 100%"><tr>
|
||||
<td style="width: 80%">
|
||||
|
||||
</td>
|
||||
<td style="text-align: right; vertical-align: bottom;">
|
||||
www.e5.pl
|
||||
</td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
';
|
||||
28
modules/EcmStockDocCorrectNews/PDFTemplate/helper.php
Normal file
28
modules/EcmStockDocCorrectNews/PDFTemplate/helper.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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']);
|
||||
|
||||
$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