defined('_JEXEC') or die('=;)');
jimport('joomla.application.component.view');
jimport('tcpdf.tcpdf');
class NewManuReportPDF extends TCPDF {
//Page header
public function Header() {
// Title
$this->SetY(10);
$currentDate = new JDate();
$currentDate->setOffset(date('Z')/3600.0);
$header =JText::_('Date'). ": " . $currentDate->toFormat("%d/%m/%y %H:%M");
$this->SetFont('helvetica', 'B', 8);
$this->Cell(0, 0,$header, 0, 0, 'L');
$this->Ln();
$margins = $this->getMargins();
$this->Line($margins['left'],$this->getY(),$this->getPageWidth()-$margins['right'],$this->getY(),array('width'=>0.3));
}
// Page footer
public function Footer() {
// Position at 2.5 cm from bottom
$this->SetY(-10);
$margins = $this->getMargins();
$this->Line($margins['left'],$this->getY(),$this->getPageWidth()-$margins['right'],$this->getY(),array('width'=>0.3));
/*
$this->SetFont('helvetica','',8);
$text = "
"."hola"."
";
$this->Cell(0, 0, implode(' ',$arrayInfo2), 0, 0, 'C');
}*/
}
}
class vxcViewMAManufacturing extends JView
{
function display($tpl = null)
{
$document =& JFactory::getDocument();
$document->setMimeEncoding('application/pdf');
$date = gmdate('D, d M Y H:i:s',time()).' GMT';
$document->setModifiedDate($date);
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$modelManufacturingOrders =& $this->getModel('manufacturingorders');
$abbs =& $modelManufacturingOrders->getMaterials();
if ($this->_layout == 'labels')
{
$orders = JRequest::getVar('orders');
if ($orders)
$ordersArray = explode(',',$orders);
else
$ordersArray = array();
$orders =& $modelManufacturingOrders->getManufacturingLabelsData($ordersArray);
//$document->_margin_top=12.5;
//$document->_margin_bottom=12.5;
//$document->_margin_left=5;
//$document->_margin_right=5;
$document->_margin_top=0;
$document->_margin_bottom=0;
$document->_margin_left=0;
$document->_margin_right=0;
$modelSettings =& $this->getModel('settings');
$this->assignRef('settings',$modelSettings);
$pdf = new NewManuReportPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetAutoPageBreak(FALSE, $document->_margin_bottom);
$pdf->SetPrintHeader(FALSE);
$pdf->SetPrintFooter(FALSE);
$this->loadHelper('manulabelhelper');
$manuLabelHelper = new ManuLabelHelper();
$manuLabelHelper->generate($pdf, $orders,$abbs);
}
else
{
$orders =& $modelManufacturingOrders->getManufacturingReportData();
$summaryrows =& $modelManufacturingOrders->getManuReportSummary();
$document->_margin_top=15;
$document->_margin_bottom=10;
$document->_margin_left=10;
$document->_margin_right=10;
$pdf = new NewManuReportPDF('L', 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetAutoPageBreak(TRUE, $document->_margin_bottom);
}
$pdf->SetMargins($document->_margin_left, $document->_margin_top, $document->_margin_right);
$pdf->SetHeaderMargin($document->_margin_header);
$pdf->SetFooterMargin($document->_margin_footer);
$pdf->SetFont('helvetica','',14);
$modelOrderAttribute =& $this->getModel('orderattribute');
$this->assignRef('summaryrows',$summaryrows);
$this->assignRef('orders', $orders);
$this->assignRef('att',$modelOrderAttribute);
$this->assignRef('abbs',$abbs);
$this->assignRef('pdf',$pdf);
parent::display($tpl);
}// function
}// class
?>