init
This commit is contained in:
69
modules/EcmStockDocOuts/createPDF.php
Normal file
69
modules/EcmStockDocOuts/createPDF.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
include_once("modules/EcmStockDocOuts/PDFTemplate/helper.php");
|
||||
|
||||
|
||||
if ($_REQUEST['action'] == 'createPDF'){
|
||||
|
||||
createPDF($_REQUEST['record'],'I');
|
||||
}
|
||||
|
||||
|
||||
function createPDF($record,$output,$filename = null){
|
||||
$focus = new EcmStockDocOut();
|
||||
$focus -> retrieve($record);
|
||||
|
||||
if($filename==null){
|
||||
$filename = str_replace(" ","_", str_replace("/", "_", $focus->document_no));
|
||||
}
|
||||
$user = new User();
|
||||
$user -> retrieve($focus->assigned_user_id);
|
||||
|
||||
include_once("include/MPDF57/mpdf.php");
|
||||
$p=new mPDF('','A4', null, 'helvetica', 10,10,30,45,5,5);
|
||||
$mpdf->mirrorMargins = 1;
|
||||
|
||||
//get languages
|
||||
$labels = return_module_language($focus->ecmlanguage, 'EcmStockDocOuts');
|
||||
$db = $GLOBALS ['db'];
|
||||
|
||||
// document pdf
|
||||
// document already exist?
|
||||
|
||||
$header = '';
|
||||
include("modules/EcmStockDocOuts/PDFTemplate/header.php");
|
||||
|
||||
// create and save document
|
||||
$positions = formatPDFPositions($focus->getPositionList(true), $focus);
|
||||
// get header
|
||||
|
||||
$content = '';
|
||||
include("modules/EcmStockDocOuts/PDFTemplate/footer-".$focus->ecmlanguage.".php");
|
||||
|
||||
|
||||
//get content
|
||||
$content = '';
|
||||
|
||||
include("modules/EcmStockDocOuts/PDFTemplate/content.php");
|
||||
|
||||
|
||||
|
||||
|
||||
//get header
|
||||
//echo $header."<br>";
|
||||
$p->SetHTMLHeader($header);
|
||||
|
||||
//get footer
|
||||
|
||||
$p->SetHTMLFooter($footer);
|
||||
|
||||
//get content
|
||||
|
||||
//$p->WriteHTML($style);
|
||||
|
||||
$p->WriteHTML($content);
|
||||
|
||||
//draw PDF
|
||||
|
||||
$p->Output ($filename, $output);
|
||||
}
|
||||
Reference in New Issue
Block a user