Пример #1
0
 public function postMovimientoult()
 {
     //recibir los parametros y enviarlos al modelo, ahi ejecutar el query
     $averia = null;
     if (Input::hasFile('file_averia')) {
         if (Input::file('file_averia')->isValid()) {
             $file = Input::file('file_averia');
             $tmpArchivo = $file->getRealPath();
             $file = file($tmpArchivo);
             $con = 0;
             $averia = "";
             foreach ($file as $f) {
                 $con++;
                 if ($con > 1) {
                     $averia .= "," . trim($f);
                 }
             }
             $averia = substr($averia, 1);
         }
     }
     $averiau = Input::get('txt_cod_actu');
     $checkFecha = Input::get('check_fecha');
     $reporte = Input::get('slct_reporte');
     $checkAveria = Input::get('check_averia');
     $checkAveriaU = Input::get('check_averia_u');
     $fechaIni = Input::get('fecha_ini');
     $fechaFin = Input::get('fecha_fin');
     $detalle = Input::get('slct_detalle_observacion');
     $pendiente = Input::get('slct_pendiente');
     $checkDetalleAgenda = false;
     $total = GestionMovimiento::getGestionMovimiento_ult($checkFecha, $checkAveria, $checkAveriaU, $reporte, $fechaIni, $fechaFin, $averia, $averiau, $pendiente);
     $output = "<table>";
     $con = 0;
     foreach ($total as $t) {
         $con++;
         if ($con == 1) {
             $output .= "<tr>";
             foreach ($t as $key => $value) {
                 $output .= "<th>";
                 $output .= $key;
                 $output .= "</th>";
             }
             $output .= "</tr>";
         }
         $output .= "<tr>";
         foreach ($t as $key => $value) {
             $output .= "<td>";
             $output .= $value;
             $output .= "</td>";
         }
         $output .= "</tr>";
     }
     $output .= "</table>";
     $filename = Helpers::convert_to_file_excel('reporte_ult_movimientos');
     $headers = array('Pragma' => 'public', 'Expires' => 'public', 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0', 'Cache-Control' => 'private', 'Content-Type' => 'application/vnd.ms-excel', 'charset' => 'utf-8', 'Content-Disposition' => 'attachment; filename=' . $filename, 'Content-Transfer-Encoding' => ' binary');
     return Response::make($output, 200, $headers);
 }