File "datatables-demo-20260419210105.js"

Full Path: C:/wamp64/www/INVENTAPP/js/demo/datatables-demo-20260419210105.js
File size: 12.56 KB
MIME-type: text/plain
Charset: utf-8

// Call the dataTables jQuery plugin
$(document).ready(function () {
  $(document).on("click", ".btnCargarTblControl", function () {
    Swal.fire({

      icon: 'success',
      title: 'Cargando tabla',
      showConfirmButton: false,
      timer: 450
    })
    $('#tableControl').DataTable({
      order: [[0, 'desc']],
      fixedHeader: true,

      "ajax": {
        "url": "../models/tableControl.php",
        "type": "POST",
        "data": { opcion: 1 },
        "dataSrc": ""
      },
      "columns": [
        { "data": "IDMOV" },
        { "data": "TPDCTO" },
        { "data": "CODUBI" },
        { "data": "FECHA" },
        { "data": "ESTADO" },
        { "data": "USUARIO" },
        { "data": "CODPROD" },
        { "data": "NPROD" },
        { "data": "CANTIDAD" },
        { "data": "CANTEMPAQ" },
        { "data": "BULTOS" },
        { "data": "CAJAS" },
        { "data": "CNASTAPLL" },
        { "data": "CNASTAPV" },
        { "data": "CNASTILLAPLL" },
        { "data": "CNASTILLAPV" },
        { "data": "BASES" },
        { "data": "RESPONSABLE" },
        { "data": "PLANILLADOR" },
        { "data": "LOTE" },
        { "data": "PESOPROM" }
      ],

      "drawCallback": function () {
        var api = this.api();
        $(api.column(8).footer()).html(
          'PESO ACTUAL: ' + api.column(8, { page: 'current' }).data().sum() + '<br> PESO TOTAL: ' + api.column(8).data().sum()

        ),

          $(api.column(9).footer()).html(
            'UND ACTUAL: ' + api.column(9, { page: 'current' }).data().sum() + '<br> UND TOTAL: ' + api.column(9).data().sum()
          ),
          $(api.column(10).footer()).html(
            'BULTO ACTUAL: ' + api.column(10, { page: 'current' }).data().sum() + '<br> BULTO TOTAL: ' + api.column(10).data().sum()
          ),
          $(api.column(11).footer()).html(
            'CAJA TOTAL: ' + api.column(11, { page: 'current' }).data().sum() + '<br> CAJA TOTAL: ' + api.column(11).data().sum()
          ),
          $(api.column(12).footer()).html(
            'CNASTA PLL: ' + api.column(12, { page: 'current' }).data().sum() + '<br> CNASTA PLL TOTAL: ' + api.column(12).data().sum()
          ),
          $(api.column(13).footer()).html(
            'CNASTA PV: ' + api.column(13, { page: 'current' }).data().sum() + '<br> CNASTA PV TOTAL: ' + api.column(13).data().sum()
          ),
          $(api.column(14).footer()).html(
            'CNASTILLA PLL: ' + api.column(14, { page: 'current' }).data().sum() + '<br> CNASTILLA PLL TOTAL: ' + api.column(14).data().sum()
          ),
          $(api.column(15).footer()).html(
            'CNASTILLA PV: ' + api.column(15, { page: 'current' }).data().sum() + '<br> CNASTILLA PV TOTAL: ' + api.column(15).data().sum()
          ),
          $(api.column(16).footer()).html(
            'BASES: ' + api.column(16, { page: 'current' }).data().sum() + '<br> BASE TOTAL: ' + api.column(16).data().sum()
          )
      },
      "language": {
        "emptyTable": "No existen datos aun"
      },
      "scrollX": "400px",
      "scrollY": "250px",
      "scrollCollapse": true,

    });
  })
  $(document).on("click", ".btnCargarTblControlReg", function () {
    Swal.fire({

      icon: 'success',
      title: 'Cargando tabla',
      showConfirmButton: false,
      timer: 450
    })
    var tbl = $('#tblControlRegistro').DataTable({
      fixedHeader: true,
      /* dom: 'Bfrtip', */
      buttons: [{
        extend: 'excelHtml5',
        autoFilter: true,
        sheetName: 'Exported data',
        text: 'GENERAR EXCEL',
        className: 'btn btn-success'
      }],

      order: [[0, 'desc']],
      searchPanes: {
        cascadePanes: true,
        dtOpts: {
          dom: 'tp',
          paging: 'true',
          pagingType: 'simple',
          searching: true
        }
      },
      dom: 'BPlfrtip',
      /*columnDefs: [{
        searchPanes: {
          show: false,
          info: true,

        },
        targets: [18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 6, 5, 3]
      }],
     */
      columnDefs: [
        {
          searchPanes: {
            show: true,
            threshold: 0,
          },
          targets: [0, 1, 2, 4, 7, 19],
        },
        {
          searchPanes: {
            show: false,
            info: true,
          },
          targets: [18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 6, 5, 3],
        },
      ],

      "ajax": {
        "url": "../models/tableControl.php",
        "type": "POST",
        "data": { opcion: 2 },
        "dataSrc": ""
      },
      "columns": [
        { "data": "IDMOV" },
        { "data": "TPDCTO" },
        { "data": "CODUBI" },
        { "data": "FECHA" },
        { "data": "ESTADO" },
        { "data": "USUARIO" },
        { "data": "CODPROD" },
        { "data": "NPROD" },
        { "data": "CANTIDAD" },
        { "data": "CANTEMPAQ" },
        { "data": "BULTOS" },
        { "data": "CAJAS" },
        { "data": "CNASTAPLL" },
        { "data": "CNASTAPV" },
        { "data": "CNASTILLAPLL" },
        { "data": "CNASTILLAPV" },
        { "data": "BASES" },
        { "data": "RESPONSABLE" },
        { "data": "PLANILLADOR" },
        { "data": "LOTE" },
        { "data": "PESOPROM" },
        {
          "targets": -1,
          "data": null,
          "defaultContent": "<div class='text-center'><div class='btn-group'><button class='btn btn-danger btnEliminar'>Eliminar</button></div></div>"
        }
      ],
      "drawCallback": function () {
        var api = this.api();
        $(api.column(8).footer()).html(
          'PESO ACTUAL: ' + api.column(8, { page: 'current' }).data().sum() + '<br> PESO TOTAL: ' + api.column(8).data().sum()

        ),

          $(api.column(9).footer()).html(
            'UND ACTUAL: ' + api.column(9, { page: 'current' }).data().sum() + '<br> UND TOTAL: ' + api.column(9).data().sum()
          ),
          $(api.column(10).footer()).html(
            'BULTO ACTUAL: ' + api.column(10, { page: 'current' }).data().sum() + '<br> BULTO TOTAL: ' + api.column(10).data().sum()
          ),
          $(api.column(11).footer()).html(
            'CAJA TOTAL: ' + api.column(11, { page: 'current' }).data().sum() + '<br> CAJA TOTAL: ' + api.column(11).data().sum()
          ),
          $(api.column(12).footer()).html(
            'CNASTA PLL: ' + api.column(12, { page: 'current' }).data().sum() + '<br> CNASTA PLL TOTAL: ' + api.column(12).data().sum()
          ),
          $(api.column(13).footer()).html(
            'CNASTA PV: ' + api.column(13, { page: 'current' }).data().sum() + '<br> CNASTA PV TOTAL: ' + api.column(13).data().sum()
          ),
          $(api.column(14).footer()).html(
            'CNASTILLA PLL: ' + api.column(14, { page: 'current' }).data().sum() + '<br> CNASTILLA PLL TOTAL: ' + api.column(14).data().sum()
          ),
          $(api.column(15).footer()).html(
            'CNASTILLA PV: ' + api.column(15, { page: 'current' }).data().sum() + '<br> CNASTILLA PV TOTAL: ' + api.column(15).data().sum()
          ),
          $(api.column(16).footer()).html(
            'BASES: ' + api.column(16, { page: 'current' }).data().sum() + '<br> BASE TOTAL: ' + api.column(16).data().sum()
          ),
          $(api.column(20).footer()).html(
            'PESO PROM: ' + api.column(20, { page: 'current' }).data().sum() + '<br> PESO PROM TOTAL: ' + api.column(20).data().sum()
          )
      },
      aLengthMenu: [
        [10, 25, 50, 100, 200, -1],
        [10, 25, 50, 100, 200, "All"]
      ],
      language: {
        "searchPanes": {
          "clearMessage": "Borrar todo",
          "collapse": {
            "0": "Paneles de búsqueda",
            "_": "Paneles de búsqueda (%d)"
          },
          "count": "{total}",
          "countFiltered": "{shown} ({total})",
          "emptyPanes": "Sin paneles de búsqueda",
          "loadMessage": "Cargando paneles de búsqueda",
          "title": "Filtros Activos - %d",
          "showMessage": "Mostrar Todo",
          "collapseMessage": "Ocultar Todo"
        }

      },
      "scrollX": "400px",
      "scrollY": "250px",
      "scrollCollapse": true,


    });
  })

  $(document).on("click", ".btnCargarTblConsulReg", function () {
    Swal.fire({

      icon: 'success',
      title: 'Cargando tabla',
      showConfirmButton: false,
      timer: 450
    })

    $('#tblConsulRegistro').DataTable({
      order: [[0, 'desc']],

      searchPanes: {
        cascadePanes: true,
        dtOpts: {
          dom: 'tp',
          paging: 'true',
          pagingType: 'simple',
          searching: true
        }
      },
      dom: 'Pfrltip',
      columnDefs: [{
        searchPanes: {
          show: false,
          info: true
        },
        targets: [18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 6, 5, 3]
      }],

      "ajax": {
        "url": "../models/tableControl.php",
        "type": "POST",
        "data": { opcion: 3 },
        "dataSrc": ""
      },
      "columns": [
        { "data": "IDMOV" },
        { "data": "TPDCTO" },
        { "data": "CODUBI" },
        { "data": "FECHA" },
        { "data": "ESTADO" },
        { "data": "USUARIO" },
        { "data": "CODPROD" },
        { "data": "NPROD" },
        { "data": "CANTIDAD" },
        { "data": "CANTEMPAQ" },
        { "data": "BULTOS" },
        { "data": "CAJAS" },
        { "data": "CNASTAPLL" },
        { "data": "CNASTAPV" },
        { "data": "CNASTILLAPLL" },
        { "data": "CNASTILLAPV" },
        { "data": "BASES" },
        { "data": "RESPONSABLE" },
        { "data": "PLANILLADOR" },
        { "data": "LOTE" },
        { "data": "PESOPROM" }
      ],

      "drawCallback": function () {
        var api = this.api();
        $(api.column(8).footer()).html(
          'PESO ACTUAL: ' + api.column(8, { page: 'current' }).data().sum() + '<br> PESO TOTAL: ' + api.column(8).data().sum()

        ),

          $(api.column(9).footer()).html(
            'UND ACTUAL: ' + api.column(9, { page: 'current' }).data().sum() + '<br> UND TOTAL: ' + api.column(9).data().sum()
          ),
          $(api.column(10).footer()).html(
            'BULTO ACTUAL: ' + api.column(10, { page: 'current' }).data().sum() + '<br> BULTO TOTAL: ' + api.column(10).data().sum()
          ),
          $(api.column(11).footer()).html(
            'CAJA TOTAL: ' + api.column(11, { page: 'current' }).data().sum() + '<br> CAJA TOTAL: ' + api.column(11).data().sum()
          ),
          $(api.column(12).footer()).html(
            'CNASTA PLL: ' + api.column(12, { page: 'current' }).data().sum() + '<br> CNASTA PLL TOTAL: ' + api.column(12).data().sum()
          ),
          $(api.column(13).footer()).html(
            'CNASTA PV: ' + api.column(13, { page: 'current' }).data().sum() + '<br> CNASTA PV TOTAL: ' + api.column(13).data().sum()
          ),
          $(api.column(14).footer()).html(
            'CNASTILLA PLL: ' + api.column(14, { page: 'current' }).data().sum() + '<br> CNASTILLA PLL TOTAL: ' + api.column(14).data().sum()
          ),
          $(api.column(15).footer()).html(
            'CNASTILLA PV: ' + api.column(15, { page: 'current' }).data().sum() + '<br> CNASTILLA PV TOTAL: ' + api.column(15).data().sum()
          ),
          $(api.column(16).footer()).html(
            'BASES: ' + api.column(16, { page: 'current' }).data().sum() + '<br> BASE TOTAL: ' + api.column(16).data().sum()
          )
      },
      language: {
        "searchPanes": {
          "clearMessage": "Borrar todo",
          "collapse": {
            "0": "Paneles de búsqueda",
            "_": "Paneles de búsqueda (%d)"
          },
          "count": "{total}",
          "countFiltered": "{shown} ({total})",
          "emptyPanes": "Sin paneles de búsqueda",
          "loadMessage": "Cargando paneles de búsqueda",
          "title": "Filtros Activos - %d",
          "showMessage": "Mostrar Todo",
          "collapseMessage": "Ocultar Todo"
        }
      }

    });

  });
  $(document).on("click", ".btnCargarTblProm", function () {
    Swal.fire({

      icon: 'success',
      title: 'Cargando tabla',
      showConfirmButton: false,
      timer: 450
    })

    var tbl = $('#tblControlPromedio').DataTable({
      order: [[0, 'asc']],
      "ajax": {
        "url": "../models/tableControl.php",
        "type": "POST",
        "data": { opcion: 4 },
        "dataSrc": ""
      },
      "columns": [
        { "data": "id" },
        { "data": "codLinea" },
        { "data": "codItem" },
        { "data": "nomItem" },
        { "data": "pesoProm" },
        { "data": "minimo" },
        { "data": "maximo" },

        {
          "targets": -1,
          "data": null,
          "defaultContent": "<div class='text-center'><div class='btn-group'><button class='btn btn-success btnEditarProm'>Actualizar</button></div></div>"
        }
      ],

    });
  })
});