init
This commit is contained in:
119
modules/EcmDocumentTemplates/DocumentTemplatePDF.php
Executable file
119
modules/EcmDocumentTemplates/DocumentTemplatePDF.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
error_reporting(LC_ALL);
|
||||
|
||||
require_once('modules/EcmDocumentTemplates/DocumentPDF.php');
|
||||
|
||||
class DocumentTemplatePDF extends DocumentPDF {
|
||||
|
||||
private $blnShowHeader = true;
|
||||
private $blnShowFooter = true;
|
||||
|
||||
public $edt; // EcmDocumentTemplate
|
||||
|
||||
public function WorkReportPDF($orientation='P',$unit='mm',$format='A4') {
|
||||
parent::DocumentPDF($orientation,$unit,$format);
|
||||
}
|
||||
public function enableHeader() { $this->blnShowHeader = true; }
|
||||
public function disableHeader() { $this->blnShowHeader = false; }
|
||||
public function enableFooter() { $this->blnShowFooter = true; }
|
||||
public function disableFooter() { $this->blnShowFooter = false; }
|
||||
|
||||
public function Header($content='') {
|
||||
$arr=$this->edt->getTemplateFile($_REQUEST['module']);
|
||||
$nip=$this->edt->footer_nip;
|
||||
$module_t=$_REQUEST['module'];
|
||||
if($_REQUEST['module']=="EcmInsideOrders"){
|
||||
$arr[0]="EcmInsideOrders";$arr[1]="e5";
|
||||
}
|
||||
include("modules/EcmDocumentTemplates/templates/".$arr[0]."/".$arr[1]."/header.php");
|
||||
}
|
||||
|
||||
public function getBreakLine() {
|
||||
return $this->fh-$this->bMargin+1;
|
||||
}
|
||||
|
||||
public function Footer() {
|
||||
global $mod_strings;
|
||||
//if(!$this->blnShowFooter) return;
|
||||
|
||||
$arr=$this->edt->getTemplateFile($_REQUEST['module']);
|
||||
if($_REQUEST['module']=="EcmInsideOrders"){
|
||||
$arr[0]="EcmInsideOrders";$arr[1]="e5";
|
||||
}
|
||||
//manage pdf types
|
||||
//sales
|
||||
if ($_REQUEST['module']=='EcmSales') {
|
||||
$s = new EcmSale();
|
||||
|
||||
$s->retrieve($_REQUEST['record']);
|
||||
if ($s->invoice_type=='U' || $s->invoice_type=='I' || $s->ecmlanguage == "en_us")
|
||||
include("modules/EcmDocumentTemplates/templates/".$arr[0]."/".$arr[1]."/footer.en.php");
|
||||
else
|
||||
include("modules/EcmDocumentTemplates/templates/".$arr[0]."/".$arr[1]."/footer.pl.php");
|
||||
return;
|
||||
}
|
||||
|
||||
if ($_REQUEST['module']=='EcmInvoiceOutOlds') {
|
||||
|
||||
$i = new EcmInvoiceOutOld();
|
||||
$i->retrieve($_REQUEST['record']);
|
||||
|
||||
if ($i->pdf_type=='U' || $i->pdf_type=='I')
|
||||
include("modules/EcmDocumentTemplates/templates/EcmInvoiceOuts/e5/footer.en.php");
|
||||
else
|
||||
include("modules/EcmDocumentTemplates/templates/EcmInvoiceOuts/e5/footer.pl.php");
|
||||
return;
|
||||
}
|
||||
include("modules/EcmDocumentTemplates/templates/".$arr[0]."/".$arr[1]."/footer.php");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function Main() {
|
||||
|
||||
global $mod_strings;
|
||||
$arr=$this->edt->getTemplateFile($_REQUEST['module']);
|
||||
|
||||
include_once("modules/EcmDocumentTemplates/templates/".$arr[0]."/".$arr[1]."/subheader.php");
|
||||
|
||||
//$this->edt->DrawPositions($this);
|
||||
|
||||
include_once("modules/EcmDocumentTemplates/templates/".$arr[0]."/".$arr[1]."/subfooter.php");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function DrawPositions($positions) {
|
||||
$name_w = 55;
|
||||
if($this->document_info['calc']['draw_discount']) $name_w -= 8;
|
||||
if($this->document_info['calc']['draw_vat']) $name_w -= 8;
|
||||
$table = array();
|
||||
$table [0]['position'] = array('width' => 5, 'value' => $this->TEXT['LBL_PDF_POSITIONS_LIST_POSITION'], 'background' => array(233,233,233), 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
||||
$table [0]['quantity'] = array('width' => 6, 'value' => $this->TEXT['LBL_PDF_POSITIONS_LIST_QUANTITY'],'background' => array(233,233,233), 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
||||
$table [0]['unit'] = array('width' => 6, 'value' => $this->TEXT['LBL_PDF_POSITIONS_LIST_UNIT'],'background' => array(233,233,233), 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
||||
$table [0]['description'] = array('width' => $name_w, 'value' => $this->TEXT['LBL_PDF_POSITIONS_LIST_DESCRIPTION'], 'background' => array(233,233,233), 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
||||
$table [0]['unit_price'] = array('width' => 14, 'value' => $this->TEXT['LBL_PDF_POSITIONS_LIST_SELLING_PRICE'], 'background' => array(233,233,233), 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
||||
if($this->document_info['calc']['draw_discount']) $table [0]['discount'] = array('width' => 8, 'value' => $this->TEXT['LBL_PDF_POSITIONS_LIST_DISCOUNT'], 'background' => array(233,233,233), 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
||||
if($this->document_info['calc']['draw_vat']) $table [0]['vat_id'] = array('width' => 8, 'value' => $this->TEXT['LBL_PDF_POSITIONS_LIST_VAT'], 'background' => array(233,233,233), 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
||||
$table [0]['total'] = array('width' => 14, 'value' => $this->TEXT['LBL_PDF_POSITIONS_LIST_TOTAL'], 'background' => array(233,233,233), 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
||||
|
||||
$i = 1;
|
||||
if($positions != '')
|
||||
foreach($positions as $p) {
|
||||
$table [$i]['position'] = array('width' => 5, 'value' => $i, 'border' => 'LR', 'align' => 'C', );
|
||||
$table [$i]['quantity'] = array('width' => 6, 'value' => $p['quantity'], 'border' => 1, 'align' => 'C', );
|
||||
$table [$i]['unit'] = array('width' => 6, 'value' => $p['unit_id'], 'border' => 1, 'align' => 'C', );
|
||||
$table [$i]['description'] = array('width' => $name_w, 'value' => $p['name'], 'border' => 1, 'align' => 'L', );
|
||||
$table [$i]['unit_price'] = array('width' => 14, 'value' => $p['price'], 'border' => 1, 'align' => 'R', );
|
||||
if($this->document_info['calc']['draw_discount']) $table [$i]['discount'] = array('width' => 8, 'value' => $p['discount'], 'border' => 1, 'align' => 'R', );
|
||||
if($this->document_info['calc']['draw_vat']) $table [$i]['vat_id'] = array('width' => 8, 'value' => $p['vat_id'], 'border' => 1, 'align' => 'R', );
|
||||
$table [$i]['total'] = array('width' => 14, 'value' => $p['total'], 'border' => 1, 'align' => 'R', );
|
||||
$i++;
|
||||
}
|
||||
$this->DrawTable($table);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user