Exemplo n.º 1
0
 /**
  * retornar reporte en formato xls
  * POST historico/listaraveriadetalle
  *
  * @return json
  */
 public function postListaraveriadetalle()
 {
     $tipo = Input::get('tipo');
     $negocio = Input::get('negocio');
     $actuacion = Input::get('actuacion');
     $reporte = '';
     if ($tipo == "averia") {
         switch ($negocio) {
             case 'CATV-LIQ':
                 try {
                     $reporte = Historico::getAveriasCatvLiquidadas($tipo, $actuacion);
                 } catch (Exception $exc) {
                     $this->_errorController->saveError($exc);
                     return array('rst' => 0, 'datos' => '', 'tipo' => '');
                 }
                 break;
             case 'TBA-LIQ':
                 try {
                     $reporte = Historico::getAveriasTbaLiquidadasLima($tipo, $actuacion);
                 } catch (Exception $exc) {
                     $this->_errorController->saveError($exc);
                     return array('rst' => 0, 'datos' => '', 'tipo' => '');
                 }
                 break;
             case 'ADSL-LIQ':
                 try {
                     $reporte = Historico::getAveriasAdslLiquidadas($tipo, $actuacion);
                 } catch (Exception $exc) {
                     $this->_errorController->saveError($exc);
                     return array('rst' => 0, 'datos' => '', 'tipo' => '');
                 }
                 break;
             case 'ADSL-PEN':
                 $reporte = null;
                 try {
                     $reporte = Historico::getAveriasAdslPendientes($tipo, $actuacion);
                 } catch (Exception $exc) {
                     $this->_errorController->saveError($exc);
                     return array('rst' => 0, 'datos' => '', 'tipo' => '');
                 }
                 break;
             default:
                 $reporte = '';
                 break;
         }
     }
     if (count($reporte) > 0 && is_array($reporte)) {
         $rst = 1;
     } else {
         $rst = 0;
     }
     return Response::json(array('rst' => $rst, 'datos' => $reporte, 'tipo' => $tipo));
 }