init
This commit is contained in:
61
modules/EcmInvoiceCosOuts/createPDF.php
Normal file
61
modules/EcmInvoiceCosOuts/createPDF.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if (! $_REQUEST ['record'] || $_REQUEST ['record'] == '')
|
||||
die ( 'Brak rekordu' );
|
||||
else
|
||||
$record = $_REQUEST ['record'];
|
||||
|
||||
include_once ("modules/EcmInvoiceCosOuts/PDFTemplate/helper.php");
|
||||
|
||||
$focus = new EcmInvoiceCosOut ();
|
||||
$focus->retrieve ( $record );
|
||||
|
||||
$user = new User ();
|
||||
$user->retrieve ( $focus->assigned_user_id );
|
||||
$labels = return_module_language($focus->ecmlanguage, 'EcmInvoiceCosOuts');
|
||||
include_once ("include/MPDF57/mpdf.php");
|
||||
$p = new mPDF ( '', 'A4', null, 'helvetica', 10, 10, 30, 45, 5, 5 );
|
||||
$mpdf->mirrorMargins = 1;
|
||||
|
||||
$db = $GLOBALS ['db'];
|
||||
// document pdf
|
||||
// document already exist?
|
||||
/*
|
||||
$res = $db->query ( "SELECT footer, content FROM ecminvoicecosout_pdf WHERE id='$record'" );
|
||||
if ($res->num_rows == 0) {
|
||||
*/
|
||||
// create and save document
|
||||
$positions = formatPDFPositions ( $focus->getPositionList ( true ), $focus );
|
||||
// get header
|
||||
$header = '';
|
||||
if($focus->pdf_type=='K'){
|
||||
include_once ("modules/EcmInvoiceCosOuts/PDFTemplate/header.php");
|
||||
$content = '';
|
||||
include_once ("modules/EcmInvoiceCosOuts/PDFTemplate/content.php");
|
||||
} else {
|
||||
include_once ("modules/EcmInvoiceCosOuts/PDFTemplate/header_en.php");
|
||||
$content = '';
|
||||
include_once ("modules/EcmInvoiceCosOuts/PDFTemplate/content_en.php");
|
||||
}
|
||||
global $current_user,$app_list_strings;
|
||||
/*
|
||||
$db->query ( "INSERT INTO ecminvoicecosout_pdf VALUES ('$record','$current_user->id', NOW(),'" . urlencode ( $header ) . "', '" . urlencode( $content ) . "')" );
|
||||
} else {
|
||||
$row = $db->fetchByAssoc ( $res );
|
||||
$header = urldecode ( $row ['footer'] ); // punk rock!
|
||||
$content = urldecode ( $row ['content'] );
|
||||
}*/
|
||||
//var_dump($positions);
|
||||
$p->SetHTMLHeader ( $header );
|
||||
$footer='<hr><table style="font-size: 8pt; width: 100%;vertical-align:top;">
|
||||
<tr><td width="25%">e5 Polska Sp. z o.o<br />
|
||||
ul. Wąwozowa 11, 02-796 Warszawa, Poland<br />
|
||||
22 228 20 90<br />
|
||||
+ 48 (56) 674 60 47 <br/>
|
||||
www.e5.pl</td><td width="25%"></td><td width="20%">Bank: BANK MILLENIUM<br>Bank IBAN: PL36116022020000000064080587<br>Bank SWIFT: BIGBPLPW<br>KRS: 28207<br>NIP: PL 525-21-73-990<br>REGON: 016280234</td></tr></table>';
|
||||
$p->SetHTMLFooter($footer);
|
||||
$p->WriteHTML ( $content );
|
||||
//echo $content;
|
||||
// draw PDF
|
||||
|
||||
$p->Output ();
|
||||
|
||||
Reference in New Issue
Block a user