74 lines
2.3 KiB
PHP
Executable File
74 lines
2.3 KiB
PHP
Executable File
<?php
|
|
ini_set('display_errors',1);
|
|
if (! $_REQUEST ['record'] || $_REQUEST ['record'] == '')
|
|
die ( 'Brak rekordu' );
|
|
else
|
|
$record = $_REQUEST ['record'];
|
|
|
|
include_once ("modules/EcmNewKpkws/PDFTemplate/helper.php");
|
|
|
|
$focus = new EcmNewKpkw ();
|
|
$focus->retrieve ( $record );
|
|
|
|
$user = new User ();
|
|
$user->retrieve ( $focus->assigned_user_id );
|
|
|
|
include_once ("include/MPDF57/mpdf.php");
|
|
include_once ("modules/EcmSysInfos/EcmSysInfo.php");
|
|
$p = new mPDF ( '', 'A4', null, 'helvetica', 10, 10, 30, 45, 5, 5 );
|
|
$labels = return_module_language($focus->ecmlanguage, 'EcmNewKpkws');
|
|
$mpdf->mirrorMargins = 1;
|
|
$EcmSysInfo = new EcmSysInfo();
|
|
$db = $GLOBALS ['db'];
|
|
|
|
$r=$db->query ("select name,footer_address,footer_nip from ecmdocumenttemplates where id='75997203-f430-7f64-10e0-4b0a912673fa'");
|
|
$comp=$db->fetchByAssoc($r);
|
|
$addr = explode(",", $comp['footer_address']);
|
|
// document pdf
|
|
// document already exist?
|
|
$res = $db->query ( "SELECT footer, content FROM ecmnewkpkw_pdf WHERE id='$record'" );
|
|
if ($focus->type_id == 0) {
|
|
$nag = 'PRZYJĄŁ';
|
|
$header = $EcmSysInfo->getHeaderForModule('EcmNewKpkwsReceived');
|
|
$footer= $EcmSysInfo->getFooterForModule('EcmNewKpkwsReceived');
|
|
} else {
|
|
$nag = 'WYDAŁ';
|
|
$header = $EcmSysInfo->getHeaderForModule('EcmNewKpkwsGave');
|
|
$footer= $EcmSysInfo->getFooterForModule('EcmNewKpkwsGave');
|
|
}
|
|
/*
|
|
if ($res->num_rows == 0) {
|
|
*/
|
|
// create and save document
|
|
$positions = formatPDFPositions ( $focus->getPositionList ( true ), $focus );
|
|
// get header
|
|
|
|
$content = '';
|
|
include_once ("modules/EcmNewKpkws/PDFTemplate/content.php");
|
|
|
|
global $current_user;
|
|
//$db->query ( "INSERT INTO ecmnewkpkw_pdf VALUES ('$record','$current_user->id', NOW(),'" . mysql_real_escape_string ( $header ) . "', '" . mysql_real_escape_string ( $content ) . "')" );
|
|
/*
|
|
} else {
|
|
|
|
$positions = formatPDFPositions ( $focus->getPositionList ( true ), $focus );
|
|
$row = $db->fetchByAssoc ( $res );
|
|
$header = htmlspecialchars_decode ( $row ['footer'] ); // punk rock!
|
|
$content = htmlspecialchars_decode ( $row ['content'] );
|
|
$header = '';
|
|
include_once ("modules/EcmNewKpkws/PDFTemplate/header.php");
|
|
$content = '';
|
|
include_once ("modules/EcmNewKpkws/PDFTemplate/content.php");
|
|
|
|
//}
|
|
*/
|
|
|
|
$p->SetHTMLHeader ( $header );
|
|
|
|
$p->SetHTMLFooter($footer);
|
|
$p->WriteHTML ( $content );
|
|
|
|
// draw PDF
|
|
$p->Output ();
|
|
|