Tema: Exportar
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/10/2015, 07:19
esoto
 
Fecha de Ingreso: abril-2015
Mensajes: 96
Antigüedad: 9 años
Puntos: 1
Respuesta: Exportar

Controlador

Código PHP:
Ver original
  1. public function excelEstado()
  2.     {
  3.        $this->load->model('prejud_model');
  4.        to_excel($this->prejud_model->getExcel(), "Estado");
  5.  
  6.     }


Modelo

Código PHP:
Ver original
  1. public function getExcel()
  2.     {
  3.            $fields = $this->db->field_data('Cartera31072015');
  4.         $query = $this->db->select('*')->get('Cartera31072015');
  5.         return array("fields" => $fields, "query" => $query);
  6.     }

Vista

Código PHP:
Ver original
  1. <form action="<?= base_url().'prejudicial/excelEstado'?>">
  2.  <div class="muestra_poblaciones">
  3.  
  4.  
  5.  
  6.    <div class="table">
  7.    <div class="table-responsive">
  8.    <table class="table table-hover">
  9.     <?php //si hay resultados los mostramos
  10.  
  11.   if(is_array($resultados) && !is_null($resultados))
  12.   {
  13.   ?>
  14.     <thead>
  15.     <tr>               <th>Supervisor<th>
  16.  
  17.                        <th>NOMBRE</th>
  18.                        <th>RUT</th>
  19.                        <th>cDv</th>
  20.                        <th>SUCURSAL</th>          
  21.                        <th>TIPO DE CREDITO</th>          
  22.                        <th>PRODUCTO</th>        
  23.                        <th>ESTADO DEL SOCIO EN GAC</th>                    
  24.                        <th>DIAS DE MOROSIDAD</th>
  25.                        <th>VALOR CUOTA</th>                    
  26.                        <th>CANTIDAD CUOTAS MOROSAS</th>                    
  27.                        <th>ESTADO JUDICIAL</th>                    
  28.                        <th>SUBESTADO JUDICIAL</th>                    
  29.                        <th>FECHA OTORGAMIENTO</th>                    
  30.                        <th>SUBTOTAL</th>                    
  31.                        <th>TIPO COBRANZA</th>
  32.              
  33.  
  34.                          <?php
  35.                          foreach($resultados as $dato){
  36.                          ?>
  37.     </tr>
  38.   </thead>
  39.  
  40.       <tr>
  41.                  <td><?php echo $dato->Supervisor?></td>
  42.                  <td></td>
  43.                  <td><?php echo $dato->Nombre?></td>
  44.                  <td><?php echo $dato->Rut?></td>
  45.                  <td><?php echo $dato->cDv?></td>
  46.                  <td><?php echo $dato->Sucursal?></td>
  47.                  <td><?php echo $dato->Tipo_producto?></td>
  48.                  <td><?php echo $dato->Producto?></td>
  49.                  <td><?php echo $dato->ESTADOSOCIO?></td>
  50.                  <td><?php echo $dato->qDiasMora?></td>
  51.                  <td><?php echo $dato->ValorCuota  ?></td>
  52.                  <td><?php echo $dato->cancuo_morosas ?></td>
  53.                  <td></td>
  54.                  <td></td>                
  55.                  <td><?php echo $dato->FAPERTURA  ?></td>
  56.                  <td><?php echo $dato->Subtotal2  ?></td>
  57.          
  58.       </tr>
  59.         <?php
  60.     }
  61.     ?>
  62.       <?php
  63.   }
  64.   ?>  
  65.   </table>
  66.  
  67.   <input type="hidden" class="btn btn-primary" value="exportar">              
  68.          </div>


Es asi como lo estoy haciendo.