/** * 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'); } }
/** * Devuelve un array de objeto RutasRepartoDetalle * * Si se indica $idDirec el array tendrá las rutas de reparto de la dirección de entrega * * Si no se indica $idDirec el array tendrá las rutas de reparto de todas las * direcciones de entrega del cliente * * @param integer $idDirec El id de la direccion de entregra, opcional * @return array Array con objetos RutasRepartoDetalle */ public function getRutasReparto($idDirec = '') { $rutasReparto = array(); $rutaReparto = new RutasRepartoDetalle(); $direc = new ClientesDentrega(); $filtro = $idDirec == '' ? "IDDirec IN (SELECT IDDirec from {$direc->getDataBaseName()}.{$direc->getTableName()} where IDCliente='{$this->IDCliente}')" : "IDDirec='{$idDirec}'"; $rows = $rutaReparto->cargaCondicion("Id", $filtro, "Dia ASC, OrdenDirec ASC"); foreach ($rows as $row) { $rutasReparto[] = new RutasRepartoDetalle($row['Id']); } unset($rutaReparto); unset($direc); return $rutasReparto; }