return file path if OK // MULTIPDF - save in MultiPdf temp dir / function createEcmSalePdf($record, $outputtype, $pdf_type = null) { if (! $record || $record == '') die ( 'Brak rekordu' ); if (isset($pdf_type)) { $_REQUEST['pdf_type'] = $pdf_type; } include_once ("modules/EcmSales/PDFTemplate/helper.php"); include_once ("modules/EcmSysInfos/EcmSysInfo.php"); $focus = new EcmSale (); $focus->retrieve ( $record ); $positions = formatPDFPositions ( $focus->getPositionList ( true ), $focus ); $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, 'EcmSales' ); // get header // get footer //$footer = ''; //include ("modules/EcmSales/PDFTemplate/footer-" . $focus->ecmlanguage . ".php"); //$p->SetHTMLFooter ( $footer ); // get content $content = ''; include ("modules/EcmSales/PDFTemplate/content.php"); $EcmSysInfo = new EcmSysInfo(); $header = $EcmSysInfo->getHeaderForModule('EcmSales'); if($_REQUEST['pdf_type']=='0'){ $header = $EcmSysInfo->getHeaderForModule('EcmInvoiceOuts'); $p->SetHTMLHeader ( $header ); } else { $p->SetHTMLHeader ( $header ); } $p->WriteHTML ( $content ); $p->SetHTMLFooter ( $EcmSysInfo->getFooterForModule('EcmSales') ); switch ($outputtype) { case "BROSWER" : $p->Output (); return true; case "FILE" : $path = 'upload/zs_' . str_replace("/", "-", $focus->document_no) . '.pdf'; break; case "EMAIL" : include_once 'include/ECM/EcmSendMail/EcmSendMail.inc'; $path = EcmSendMail::TEMP_DIR . 'ZS_' . $focus->number . '.pdf'; break; case "MULTIPDF" : include_once 'include/ECM/EcmMultiPdf/EcmMultiPdf.inc'; $path = EcmMultiPdf::TEMP_DIR . 'EcmSales_' . $focus->id. '_' . create_guid() . '.pdf'; break; }; $p->Output ($path, "F" ); return $path; }