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'); }