Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/03/2015, 16:20
Begotten
 
Fecha de Ingreso: enero-2015
Ubicación: Valparaiso
Mensajes: 88
Antigüedad: 9 años, 3 meses
Puntos: 0
Respuesta: Error de script con datatables

Código PHP:
Ver original
  1. include_once('conexion.php');
  2.     $sql = "SELECT * FROM cuenta c WHERE c.fecha_baja IS NULL ORDER BY fecha;";
  3.     $res = $con->query($sql);
  4.     $ide = "";
  5.     echo "<div id='pad-wrapper' class='datatables-page'>";
  6.     echo "           <div class='row'>";
  7.     echo "               <div class='col-md-8-2'>";
  8.     echo "                    <table id='tablCuentas' style='text-align:center' class='stripe row-border order-column' cellspacing='0' width='60%'>";
  9.     echo "                        <thead>";
  10.     echo "                            <tr>";
  11.     echo "                                <th tabindex='0' rowspan='2' colspan='1'></th>";
  12.     echo "                                <th tabindex='0' rowspan='2' colspan='1'></th>";
  13.     echo "                                <th style = 'display:none;' tabindex='0' rowspan='2' colspan='1'>ID</th>";
  14.     echo "                                <th class='center' tabindex='0' rowspan='2' colspan='1'>Fecha</th>";
  15.     echo "                                <th class='center' tabindex='0' rowspan='2' colspan='1'>Detalle</th>";
  16.     echo "                                <th class='center' tabindex='0' rowspan='2' colspan='1'>Monto</th>";
  17.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Caja</th>";
  18.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>BCI P7</th>";
  19.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Chile P7</th>";  
  20.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Santander P7 1</th>";
  21.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Santander P7 2</th>";
  22.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Proveedores</th>";
  23.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Clientes</th>";
  24.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Varios Acreedores</th>"; 
  25.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Varios Deudores</th>";
  26.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Cuenta RGU</th>";
  27.     echo "                                <th class='center' tabindex='0' rowspan='1' colspan='2'>Cuenta EGD</th>";
  28.     echo "                            </tr>";
  29.     echo "                            <tr>";
  30.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Egreso</th>";
  31.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Ingreso</th>";
  32.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Deposito</th>";
  33.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Cargo</th>";
  34.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Deposito</th>";
  35.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Cargo</th>";
  36.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Deposito</th>";
  37.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Cargo</th>";
  38.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Deposito</th>";
  39.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Cargo</th>";
  40.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Compra</th>";
  41.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Pago</th>";
  42.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Gastos</th>";
  43.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Ingresos</th>";
  44.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Deuda</th>";
  45.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Pago</th>";
  46.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Deuda</th>";
  47.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Pago</th>";
  48.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Retiros</th>";
  49.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Aportes</th>";
  50.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Retiros</th>";
  51.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Aportes</th>";
  52.     echo "                                <th tabindex='0' rowspan='1' colspan='1'>Validado</th>";
  53.     echo "                            </tr>";
  54.     echo "                        </thead>";
  55.     echo "                        <tbody>";
  56.             while ($edit_cuentas = $res->fetch_array()) {
  57.     echo "                            <tr>";
  58.     echo "                                <td class='center'><a onclick='actualizarCuenta(".$ide=$edit_cuentas[0].");' data-toggle='modal' style='cursor:pointer;'><img src='img/edit.png' width='20' height='20'></i></a></td>";
  59.     echo "                                <td class='center'><a onclick='Menelimcta(".$ide=$edit_cuentas[0].");' data-toggle='modal' data-target='#myModal-DeleteCta' style='cursor:pointer;'><img src='img/delete.png' width='20' height='20'></a></td>";
  60.     echo "                                <td style = 'display:none;'>".$edit_cuentas[0]."</td>";
  61.     echo "                                <td class='center'>".$edit_cuentas[3]."</td>";
  62.     echo "                                <td class='center'>".$edit_cuentas[4]."</td>";
  63.     echo "                                <td class='center'>".$edit_cuentas[5]."</td>";
  64.     echo "                                <td class='center'>".$edit_cuentas[6]."</td>";
  65.     echo "                                <td class='center'>".$edit_cuentas[7]."</td>";
  66.     echo "                                <td class='center'>".$edit_cuentas[8]."</td>";
  67.     echo "                                <td class='center'>".$edit_cuentas[9]."</td>";
  68.     echo "                                <td class='center'>".$edit_cuentas[10]."</td>";
  69.     echo "                                <td class='center'>".$edit_cuentas[11]."</td>";
  70.     echo "                                <td class='center'>".$edit_cuentas[12]."</td>";
  71.     echo "                                <td class='center'>".$edit_cuentas[13]."</td>";
  72.     echo "                                <td class='center'>".$edit_cuentas[14]."</td>";
  73.     echo "                                <td class='center'>".$edit_cuentas[15]."</td>";
  74.     echo "                                <td class='center'>".$edit_cuentas[16]."</td>";
  75.     echo "                                <td class='center'>".$edit_cuentas[17]."</td>";
  76.     echo "                                <td class='center'>".$edit_cuentas[18]."</td>";
  77.     echo "                                <td class='center'>".$edit_cuentas[19]."</td>";
  78.     echo "                                <td class='center'>".$edit_cuentas[20]."</td>";
  79.     echo "                                <td class='center'>".$edit_cuentas[21]."</td>";
  80.     echo "                                <td class='center'>".$edit_cuentas[22]."</td>";
  81.     echo "                                <td class='center'>".$edit_cuentas[23]."</td>";
  82.     echo "                                <td class='center'>".$edit_cuentas[24]."</td>";
  83.     echo "                                <td class='center'>".$edit_cuentas[25]."</td>";  
  84.     echo "                                <td class='center'>".$edit_cuentas[26]."</td>";
  85.     echo "                                <td class='center'>".$edit_cuentas[27]."</td>";  
  86.     echo "                                <td class='center'>".$edit_cuentas[28]."</td>";
  87.     echo "                            </tr>";
  88.     $cta = $edit_cuentas[2];
  89.             }
  90.     echo "                        </tbody>";
  91.     echo "                    </table>";
  92.     echo "                  <br />";
  93.     echo "                  <p style='margin-top: 25px;'>";
  94.     echo "                      <button type='submit' name= 'envio' onclick='mostrarFormularioCuenta()' class='btn-flat1' data-toggle='modal' data-target='#myModal-NewCta'>Nuevo Registro en Cuenta</button>";
  95.     echo "                      <button type='submit' name= 'generar' onclick='CrearPlanillaDetalle()' class='btn-flat1' data-toggle='modal' data-target='#myModal-Gen'>Generar Excel</button>";
  96.     echo "                  </p>";
  97.     echo "                </div>";
  98.     echo "            </div>";
  99.     echo "        </div>";
  100.     <script type="text/javascript">
  101.  
  102.  
  103.     $(document).ready(function() {
  104.         var table = $('#tablCuentas').DataTable( {
  105.             dom:            'Cfrtip',
  106.             scrollY:        '300px',
  107.             scrollX:        true,
  108.             scrollCollapse: true,
  109.             sPaginationType: 'full_numbers',
  110.             oLanguage:{
  111.                 sProcessing:     'Cargando...',
  112.                 sLengthMenu:     'Mostrar _MENU_ registros',
  113.                 sZeroRecords:    'No se encontraron resultados',
  114.                 sEmptyTable:     'Ningún dato disponible en esta tabla',
  115.                 sInfo:           'Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros',
  116.                 sInfoEmpty:      'Mostrando registros del 0 al 0 de un total de 0 registros',
  117.                 sInfoFiltered:   '(filtrado de un total de _MAX_ registros)',
  118.                 sInfoPostFix:    '',
  119.                 sSearch:         'Buscar:',
  120.                 sUrl:            '',
  121.                 sInfoThousands:  '',
  122.                 sLoadingRecords: 'Cargando...',
  123.                 oPaginate: {
  124.                     sFirst:    'Primero',
  125.                     sLast:     'Último',
  126.                     sNext:     'Siguiente',
  127.                     sPrevious: 'Anterior'
  128.                 },
  129.                 oAria: {
  130.                     sSortAscending:  ': Activar para ordenar la columna de manera ascendente',
  131.                     sSortDescending: ': Activar para ordenar la columna de manera descendente'
  132.                 }
  133.             },
  134.                     aaSorting: [[ 0, 'desc' ]],//ordenar
  135.                     iDisplayLength: 20,
  136.                     aLengthMenu: [[1, 2, 5, 10, 20, 50, -1], [1, 2, 5, 10, 20, 50, 'All']]
  137.                 } );
  138.  
  139.         new $.fn.dataTable.FixedColumns( table, {
  140.             leftColumns: 6
  141.         } );
  142.     } );
  143. </script>