Exemplo n.º 1
0
 function write($fileName)
 {
     $pdf = new CustomReport('P', PDF_UNIT, "LETTER", true, 'UTF-8', false);
     $pdf->setDataSource($this->getDataSource());
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(10);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     // add a page
     $pdf->AddPage();
     $height = 5;
     $width1 = 15;
     $width2 = 20;
     $width3 = 35;
     $width4 = 75;
     $white = array('LTRB' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 255)));
     $black = array('T' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $pdf->SetFontSize(7);
     $pdf->SetFont('', 'B');
     $pdf->Cell($width1, $height, 'Señores:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width4 + $width3 + $width2, $height, $this->getDataSource()->getParameter('desc_proveedor'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->SetFont('', 'B');
     $pdf->Cell(5, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width1, $height, 'Telf.:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width2, $height, $this->getDataSource()->getParameter('telefono1'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width1, $height, 'Dirección:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width4 + $width3 + $width2, $height, $this->getDataSource()->getParameter('direccion'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Cell(5, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', 'B');
     $pdf->Cell($width1, $height, 'Telf. 2:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width2, $height, $this->getDataSource()->getParameter('telefono2'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width1, $height, 'Ciudad:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width4 + $width3 + $width2, $height, $this->getDataSource()->getParameter('lugar_entrega'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->SetFont('', 'B');
     $pdf->Cell(5, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width1, $height, 'Celular:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width2, $height, $this->getDataSource()->getParameter('celular'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width1, $height, 'Email:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width4 + $width3 + $width2, $height, $this->getDataSource()->getParameter('email'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Cell(5, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', 'B');
     $pdf->Cell($width1, $height, 'Fax:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width2, $height, $this->getDataSource()->getParameter('fax'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFontSize(10);
     $pdf->SetFont('', 'B');
     $tipo = $this->getDataSource()->getParameter('tipo');
     if ($tipo == 'borrador') {
         $pdf->MultiCell(0, $height, 'Agradecemos a Ud.(s) cotizar el siguiente material con IMPUESTOS INCLUIDOS, indicando plazo de entrega y validez de su oferta hasta el ' . $this->getDataSource()->getParameter('fecha_venc'), 1, 'L', false, 1);
     }
     $this->writeDetalles($this->getDataSource()->getParameter('detalleDataSource'), $pdf, $tipo);
     $pdf->SetFontSize(9);
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Fecha de Entrega:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('fecha_entrega'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Cell(5, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Moneda:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('moneda'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Tipo de Entrega:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('tipo_entrega'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Cell(5, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Lugar de Entrega:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('lugar_entrega'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Ln();
     if ($this->getDataSource()->getParameter('tipo') == 'adjudicado') {
         $pdf->SetFont('', 'B');
         $pdf->Cell($width3, $height, 'Fecha Adjudicacion:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
         $pdf->SetFont('', '');
         $pdf->SetFillColor(192, 192, 192, true);
         $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('fecha_adju'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     }
     $pdf->Output($fileName, 'F');
 }
Exemplo n.º 2
0
 function write($fileName)
 {
     $pdf = new CustomReport('P', PDF_UNIT, "LETTER", true, 'UTF-8', false);
     $pdf->setDataSource($this->getDataSource());
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(10);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     // add a page
     $pdf->AddPage();
     $height = 5;
     $width1 = 15;
     $width2 = 20;
     $width3 = 35;
     $width4 = 75;
     $pdf->SetFontSize(8.5);
     $pdf->SetFont('', 'B');
     $pdf->setTextColor(0, 0, 0);
     $pdf->Cell($width3, $height, 'Número de Solicitud', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width3, $height, 'Fecha de Solicitud', 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width3, $height, 'Fecha de Aprobacion', 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width2 + 5, $height, 'Tipo', 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width2 + 5, $height, 'Moneda', 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width2 + 5, $height, 'Gestion', 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->SetFont('', '');
     $pdf->Cell($width3, $height, $this->getDataSource()->getParameter('numero'), 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width3, $height, $this->getDataSource()->getParameter('fecha_soli'), 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width3, $height, $this->getDataSource()->getParameter('fecha_apro'), 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width2 + 5, $height, $this->getDataSource()->getParameter('tipo'), 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width2 + 5, $height, $this->getDataSource()->getParameter('desc_moneda'), 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width2 + 5, $height, $this->getDataSource()->getParameter('desc_gestion'), 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->Ln();
     $white = array('LTRB' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 255)));
     $black = array('T' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     //$pdf->setLineStyle($white);
     $pdf->SetFontSize(7);
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Proceso:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('desc_proceso_macro'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->SetFont('', 'B');
     $pdf->Cell(5, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width3, $height, 'Categoria de Compra:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('desc_categoria_compra'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Unidad Organizacional:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('desc_uo'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Cell(5, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Funcionario:', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->SetFillColor(192, 192, 192, true);
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('desc_funcionario'), $white, 0, 'L', true, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $this->writeDetalles($this->getDataSource()->getParameter('detalleDataSource'), $pdf);
     $pdf->SetFontSize(8);
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Justificación', 0, 0, 'L', false, '', 1, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->MultiCell($width4 * 2, $height, $this->getDataSource()->getParameter('justificacion'), 0, 'L', false, 0);
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Comité Calificación:', 0, 0, 'L', false, '', 1, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->MultiCell($width4 * 2, $height, $this->getDataSource()->getParameter('comite_calificacion'), 0, 'L', false, 0);
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Posibles Proveedores:', 0, 0, 'L', false, '', 1, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->MultiCell($width4 * 2, $height, $this->getDataSource()->getParameter('posibles_proveedores'), 0, 'L', false, 0);
     $pdf->setTextColor(0, 0, 0);
     $pdf->Ln();
     $pdf->SetFont('', 'B');
     $pdf->Cell($width3, $height, 'Lugar de Entrega:', 0, 0, 'L', false, '', 1, false, 'T', 'C');
     $pdf->SetFont('', '');
     $pdf->Cell($width3 + $width2, $height, $this->getDataSource()->getParameter('lugar_entrega'), 0, 1, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Cell($width4 - 8, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width3 + $width1, $height, $this->getDataSource()->getParameter('desc_funcionario_apro'), $black, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width4 - 8, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->Cell($width4 - 8, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width3 + $width1, $height, 'Firma Autorizada', 0, 0, 'C', false, '', 0, false, 'T', 'C');
     $pdf->Cell($width4 - 8, $height, '', 0, 0, 'L', false, '', 0, false, 'T', 'C');
     $pdf->Ln();
     $pdf->Output($fileName, 'F');
 }