コード例 #1
0
 /**
  * Genera un listado en PDF con todos clientes del comercial
  * separados por dia (el rutero)
  */
 public function listadoAction()
 {
     if ($this->values['permisos']['permisosModulo']['LI']) {
         $idComercial = $this->request['IDComercial'];
         $comercial = new Agentes($idComercial);
         $opciones = array('title' => 'Rutas de ventas del comercial ' . $comercial->getNombre());
         unset($comercial);
         //CREAR EL DOCUMENTO-------------------------------------------------------------
         $pdf = new RutasPDF('L', 'mm', 'A4', $opciones);
         //$pdf->SetTopMargin($MEDIDAS['MargenSup']);
         //$pdf->SetLeftMargin($MEDIDAS['MargenIzq']);
         $pdf->SetAuthor("Informatica ALBATRONIC, SL");
         $pdf->SetTitle('Rutas de Ventas');
         $pdf->AliasNbPages();
         $pdf->SetFillColor(210);
         $pdf->AddPage();
         $pdf->SetAutoPageBreak(1, 15);
         $lis = new $this->entity();
         $rows = $lis->cargaCondicion("Id", "IDComercial='{$idComercial}'", "Dia,OrdenCliente,IDZona ASC");
         $auxTotales = $lis->cargaCondicion("Dia as Id,count(Id) as Value", "(IDComercial='{$idComercial}') GROUP BY Dia", "Dia ASC");
         unset($lis);
         foreach ($auxTotales as $totalDia) {
             $totales[$totalDia['Id']] = $totalDia['Value'];
         }
         $totClientes = 0;
         //CUERPO-------------------------------------------------------------------------
         $diaAnt = '';
         $pdf->SetFont('Courier', '', 8);
         foreach ($rows as $value) {
             $datos = new $this->entity($value['Id']);
             if ($diaAnt != $datos->getDia()) {
                 $pdf->SetFont('Courier', 'B', 10);
                 $pdf->Cell(0, 10, $pdf->DecodificaTexto($datos->getDia()) . "({$totales[$datos->getDia()->getIDTipo()]})");
                 $pdf->Ln();
                 $pdf->SetFont('Courier', '', 8);
             }
             $diaAnt = $datos->getDia();
             $pdf->SetFont('Courier', 'B', 8);
             $pdf->Cell(30, 4, $pdf->DecodificaTexto($datos->getIDCliente()->getIDZona()->getZona(), 30), 0, 0);
             $pdf->SetFont('Courier', '', 8);
             $pdf->Cell(110, 4, $pdf->DecodificaTexto($datos->getIDCliente()->getRazonSocial() . " - " . $datos->getIDCliente()->getNombreComercial(), 110), 0, 0);
             $pdf->Cell(80, 4, $pdf->DecodificaTexto($datos->getIDCliente()->getDireccion(), 45), 0, 0);
             $pdf->Cell(20, 4, $pdf->DecodificaTexto($datos->getIDCliente()->getIDPoblacion, 20), 0, 0);
             $pdf->Cell(30, 4, trim($datos->getIDCliente()->getTelefono() . " " . $datos->getIDCliente()->getMovil()), 0, 0);
             $pdf->Ln();
             $totClientes += 1;
         }
         unset($datos);
         $pdf->SetFont('Courier', 'B', 10);
         $pdf->Ln();
         $pdf->Cell(30, 4, "Total clientes " . $totClientes, 0, 0);
         $archivo = "docs/docs" . $_SESSION['emp'] . "/pdfs/" . md5(date('d-m-Y H:i:s')) . ".pdf";
         $pdf->Output($archivo, 'F');
         unset($pdf);
         $this->values['archivo'] = $archivo;
         return array('template' => '_global/listadoPdf.html.twig', 'values' => $this->values);
     } else {
         echo "adsfasdfads";
         return array('template' => '_global/forbiden.html.twig');
     }
 }
コード例 #2
0
 /**
  * Genera un listado en PDF con todos clientes del repartidor
  * separados por dia (el rutero)
  */
 public function listadoAction()
 {
     if ($this->values['permisos']['permisosModulo']['LI']) {
         $idRuta = $this->request['RutasReparto']['IDRuta'];
         $ruta = new RutasReparto($idRuta);
         $opciones = array('title' => 'Ruta de reparto ' . $ruta->getDescripcion());
         unset($ruta);
         //CREAR EL DOCUMENTO-------------------------------------------------------------
         $pdf = new RutasPDF('L', 'mm', 'A4', $opciones);
         //$pdf->SetTopMargin($MEDIDAS['MargenSup']);
         //$pdf->SetLeftMargin($MEDIDAS['MargenIzq']);
         $pdf->SetAuthor("Informatica ALBATRONIC, SL");
         $pdf->SetTitle('Rutas de Reparto');
         $pdf->AliasNbPages();
         $pdf->SetFillColor(210);
         $pdf->AddPage();
         $pdf->SetAutoPageBreak(1, 15);
         $lis = new RutasRepartoDetalle();
         $rows = $lis->cargaCondicion("Id", "IDRuta='{$idRuta}'", "Dia,OrdenDirec,IDZona ASC");
         unset($lis);
         //CUERPO-------------------------------------------------------------------------
         $diaAnt = '';
         $pdf->SetFont('Courier', '', 8);
         foreach ($rows as $key => $value) {
             $datos = new RutasRepartoDetalle($value['Id']);
             if ($diaAnt != $datos->getDia()->getIDTipo()) {
                 $pdf->SetFont('Courier', 'B', 10);
                 $pdf->Cell(0, 10, $datos->getDia() . ": " . $datos->getIDRepartidor()->getNombre(), 0, 0, 'L', 1);
                 $pdf->Ln();
                 $pdf->SetFont('Courier', '', 8);
             }
             $diaAnt = $datos->getDia()->getIDTipo();
             $pdf->SetFont('Courier', 'B', 8);
             $pdf->Cell(20, 4, $pdf->DecodificaTexto($datos->getIDDirec()->getIDZona()->getZona(), 11), 0, 0);
             $pdf->SetFont('Courier', '', 8);
             $pdf->Cell(115, 4, $pdf->DecodificaTexto($datos->getIDDirec()->getNombre() . " - " . $datos->getIDDirec()->getIDCliente()->getNombreComercial(), 115), 0, 0);
             $pdf->Cell(70, 4, $pdf->DecodificaTexto($datos->getIDDirec()->getDireccion(), 40), 0, 0);
             $pdf->Cell(30, 4, $pdf->DecodificaTexto($datos->getIDDirec()->getIDPoblacion(), 17), 0, 0);
             $pdf->Cell(35, 4, $pdf->DecodificaTexto($datos->getIDDirec()->getTelefono() . " " . $datos->getIDDirec()->getHorario(), 30), 0, 0);
             $pdf->Ln();
         }
         unset($datos);
         $archivo = "docs/docs" . $_SESSION['emp'] . "/pdfs/" . md5(date('d-m-Y H:i:s')) . ".pdf";
         $pdf->Output($archivo, 'F');
         unset($datos);
         unset($pdf);
         $this->values['archivo'] = $archivo;
         return array('template' => '_global/listadoPdf.html.twig', 'values' => $this->values);
     } else {
         return array('template' => '_global/forbiden.html.twig');
     }
 }