(86,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-04-28 22:44:00','rafael',781,152212,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n/*include_once \'../../core/configuracion.php\';\ninclude_once \'../../core/conexiones.php\';\ninclude_once \'../../inc/practico/def_basedatos.php\';\ninclude_once \'../../core/comunes.php\';*/\n\n//echo \"$builder\";\n$saldoFavor = $factura[\"saldo_pendiente\"] < 0 ? -$factura[\"saldo_pendiente\"] : 0;\n$saldoPendienteValor = $factura[\"saldo_pendiente\"] > 0 ? $factura[\"saldo_pendiente\"] : 0;\n$saldoPendiente = number_format($saldoPendienteValor, 0, \',\', \'.\');\n\n$descargar = 0;\nif ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1;\n$fechaSinRecargoBr = str_replace(\"-\", \"\", $factura[\"fecha_sin_recargo\"]);\n$totalValor =  number_format($factura[\"valor_sin_recargo\"] + $saldoPendienteValor - $saldoFavor, 0, \',\', \'.\');\n$total = $totalValor > 0 ? $totalValor : 0;\n$totalBr = str_replace(\".\", \"\", $total);\n$codigobarra=\"7709998678439\";\n$Barcode = $codigobarra.$factura[\"id_contrato\"].\"$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n//$Barcode = \"(415)7709998678439(8020)12345(3900)50000(96)20220524\";\n//$Barcode = \"41577099986784398020123453900500009620220524\";\n//$Barcode = \"12345670\";\n\n$rayaDesprendibleBanco = str_repeat(\"- \", 34);\n\n$estadoMedidor = \"Bueno\";\nif($factura[\"estado_medidor\"] == 2) $estadoMedidor = \"Dañado\";\nif($factura[\"estado_medidor\"] == 3) $estadoMedidor = \"N/A\";\n\nfunction getMesEsp($mes) {\n    $mesesArray = [\"\",\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"];\n    return $mesesArray[$mes];\n}\n$i = 1;\n$grafBarra = \"\";\n$tableData = \"\";\n$class = \"\";\n\n$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha_fin_facturacion) mes, valor_sin_recargo, saldo_pendiente, valor_tarifa_aplicada\n    FROM \n        app_facturas\n    WHERE \n        id_contrato = \". $factura[\"id_contrato\"]. \" ORDER BY id DESC LIMIT 6\n\")->fetchAll();\n\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"], 0, \',\', \'.\');\n    $grafBarra .= \'<div class=\"barra\"><div class=\"sub_barra b\' . $i . \'\"><div class=\"tag_g\">\' . $consumo[\"consumo_actual\"] . \'</div><div class=\"tag_leyenda\">\' . $mes . \'</div></div></div>\';\n    $tableData .= \'<tr><td>\' . $mes . \'</td><td>\' . $consumo[\"consumo_actual\"] . \'</td><td>\' . $consumo[\"valor_tarifa_aplicada\"] . \'</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . (is_numeric($consumo[\"consumo_actual\"]) ? $consumo[\"consumo_actual\"] : 0) . \"%} \";\n    $i++;\n}\n\n$html = \'\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         list-style: none;\n         padding: 0;\n         text-decoration: none;\n      }\n\n    table.info, \n    .info td,\n    .info tr {\n        border-width: 0px !important;\n        border-style: none;\n        text-align:left\n    }\n      /* heading */\n\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n      }\n\n      table {\n         border-collapse: separate;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.56em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n\n      html {\n         font: 16px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.4in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.4em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n      table.inventory {\n         margin: 0 0 0.3em;\n      }\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 30%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 38%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      table.inventory td:nth-child(1) {\n         width: 26%;\n      }\n\n      table.inventory td:nth-child(2) {\n         width: 38%;\n      }\n\n      table.inventory td:nth-child(3) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(4) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(5) {\n         text-align: center;\n         width: 12%;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 40%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n      }\n      \n.board{\n    width: 100%;\n    height: 160px;\n    box-sizing: border-box;\n    overflow: hidden;\n}\n.titulo_grafica{\n    width: 100%;\n    height: 10%;\n}\n.titulo_grafica>h3{\n    padding: 0;\n    margin: 0px;\n    text-align: center;\n    color: #666666;\n}\n.sub_board{\n    width: 100%;\n    height: 100%;\n    margin-top: 0px;\n    overflow: hidden;\n    box-sizing: border-box;\n}\n.sep_board{\n    width: 100%;\n    height: 10%;\n}\n.cont_board{\n    width: 100%;\n    height: 80%;\n}\n.graf_board{\n    width: 90%;\n    height: 100%;\n    float: right;\n    margin-top: 0px;\n    background-color: darkgrey;\n    border-left: 2px solid #999999;\n    border-bottom: 2px solid #999999;\n    box-sizing: border-box;\n    display: flex;\n    background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, \n \n    rgba(0,0,0,0) 100%);\n    background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, \n    rgba(0,0,0,0) 100%);\n\n    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,\n    rgba(0,0,0,0) 100%);\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\"#00ffffff\", endColorstr=\"#00ffffff\",GradientType=0 );\n}\n.barra{\n    width:100%;\n    height: 100%;\n    margin-right: 9px;\n    margin-left: 9px;\n    background-color: none;\n    display: flex;\n    flex-wrap: wrap;\n    align-items: flex-end;\n}\n.sub_barra{\n    width: 100%;\n    height: 80%;\n    background: #00799b;\n    background: -moz-linear-gradient(top, #00799b 0%, #64d1be 100%);\n    \n    -webkit-border-radius: 12px 12px 0 0;\n    border-radius: 12px 12px 0 0;\n}\n.tag_g{\n    position: relative;\n    width: 100%;\n    height: 100%;\n    margin-bottom: 23px;\n    text-align: center;\n    margin-top: -20px;\n    z-index: 2;\n}\n.tag_leyenda{\n    text-align: center;\n    margin-top: 0px;\n}\n.tag_board{\n    height: 100%;\n    width: 15%;\n    border-bottom: 2px solid rgba(0,0,0,0);\n    box-sizing: border-box;\n}\n.sub_tag_board{\n    height: 85%;\n    width: 60%;\n    display: flex;\n    align-items: flex-end;\n    flex-wrap: wrap;\n}\n.sub_tag_board>div{\n    width: 100%;\n    height: 3%;\n    text-align: right;\n    padding-right: 3px;\n    box-sizing: border-box;\n}\n\'.$class.\'\nfooter{\n    position: absolute;\n    bottom: 0px;\n    width: 100%;\n    text-align: center;\n    font-size: 12px;\n    font-family: sans-serif;\n}\n   </style>\n\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n      <!-- BARCODE -->\n        <!--<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js\"></script>-->\n        \n		\n	\n		\n</head>\n\n<body id=\"Invoices\">\n   <article>\n      <img\n         src=\"data:image/png;base64,[encoded data, 74668 characters]\"\n         data-filename=\"logoASJ_.png\">\n      <!--<img src=\"./logoASJ_.png\">-->\n      <BR>\n      <BR>\n      <address style=\"width: 62%;\">\n         <div style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AGUAS DE SAN JERONIMO E.S.P</div>\n         <div style=\"font-size: 12px;\">NIT: 811018300-6</div>\n         <div style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</div>\n         <BR>\n         <table class=\"info\">\n            <tr>\n                <td>\n                    <p style=\"font-size: 14px;\">\n                        <span style=\"font-weight: bold;\">Contrato N° </span> \' . $factura[\"id_contrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Nombre: </span>\' . $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion_predio\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Estrato: </span>\' . $factura[\"estrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Consumo Periodo: </span>\' . $factura[\"fecha_inicio_facturacion\"] . \' - \' . $factura[\"fecha_fin_facturacion\"] . \' <br>\n                    </p>\n                </td>\n                <!--<td>\n\n                </td>-->\n            </tr>\n         </table>\n\n      </address>\n\n      <table class=\"meta\">\n         <tr>\n            <th style=\"width: 120px !important;\"><span>Factura</span></th>\n            <td><span>\' . $factura[\"id\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha sin recargo</span></th>\n            <td><span>\' . $factura[\"fecha_sin_recargo\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha con recargo</span></th>\n            <td><span>\' . $factura[\"fecha_con_recargo\"] . \'</span></td>\n         </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">INFORMACIÓN ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Medidor </span> \' . $factura[\"numero_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Diametro </span> 1/2\" <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Lectura actual </span> \' . $factura[\"lectura_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Lectura anterior </span> \' . $factura[\"lectura_anterior\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Estado medidor </span> \' . $estadoMedidor. \' <br>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                </p>\n            </td>\n        </tr>\n      </table>\n      <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n          <tr>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px; vertical-align: none !important;\">\n              <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n              \n                <tr>\n                  <th>MES</th>\n                  <th>M3</th>\n                  <th>CARGO FIJO</th>\n                  <th>TOTAL</th>\n                </tr>\n                \' . $tableData . \'\n              </table>\n            </td>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n               <div class=\"board\">\n                <div class=\"titulo_grafica\">\n                    <h3 class=\"t_grafica\">Consumos anteriores en metros cúbicos</h3>\n                </div>\n                <div class=\"sub_board\">\n                    <div class=\"cont_board\">\n                        <div class=\"graf_board\">\n                            \' . $grafBarra . \'\n                        </div>\n                        <div class=\"tag_board\">\n                            <div class=\"sub_tag_board\">\n                                <div>100</div>\n                                <div>90</div>\n                                <div>80</div>\n                                <div>70</div>\n                                <div>60</div>\n                                <div>50</div>\n                                <div>40</div>\n                                <div>30</div>\n                                <div>20</div>\n                                <div>10</div>\n                            </div>\n                        </div>\n                   </div>\n                </div>\n               </div>\n            </td>\n          </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">COSTOS REFERENCIA ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    \n                    <span>Cargo Fijo. = \' . $factura[\"valor_tarifa_aplicada\"] . \'</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    \n                    <span>CMO=Costo por consumo = \' . $factura[\"costo_medio_operacion\"] . \'</span>\n                </p>\n            </td>\n           \n        </tr>\n      </table>\n      <!--<table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Descripción</span></th>\n               <th><span>Cantidad</span></th>\n               <th style=\"background-color: #14406b;\"><span>Precio</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span>Consumo de agua m3</span></td>\n               <td><span>\' . $factura[\"consumo_actual\"] . \'</span></td>\n               <td style=\"text-align: center !important;\"><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"], 0, \',\', \'.\') . \'</span></td>\n            </tr>\n         </tbody>\n      </table> -->\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td><span>SUBTOTAL</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"] + $factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\'], 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>CUENTAS VENCIDAS</span></td>\n            <th><span data-prefix>$</span><span>\' . $saldoPendiente . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SALDO A FAVOR</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($saldoFavor, 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SUBSIDIO</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\']) . \'</span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 16px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span data-prefix>$</span><span>\' . $total . \'</span></th>\n         </tr>\n      </table>\n     <address style=\"width: 62%;\">\n      <table>\n            <tr>\n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                  <p style=\"font-size: 13px; vertical-align: middle; line-height: normal\">\n                     <span style=\"font-weight: bold;\"> Canales y medios disponibles para hacer el pago de tu\n                        factura</span>\n                     <br>\n                     <br>\n                     <span>Transferencia o consignación a la cuenta de:</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">Ahorros Bancolombia N°</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">240-000018-93</span>\n                  </p>\n               </td> \n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                    <img src=\"data:image/png;base64,[encoded data, 21620 characters]\" data-filename=\"Firma Ignacio Digital.png\"\n                    data-filename=\"Firma Ignacio Digital.png\" style=\"width: 220px; height: 70px;\">\n                    <p style=\"font-size: 10.3px; font-weight: bold;\">JORGE IGNACIO AREIZA CASTRILLON <BR> GERENTE</p>\n               </td>\n            </tr>\n         </table> \n\n      <BR>\n       </address> \n   </article>\n   <BR>\n   <p style=\"font-size:10px;\">\' . $rayaDesprendibleBanco . \' DESPRENDIBLE PARA EL BANCO \' . $rayaDesprendibleBanco . \'</p>\n   <table style=\"border-collapse: collapse; border:none; border-width: 0px; style=\"vertical-align: middle !important;\">\n        <tr style=\"float: middle; !important;\">\n            <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width: 30%\">\n                <img \n                	<img src=\"data:image/png;base64,[encoded data, 32188 characters]\"\n	                style=\"width: 208px;\" data-filename=\"Logo2.png\">\n            </td>\n            <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width:70%\">\n                <img id=\"barcodeTarget\"/>\n                \n            </td>\n        </tr>\n    </table>\n</body>\n    <script>\n        //https://parzibyte.me/blog/2019/08/19/codigos-barras-javascript-jsbarcode/\n        try {\n            // The return value is the canvas element\n            const canvas = document.createElement(\"canvas\");\n            //let canvas = bwipjs.toCanvas(\"mycanvas\", {\n            const options = {\n                bcid:        \"code128\",       // Barcode type\n                text:        \"0123456789\",    // Text to encode\n                scale:       3,               // 3x scaling factor\n                height:      10,              // Bar height, in millimeters\n                includetext: true,            // Show human-readable text\n                textxalign:  \"center\",        // Always good to set this\n            };\n            bwipjs(canvas, options, (err, cvs) => {\n                if (err) {\n                    console.log({err});\n                } else {\n                    // Dont need the second param since we have the canvas in scope...    \n                    document.getElementById(\"barcodeTarget\").src = canvas.toDataURL(\"image/png\");\n                }\n            });\n        } catch (e) {\n            console.log({e});\n            // `e` may be a string or Error object\n        }\n         /* JsBarcode(\"#barcodeTarget\", \"\' . $Barcode. \'\", {\n            format: \"CODE128C\",// El formato\n    		width: 2.67, // La anchura de cada barra\n    		height: 65, // La altura del código\n    		displayValue: true, // ¿Mostrar el valor (como texto) del código de barras?\n    		text: \"\' . $BarcodeParent . \'\", // Texto (no código) que acompaña al barcode\n    		fontSize: 14, // Tamaño de la fuente\n    		fontOptions: \"bold\", // Opciones de la fuente del texto del barcode\n    		ean128: true,\n    	}); */\n		</script>\n   <script> \n      document.addEventListener(\"DOMContentLoaded\", function (event) {\n        //setTimeout(function(){ hola(); }, 1000);\n        var descargar = \' . $descargar . \';\n        if(descargar == 1) {\n             var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . str_replace(\' \', \'\', $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"]) . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n    		 setTimeout(function(){ window.close(); }, 1650);\n        }\n        });\n        \n        function hola(){\n            var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . $factura[\"contrato\"] . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n        }\n   </script>\n</html>\';\n\necho $html;\ndie();','A'),(87,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-04-28 22:45:00','rafael',781,152212,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n/*include_once \'../../core/configuracion.php\';\ninclude_once \'../../core/conexiones.php\';\ninclude_once \'../../inc/practico/def_basedatos.php\';\ninclude_once \'../../core/comunes.php\';*/\n\n//echo \"$builder\";\n$saldoFavor = $factura[\"saldo_pendiente\"] < 0 ? -$factura[\"saldo_pendiente\"] : 0;\n$saldoPendienteValor = $factura[\"saldo_pendiente\"] > 0 ? $factura[\"saldo_pendiente\"] : 0;\n$saldoPendiente = number_format($saldoPendienteValor, 0, \',\', \'.\');\n\n$descargar = 0;\nif ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1;\n$fechaSinRecargoBr = str_replace(\"-\", \"\", $factura[\"fecha_sin_recargo\"]);\n$totalValor =  number_format($factura[\"valor_sin_recargo\"] + $saldoPendienteValor - $saldoFavor, 0, \',\', \'.\');\n$total = $totalValor > 0 ? $totalValor : 0;\n$totalBr = str_replace(\".\", \"\", $total);\n$codigobarra=\"7709998678439\";\n$Barcode = $codigobarra.$factura[\"id_contrato\"].\"$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n//$Barcode = \"(415)7709998678439(8020)12345(3900)50000(96)20220524\";\n//$Barcode = \"41577099986784398020123453900500009620220524\";\n//$Barcode = \"12345670\";\n\n$rayaDesprendibleBanco = str_repeat(\"- \", 34);\n\n$estadoMedidor = \"Bueno\";\nif($factura[\"estado_medidor\"] == 2) $estadoMedidor = \"Dañado\";\nif($factura[\"estado_medidor\"] == 3) $estadoMedidor = \"N/A\";\n\nfunction getMesEsp($mes) {\n    $mesesArray = [\"\",\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"];\n    return $mesesArray[$mes];\n}\n$i = 1;\n$grafBarra = \"\";\n$tableData = \"\";\n$class = \"\";\n\n$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha_fin_facturacion) mes, valor_sin_recargo, saldo_pendiente, valor_tarifa_aplicada\n    FROM \n        app_facturas\n    WHERE \n        id_contrato = \". $factura[\"id_contrato\"]. \" ORDER BY id DESC LIMIT 6\n\")->fetchAll();\n\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"], 0, \',\', \'.\');\n    $grafBarra .= \'<div class=\"barra\"><div class=\"sub_barra b\' . $i . \'\"><div class=\"tag_g\">\' . $consumo[\"consumo_actual\"] . \'</div><div class=\"tag_leyenda\">\' . $mes . \'</div></div></div>\';\n    $tableData .= \'<tr><td>\' . $mes . \'</td><td>\' . $consumo[\"consumo_actual\"] . \'</td><td>\' . $consumo[\"valor_tarifa_aplicada\"] . \'</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . (is_numeric($consumo[\"consumo_actual\"]) ? $consumo[\"consumo_actual\"] : 0) . \"%} \";\n    $i++;\n}\n\n$html = \'\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         list-style: none;\n         padding: 0;\n         text-decoration: none;\n      }\n\n    table.info, \n    .info td,\n    .info tr {\n        border-width: 0px !important;\n        border-style: none;\n        text-align:left\n    }\n      /* heading */\n\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n      }\n\n      table {\n         border-collapse: separate;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.56em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n\n      html {\n         font: 16px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.4in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.4em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n      table.inventory {\n         margin: 0 0 0.3em;\n      }\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 30%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 38%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      table.inventory td:nth-child(1) {\n         width: 26%;\n      }\n\n      table.inventory td:nth-child(2) {\n         width: 38%;\n      }\n\n      table.inventory td:nth-child(3) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(4) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(5) {\n         text-align: center;\n         width: 12%;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 40%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n      }\n      \n.board{\n    width: 100%;\n    height: 160px;\n    box-sizing: border-box;\n    overflow: hidden;\n}\n.titulo_grafica{\n    width: 100%;\n    height: 10%;\n}\n.titulo_grafica>h3{\n    padding: 0;\n    margin: 0px;\n    text-align: center;\n    color: #666666;\n}\n.sub_board{\n    width: 100%;\n    height: 100%;\n    margin-top: 0px;\n    overflow: hidden;\n    box-sizing: border-box;\n}\n.sep_board{\n    width: 100%;\n    height: 10%;\n}\n.cont_board{\n    width: 100%;\n    height: 80%;\n}\n.graf_board{\n    width: 90%;\n    height: 100%;\n    float: right;\n    margin-top: 0px;\n    background-color: darkgrey;\n    border-left: 2px solid #999999;\n    border-bottom: 2px solid #999999;\n    box-sizing: border-box;\n    display: flex;\n    background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, \n \n    rgba(0,0,0,0) 100%);\n    background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, \n    rgba(0,0,0,0) 100%);\n\n    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,\n    rgba(0,0,0,0) 100%);\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\"#00ffffff\", endColorstr=\"#00ffffff\",GradientType=0 );\n}\n.barra{\n    width:100%;\n    height: 100%;\n    margin-right: 9px;\n    margin-left: 9px;\n    background-color: none;\n    display: flex;\n    flex-wrap: wrap;\n    align-items: flex-end;\n}\n.sub_barra{\n    width: 100%;\n    height: 80%;\n    background: #00799b;\n    background: -moz-linear-gradient(top, #00799b 0%, #64d1be 100%);\n    \n    -webkit-border-radius: 12px 12px 0 0;\n    border-radius: 12px 12px 0 0;\n}\n.tag_g{\n    position: relative;\n    width: 100%;\n    height: 100%;\n    margin-bottom: 23px;\n    text-align: center;\n    margin-top: -20px;\n    z-index: 2;\n}\n.tag_leyenda{\n    text-align: center;\n    margin-top: 0px;\n}\n.tag_board{\n    height: 100%;\n    width: 15%;\n    border-bottom: 2px solid rgba(0,0,0,0);\n    box-sizing: border-box;\n}\n.sub_tag_board{\n    height: 85%;\n    width: 60%;\n    display: flex;\n    align-items: flex-end;\n    flex-wrap: wrap;\n}\n.sub_tag_board>div{\n    width: 100%;\n    height: 3%;\n    text-align: right;\n    padding-right: 3px;\n    box-sizing: border-box;\n}\n\'.$class.\'\nfooter{\n    position: absolute;\n    bottom: 0px;\n    width: 100%;\n    text-align: center;\n    font-size: 12px;\n    font-family: sans-serif;\n}\n   </style>\n\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n      <!-- BARCODE -->\n        <!--<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js\"></script>-->\n        \n		\n	\n		\n</head>\n\n<body id=\"Invoices\">\n   <article>\n      <img\n         src=\"data:image/png;base64,[encoded data, 74668 characters]\"\n         data-filename=\"logoASJ_.png\">\n      <!--<img src=\"./logoASJ_.png\">-->\n      <BR>\n      <BR>\n      <address style=\"width: 62%;\">\n         <div style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AGUAS DE SAN JERONIMO E.S.P</div>\n         <div style=\"font-size: 12px;\">NIT: 811018300-6</div>\n         <div style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</div>\n         <BR>\n         <table class=\"info\">\n            <tr>\n                <td>\n                    <p style=\"font-size: 14px;\">\n                        <span style=\"font-weight: bold;\">Contrato N° </span> \' . $factura[\"id_contrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Nombre: </span>\' . $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion_predio\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Estrato: </span>\' . $factura[\"estrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Consumo Periodo: </span>\' . $factura[\"fecha_inicio_facturacion\"] . \' - \' . $factura[\"fecha_fin_facturacion\"] . \' <br>\n                    </p>\n                </td>\n                <!--<td>\n\n                </td>-->\n            </tr>\n         </table>\n\n      </address>\n\n      <table class=\"meta\">\n         <tr>\n            <th style=\"width: 120px !important;\"><span>Factura</span></th>\n            <td><span>\' . $factura[\"id\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha sin recargo</span></th>\n            <td><span>\' . $factura[\"fecha_sin_recargo\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha con recargo</span></th>\n            <td><span>\' . $factura[\"fecha_con_recargo\"] . \'</span></td>\n         </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">INFORMACIÓN ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Medidor </span> \' . $factura[\"numero_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Diametro </span> 1/2\" <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Lectura actual </span> \' . $factura[\"lectura_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Lectura anterior </span> \' . $factura[\"lectura_anterior\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Estado medidor </span> \' . $estadoMedidor. \' <br>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                </p>\n            </td>\n        </tr>\n      </table>\n      <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n          <tr>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px; vertical-align: none !important;\">\n              <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n              \n                <tr>\n                  <th>MES</th>\n                  <th>M3</th>\n                  <th>CARGO FIJO</th>\n                  <th>TOTAL</th>\n                </tr>\n                \' . $tableData . \'\n              </table>\n            </td>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n               <div class=\"board\">\n                <div class=\"titulo_grafica\">\n                    <h3 class=\"t_grafica\">Consumos anteriores en metros cúbicos</h3>\n                </div>\n                <div class=\"sub_board\">\n                    <div class=\"cont_board\">\n                        <div class=\"graf_board\">\n                            \' . $grafBarra . \'\n                        </div>\n                        <div class=\"tag_board\">\n                            <div class=\"sub_tag_board\">\n                                <div>100</div>\n                                <div>90</div>\n                                <div>80</div>\n                                <div>70</div>\n                                <div>60</div>\n                                <div>50</div>\n                                <div>40</div>\n                                <div>30</div>\n                                <div>20</div>\n                                <div>10</div>\n                            </div>\n                        </div>\n                   </div>\n                </div>\n               </div>\n            </td>\n          </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">COSTOS REFERENCIA ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    \n                    <span>Cargo Fijo. = \' . $factura[\"valor_tarifa_aplicada\"] . \'</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    \n                    <span>CMO=Costo por consumo = \' . $factura[\"costo_medio_operacion\"] . \'</span>\n                </p>\n            </td>\n           \n        </tr>\n      </table>\n      <!--<table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Descripción</span></th>\n               <th><span>Cantidad</span></th>\n               <th style=\"background-color: #14406b;\"><span>Precio</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span>Consumo de agua m3</span></td>\n               <td><span>\' . $factura[\"consumo_actual\"] . \'</span></td>\n               <td style=\"text-align: center !important;\"><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"], 0, \',\', \'.\') . \'</span></td>\n            </tr>\n         </tbody>\n      </table> -->\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td><span>SUBTOTAL</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"] + $factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\'], 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>CUENTAS VENCIDAS</span></td>\n            <th><span data-prefix>$</span><span>\' . $saldoPendiente . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SALDO A FAVOR</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($saldoFavor, 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SUBSIDIO</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\']) . \'</span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 16px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span data-prefix>$</span><span>\' . $total . \'</span></th>\n         </tr>\n      </table>\n     <address style=\"width: 62%;\">\n      <table>\n            <tr>\n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                  <p style=\"font-size: 13px; vertical-align: middle; line-height: normal\">\n                     <span style=\"font-weight: bold;\"> Canales y medios disponibles para hacer el pago de tu\n                        factura</span>\n                     <br>\n                     <br>\n                     <span>Transferencia o consignación a la cuenta de:</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">Ahorros Bancolombia N°</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">240-000018-93</span>\n                  </p>\n               </td> \n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                    <img src=\"data:image/png;base64,[encoded data, 21620 characters]\" data-filename=\"Firma Ignacio Digital.png\"\n                    data-filename=\"Firma Ignacio Digital.png\" style=\"width: 220px; height: 70px;\">\n                    <p style=\"font-size: 10.3px; font-weight: bold;\">JORGE IGNACIO AREIZA CASTRILLON <BR> GERENTE</p>\n               </td>\n            </tr>\n         </table> \n\n      <BR>\n       </address> \n   </article>\n   <BR>\n   <p style=\"font-size:10px;\">\' . $rayaDesprendibleBanco . \' DESPRENDIBLE PARA EL BANCO \' . $rayaDesprendibleBanco . \'</p>\n   <table style=\"border-collapse: collapse; border:none; border-width: 0px; style=\"vertical-align: middle !important;\">\n        <tr style=\"float: middle; !important;\">\n            <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width: 30%\">\n                <img \n                	<img src=\"data:image/png;base64,[encoded data, 32188 characters]\"\n	                style=\"width: 208px;\" data-filename=\"Logo2.png\">\n            </td>\n            <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width:70%\">\n                <img id=\"barcodeTarget\"/>\n                \n            </td>\n        </tr>\n    </table>\n</body>\n    <script>\n        //https://parzibyte.me/blog/2019/08/19/codigos-barras-javascript-jsbarcode/\n        try {\n            // The return value is the canvas element\n            const canvas = document.createElement(\"canvas\");\n            //let canvas = bwipjs.toCanvas(\"mycanvas\", {\n            const options = {\n                bcid:        \"code128\",       // Barcode type\n                text:        \"0123456789\",    // Text to encode\n                scale:       3,               // 3x scaling factor\n                height:      10,              // Bar height, in millimeters\n                includetext: true,            // Show human-readable text\n                textxalign:  \"center\",        // Always good to set this\n            };\n            bwipjs(canvas, options, (err, cvs) => {\n                if (err) {\n                    console.log({err});\n                } else {\n                    // Dont need the second param since we have the canvas in scope...    \n                    document.getElementById(\"barcodeTarget\").src = canvas.toDataURL(\"image/png\");\n                }\n            });\n        } catch (e) {\n            console.log({e});\n            // `e` may be a string or Error object\n        }\n         /* JsBarcode(\"#barcodeTarget\", \"\' . $Barcode. \'\", {\n            format: \"CODE128C\",// El formato\n    		width: 2.67, // La anchura de cada barra\n    		height: 65, // La altura del código\n    		displayValue: true, // ¿Mostrar el valor (como texto) del código de barras?\n    		text: \"\' . $BarcodeParent . \'\", // Texto (no código) que acompaña al barcode\n    		fontSize: 14, // Tamaño de la fuente\n    		fontOptions: \"bold\", // Opciones de la fuente del texto del barcode\n    		ean128: true,\n    	}); */\n		</script>\n   <script> \n      document.addEventListener(\"DOMContentLoaded\", function (event) {\n        //setTimeout(function(){ hola(); }, 1000);\n        var descargar = \' . $descargar . \';\n        if(descargar == 1) {\n             var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . str_replace(\' \', \'\', $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"]) . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n    		 setTimeout(function(){ window.close(); }, 1650);\n        }\n        });\n        \n        function hola(){\n            var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . $factura[\"contrato\"] . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n        }\n   </script>\n</html>\';\n\necho $html;\ndie();','A'),(88,'core/marco_abajo.php','2023-04-28 22:46:00','rafael',941,52370,'<?php\n/*\n	 _\n	|_) _ _  _ _|_. _ _					  	Copyright (C) 2012-2022\n	|  | (_|(_  | |(_(_) 				  	John F. Arroyave Gutiérrez\n	  www.practico.org					  	unix4you2@gmail.com\n                                            All rights reserved.\n    \n	 This program is free software: you can redistribute it and/or modify\n	 it under the terms of the GNU General Public License as published by\n	 the Free Software Foundation, either version 3 of the License, or\n	 (at your option) any later version.\n\n	 This program is distributed in the hope that it will be useful,\n	 but WITHOUT ANY WARRANTY; without even the implied warranty of\n	 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n	 GNU General Public License for more details.\n\n	 You should have received a copy of the GNU General Public License\n	 along with this program.  If not, see <http://www.gnu.org/licenses/>\n	 \n	            --- TRADUCCION NO OFICIAL DE LA LICENCIA ---\n\n     Esta es una traducción no oficial de la Licencia Pública General de\n     GNU al español. No ha sido publicada por la Free Software Foundation\n     y no establece los términos jurídicos de distribución del software \n     publicado bajo la GPL 3 de GNU, solo la GPL de GNU original en inglés\n     lo hace. De todos modos, esperamos que esta traducción ayude a los\n     hispanohablantes a comprender mejor la GPL de GNU:\n	 \n     Este programa es software libre: puede redistribuirlo y/o modificarlo\n     bajo los términos de la Licencia General Pública de GNU publicada por\n     la Free Software Foundation, ya sea la versión 3 de la Licencia, o \n     (a su elección) cualquier versión posterior.\n\n     Este programa se distribuye con la esperanza de que sea útil pero SIN\n     NINGUNA GARANTÍA; incluso sin la garantía implícita de MERCANTIBILIDAD\n     o CALIFICADA PARA UN PROPÓSITO EN PARTICULAR. Vea la Licencia General\n     Pública de GNU para más detalles.\n\n     Usted ha debido de recibir una copia de la Licencia General Pública de\n     GNU junto con este programa. Si no, vea <http://www.gnu.org/licenses/>\n*/\n\n	/*\n		Title: Seccion inferior\n		Ubicacion *[/core/marco_abajo.php]*.  Archivo dedicado a la diagramacion de contenidos en el pie de pagina de la aplicacion, incluye valores de accion y tiempos para el usuario administrador.\n\n	Variables de entrada:\n\n		PCOSESS_LoginUsuario - Nombre de usuario que se encuentra logueado en el sistema\n		accion - Accion llamada actualmente en Practico (identificador unico de funcion interna o personalizada)\n		tiempo_inicio_script - Hora en microtime marcada para el incio del script\n\n		(start code)\n			if(PCO_EsAdministrador(@$PCOSESS_LoginUsuario) && $PCO_Accion!=\"\")\n				{\n					$tiempo_final_script = PCO_ObtenerMicrotime();\n					$tiempo_total_script = $tiempo_final_script - $tiempo_inicio_script;\n				}\n		(end)\n\n	Salida:\n		Pie de pagina de aplicacion e informacion asociada a la accion y tiempos de ejecucion en caso de ser el usuario administrador\n\n	Ver tambien:\n		<Seccion superior> | <Articulador>\n	*/\n?>\n \n\n\n\n						<div id=\"PCODIV_AbajoEscritorio\"></div>\n\n                    </div>\n                    <!-- /.col-lg-12 -->\n                </div>\n                <!-- /.row -->\n            </div>\n            <!-- /.container-fluid -->\n        </div>\n        <!-- /#page-wrapper -->\n\n\n\n		<!-- Modal para mensajes generales -->\n		<div id=\"PCO_Modal_Mensaje\" class=\"modal fade oculto_impresion\">\n			<div class=\"modal-dialog\">\n				<div class=\"modal-content\">\n					<div class=\"modal-header\">\n						<button type=\"button\" class=\"close\" data-dismiss=\"modal\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Cerrar</span></button>\n						<h4 id=\"PCO_Modal_MensajeTitulo\" class=\"modal-title\"></h4>\n					</div>\n					<div class=\"modal-body\">\n						<p id=\"PCO_Modal_MensajeCuerpo\"></p>\n					</div>\n					<div class=\"modal-footer\">\n						<div id=\"PCO_Modal_MensajeBotones\"><button type=\"button\" class=\"btn btn-outline btn-info\" data-dismiss=\"modal\">Cerrar</button></div>\n					</div>\n				</div><!-- /.modal-content -->\n			</div><!-- /.modal-dialog -->\n		</div><!-- /.modal -->\n\n\n		<!-- Modal para mensajes de carga -->\n		<div id=\"PCO_Modal_MensajeCargando\" class=\"modal fade oculto_impresion\"  data-backdrop=\"static\" data-keyboard=\"false\">\n			<div class=\"modal-dialog\">\n				<div class=\"modal-content\">\n					<div class=\"modal-header\">\n						<button id=\"PCO_Modal_MensajeCargandoBotonCerrar\" type=\"button\" class=\"close\" data-dismiss=\"modal\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Cerrar</span></button>\n						<h4 id=\"PCO_Modal_MensajeCargandoTitulo\" class=\"modal-title\"></h4>\n					</div>\n					<div class=\"modal-body\">\n						<div class=\"progress\" id=\"PCO_Modal_MensajeCargandoBarra\">\n							<div id=\"PCO_Modal_MensajeCargandoPorcentaje\" class=\"progress-bar progress-bar-striped active\" role=\"progressbar\" aria-valuenow=\"45\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 45%\"></div>\n						</div>\n						<p id=\"PCO_Modal_MensajeCargandoCuerpo\"></p>\n						<div align=\"right\"><i class=\"fa fa-circle-o-notch fa-fw fa-spin fa-1x\"></i></div>\n						\n						<a href=\"javascript:PCOJS_OcultarMensajeCargando();\"><?php echo $MULTILANG_Cerrar; ?></a>\n					</div>\n				</div><!-- /.modal-content -->\n			</div><!-- /.modal-dialog -->\n		</div><!-- /.modal -->\n\n		<!-- Modal para mensajes de carga -->\n		<div id=\"PCO_Modal_MensajeCargandoSimple\" class=\"modal oculto_impresion\" data-backdrop=\"false\">\n			<div class=\"modal-dialog modal-sm\">\n				<div class=\"modal-content\">\n					<div class=\"modal-body\" align=\"center\">\n						<div class=\"progress\" id=\"PCO_Modal_MensajeCargandoBarra\">\n							<div id=\"PCO_Modal_MensajeCargandoPorcentaje\" class=\"progress-bar progress-bar-striped active\" role=\"progressbar\" aria-valuenow=\"100\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 100%\"></div>\n						</div>\n						<i class=\"fa fa-circle-o-notch fa-fw fa-spin fa-1x\"></i> <?php echo $MULTILANG_Cargando; ?>...\n						\n					</div>\n				</div><!-- /.modal-content -->\n			</div><!-- /.modal-dialog -->\n		</div><!-- /.modal -->\n\n\n    </div>\n    <!-- /#wrapper inicial -->\n\n<!--</div>--> <!-- FINALIZA MARCO DE CHAT -->\n\n\n\n    <!-- Plugins JavaScript requeridos por DateTimePicker -->\n    <script src=\"inc/bootstrap/js/plugins/moment/moment-with-locales.min.js\"></script>\n\n    <!-- Plugins JavaScript adicionales -->\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/transition.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/collapse.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/slider/bootstrap-slider.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/metisMenu/metisMenu.min.js\"></script>\n    <!-- Bootstrap-Iconpicker Fuentes de iconos -->\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-fontawesome-4.2.0.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-glyphicon.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-ionicon-1.5.2.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-octicon-2.1.2.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-typicon-2.0.6.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-weathericon-1.2.0.min.js\"></script>\n    <!--<script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-elusiveicon-2.0.0.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-mapicon-2.1.0.min.js\"></script>-->\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/bootstrap-iconpicker.min.js\"></script>\n\n    <!-- Plugins JavaScript requeridos por DateTimePicker -->\n    <script src=\"inc/bootstrap/js/plugins/datepicker/bootstrap-datetimepicker.min.js\"></script>\n\n    <!-- Morris Charts JavaScript -->\n    <?php\n        //Carga solo Morris cuando es pagina principal por ahora para evitar conflictos con DatePicker\n        if (PCO_EsAdministrador(@$PCOSESS_LoginUsuario) && @$PCOSESS_SesionAbierta && @$PCO_Accion==\"PCO_VerMenu\")\n        // Incluye archivo con las consultas y datos para ser diagramados por Morris\n            include_once(\"core/marco_admin_morris.php\");\n    ?>\n    \n    <!-- Gantt -->\n    <script src=\"inc/jquery/plugins/gantt-master/js/jquery.fn.gantt.js\"></script>\n\n    <!-- DataTables JavaScript -->\n    <script src=\"inc/bootstrap/js/plugins/dataTables/jquery.dataTables.min.js\"></script>\n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.buttons.min.js\"></script><!--N-->\n    <script src=\"inc/bootstrap/js/plugins/dataTables/buttons.html5.min.js\"></script><!--N-->\n    <script src=\"inc/bootstrap/js/plugins/dataTables/buttons.colVis.min.js\"></script><!--N-->\n\n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.bootstrap.min.js\"></script>\n    \n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.select.min.js\"></script>\n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.searchPanes.min.js\"></script>\n\n    <!-- DataTables Responsive -->\n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.responsive.min.js\"></script><!--N-->\n\n	<!-- Canvas -->\n    <script type=\"text/javascript\" src=\"inc/jquery/plugins/sketch.js\"></script>\n    \n    <!-- SummerNote -->\n    <script src=\"inc/summernote/summernote.min.js\"></script>\n    <script src=\"inc/summernote/lang/summernote-<?php echo $IdiomaPredeterminado; ?>-<?php echo strtoupper($IdiomaPredeterminado); ?>.min.js\"></script>\n<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>\n    <!-- JavaScript Personalizado del tema -->\n    <script src=\"inc/bootstrap/js/sb-admin-2.js\"></script>\n    <script src=\"inc/bootstrap/js/practico.min.js?<?php echo filemtime(\'inc/bootstrap/js/practico.min.js\'); ?>\"></script>\n    \n    <?php\n    	//Carga marco de chat solamente si esta habilitado\n    	if (isset($Activar_ModuloChat) && $Activar_ModuloChat>0 && @$_SESSION[\'username\']!=\"\")\n        	{\n	?>\n                <!-- Chat -->\n                <script type=\"text/javascript\" src=\"inc/chat/js/chat.js\"></script>\n    <?php\n    	    }\n    ?>\n\n\n    <?php\n        //Si el usuario es admin por defecto presenta la barra lateral activa\n        // DEPRECATED: (PCO_EsAdministrador(@$PCOSESS_LoginUsuario) && @$PCOSESS_SesionAbierta && @$PCO_Accion==\"PCO_VerMenu\") || \n        if ((@$PCOSESS_LoginUsuario!=\"\" && @$PCOSESS_SesionAbierta && @$VerNavegacionIzquierdaResponsive==1))\n            echo \'<script language=\"JavaScript\">\n                    ver_navegacion_izquierda_responsive();\n                </script>\';\n    ?>\n\n    <?php\n        // Habilita el popup activo\n        if (@$popup_activo==\"FormularioCampos\")	\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalElementoFormulario\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"FormularioBotones\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalBotonFormulario\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"FormularioDiseno\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalDisenoFormulario\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"FormularioAcciones\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalDisenoBotones\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"InformeAcciones\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalEditaAccionesInforme\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"InformeCampos\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalCamposInforme\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"InformeTablas\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalTablaInforme\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"InformeCondiciones\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalCondicionesInforme\").modal(\"show\"); }); </script>\';\n        //Habilita pesatanas activas en el popup activo\n        if (@$pestana_activa_editor==\"eventos_objeto-tab\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\\\'.nav-tabs a[href=\"#eventos_objeto-tab\"]\\\').tab(\\\'show\\\'); }); </script>\';\n    ?>\n\n    <script language=\"JavaScript\">\n        //Actualiza tamano del marco principal para garantizar siempre un tamano adecuado de fondo\n        //TODO: Verificar consistencia en paginas grades como la administrativa\n        $( function() {\n            var PCOJSVAR_HayScroll=false;\n            //Verifica si hay scroll  METODO 1\n            if (document.getElementById(\"page-wrapper\").scrollHeight==$(document).height())\n                PCOJSVAR_HayScroll=true;\n            //Si hay scroll el alto debe tener !important para que se estire hasta abajo en la página.  Si no hay scroll solo 100%\n            if( PCOJSVAR_HayScroll )\n                {\n                    //$(\"#page-wrapper\").css({ \'height\': \"100% !important\" }); //SI Hay scroll  \n                    //console.log(\"Scroll detectado\");\n                }\n            else\n                {\n                    $(\"#page-wrapper\").css({ \'height\': \"100%\" }); // NO Hay scroll  \n                    //console.log(\"Scroll NO detectado\");\n                }\n        });\n    </script>\n\n    <script language=\"JavaScript\">\n        //Carga los tooltips programados en la hoja.  Por defecto todos los elementos con data-toggle=tootip\n        $(function () {\n          $(\'[data-toggle=\"tooltip\"]\').tooltip({\'container\':\'body\'});\n        })\n    </script>\n\n    <script language=\"JavaScript\">\n        //Carga los popovers programados en la hoja.  Por defecto todos los elementos con data-toggle=popover\n        $(function () {\n          $(\'[data-toggle=\"popover\"]\').popover()\n        })\n    </script>\n\n    <script language=\"JavaScript\">\n        //Carga las tablas en formato DataTable\n        $( function() {\n            <?php\n                //Desglosa la cadena de posibles tablas con formato DataTable y las convierte\n                $TablasDataTable=@explode(\"|\",$PCO_InformesDataTable);\n                $TablasDataTablePaginaciones=@explode(\"|\",$PCO_InformesDataTablePaginaciones);\n                $TablasDataTableTotales=@explode(\"|\",$PCO_InformesDataTableTotales);\n                $TablasDataTableFormatosTotales=@explode(\"|\",$PCO_InformesDataTableFormatoTotales);\n                $TablasDataTableExportaCLP=@explode(\"|\",$PCO_InformesDataTableExrpotaCLP);\n                $TablasDataTableExportaCSV=@explode(\"|\",$PCO_InformesDataTableExrpotaCSV);\n                $TablasDataTableExportaXLS=@explode(\"|\",$PCO_InformesDataTableExrpotaXLS);\n                $TablasDataTableExportaPDF=@explode(\"|\",$PCO_InformesDataTableExrpotaPDF);\n                $TablasDataTableDefineCOLS=@explode(\"|\",$PCO_InformesDataTableDefineCOLS);\n                $TablasDataTableIdCache=@explode(\"|\",$PCO_InformesIdCache);\n                $TablasDataTableRecuperacionAJAX=@explode(\"|\",$PCO_InformesRecuperacionAJAX);\n                $TablasDataTableColumnas=@explode(\"|\",$PCO_InformesListaColumnasDT);\n                $TablasDataTable_pane_activado=@explode(\"|\",$PCO_InformesDataTable_pane_activado);\n                $TablasDataTable_pane_cascada=@explode(\"|\",$PCO_InformesDataTable_pane_cascada);\n                $TablasDataTable_pane_colapsado=@explode(\"|\",$PCO_InformesDataTable_pane_colapsado);\n                $TablasDataTable_pane_columnas=@explode(\"|\",$PCO_InformesDataTable_pane_columnas);\n                $TablasDataTable_pane_subtotalesrelativos=@explode(\"|\",$PCO_InformesDataTable_pane_subtotalesrelativos);\n                $TablasDataTable_pane_conteos=@explode(\"|\",$PCO_InformesDataTable_pane_conteos);\n                $TablasDataTable_pane_controles=@explode(\"|\",$PCO_InformesDataTable_pane_controles);\n                $TablasDataTable_pane_control_colapsar=@explode(\"|\",$PCO_InformesDataTable_pane_control_colapsar);\n                $TablasDataTable_pane_control_ordenar=@explode(\"|\",$PCO_InformesDataTable_pane_control_ordenar);\n                \n                if (1==1)  //Solo para efectos de depuracion, cambiar a condicion invalida en produccion\n                echo \"\n                    /*\n                        Activacion de elementos tipo DATATABLE (depuracion):\n                        PCO_InformesDataTable=$PCO_InformesDataTable\n                        PCO_InformesDataTablePaginaciones=$PCO_InformesDataTablePaginaciones\n                        PCO_InformesDataTableTotales=$PCO_InformesDataTableTotales\n                        PCO_InformesDataTableFormatoTotales=$PCO_InformesDataTableFormatoTotales\n                        PCO_InformesDataTableExrpotaCLP=$PCO_InformesDataTableExrpotaCLP\n                        PCO_InformesDataTableExrpotaCSV=$PCO_InformesDataTableExrpotaCSV\n                        PCO_InformesDataTableExrpotaXLS=$PCO_InformesDataTableExrpotaXLS\n                        PCO_InformesDataTableExrpotaPDF=$PCO_InformesDataTableExrpotaPDF\n                        PCO_InformesTablasDataTableDefineCOLS=$PCO_InformesDataTableDefineCOLS\n                        PCO_InformesIdCache=$PCO_InformesIdCache\n                        PCO_InformesRecuperacionAJAX=$PCO_InformesRecuperacionAJAX\n                        PCO_InformesListaColumnasDT=$PCO_InformesListaColumnasDT\n                    */\";\n                \n                for ($i=0; $i<count($TablasDataTable);$i++)\n                    {\n                        //Agrega codigo para activacion de DataTable solamente cuando se tenga un ID de tabla valido\n                        if ($TablasDataTable[$i]!=\"\")\n                            {\n                                $Paginacion=trim($TablasDataTablePaginaciones[$i]);\n                                $ColumnaTotales=trim($TablasDataTableTotales[$i])-1;\n                                $ColumnaTotalesVisual=trim($TablasDataTableTotales[$i]);\n                                $CadenaFormateadaTotales=trim($TablasDataTableFormatosTotales[$i]);\n                                $CadenaExportaCLP=trim($TablasDataTableExportaCLP[$i]); if ($CadenaExportaCLP==\"S\") $CadenaExportaCLP=\'{ extend: \"copy\",    className: \"InformeBotonCopiar\" },\'; else $CadenaExportaCLP=\'\';\n                                $CadenaExportaCSV=trim($TablasDataTableExportaCSV[$i]); if ($CadenaExportaCSV==\"S\") $CadenaExportaCSV=\'{ extend: \"csv\",     className: \"InformeBotonCsv\" },   \'; else $CadenaExportaCSV=\'\';\n                                $CadenaExportaXLS=trim($TablasDataTableExportaXLS[$i]); if ($CadenaExportaXLS==\"S\") $CadenaExportaXLS=\'{ extend: \"excel\",   className: \"InformeBotonExcel\" ,  title: \"\" }, \'; else $CadenaExportaXLS=\'\';\n                                $CadenaExportaPDF=trim($TablasDataTableExportaPDF[$i]); if ($CadenaExportaPDF==\"S\") $CadenaExportaPDF=\'{ extend: \"pdf\",     className: \"InformeBotonPdf\" },   \'; else $CadenaExportaPDF=\'\';\n                                $CadenaPersonalizarColumnas=trim($TablasDataTableDefineCOLS[$i]); if ($CadenaPersonalizarColumnas==\"S\") $CadenaPersonalizarColumnas=\'{ extend: \"colvis\",  text:\"\'.$MULTILANG_Columna.\'(s)\",  className: \"InformeBotonCopiar\" }, \'; else $CadenaPersonalizarColumnas=\'\';\n\n                                //DEFINE CADENAS EN PANELES DE FILTRADO\n                                $CadenaPosicionPanelesArriba=\"\";\n                                $CadenaPosicionPanelesAbajo=\"\";\n                                $Cadena_pane_cascada=\"\";\n                                $Cadena_pane_colapsado=\"\";\n                                $Cadena_pane_columnas=\"\";\n                                $Cadena_pane_subtotalesrelativos=\"\";\n                                $Cadena_pane_conteos=\"\";\n                                $Cadena_pane_controles=\"\";\n                                $Cadena_pane_control_colapsar=\"\";\n                                $Cadena_pane_control_ordenar=\"\";\n                                if ($TablasDataTable_pane_activado[$i]==\"S\") $CadenaPosicionPanelesArriba=\"P\";\n                                if ($TablasDataTable_pane_activado[$i]==\"I\") $CadenaPosicionPanelesAbajo=\"P\";\n                                if ($TablasDataTable_pane_cascada[$i]==\"S\") $Cadena_pane_cascada=\" cascadePanes: true, \";\n                                if ($TablasDataTable_pane_colapsado[$i]==\"S\") $Cadena_pane_colapsado=\" initCollapsed: true, \";\n                                if ($TablasDataTable_pane_columnas[$i]!=\"\") $Cadena_pane_columnas=\' layout: \"columns-\'.$TablasDataTable_pane_columnas[$i].\'\", \';\n                                if ($TablasDataTable_pane_subtotalesrelativos[$i]==\"S\") $Cadena_pane_subtotalesrelativos=\" viewTotal: false, \";\n                                if ($TablasDataTable_pane_conteos[$i]!=\"S\") $Cadena_pane_conteos=\" viewCount: false, \";\n                                if ($TablasDataTable_pane_controles[$i]!=\"S\") $Cadena_pane_controles=\" controls: false, \";\n                                if ($TablasDataTable_pane_control_colapsar[$i]!=\"S\") $Cadena_pane_control_colapsar=\" collapse: false, \";\n                                if ($TablasDataTable_pane_control_ordenar[$i]!=\"S\") $Cadena_pane_control_ordenar=\" orderable: false, \";\n                                $CadenaPanelesFiltrado=\'\n                                            searchPanes:\n                                                {\n                                                    \'.$Cadena_pane_cascada.\'\n                                                    \'.$Cadena_pane_colapsado.\'\n                                                    \'.$Cadena_pane_columnas.\'\n                                                    \'.$Cadena_pane_subtotalesrelativos.\'\n                                                    \'.$Cadena_pane_conteos.\'\n                                                    \'.$Cadena_pane_controles.\'\n                                                    \'.$Cadena_pane_control_colapsar.\'\n                                                    \'.$Cadena_pane_control_ordenar.\'\n                                                },\n                                        \';\n\n/*\nINICIALIZACION CON AJAX\n$(document).ready( function() {\n  var table = $(\'#example\').DataTable({\n    ajax: \'../resources/options.json\',\n    dom: \'Plfrtip\',\n    columns: [\n        { data: \"users.first_name\" },\n        { data: \"users.last_name\" },\n        { data: \"users.phone\" },\n        { data: \"sites.name\" }\n    ],\n    columnDefs: [{\n        searchPanes: {\n            show: true,\n        },\n        targets: [0, 1, 2, 3]\n    }],\n  });\n} );\n*/\n\n                                //Realiza operaciones de reemplazo de patrones sobre la cadena de formato de Totales si aplica\n                                $CadenaFormateadaTotales=str_replace(\"_TOTAL_PAGINA_\",\"\'+pageTotal +\'\",$CadenaFormateadaTotales);\n                                $CadenaFormateadaTotales=str_replace(\"_TOTAL_INFORME_\",\"\'+total +\'\",$CadenaFormateadaTotales);\n                                $CadenaFormateadaTotales=str_replace(\"_COLUMNA_\",\"$ColumnaTotalesVisual\",$CadenaFormateadaTotales);\n        \n                                if ($Paginacion==\"\" || $Paginacion==0) $Paginacion=10;  //Si no hay paginacion personalizada pone 10 por defecto\n\n                                echo \'\n                                    var oTable\'.$i.\' = $(\"#\'.$TablasDataTable[$i].\'\").dataTable(\n                                        {\n                                            destroy: true,   //Habilita autodestruccion de objeto si se necesita reinicializar\n                                            dom: \"\'.$CadenaPosicionPanelesArriba.\'Blfrtip\'.$CadenaPosicionPanelesAbajo.\'\",  //Ej:  Blfrtip  Da formato a la tabla: Ver https://datatables.net/reference/option/dom\n                                            buttons: [\n                                                \'.$CadenaPersonalizarColumnas.\'\n                                                \'.$CadenaExportaCLP.\'\n                                                \'.$CadenaExportaCSV.\'\n                                                \'.$CadenaExportaXLS.\'\n                                                \'.$CadenaExportaPDF.\'\n                                                //{ extend: \"print\", className: \"InformeBotonPrint\" }\n                                            ],\n                                            \'.$CadenaPanelesFiltrado.\'\n                                            \"pageLength\": \'.$Paginacion.\',\n                                            //\"responsive\": true, //Opcional, no necesario activarlo si la tabla ya tiene la clase nowrap y responsive (y ya esto se hace en la generacion del informe)\n                                            \"scrollX\": true,\n                                            \"bAutoWidth\": true,\n                                            //\"bSort\": false,\n                                            //\"autoWidth\": true,\n                                            //aoColumns: [ { sWidth: \"45%\" }, { sWidth: \"45%\" }, { sWidth: \"10%\", bSearchable: false, bSortable: false } ],\n                                            //\"aaSorting\": [],  //Un alias a versiones viejas de order:\n                                            \"order\": [],\n                                            \"fnInitComplete\": function() {\n                                            this.fnAdjustColumnSizing(true);\n                                            },\';\n\n                                //Agrega configuraciones especificas para tablas con recuperacion por AJAX\n                                if($TablasDataTableRecuperacionAJAX[$i]==\"1\")\n                                    {\n                                        //Genera la definicion requerida por DT con la lista de columnas \n                                        $ListaCamposDT=explode(\",\",$TablasDataTableColumnas[$i]); //Genera arreglo para los campos\n                                        //FORMA OPCIONAL: Recuperar la lista de columnas directo desde la cache (menos rapido): $ListaCamposDT=explode(\",\",PCO_EjecutarSQL(\"SELECT columnas FROM {$TablasCore}informe_cache WHERE id=\'\".$TablasDataTableIdCache[$i].\"\' \")->fetchColumn());\n                                        $CadenaCamposDT=\"\";\n                                        foreach ($ListaCamposDT as $CampoDT)\n                                            $CadenaCamposDT.=\"{ data: \'{$CampoDT}\' } ,\";\n                                        echo \"\n                                            \'processing\': true,\n                                            \'serverSide\': true,\n                                            \'serverMethod\': \'post\',\n                                            \n                                            \'ajax\': {\n                                                \'url\':\'core/ajax.php?PCO_Accion=PCO_RecuperarRecordsetJSON_DataTable&IdRegistro_CacheSQL=\".$TablasDataTableIdCache[$i].\"&NroFilasBase={$Paginacion}\'\n                                            },\n                                            \n                                            \'columns\': [\n                                                {$CadenaCamposDT}\n                                            ],\n    columnDefs: [{\n        searchPanes: {\n            show: true,\n        },\n        //targets: [7]\n    }],\n                                        \";\n                                    }\n        \n                                //Agrega al datatable el footer con autosuma cuando aplica\n                                if (trim($TablasDataTableTotales[$i])!=\"\" && $CadenaFormateadaTotales!=\"\")\n                                    echo \'\n                                            \"footerCallback\": function ( row, data, start, end, display ) {\n                                                var api = this.api(), data;\n                                                // Remueve el formato de la celda para obtener solamente el numero entero para la suma\n                                                    var intVal = function ( i ) {\n                                                        return typeof i === \\\'string\\\' ?\n                                                            i.replace(/[\\$,]/g, \\\'\\\')*1 :\n                                                            typeof i === \\\'number\\\' ?\n                                                                i : 0;\n                                                    };\n                                                // Total de todas las paginas\n                                                    total = api\n                                                        .column( \'.$ColumnaTotales.\' )\n                                                        .data()\n                                                        .reduce( function (a, b) {\n                                                            return intVal(a) + intVal(b);\n                                                        }, 0 );\n                                                // Total de la pagina actual\n                                                    pageTotal = api\n                                                        .column( \'.$ColumnaTotales.\', { page: \\\'current\\\'} )\n                                                        .data()\n                                                        .reduce( function (a, b) {\n                                                            return intVal(a) + intVal(b);\n                                                        }, 0 );\n                                                // Actualiza el pie de pagina del datatable siempre en la columna 0\n                                                $( api.column( 0 ).footer() ).html(\n                                                    \\\'\'.$CadenaFormateadaTotales.\'\\\'\n                                                );\n                                            },\';\n                                echo \'\n                                            \"language\": {\n                                                    \"lengthMenu\": \"\'.$MULTILANG_Mostrando.\' _MENU_ \'.$MULTILANG_InfDataTableResXPag.\'\",\n                                                    \"zeroRecords\": \"Nothing found - sorry\",\n                                                    \"info\": \"\'.$MULTILANG_InfDataTableViendoP.\' _PAGE_ \'.$MULTILANG_InfDataTableDe.\' _PAGES_\",\n                                                    \"infoEmpty\": \"\'.$MULTILANG_InfDataTableNoRegistrosDisponibles.\'\",\n                                                    \"infoFiltered\": \"(\'.$MULTILANG_InfDataTableFiltradoDe.\' _MAX_ \'.$MULTILANG_InfDataTableRegTotal.\')\",\n                                                    oPaginate: { sFirst:\"\'.$MULTILANG_Primero.\'\",sLast:\"\'.$MULTILANG_Ultimo.\'\",sNext:\"\'.$MULTILANG_Siguiente.\'\",sPrevious:\"\'.$MULTILANG_Previo.\'\" },\n                                                    sEmptyTable:\"\'.$MULTILANG_InfDataTableNoDatos.\'\",\n                                                    sSearch:\"\'.$MULTILANG_Buscar.\':\",\n                                                    sLoadingRecords:\"\'.$MULTILANG_Cargando.\'...\",\n                                                    sProcessing:\"\'.$MULTILANG_Procesando.\'...\",\n                                                    sZeroRecords:\"\'.$MULTILANG_InfDataTableNoRegistros.\'\",\n\n                                                    searchPanes: {\n                                                            title: {\n                                                                _: \"Filtros aplicados: %d\",\n                                                                0: \"Sin filtros aplicados\",\n                                                                1: \"Un filtro aplicado\",\n                                                            },\n                                                            collapse: {\n                                                                0: \"Opciones de filtro\",\n                                                                1: \"Filtro (uno aplicado)\",\n                                                                _: \"Opciones de filtro (%d)\"\n                                                            },\n                                                            collapseMessage: \"Colapsar todo\",\n                                                            showMessage: \"Mostrar todo\",\n                                                            clearMessage: \"Quitar filtros\",\n                                                            count: \"{total}\",\n                                                            countFiltered: \"{shown} / ({total})\"\n                                                        }\n                                                }\n                                        }\n                                    );\n                                \';\n                            } //Fin si hay un ID valido de DataTable\n                    } //Fin activacion de todas las DT\n            ?>\n            \n            //Ejecucion de algunas funciones para correcion de estilos y responsive sobre datatables\n            //Ref: https://www.gyrocode.com/articles/jquery-datatables-column-width-issues-with-bootstrap-tabs/\n            $(\'a[data-toggle=\"tab\"]\').on(\'shown.bs.tab\', function(e){\n               $($.fn.dataTable.tables(true)).DataTable()\n                  .columns.adjust();\n            });\n        });\n\n        //Busca por posibles graficos sin datos\n        $( function() {\n            <?php\n                //Desglosa la cadena de posibles graficos sin datos\n                $PCO_MarcosGraficosSinDatos=@explode(\"|\",$PCO_InformesGraficosSinDatos);\n                for ($i=0; $i<count($PCO_MarcosGraficosSinDatos);$i++)\n                    if (trim($PCO_MarcosGraficosSinDatos[$i])!=\"\")\n                        echo \'$(\"#\'.$PCO_MarcosGraficosSinDatos[$i].\'\").html(\"<br><div align=center style=\\\'color:lightgray; text-shadow: 1px 1px 2px gray;\\\'><i class=\\\'fa fa-bar-chart-o fa-fw fa-4x\\\'></i> &nbsp; <i class=\\\'fa fa-pie-chart fa-fw fa-4x\\\'></i><br><i>\'.$MULTILANG_InfSinDatos.\'</i></div>\");\';\n            ?>\n        });\n\n		//Si hay tablas con propiedad de editables espera por eventos sobre sus campos\n		$(function(){\n			$(\"td[contenteditable=true]\").on(\"blur\", function(){\n			//$(\"td[contenteditable=true]\").blur( function(){\n				var nuevo_valor_campo = $(this).text();\n				var datos_campo_peticion = $(this).attr(\"id\");\n				var partes_campo_peticion = datos_campo_peticion.split(\":\");\n				var tabla_peticion=partes_campo_peticion[0];\n				var campo_peticion=partes_campo_peticion[1];\n				var PCO_CambioEstado_CampoLlave=partes_campo_peticion[2];\n				var id_peticion=partes_campo_peticion[3];\n				\n				var ParametrosApertura=\"PCO_Accion=cambiar_estado_campo&Presentar_FullScreen=1&PCO_CambioEstado_NoUsarCore=1&PCO_CambioEstado_NegarRetorno=1&tabla=\"+tabla_peticion+\"&campo=\"+campo_peticion+\"&id=\"+id_peticion+\"&valor=\"+nuevo_valor_campo+\"&PCO_CambioEstado_CampoLlave=\"+PCO_CambioEstado_CampoLlave;\n				Actualizacion=PCO_ObtenerContenidoAjax(1,\"index.php\",ParametrosApertura);\n				\n				//Presenta mensaje temporal de actualizacion durante 1 segundo\n				PCOJS_MostrarMensajeCargandoSimple(1000);\n			});\n		});\n\n    </script>\n\n\n    <?php\n        //Carga las funciones activadoras de diferentes tipos de control (si fue encontrado algun campo de ese tipo)\n        //DatePicker\n        if (@$funciones_activacion_datepickers!=\"\")\n            echo \'<script type=\"text/javascript\">\'.$funciones_activacion_datepickers.\'</script>\';\n        //Deslizadores\n        if (@$funciones_activacion_sliders!=\"\")\n            echo \'<script type=\"text/javascript\">\'.$funciones_activacion_sliders.\'</script>\';\n        //Canvas\n        if (@$funciones_activacion_canvas!=\"\")\n            echo \'<script type=\"text/javascript\">\'.$funciones_activacion_canvas.\'</script>\';\n    ?>\n\n    <?php\n        // Calcula tiempos de ejecucion del script\n        $tiempo_final_script = PCO_ObtenerMicrotime();\n        $tiempo_total_script = $tiempo_final_script - @$tiempo_inicio_script;\n        $tiempo_total_script = round($tiempo_total_script,3);\n    ?>\n\n    <script language=\"JavaScript\">\n        //Actualiza marco con el tiempo de carga (inclusiones y PHP del lado del servidor)\n        $(\'#PCO_TCarga\').text(\"<?php echo $tiempo_total_script; ?>\");\n    </script>\n\n    <?php\n        //Si se requiere selector de iconos genera los eventos\n        if (@$PCO_Accion==\"PCOFUNC_AdministrarMenu\")\n            {\n    ?>\n        <script language=\"JavaScript\">\n            //Crea evento para el selector de iconos (cuando aplica)\n            $(\'#lib_glyphicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'glyphicon \'+e.icon;\n            });\n            $(\'#lib_ionicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'fa \'+e.icon;\n            });\n            $(\'#lib_fontawesome\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'fa \'+e.icon;\n            });\n            $(\'#lib_weathericon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'wi fa \'+e.icon;\n            });\n            $(\'#lib_mapicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=e.icon;\n            });\n            $(\'#lib_octicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'octicon \'+e.icon;\n            });\n            $(\'#lib_typicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'typcn fa \'+e.icon;\n            });\n            $(\'#lib_elusiveicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=e.icon;\n            });\n        </script>\n    <?php\n            } //Fin de eventos para selector de iconos\n    ?>\n\n    <?php\n        // Si existe el directorio para el editor ACE lo incluye\n        if (@file_exists(\"inc/ace\"))\n            {\n    ?>\n            <script src=\"inc/ace/src-min-noconflict/ace.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n            <script>\n                // Habilita el editor ACE para los textareas con el atributo data-editor\n                $(function () {\n                    $(\'textarea[data-editor]\').each(function () {\n                        var textarea = $(this);\n\n                        var mode = textarea.data(\'editor\');\n\n                        var editDiv = $(\'<div>\', {\n                            position: \'absolute\',\n                            width: textarea.width(),\n                            height: textarea.height(),\n                            \'class\': textarea.attr(\'class\')\n                        }).insertBefore(textarea);\n\n                        textarea.css(\'visibility\', \'hidden\');\n                        textarea.css(\'display\', \'none\');\n\n                        var editor = ace.edit(editDiv[0]);\n                        //editor.renderer.setShowGutter(false); //Ocultar numero de lineas, ayudas, opciones de colapsar, etc\n                        editor.getSession().setValue(textarea.val());\n                        editor.getSession().setMode(\"ace/mode/\" + mode);\n                        editor.setTheme(\"ace/theme/eclipse\"); //Establece el tema a utilizar twilight|eclipse\n                        \n                        /*\n                        // copy back to textarea on form submit...\n                        textarea.closest(\'form\').submit(function () {\n                            textarea.val(editor.getSession().getValue());\n                        })\n                        */\n\n                        //En cada evento de cambio actualiza el textarea\n                        editor.getSession().on(\'change\', function(){\n                          textarea.val(editor.getSession().getValue());\n                        });\n                        \n                    });\n                });\n            </script>\n    <?php        \n            } // Fin Si existe ACE\n    ?>\n	\n    <script language=\"JavaScript\">\n		//Activa visualmente todos los div tipo SummerNote y los asocia a cada textarea\n        $( function() {\n            <?php\n				//Activa el summernote para la edicion de controles de texto como etiqueta en formularios si se esta en esa accion\n				if ($PCO_Accion==\"PCO_EditarFormulario\")\n					{\n						echo \"\n							$(\'#Summer_valor_etiqueta\').summernote({\n							lang: \'es-ES\',\n							  height: 300,\n							  toolbar: [\n								[\'Estilos\', [\'style\']],\n								[\'Fuentes1\', [\'fontname\']],\n								[\'Fuentes2\', [\'fontsize\']],\n								[\'Operaciones\', [\'undo\', \'redo\']],\n								[\'Caracter\', [\'bold\', \'italic\', \'underline\', \'strikethrough\', \'clear\', \'color\']],\n								[\'Parrafo1\', [\'ul\', \'ol\']],\n								[\'Parrafo2\', [\'paragraph\']],\n								[\'Parrafo3\', [\'height\']],\n								[\'Insertar1\', [\'link\', \'table\', \'hr\']],\n								[\'Otros\', [\'fullscreen\', \'codeview\']], \n								[\'Insertar2\', [\'picture\', \'video\']],\n								],\n							  //ANTERIORonChange: function(contents) { document.datosform.valor_etiqueta.value=contents; }\n                              callbacks: {\n                                onChange: function(contents) {\n                                   document.datosform.valor_etiqueta.value=contents;\n                                }\n                              }\n							});\n							//ANTERIOR$(\'#Summer_valor_etiqueta\').code(document.datosform.valor_etiqueta.value);\n							$(\'#Summer_valor_etiqueta\').summernote(\'code\',document.datosform.valor_etiqueta.value);\n						\";\n					}\n            ?>\n        }); //Fin del document.ready\n    </script>\n\n    <!-- Menu Toggle Script -->\n    <script language=\"JavaScript\">\n    $(\"#menu-toggle\").on(\"click\",function(e) {\n        e.preventDefault();\n        $(\"#wrapper\").toggleClass(\"toggled\");\n    });\n    </script>\n\n    <script language=\"JavaScript\">\n		/*\n		//Activa visualmente todos los div tipo SummerNote y los asocia a cada textarea\n        $(document).ready(function() {\n			$(\'#Summer_valor_etiqueta\').summernote({\n			lang: \'es-ES\',\n			  height: 300,\n			  toolbar: [\n				[\'Estilos\', [\'style\']],\n				[\'Fuentes1\', [\'fontname\']],\n				[\'Fuentes2\', [\'fontsize\']],\n				[\'Operaciones\', [\'undo\', \'redo\']],\n				[\'Caracter\', [\'bold\', \'italic\', \'underline\', \'strikethrough\', \'clear\', \'color\']],\n				[\'Parrafo1\', [\'ul\', \'ol\']],\n				[\'Parrafo2\', [\'paragraph\']],\n				[\'Parrafo3\', [\'height\']],\n				[\'Insertar1\', [\'link\', \'table\', \'hr\']],\n				[\'Otros\', [\'fullscreen\', \'codeview\']], \n				[\'Insertar2\', [\'picture\', \'video\']],\n				],\n\n			  onChange: function(contents) { document.datos.valor_etiqueta.value=contents; }\n			});\n			$(\'#Summer_valor_etiqueta\').code(document.datos.valor_etiqueta.value);\n        }); //Fin del document.ready\n        */\n    </script>\n\n	<?php\n        //Agrega funcion para la intercepcion del submit del formulario\n        echo \'\n        <script type=\"text/javascript\">\n            PCOJS_ListaCamposValidar=\"\'.$POSTForm_ListaCamposObligatorios.\'\".split(\"|\");\n            PCOJS_ListaCombosMultiplesJoin=\"\'.@$PCO_ListaCombosMultiplesJoin.\'\".split(\"|\");\n            PCOJS_ListaTitulosValidar=\"\'.PCO_ReemplazarVariablesPHPEnCadena($POSTForm_ListaTitulosObligatorios).\'\".split(\"|\");\n            \n            function PCOJS_SanitizarValoresListaMultiple()\n                {\n                    //Antes de hacer el submit definitivo sanitiza valores de combos multiples\n                    for (var ComboMultiple of PCOJS_ListaCombosMultiplesJoin) \n                        {\n                            ComboMultiple=ComboMultiple.trim();             //Elimina posibles espacios en el id del elemento\n                            if (ComboMultiple!=\"\")\n                                {\n                                    ValorComboMultiple=$(\"#\"+ComboMultiple).val();\n                                    if (ValorComboMultiple!=null)\n                                        {\n                                            ValorSanitizadoComboMultiple=$(\"#\"+ComboMultiple).val().join(\",\");\n                                            //Asigna al campo extra del combo multiple los valores sanitizados\n                                            $(\"#PCO_ComboMultiple_\"+ComboMultiple).val(ValorSanitizadoComboMultiple);\n                                        }\n                                    else\n                                        {\n                                            //Si el combo es null porque se dejo sin valores entonces limpia campo sanitizado\n                                            $(\"#PCO_ComboMultiple_\"+ComboMultiple).val(\"\");\n                                        }\n                                }\n                        }\n                }\n            \n            \n            function PCOJS_ValidarCamposYProcesarFormulario(FormularioProcesar=\"datos\",AnularSubmit=0)\n                {\n                    MensajeCamposObligatorios=\"\";\n                    //Recorre todos los campos de la lista en busca de sus valores\n                    ConteoCamposValidacion=0;\n                    for (Campo in PCOJS_ListaCamposValidar)\n                        {\n                            //Si se tiene un nombre de campo como obligatorio valida que tenga valor\n                            if (PCOJS_ListaCamposValidar[Campo]!=\"\")\n                                {\n                                    //Valida su valor actual\n                                    if ($(\"#\"+PCOJS_ListaCamposValidar[Campo]).val() == \"\" || $(\"#\"+PCOJS_ListaCamposValidar[Campo]).val() == null )\n                                        MensajeCamposObligatorios+=\"<br><i class=\\\'fa fa-info-circle\\\'></i> \'.$MULTILANG_ErrFrmObligatorio.\' <b>\"+PCOJS_ListaTitulosValidar[ConteoCamposValidacion]+\"</b>\";\n                                }\n                            ConteoCamposValidacion++;\n                        }\n                    // Valida si hay errores y muestra el emerente, sino continua adelante y procesa el form\n                    if (MensajeCamposObligatorios!=\"\")\n                        PCOJS_MostrarMensaje(\"\'.$MULTILANG_AvisoSistema.\'\", MensajeCamposObligatorios);\n                    else\n                        {\n                            if (AnularSubmit==0)\n                                {\n                                    PCOJS_SanitizarValoresListaMultiple();\n                                    //Hace el envio del formulario\n                                    document.getElementById(FormularioProcesar).submit();\n                                }\n                        }\n                }\n        </script> \';\n\n		//Si existen funciones JavaScript generadas por algun formulario del usuario entonces las imprime\n		if(@$PCO_FuncionesJSInternasFORM!=\"\")\n			echo $PCO_FuncionesJSInternasFORM;\n	?>\n\n	<?php\n        //Agrega funcion para verificar periodicamente la conectividad del cliente\n        if (@$PCOSESS_SesionAbierta)\n            echo \'\n            <script type=\"text/javascript\">\n                function VerificarConectividad()\n                    {\n                        $.ajax({\n                            url: \"inc/version_actual.txt\",\n                            cache: false\n                        })\n                        .done(function( contenido_respuesta_html ) {\n                            $(\"#PCO_Modal_MensajeCargando\").modal(\"hide\");\n                        });\n                    }\n                var ValidadorConexion = setInterval(VerificarConectividad, 5000);\n                $(document).ajaxError(function(){\n                    if (window.console && window.console.error) {\n                        PCOJS_MostrarMensajeCargando(\"\'.$MULTILANG_EventoTipoInternet.\'\", \" <i class=\\\"fa fa-4x fa-globe fa-pull-left fa-border \\\"></i>\'.$MULTILANG_ErrorConexionInternet.\'\", 0, 100);\n                    }\n                });\n            </script> \';\n	?>\n\n	<?php\n	    //Carga tema de MaterialDesign cuando aplica\n        if ($Tema_PracticoFramework==\"material\")\n            {\n                echo \'\n                    <script src=\"inc/bootstrap-material-design/js/material.min.js\"></script>\n                    <script src=\"inc/bootstrap-material-design/js/ripples.min.js\"></script>\n                \n                    <script language=\"JavaScript\">\n                        $.material.init();\n                    </script>\';\n            }\n	?>\n\n	<?php\n	    //Solicita autorizacion de ubicar al usuario de acuerdo a la configuracion actual\n        if ($PWA_AutorizacionGPS==\"1\")\n            {\n                echo \'<script language=\"JavaScript\">\n                        PCOJS.GeoLocalizarUsuario();\n                    </script>\';\n            }\n\n	    //Solicita autorizacion para uso de camara y microfono de acuerdo a la configuracion actual\n        if ($PWA_AutorizacionCAM==\"1\" || $PWA_AutorizacionMIC==\"1\")\n            {\n                $PCO_SolicitudCAM=\'false\';\n                $PCO_SolicitudMIC=\'false\';\n                if ($PWA_AutorizacionCAM==1) $PCO_SolicitudCAM=\'true\';\n                if ($PWA_AutorizacionMIC==1) $PCO_SolicitudMIC=\'true\';\n                echo \'<script language=\"JavaScript\">\n                        navigator.getUserMedia = ( navigator.getUserMedia ||\n                                               navigator.webkitGetUserMedia ||\n                                               navigator.mozGetUserMedia ||\n                                               navigator.msGetUserMedia);\n                        navigator.getUserMedia (\n\n                           // Indica el tipo de medio al que se solicita el acceso\n                               {\n                                  video: \'.$PCO_SolicitudCAM.\',\n                                  audio: \'.$PCO_SolicitudMIC.\'\n                               },\n                           // Si no hay error, es devuelto en el objeto LocalMediaStream en un tag video:\n                               function(localMediaStream) {\n                                  var video = document.querySelector(video);\n                                  video.src = window.URL.createObjectURL(localMediaStream);\n                               },\n                           // Si hay errores lleva log a consola de depuracion\n                               function(err) {\n                                console.log(\"Practico Framework: No autorizado el uso de dispositivo de video/audio: \" + err);\n                               }\n                        );\n                    </script>\';\n            }\n	?>\n\n    <?php\n        // Estadisticas de uso anonimo con GABeacon(Deprecated) Directo por Google Analytics\n        PCO_AgregarFaroAnalytics();\n    ?>\n\n    <script language=\"JavaScript\">\n        //Limpia parametros de la URL si aplica\n        if(window.location.href.indexOf(\"?\") > -1)\n            window.history.pushState({data:true}, \"\", window.location.href.split(\"?\")[0].split(\"index.php\")[0] );\n\n        <?php\n            //Agrega scripts de postcarga para listas de seleccion si aplica\n            echo $PCO_ScriptsListaCombosPostCarga;\n        ?>\n\n        //Actualiza marco con el tiempo de carga JavaScript (tiempo de carga y transferencia)\n        var tiempo_final_javascript = (new Date()).getTime();\n        var tiempo_final_javascript_segs = (tiempo_final_javascript-tiempo_inicio_javascript)/1000;\n        $(\'#PCO_TCargaJS\').text(tiempo_final_javascript_segs);\n\n        //Mensajes de advertencia en consola de desarrollo del navegador\n        console.log(\'%c Practico Framework: <?php echo $MULTILANG_ZonaPeligro; ?>! %c\\nEsta caracteristica del navegador existe para desarrolladores.  Si alguien te sugiere copiar y pegar algun comando aqui puede comprometer tu seguridad. / This is a browser feature intended for developers. If someone told you to copy-paste something here this could break your security.\', \'color: yellow; background: darkred; font-size:1.5rem;font-weight:bold; box-shadow: 10px 3px 3px gray;\', \'font-size:1.25rem;line-height:1.1;margin-top:.5em\');\n\n    </script>\n\n</body>\n</html>','A'),(89,'core/marco_abajo.php','2023-04-28 22:47:00','rafael',941,52370,'<?php\n/*\n	 _\n	|_) _ _  _ _|_. _ _					  	Copyright (C) 2012-2022\n	|  | (_|(_  | |(_(_) 				  	John F. Arroyave Gutiérrez\n	  www.practico.org					  	unix4you2@gmail.com\n                                            All rights reserved.\n    \n	 This program is free software: you can redistribute it and/or modify\n	 it under the terms of the GNU General Public License as published by\n	 the Free Software Foundation, either version 3 of the License, or\n	 (at your option) any later version.\n\n	 This program is distributed in the hope that it will be useful,\n	 but WITHOUT ANY WARRANTY; without even the implied warranty of\n	 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n	 GNU General Public License for more details.\n\n	 You should have received a copy of the GNU General Public License\n	 along with this program.  If not, see <http://www.gnu.org/licenses/>\n	 \n	            --- TRADUCCION NO OFICIAL DE LA LICENCIA ---\n\n     Esta es una traducción no oficial de la Licencia Pública General de\n     GNU al español. No ha sido publicada por la Free Software Foundation\n     y no establece los términos jurídicos de distribución del software \n     publicado bajo la GPL 3 de GNU, solo la GPL de GNU original en inglés\n     lo hace. De todos modos, esperamos que esta traducción ayude a los\n     hispanohablantes a comprender mejor la GPL de GNU:\n	 \n     Este programa es software libre: puede redistribuirlo y/o modificarlo\n     bajo los términos de la Licencia General Pública de GNU publicada por\n     la Free Software Foundation, ya sea la versión 3 de la Licencia, o \n     (a su elección) cualquier versión posterior.\n\n     Este programa se distribuye con la esperanza de que sea útil pero SIN\n     NINGUNA GARANTÍA; incluso sin la garantía implícita de MERCANTIBILIDAD\n     o CALIFICADA PARA UN PROPÓSITO EN PARTICULAR. Vea la Licencia General\n     Pública de GNU para más detalles.\n\n     Usted ha debido de recibir una copia de la Licencia General Pública de\n     GNU junto con este programa. Si no, vea <http://www.gnu.org/licenses/>\n*/\n\n	/*\n		Title: Seccion inferior\n		Ubicacion *[/core/marco_abajo.php]*.  Archivo dedicado a la diagramacion de contenidos en el pie de pagina de la aplicacion, incluye valores de accion y tiempos para el usuario administrador.\n\n	Variables de entrada:\n\n		PCOSESS_LoginUsuario - Nombre de usuario que se encuentra logueado en el sistema\n		accion - Accion llamada actualmente en Practico (identificador unico de funcion interna o personalizada)\n		tiempo_inicio_script - Hora en microtime marcada para el incio del script\n\n		(start code)\n			if(PCO_EsAdministrador(@$PCOSESS_LoginUsuario) && $PCO_Accion!=\"\")\n				{\n					$tiempo_final_script = PCO_ObtenerMicrotime();\n					$tiempo_total_script = $tiempo_final_script - $tiempo_inicio_script;\n				}\n		(end)\n\n	Salida:\n		Pie de pagina de aplicacion e informacion asociada a la accion y tiempos de ejecucion en caso de ser el usuario administrador\n\n	Ver tambien:\n		<Seccion superior> | <Articulador>\n	*/\n?>\n \n\n\n\n						<div id=\"PCODIV_AbajoEscritorio\"></div>\n\n                    </div>\n                    <!-- /.col-lg-12 -->\n                </div>\n                <!-- /.row -->\n            </div>\n            <!-- /.container-fluid -->\n        </div>\n        <!-- /#page-wrapper -->\n\n\n\n		<!-- Modal para mensajes generales -->\n		<div id=\"PCO_Modal_Mensaje\" class=\"modal fade oculto_impresion\">\n			<div class=\"modal-dialog\">\n				<div class=\"modal-content\">\n					<div class=\"modal-header\">\n						<button type=\"button\" class=\"close\" data-dismiss=\"modal\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Cerrar</span></button>\n						<h4 id=\"PCO_Modal_MensajeTitulo\" class=\"modal-title\"></h4>\n					</div>\n					<div class=\"modal-body\">\n						<p id=\"PCO_Modal_MensajeCuerpo\"></p>\n					</div>\n					<div class=\"modal-footer\">\n						<div id=\"PCO_Modal_MensajeBotones\"><button type=\"button\" class=\"btn btn-outline btn-info\" data-dismiss=\"modal\">Cerrar</button></div>\n					</div>\n				</div><!-- /.modal-content -->\n			</div><!-- /.modal-dialog -->\n		</div><!-- /.modal -->\n\n\n		<!-- Modal para mensajes de carga -->\n		<div id=\"PCO_Modal_MensajeCargando\" class=\"modal fade oculto_impresion\"  data-backdrop=\"static\" data-keyboard=\"false\">\n			<div class=\"modal-dialog\">\n				<div class=\"modal-content\">\n					<div class=\"modal-header\">\n						<button id=\"PCO_Modal_MensajeCargandoBotonCerrar\" type=\"button\" class=\"close\" data-dismiss=\"modal\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Cerrar</span></button>\n						<h4 id=\"PCO_Modal_MensajeCargandoTitulo\" class=\"modal-title\"></h4>\n					</div>\n					<div class=\"modal-body\">\n						<div class=\"progress\" id=\"PCO_Modal_MensajeCargandoBarra\">\n							<div id=\"PCO_Modal_MensajeCargandoPorcentaje\" class=\"progress-bar progress-bar-striped active\" role=\"progressbar\" aria-valuenow=\"45\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 45%\"></div>\n						</div>\n						<p id=\"PCO_Modal_MensajeCargandoCuerpo\"></p>\n						<div align=\"right\"><i class=\"fa fa-circle-o-notch fa-fw fa-spin fa-1x\"></i></div>\n						\n						<a href=\"javascript:PCOJS_OcultarMensajeCargando();\"><?php echo $MULTILANG_Cerrar; ?></a>\n					</div>\n				</div><!-- /.modal-content -->\n			</div><!-- /.modal-dialog -->\n		</div><!-- /.modal -->\n\n		<!-- Modal para mensajes de carga -->\n		<div id=\"PCO_Modal_MensajeCargandoSimple\" class=\"modal oculto_impresion\" data-backdrop=\"false\">\n			<div class=\"modal-dialog modal-sm\">\n				<div class=\"modal-content\">\n					<div class=\"modal-body\" align=\"center\">\n						<div class=\"progress\" id=\"PCO_Modal_MensajeCargandoBarra\">\n							<div id=\"PCO_Modal_MensajeCargandoPorcentaje\" class=\"progress-bar progress-bar-striped active\" role=\"progressbar\" aria-valuenow=\"100\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 100%\"></div>\n						</div>\n						<i class=\"fa fa-circle-o-notch fa-fw fa-spin fa-1x\"></i> <?php echo $MULTILANG_Cargando; ?>...\n						\n					</div>\n				</div><!-- /.modal-content -->\n			</div><!-- /.modal-dialog -->\n		</div><!-- /.modal -->\n\n\n    </div>\n    <!-- /#wrapper inicial -->\n\n<!--</div>--> <!-- FINALIZA MARCO DE CHAT -->\n\n\n\n    <!-- Plugins JavaScript requeridos por DateTimePicker -->\n    <script src=\"inc/bootstrap/js/plugins/moment/moment-with-locales.min.js\"></script>\n\n    <!-- Plugins JavaScript adicionales -->\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/transition.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/collapse.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/slider/bootstrap-slider.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/metisMenu/metisMenu.min.js\"></script>\n    <!-- Bootstrap-Iconpicker Fuentes de iconos -->\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-fontawesome-4.2.0.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-glyphicon.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-ionicon-1.5.2.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-octicon-2.1.2.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-typicon-2.0.6.min.js\"></script>\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-weathericon-1.2.0.min.js\"></script>\n    <!--<script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-elusiveicon-2.0.0.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/iconset/iconset-mapicon-2.1.0.min.js\"></script>-->\n    <script type=\"text/javascript\" src=\"inc/bootstrap/js/plugins/iconpicker/bootstrap-iconpicker.min.js\"></script>\n\n    <!-- Plugins JavaScript requeridos por DateTimePicker -->\n    <script src=\"inc/bootstrap/js/plugins/datepicker/bootstrap-datetimepicker.min.js\"></script>\n\n    <!-- Morris Charts JavaScript -->\n    <?php\n        //Carga solo Morris cuando es pagina principal por ahora para evitar conflictos con DatePicker\n        if (PCO_EsAdministrador(@$PCOSESS_LoginUsuario) && @$PCOSESS_SesionAbierta && @$PCO_Accion==\"PCO_VerMenu\")\n        // Incluye archivo con las consultas y datos para ser diagramados por Morris\n            include_once(\"core/marco_admin_morris.php\");\n    ?>\n    \n    <!-- Gantt -->\n    <script src=\"inc/jquery/plugins/gantt-master/js/jquery.fn.gantt.js\"></script>\n\n    <!-- DataTables JavaScript -->\n    <script src=\"inc/bootstrap/js/plugins/dataTables/jquery.dataTables.min.js\"></script>\n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.buttons.min.js\"></script><!--N-->\n    <script src=\"inc/bootstrap/js/plugins/dataTables/buttons.html5.min.js\"></script><!--N-->\n    <script src=\"inc/bootstrap/js/plugins/dataTables/buttons.colVis.min.js\"></script><!--N-->\n\n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.bootstrap.min.js\"></script>\n    \n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.select.min.js\"></script>\n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.searchPanes.min.js\"></script>\n\n    <!-- DataTables Responsive -->\n    <script src=\"inc/bootstrap/js/plugins/dataTables/dataTables.responsive.min.js\"></script><!--N-->\n\n	<!-- Canvas -->\n    <script type=\"text/javascript\" src=\"inc/jquery/plugins/sketch.js\"></script>\n    \n    <!-- SummerNote -->\n    <script src=\"inc/summernote/summernote.min.js\"></script>\n    <script src=\"inc/summernote/lang/summernote-<?php echo $IdiomaPredeterminado; ?>-<?php echo strtoupper($IdiomaPredeterminado); ?>.min.js\"></script>\n\n    <!-- JavaScript Personalizado del tema -->\n    <script src=\"inc/bootstrap/js/sb-admin-2.js\"></script>\n    <script src=\"inc/bootstrap/js/practico.min.js?<?php echo filemtime(\'inc/bootstrap/js/practico.min.js\'); ?>\"></script>\n    \n    <?php\n    	//Carga marco de chat solamente si esta habilitado\n    	if (isset($Activar_ModuloChat) && $Activar_ModuloChat>0 && @$_SESSION[\'username\']!=\"\")\n        	{\n	?>\n                <!-- Chat -->\n                <script type=\"text/javascript\" src=\"inc/chat/js/chat.js\"></script>\n    <?php\n    	    }\n    ?>\n\n\n    <?php\n        //Si el usuario es admin por defecto presenta la barra lateral activa\n        // DEPRECATED: (PCO_EsAdministrador(@$PCOSESS_LoginUsuario) && @$PCOSESS_SesionAbierta && @$PCO_Accion==\"PCO_VerMenu\") || \n        if ((@$PCOSESS_LoginUsuario!=\"\" && @$PCOSESS_SesionAbierta && @$VerNavegacionIzquierdaResponsive==1))\n            echo \'<script language=\"JavaScript\">\n                    ver_navegacion_izquierda_responsive();\n                </script>\';\n    ?>\n\n    <?php\n        // Habilita el popup activo\n        if (@$popup_activo==\"FormularioCampos\")	\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalElementoFormulario\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"FormularioBotones\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalBotonFormulario\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"FormularioDiseno\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalDisenoFormulario\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"FormularioAcciones\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalDisenoBotones\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"InformeAcciones\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalEditaAccionesInforme\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"InformeCampos\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalCamposInforme\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"InformeTablas\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalTablaInforme\").modal(\"show\"); }); </script>\';\n        if (@$popup_activo==\"InformeCondiciones\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\"#myModalCondicionesInforme\").modal(\"show\"); }); </script>\';\n        //Habilita pesatanas activas en el popup activo\n        if (@$pestana_activa_editor==\"eventos_objeto-tab\")\n            echo \'<script type=\"text/javascript\"> $(window).load(function(){ $(\\\'.nav-tabs a[href=\"#eventos_objeto-tab\"]\\\').tab(\\\'show\\\'); }); </script>\';\n    ?>\n\n    <script language=\"JavaScript\">\n        //Actualiza tamano del marco principal para garantizar siempre un tamano adecuado de fondo\n        //TODO: Verificar consistencia en paginas grades como la administrativa\n        $( function() {\n            var PCOJSVAR_HayScroll=false;\n            //Verifica si hay scroll  METODO 1\n            if (document.getElementById(\"page-wrapper\").scrollHeight==$(document).height())\n                PCOJSVAR_HayScroll=true;\n            //Si hay scroll el alto debe tener !important para que se estire hasta abajo en la página.  Si no hay scroll solo 100%\n            if( PCOJSVAR_HayScroll )\n                {\n                    //$(\"#page-wrapper\").css({ \'height\': \"100% !important\" }); //SI Hay scroll  \n                    //console.log(\"Scroll detectado\");\n                }\n            else\n                {\n                    $(\"#page-wrapper\").css({ \'height\': \"100%\" }); // NO Hay scroll  \n                    //console.log(\"Scroll NO detectado\");\n                }\n        });\n    </script>\n\n    <script language=\"JavaScript\">\n        //Carga los tooltips programados en la hoja.  Por defecto todos los elementos con data-toggle=tootip\n        $(function () {\n          $(\'[data-toggle=\"tooltip\"]\').tooltip({\'container\':\'body\'});\n        })\n    </script>\n\n    <script language=\"JavaScript\">\n        //Carga los popovers programados en la hoja.  Por defecto todos los elementos con data-toggle=popover\n        $(function () {\n          $(\'[data-toggle=\"popover\"]\').popover()\n        })\n    </script>\n\n    <script language=\"JavaScript\">\n        //Carga las tablas en formato DataTable\n        $( function() {\n            <?php\n                //Desglosa la cadena de posibles tablas con formato DataTable y las convierte\n                $TablasDataTable=@explode(\"|\",$PCO_InformesDataTable);\n                $TablasDataTablePaginaciones=@explode(\"|\",$PCO_InformesDataTablePaginaciones);\n                $TablasDataTableTotales=@explode(\"|\",$PCO_InformesDataTableTotales);\n                $TablasDataTableFormatosTotales=@explode(\"|\",$PCO_InformesDataTableFormatoTotales);\n                $TablasDataTableExportaCLP=@explode(\"|\",$PCO_InformesDataTableExrpotaCLP);\n                $TablasDataTableExportaCSV=@explode(\"|\",$PCO_InformesDataTableExrpotaCSV);\n                $TablasDataTableExportaXLS=@explode(\"|\",$PCO_InformesDataTableExrpotaXLS);\n                $TablasDataTableExportaPDF=@explode(\"|\",$PCO_InformesDataTableExrpotaPDF);\n                $TablasDataTableDefineCOLS=@explode(\"|\",$PCO_InformesDataTableDefineCOLS);\n                $TablasDataTableIdCache=@explode(\"|\",$PCO_InformesIdCache);\n                $TablasDataTableRecuperacionAJAX=@explode(\"|\",$PCO_InformesRecuperacionAJAX);\n                $TablasDataTableColumnas=@explode(\"|\",$PCO_InformesListaColumnasDT);\n                $TablasDataTable_pane_activado=@explode(\"|\",$PCO_InformesDataTable_pane_activado);\n                $TablasDataTable_pane_cascada=@explode(\"|\",$PCO_InformesDataTable_pane_cascada);\n                $TablasDataTable_pane_colapsado=@explode(\"|\",$PCO_InformesDataTable_pane_colapsado);\n                $TablasDataTable_pane_columnas=@explode(\"|\",$PCO_InformesDataTable_pane_columnas);\n                $TablasDataTable_pane_subtotalesrelativos=@explode(\"|\",$PCO_InformesDataTable_pane_subtotalesrelativos);\n                $TablasDataTable_pane_conteos=@explode(\"|\",$PCO_InformesDataTable_pane_conteos);\n                $TablasDataTable_pane_controles=@explode(\"|\",$PCO_InformesDataTable_pane_controles);\n                $TablasDataTable_pane_control_colapsar=@explode(\"|\",$PCO_InformesDataTable_pane_control_colapsar);\n                $TablasDataTable_pane_control_ordenar=@explode(\"|\",$PCO_InformesDataTable_pane_control_ordenar);\n                \n                if (1==1)  //Solo para efectos de depuracion, cambiar a condicion invalida en produccion\n                echo \"\n                    /*\n                        Activacion de elementos tipo DATATABLE (depuracion):\n                        PCO_InformesDataTable=$PCO_InformesDataTable\n                        PCO_InformesDataTablePaginaciones=$PCO_InformesDataTablePaginaciones\n                        PCO_InformesDataTableTotales=$PCO_InformesDataTableTotales\n                        PCO_InformesDataTableFormatoTotales=$PCO_InformesDataTableFormatoTotales\n                        PCO_InformesDataTableExrpotaCLP=$PCO_InformesDataTableExrpotaCLP\n                        PCO_InformesDataTableExrpotaCSV=$PCO_InformesDataTableExrpotaCSV\n                        PCO_InformesDataTableExrpotaXLS=$PCO_InformesDataTableExrpotaXLS\n                        PCO_InformesDataTableExrpotaPDF=$PCO_InformesDataTableExrpotaPDF\n                        PCO_InformesTablasDataTableDefineCOLS=$PCO_InformesDataTableDefineCOLS\n                        PCO_InformesIdCache=$PCO_InformesIdCache\n                        PCO_InformesRecuperacionAJAX=$PCO_InformesRecuperacionAJAX\n                        PCO_InformesListaColumnasDT=$PCO_InformesListaColumnasDT\n                    */\";\n                \n                for ($i=0; $i<count($TablasDataTable);$i++)\n                    {\n                        //Agrega codigo para activacion de DataTable solamente cuando se tenga un ID de tabla valido\n                        if ($TablasDataTable[$i]!=\"\")\n                            {\n                                $Paginacion=trim($TablasDataTablePaginaciones[$i]);\n                                $ColumnaTotales=trim($TablasDataTableTotales[$i])-1;\n                                $ColumnaTotalesVisual=trim($TablasDataTableTotales[$i]);\n                                $CadenaFormateadaTotales=trim($TablasDataTableFormatosTotales[$i]);\n                                $CadenaExportaCLP=trim($TablasDataTableExportaCLP[$i]); if ($CadenaExportaCLP==\"S\") $CadenaExportaCLP=\'{ extend: \"copy\",    className: \"InformeBotonCopiar\" },\'; else $CadenaExportaCLP=\'\';\n                                $CadenaExportaCSV=trim($TablasDataTableExportaCSV[$i]); if ($CadenaExportaCSV==\"S\") $CadenaExportaCSV=\'{ extend: \"csv\",     className: \"InformeBotonCsv\" },   \'; else $CadenaExportaCSV=\'\';\n                                $CadenaExportaXLS=trim($TablasDataTableExportaXLS[$i]); if ($CadenaExportaXLS==\"S\") $CadenaExportaXLS=\'{ extend: \"excel\",   className: \"InformeBotonExcel\" ,  title: \"\" }, \'; else $CadenaExportaXLS=\'\';\n                                $CadenaExportaPDF=trim($TablasDataTableExportaPDF[$i]); if ($CadenaExportaPDF==\"S\") $CadenaExportaPDF=\'{ extend: \"pdf\",     className: \"InformeBotonPdf\" },   \'; else $CadenaExportaPDF=\'\';\n                                $CadenaPersonalizarColumnas=trim($TablasDataTableDefineCOLS[$i]); if ($CadenaPersonalizarColumnas==\"S\") $CadenaPersonalizarColumnas=\'{ extend: \"colvis\",  text:\"\'.$MULTILANG_Columna.\'(s)\",  className: \"InformeBotonCopiar\" }, \'; else $CadenaPersonalizarColumnas=\'\';\n\n                                //DEFINE CADENAS EN PANELES DE FILTRADO\n                                $CadenaPosicionPanelesArriba=\"\";\n                                $CadenaPosicionPanelesAbajo=\"\";\n                                $Cadena_pane_cascada=\"\";\n                                $Cadena_pane_colapsado=\"\";\n                                $Cadena_pane_columnas=\"\";\n                                $Cadena_pane_subtotalesrelativos=\"\";\n                                $Cadena_pane_conteos=\"\";\n                                $Cadena_pane_controles=\"\";\n                                $Cadena_pane_control_colapsar=\"\";\n                                $Cadena_pane_control_ordenar=\"\";\n                                if ($TablasDataTable_pane_activado[$i]==\"S\") $CadenaPosicionPanelesArriba=\"P\";\n                                if ($TablasDataTable_pane_activado[$i]==\"I\") $CadenaPosicionPanelesAbajo=\"P\";\n                                if ($TablasDataTable_pane_cascada[$i]==\"S\") $Cadena_pane_cascada=\" cascadePanes: true, \";\n                                if ($TablasDataTable_pane_colapsado[$i]==\"S\") $Cadena_pane_colapsado=\" initCollapsed: true, \";\n                                if ($TablasDataTable_pane_columnas[$i]!=\"\") $Cadena_pane_columnas=\' layout: \"columns-\'.$TablasDataTable_pane_columnas[$i].\'\", \';\n                                if ($TablasDataTable_pane_subtotalesrelativos[$i]==\"S\") $Cadena_pane_subtotalesrelativos=\" viewTotal: false, \";\n                                if ($TablasDataTable_pane_conteos[$i]!=\"S\") $Cadena_pane_conteos=\" viewCount: false, \";\n                                if ($TablasDataTable_pane_controles[$i]!=\"S\") $Cadena_pane_controles=\" controls: false, \";\n                                if ($TablasDataTable_pane_control_colapsar[$i]!=\"S\") $Cadena_pane_control_colapsar=\" collapse: false, \";\n                                if ($TablasDataTable_pane_control_ordenar[$i]!=\"S\") $Cadena_pane_control_ordenar=\" orderable: false, \";\n                                $CadenaPanelesFiltrado=\'\n                                            searchPanes:\n                                                {\n                                                    \'.$Cadena_pane_cascada.\'\n                                                    \'.$Cadena_pane_colapsado.\'\n                                                    \'.$Cadena_pane_columnas.\'\n                                                    \'.$Cadena_pane_subtotalesrelativos.\'\n                                                    \'.$Cadena_pane_conteos.\'\n                                                    \'.$Cadena_pane_controles.\'\n                                                    \'.$Cadena_pane_control_colapsar.\'\n                                                    \'.$Cadena_pane_control_ordenar.\'\n                                                },\n                                        \';\n\n/*\nINICIALIZACION CON AJAX\n$(document).ready( function() {\n  var table = $(\'#example\').DataTable({\n    ajax: \'../resources/options.json\',\n    dom: \'Plfrtip\',\n    columns: [\n        { data: \"users.first_name\" },\n        { data: \"users.last_name\" },\n        { data: \"users.phone\" },\n        { data: \"sites.name\" }\n    ],\n    columnDefs: [{\n        searchPanes: {\n            show: true,\n        },\n        targets: [0, 1, 2, 3]\n    }],\n  });\n} );\n*/\n\n                                //Realiza operaciones de reemplazo de patrones sobre la cadena de formato de Totales si aplica\n                                $CadenaFormateadaTotales=str_replace(\"_TOTAL_PAGINA_\",\"\'+pageTotal +\'\",$CadenaFormateadaTotales);\n                                $CadenaFormateadaTotales=str_replace(\"_TOTAL_INFORME_\",\"\'+total +\'\",$CadenaFormateadaTotales);\n                                $CadenaFormateadaTotales=str_replace(\"_COLUMNA_\",\"$ColumnaTotalesVisual\",$CadenaFormateadaTotales);\n        \n                                if ($Paginacion==\"\" || $Paginacion==0) $Paginacion=10;  //Si no hay paginacion personalizada pone 10 por defecto\n\n                                echo \'\n                                    var oTable\'.$i.\' = $(\"#\'.$TablasDataTable[$i].\'\").dataTable(\n                                        {\n                                            destroy: true,   //Habilita autodestruccion de objeto si se necesita reinicializar\n                                            dom: \"\'.$CadenaPosicionPanelesArriba.\'Blfrtip\'.$CadenaPosicionPanelesAbajo.\'\",  //Ej:  Blfrtip  Da formato a la tabla: Ver https://datatables.net/reference/option/dom\n                                            buttons: [\n                                                \'.$CadenaPersonalizarColumnas.\'\n                                                \'.$CadenaExportaCLP.\'\n                                                \'.$CadenaExportaCSV.\'\n                                                \'.$CadenaExportaXLS.\'\n                                                \'.$CadenaExportaPDF.\'\n                                                //{ extend: \"print\", className: \"InformeBotonPrint\" }\n                                            ],\n                                            \'.$CadenaPanelesFiltrado.\'\n                                            \"pageLength\": \'.$Paginacion.\',\n                                            //\"responsive\": true, //Opcional, no necesario activarlo si la tabla ya tiene la clase nowrap y responsive (y ya esto se hace en la generacion del informe)\n                                            \"scrollX\": true,\n                                            \"bAutoWidth\": true,\n                                            //\"bSort\": false,\n                                            //\"autoWidth\": true,\n                                            //aoColumns: [ { sWidth: \"45%\" }, { sWidth: \"45%\" }, { sWidth: \"10%\", bSearchable: false, bSortable: false } ],\n                                            //\"aaSorting\": [],  //Un alias a versiones viejas de order:\n                                            \"order\": [],\n                                            \"fnInitComplete\": function() {\n                                            this.fnAdjustColumnSizing(true);\n                                            },\';\n\n                                //Agrega configuraciones especificas para tablas con recuperacion por AJAX\n                                if($TablasDataTableRecuperacionAJAX[$i]==\"1\")\n                                    {\n                                        //Genera la definicion requerida por DT con la lista de columnas \n                                        $ListaCamposDT=explode(\",\",$TablasDataTableColumnas[$i]); //Genera arreglo para los campos\n                                        //FORMA OPCIONAL: Recuperar la lista de columnas directo desde la cache (menos rapido): $ListaCamposDT=explode(\",\",PCO_EjecutarSQL(\"SELECT columnas FROM {$TablasCore}informe_cache WHERE id=\'\".$TablasDataTableIdCache[$i].\"\' \")->fetchColumn());\n                                        $CadenaCamposDT=\"\";\n                                        foreach ($ListaCamposDT as $CampoDT)\n                                            $CadenaCamposDT.=\"{ data: \'{$CampoDT}\' } ,\";\n                                        echo \"\n                                            \'processing\': true,\n                                            \'serverSide\': true,\n                                            \'serverMethod\': \'post\',\n                                            \n                                            \'ajax\': {\n                                                \'url\':\'core/ajax.php?PCO_Accion=PCO_RecuperarRecordsetJSON_DataTable&IdRegistro_CacheSQL=\".$TablasDataTableIdCache[$i].\"&NroFilasBase={$Paginacion}\'\n                                            },\n                                            \n                                            \'columns\': [\n                                                {$CadenaCamposDT}\n                                            ],\n    columnDefs: [{\n        searchPanes: {\n            show: true,\n        },\n        //targets: [7]\n    }],\n                                        \";\n                                    }\n        \n                                //Agrega al datatable el footer con autosuma cuando aplica\n                                if (trim($TablasDataTableTotales[$i])!=\"\" && $CadenaFormateadaTotales!=\"\")\n                                    echo \'\n                                            \"footerCallback\": function ( row, data, start, end, display ) {\n                                                var api = this.api(), data;\n                                                // Remueve el formato de la celda para obtener solamente el numero entero para la suma\n                                                    var intVal = function ( i ) {\n                                                        return typeof i === \\\'string\\\' ?\n                                                            i.replace(/[\\$,]/g, \\\'\\\')*1 :\n                                                            typeof i === \\\'number\\\' ?\n                                                                i : 0;\n                                                    };\n                                                // Total de todas las paginas\n                                                    total = api\n                                                        .column( \'.$ColumnaTotales.\' )\n                                                        .data()\n                                                        .reduce( function (a, b) {\n                                                            return intVal(a) + intVal(b);\n                                                        }, 0 );\n                                                // Total de la pagina actual\n                                                    pageTotal = api\n                                                        .column( \'.$ColumnaTotales.\', { page: \\\'current\\\'} )\n                                                        .data()\n                                                        .reduce( function (a, b) {\n                                                            return intVal(a) + intVal(b);\n                                                        }, 0 );\n                                                // Actualiza el pie de pagina del datatable siempre en la columna 0\n                                                $( api.column( 0 ).footer() ).html(\n                                                    \\\'\'.$CadenaFormateadaTotales.\'\\\'\n                                                );\n                                            },\';\n                                echo \'\n                                            \"language\": {\n                                                    \"lengthMenu\": \"\'.$MULTILANG_Mostrando.\' _MENU_ \'.$MULTILANG_InfDataTableResXPag.\'\",\n                                                    \"zeroRecords\": \"Nothing found - sorry\",\n                                                    \"info\": \"\'.$MULTILANG_InfDataTableViendoP.\' _PAGE_ \'.$MULTILANG_InfDataTableDe.\' _PAGES_\",\n                                                    \"infoEmpty\": \"\'.$MULTILANG_InfDataTableNoRegistrosDisponibles.\'\",\n                                                    \"infoFiltered\": \"(\'.$MULTILANG_InfDataTableFiltradoDe.\' _MAX_ \'.$MULTILANG_InfDataTableRegTotal.\')\",\n                                                    oPaginate: { sFirst:\"\'.$MULTILANG_Primero.\'\",sLast:\"\'.$MULTILANG_Ultimo.\'\",sNext:\"\'.$MULTILANG_Siguiente.\'\",sPrevious:\"\'.$MULTILANG_Previo.\'\" },\n                                                    sEmptyTable:\"\'.$MULTILANG_InfDataTableNoDatos.\'\",\n                                                    sSearch:\"\'.$MULTILANG_Buscar.\':\",\n                                                    sLoadingRecords:\"\'.$MULTILANG_Cargando.\'...\",\n                                                    sProcessing:\"\'.$MULTILANG_Procesando.\'...\",\n                                                    sZeroRecords:\"\'.$MULTILANG_InfDataTableNoRegistros.\'\",\n\n                                                    searchPanes: {\n                                                            title: {\n                                                                _: \"Filtros aplicados: %d\",\n                                                                0: \"Sin filtros aplicados\",\n                                                                1: \"Un filtro aplicado\",\n                                                            },\n                                                            collapse: {\n                                                                0: \"Opciones de filtro\",\n                                                                1: \"Filtro (uno aplicado)\",\n                                                                _: \"Opciones de filtro (%d)\"\n                                                            },\n                                                            collapseMessage: \"Colapsar todo\",\n                                                            showMessage: \"Mostrar todo\",\n                                                            clearMessage: \"Quitar filtros\",\n                                                            count: \"{total}\",\n                                                            countFiltered: \"{shown} / ({total})\"\n                                                        }\n                                                }\n                                        }\n                                    );\n                                \';\n                            } //Fin si hay un ID valido de DataTable\n                    } //Fin activacion de todas las DT\n            ?>\n            \n            //Ejecucion de algunas funciones para correcion de estilos y responsive sobre datatables\n            //Ref: https://www.gyrocode.com/articles/jquery-datatables-column-width-issues-with-bootstrap-tabs/\n            $(\'a[data-toggle=\"tab\"]\').on(\'shown.bs.tab\', function(e){\n               $($.fn.dataTable.tables(true)).DataTable()\n                  .columns.adjust();\n            });\n        });\n\n        //Busca por posibles graficos sin datos\n        $( function() {\n            <?php\n                //Desglosa la cadena de posibles graficos sin datos\n                $PCO_MarcosGraficosSinDatos=@explode(\"|\",$PCO_InformesGraficosSinDatos);\n                for ($i=0; $i<count($PCO_MarcosGraficosSinDatos);$i++)\n                    if (trim($PCO_MarcosGraficosSinDatos[$i])!=\"\")\n                        echo \'$(\"#\'.$PCO_MarcosGraficosSinDatos[$i].\'\").html(\"<br><div align=center style=\\\'color:lightgray; text-shadow: 1px 1px 2px gray;\\\'><i class=\\\'fa fa-bar-chart-o fa-fw fa-4x\\\'></i> &nbsp; <i class=\\\'fa fa-pie-chart fa-fw fa-4x\\\'></i><br><i>\'.$MULTILANG_InfSinDatos.\'</i></div>\");\';\n            ?>\n        });\n\n		//Si hay tablas con propiedad de editables espera por eventos sobre sus campos\n		$(function(){\n			$(\"td[contenteditable=true]\").on(\"blur\", function(){\n			//$(\"td[contenteditable=true]\").blur( function(){\n				var nuevo_valor_campo = $(this).text();\n				var datos_campo_peticion = $(this).attr(\"id\");\n				var partes_campo_peticion = datos_campo_peticion.split(\":\");\n				var tabla_peticion=partes_campo_peticion[0];\n				var campo_peticion=partes_campo_peticion[1];\n				var PCO_CambioEstado_CampoLlave=partes_campo_peticion[2];\n				var id_peticion=partes_campo_peticion[3];\n				\n				var ParametrosApertura=\"PCO_Accion=cambiar_estado_campo&Presentar_FullScreen=1&PCO_CambioEstado_NoUsarCore=1&PCO_CambioEstado_NegarRetorno=1&tabla=\"+tabla_peticion+\"&campo=\"+campo_peticion+\"&id=\"+id_peticion+\"&valor=\"+nuevo_valor_campo+\"&PCO_CambioEstado_CampoLlave=\"+PCO_CambioEstado_CampoLlave;\n				Actualizacion=PCO_ObtenerContenidoAjax(1,\"index.php\",ParametrosApertura);\n				\n				//Presenta mensaje temporal de actualizacion durante 1 segundo\n				PCOJS_MostrarMensajeCargandoSimple(1000);\n			});\n		});\n\n    </script>\n\n\n    <?php\n        //Carga las funciones activadoras de diferentes tipos de control (si fue encontrado algun campo de ese tipo)\n        //DatePicker\n        if (@$funciones_activacion_datepickers!=\"\")\n            echo \'<script type=\"text/javascript\">\'.$funciones_activacion_datepickers.\'</script>\';\n        //Deslizadores\n        if (@$funciones_activacion_sliders!=\"\")\n            echo \'<script type=\"text/javascript\">\'.$funciones_activacion_sliders.\'</script>\';\n        //Canvas\n        if (@$funciones_activacion_canvas!=\"\")\n            echo \'<script type=\"text/javascript\">\'.$funciones_activacion_canvas.\'</script>\';\n    ?>\n\n    <?php\n        // Calcula tiempos de ejecucion del script\n        $tiempo_final_script = PCO_ObtenerMicrotime();\n        $tiempo_total_script = $tiempo_final_script - @$tiempo_inicio_script;\n        $tiempo_total_script = round($tiempo_total_script,3);\n    ?>\n\n    <script language=\"JavaScript\">\n        //Actualiza marco con el tiempo de carga (inclusiones y PHP del lado del servidor)\n        $(\'#PCO_TCarga\').text(\"<?php echo $tiempo_total_script; ?>\");\n    </script>\n\n    <?php\n        //Si se requiere selector de iconos genera los eventos\n        if (@$PCO_Accion==\"PCOFUNC_AdministrarMenu\")\n            {\n    ?>\n        <script language=\"JavaScript\">\n            //Crea evento para el selector de iconos (cuando aplica)\n            $(\'#lib_glyphicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'glyphicon \'+e.icon;\n            });\n            $(\'#lib_ionicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'fa \'+e.icon;\n            });\n            $(\'#lib_fontawesome\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'fa \'+e.icon;\n            });\n            $(\'#lib_weathericon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'wi fa \'+e.icon;\n            });\n            $(\'#lib_mapicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=e.icon;\n            });\n            $(\'#lib_octicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'octicon \'+e.icon;\n            });\n            $(\'#lib_typicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=\'typcn fa \'+e.icon;\n            });\n            $(\'#lib_elusiveicon\').iconpicker().on(\'change\', function(e) {\n                document.PCO_FormItemMenu.imagen.value=e.icon;\n            });\n        </script>\n    <?php\n            } //Fin de eventos para selector de iconos\n    ?>\n\n    <?php\n        // Si existe el directorio para el editor ACE lo incluye\n        if (@file_exists(\"inc/ace\"))\n            {\n    ?>\n            <script src=\"inc/ace/src-min-noconflict/ace.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n            <script>\n                // Habilita el editor ACE para los textareas con el atributo data-editor\n                $(function () {\n                    $(\'textarea[data-editor]\').each(function () {\n                        var textarea = $(this);\n\n                        var mode = textarea.data(\'editor\');\n\n                        var editDiv = $(\'<div>\', {\n                            position: \'absolute\',\n                            width: textarea.width(),\n                            height: textarea.height(),\n                            \'class\': textarea.attr(\'class\')\n                        }).insertBefore(textarea);\n\n                        textarea.css(\'visibility\', \'hidden\');\n                        textarea.css(\'display\', \'none\');\n\n                        var editor = ace.edit(editDiv[0]);\n                        //editor.renderer.setShowGutter(false); //Ocultar numero de lineas, ayudas, opciones de colapsar, etc\n                        editor.getSession().setValue(textarea.val());\n                        editor.getSession().setMode(\"ace/mode/\" + mode);\n                        editor.setTheme(\"ace/theme/eclipse\"); //Establece el tema a utilizar twilight|eclipse\n                        \n                        /*\n                        // copy back to textarea on form submit...\n                        textarea.closest(\'form\').submit(function () {\n                            textarea.val(editor.getSession().getValue());\n                        })\n                        */\n\n                        //En cada evento de cambio actualiza el textarea\n                        editor.getSession().on(\'change\', function(){\n                          textarea.val(editor.getSession().getValue());\n                        });\n                        \n                    });\n                });\n            </script>\n    <?php        \n            } // Fin Si existe ACE\n    ?>\n	\n    <script language=\"JavaScript\">\n		//Activa visualmente todos los div tipo SummerNote y los asocia a cada textarea\n        $( function() {\n            <?php\n				//Activa el summernote para la edicion de controles de texto como etiqueta en formularios si se esta en esa accion\n				if ($PCO_Accion==\"PCO_EditarFormulario\")\n					{\n						echo \"\n							$(\'#Summer_valor_etiqueta\').summernote({\n							lang: \'es-ES\',\n							  height: 300,\n							  toolbar: [\n								[\'Estilos\', [\'style\']],\n								[\'Fuentes1\', [\'fontname\']],\n								[\'Fuentes2\', [\'fontsize\']],\n								[\'Operaciones\', [\'undo\', \'redo\']],\n								[\'Caracter\', [\'bold\', \'italic\', \'underline\', \'strikethrough\', \'clear\', \'color\']],\n								[\'Parrafo1\', [\'ul\', \'ol\']],\n								[\'Parrafo2\', [\'paragraph\']],\n								[\'Parrafo3\', [\'height\']],\n								[\'Insertar1\', [\'link\', \'table\', \'hr\']],\n								[\'Otros\', [\'fullscreen\', \'codeview\']], \n								[\'Insertar2\', [\'picture\', \'video\']],\n								],\n							  //ANTERIORonChange: function(contents) { document.datosform.valor_etiqueta.value=contents; }\n                              callbacks: {\n                                onChange: function(contents) {\n                                   document.datosform.valor_etiqueta.value=contents;\n                                }\n                              }\n							});\n							//ANTERIOR$(\'#Summer_valor_etiqueta\').code(document.datosform.valor_etiqueta.value);\n							$(\'#Summer_valor_etiqueta\').summernote(\'code\',document.datosform.valor_etiqueta.value);\n						\";\n					}\n            ?>\n        }); //Fin del document.ready\n    </script>\n\n    <!-- Menu Toggle Script -->\n    <script language=\"JavaScript\">\n    $(\"#menu-toggle\").on(\"click\",function(e) {\n        e.preventDefault();\n        $(\"#wrapper\").toggleClass(\"toggled\");\n    });\n    </script>\n\n    <script language=\"JavaScript\">\n		/*\n		//Activa visualmente todos los div tipo SummerNote y los asocia a cada textarea\n        $(document).ready(function() {\n			$(\'#Summer_valor_etiqueta\').summernote({\n			lang: \'es-ES\',\n			  height: 300,\n			  toolbar: [\n				[\'Estilos\', [\'style\']],\n				[\'Fuentes1\', [\'fontname\']],\n				[\'Fuentes2\', [\'fontsize\']],\n				[\'Operaciones\', [\'undo\', \'redo\']],\n				[\'Caracter\', [\'bold\', \'italic\', \'underline\', \'strikethrough\', \'clear\', \'color\']],\n				[\'Parrafo1\', [\'ul\', \'ol\']],\n				[\'Parrafo2\', [\'paragraph\']],\n				[\'Parrafo3\', [\'height\']],\n				[\'Insertar1\', [\'link\', \'table\', \'hr\']],\n				[\'Otros\', [\'fullscreen\', \'codeview\']], \n				[\'Insertar2\', [\'picture\', \'video\']],\n				],\n\n			  onChange: function(contents) { document.datos.valor_etiqueta.value=contents; }\n			});\n			$(\'#Summer_valor_etiqueta\').code(document.datos.valor_etiqueta.value);\n        }); //Fin del document.ready\n        */\n    </script>\n\n	<?php\n        //Agrega funcion para la intercepcion del submit del formulario\n        echo \'\n        <script type=\"text/javascript\">\n            PCOJS_ListaCamposValidar=\"\'.$POSTForm_ListaCamposObligatorios.\'\".split(\"|\");\n            PCOJS_ListaCombosMultiplesJoin=\"\'.@$PCO_ListaCombosMultiplesJoin.\'\".split(\"|\");\n            PCOJS_ListaTitulosValidar=\"\'.PCO_ReemplazarVariablesPHPEnCadena($POSTForm_ListaTitulosObligatorios).\'\".split(\"|\");\n            \n            function PCOJS_SanitizarValoresListaMultiple()\n                {\n                    //Antes de hacer el submit definitivo sanitiza valores de combos multiples\n                    for (var ComboMultiple of PCOJS_ListaCombosMultiplesJoin) \n                        {\n                            ComboMultiple=ComboMultiple.trim();             //Elimina posibles espacios en el id del elemento\n                            if (ComboMultiple!=\"\")\n                                {\n                                    ValorComboMultiple=$(\"#\"+ComboMultiple).val();\n                                    if (ValorComboMultiple!=null)\n                                        {\n                                            ValorSanitizadoComboMultiple=$(\"#\"+ComboMultiple).val().join(\",\");\n                                            //Asigna al campo extra del combo multiple los valores sanitizados\n                                            $(\"#PCO_ComboMultiple_\"+ComboMultiple).val(ValorSanitizadoComboMultiple);\n                                        }\n                                    else\n                                        {\n                                            //Si el combo es null porque se dejo sin valores entonces limpia campo sanitizado\n                                            $(\"#PCO_ComboMultiple_\"+ComboMultiple).val(\"\");\n                                        }\n                                }\n                        }\n                }\n            \n            \n            function PCOJS_ValidarCamposYProcesarFormulario(FormularioProcesar=\"datos\",AnularSubmit=0)\n                {\n                    MensajeCamposObligatorios=\"\";\n                    //Recorre todos los campos de la lista en busca de sus valores\n                    ConteoCamposValidacion=0;\n                    for (Campo in PCOJS_ListaCamposValidar)\n                        {\n                            //Si se tiene un nombre de campo como obligatorio valida que tenga valor\n                            if (PCOJS_ListaCamposValidar[Campo]!=\"\")\n                                {\n                                    //Valida su valor actual\n                                    if ($(\"#\"+PCOJS_ListaCamposValidar[Campo]).val() == \"\" || $(\"#\"+PCOJS_ListaCamposValidar[Campo]).val() == null )\n                                        MensajeCamposObligatorios+=\"<br><i class=\\\'fa fa-info-circle\\\'></i> \'.$MULTILANG_ErrFrmObligatorio.\' <b>\"+PCOJS_ListaTitulosValidar[ConteoCamposValidacion]+\"</b>\";\n                                }\n                            ConteoCamposValidacion++;\n                        }\n                    // Valida si hay errores y muestra el emerente, sino continua adelante y procesa el form\n                    if (MensajeCamposObligatorios!=\"\")\n                        PCOJS_MostrarMensaje(\"\'.$MULTILANG_AvisoSistema.\'\", MensajeCamposObligatorios);\n                    else\n                        {\n                            if (AnularSubmit==0)\n                                {\n                                    PCOJS_SanitizarValoresListaMultiple();\n                                    //Hace el envio del formulario\n                                    document.getElementById(FormularioProcesar).submit();\n                                }\n                        }\n                }\n        </script> \';\n\n		//Si existen funciones JavaScript generadas por algun formulario del usuario entonces las imprime\n		if(@$PCO_FuncionesJSInternasFORM!=\"\")\n			echo $PCO_FuncionesJSInternasFORM;\n	?>\n\n	<?php\n        //Agrega funcion para verificar periodicamente la conectividad del cliente\n        if (@$PCOSESS_SesionAbierta)\n            echo \'\n            <script type=\"text/javascript\">\n                function VerificarConectividad()\n                    {\n                        $.ajax({\n                            url: \"inc/version_actual.txt\",\n                            cache: false\n                        })\n                        .done(function( contenido_respuesta_html ) {\n                            $(\"#PCO_Modal_MensajeCargando\").modal(\"hide\");\n                        });\n                    }\n                var ValidadorConexion = setInterval(VerificarConectividad, 5000);\n                $(document).ajaxError(function(){\n                    if (window.console && window.console.error) {\n                        PCOJS_MostrarMensajeCargando(\"\'.$MULTILANG_EventoTipoInternet.\'\", \" <i class=\\\"fa fa-4x fa-globe fa-pull-left fa-border \\\"></i>\'.$MULTILANG_ErrorConexionInternet.\'\", 0, 100);\n                    }\n                });\n            </script> \';\n	?>\n\n	<?php\n	    //Carga tema de MaterialDesign cuando aplica\n        if ($Tema_PracticoFramework==\"material\")\n            {\n                echo \'\n                    <script src=\"inc/bootstrap-material-design/js/material.min.js\"></script>\n                    <script src=\"inc/bootstrap-material-design/js/ripples.min.js\"></script>\n                \n                    <script language=\"JavaScript\">\n                        $.material.init();\n                    </script>\';\n            }\n	?>\n\n	<?php\n	    //Solicita autorizacion de ubicar al usuario de acuerdo a la configuracion actual\n        if ($PWA_AutorizacionGPS==\"1\")\n            {\n                echo \'<script language=\"JavaScript\">\n                        PCOJS.GeoLocalizarUsuario();\n                    </script>\';\n            }\n\n	    //Solicita autorizacion para uso de camara y microfono de acuerdo a la configuracion actual\n        if ($PWA_AutorizacionCAM==\"1\" || $PWA_AutorizacionMIC==\"1\")\n            {\n                $PCO_SolicitudCAM=\'false\';\n                $PCO_SolicitudMIC=\'false\';\n                if ($PWA_AutorizacionCAM==1) $PCO_SolicitudCAM=\'true\';\n                if ($PWA_AutorizacionMIC==1) $PCO_SolicitudMIC=\'true\';\n                echo \'<script language=\"JavaScript\">\n                        navigator.getUserMedia = ( navigator.getUserMedia ||\n                                               navigator.webkitGetUserMedia ||\n                                               navigator.mozGetUserMedia ||\n                                               navigator.msGetUserMedia);\n                        navigator.getUserMedia (\n\n                           // Indica el tipo de medio al que se solicita el acceso\n                               {\n                                  video: \'.$PCO_SolicitudCAM.\',\n                                  audio: \'.$PCO_SolicitudMIC.\'\n                               },\n                           // Si no hay error, es devuelto en el objeto LocalMediaStream en un tag video:\n                               function(localMediaStream) {\n                                  var video = document.querySelector(video);\n                                  video.src = window.URL.createObjectURL(localMediaStream);\n                               },\n                           // Si hay errores lleva log a consola de depuracion\n                               function(err) {\n                                console.log(\"Practico Framework: No autorizado el uso de dispositivo de video/audio: \" + err);\n                               }\n                        );\n                    </script>\';\n            }\n	?>\n\n    <?php\n        // Estadisticas de uso anonimo con GABeacon(Deprecated) Directo por Google Analytics\n        PCO_AgregarFaroAnalytics();\n    ?>\n\n    <script language=\"JavaScript\">\n        //Limpia parametros de la URL si aplica\n        if(window.location.href.indexOf(\"?\") > -1)\n            window.history.pushState({data:true}, \"\", window.location.href.split(\"?\")[0].split(\"index.php\")[0] );\n\n        <?php\n            //Agrega scripts de postcarga para listas de seleccion si aplica\n            echo $PCO_ScriptsListaCombosPostCarga;\n        ?>\n\n        //Actualiza marco con el tiempo de carga JavaScript (tiempo de carga y transferencia)\n        var tiempo_final_javascript = (new Date()).getTime();\n        var tiempo_final_javascript_segs = (tiempo_final_javascript-tiempo_inicio_javascript)/1000;\n        $(\'#PCO_TCargaJS\').text(tiempo_final_javascript_segs);\n\n        //Mensajes de advertencia en consola de desarrollo del navegador\n        console.log(\'%c Practico Framework: <?php echo $MULTILANG_ZonaPeligro; ?>! %c\\nEsta caracteristica del navegador existe para desarrolladores.  Si alguien te sugiere copiar y pegar algun comando aqui puede comprometer tu seguridad. / This is a browser feature intended for developers. If someone told you to copy-paste something here this could break your security.\', \'color: yellow; background: darkred; font-size:1.5rem;font-weight:bold; box-shadow: 10px 3px 3px gray;\', \'font-size:1.25rem;line-height:1.1;margin-top:.5em\');\n\n    </script>\n\n</body>\n</html>','A'),(90,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-04-28 22:47:00','rafael',781,152205,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n/*include_once \'../../core/configuracion.php\';\ninclude_once \'../../core/conexiones.php\';\ninclude_once \'../../inc/practico/def_basedatos.php\';\ninclude_once \'../../core/comunes.php\';*/\n\n//echo \"$builder\";\n$saldoFavor = $factura[\"saldo_pendiente\"] < 0 ? -$factura[\"saldo_pendiente\"] : 0;\n$saldoPendienteValor = $factura[\"saldo_pendiente\"] > 0 ? $factura[\"saldo_pendiente\"] : 0;\n$saldoPendiente = number_format($saldoPendienteValor, 0, \',\', \'.\');\n\n$descargar = 0;\nif ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1;\n$fechaSinRecargoBr = str_replace(\"-\", \"\", $factura[\"fecha_sin_recargo\"]);\n$totalValor =  number_format($factura[\"valor_sin_recargo\"] + $saldoPendienteValor - $saldoFavor, 0, \',\', \'.\');\n$total = $totalValor > 0 ? $totalValor : 0;\n$totalBr = str_replace(\".\", \"\", $total);\n$codigobarra=\"7709998678439\";\n$Barcode = $codigobarra.$factura[\"id_contrato\"].\"$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n//$Barcode = \"(415)7709998678439(8020)12345(3900)50000(96)20220524\";\n//$Barcode = \"41577099986784398020123453900500009620220524\";\n//$Barcode = \"12345670\";\n\n$rayaDesprendibleBanco = str_repeat(\"- \", 34);\n\n$estadoMedidor = \"Bueno\";\nif($factura[\"estado_medidor\"] == 2) $estadoMedidor = \"Dañado\";\nif($factura[\"estado_medidor\"] == 3) $estadoMedidor = \"N/A\";\n\nfunction getMesEsp($mes) {\n    $mesesArray = [\"\",\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"];\n    return $mesesArray[$mes];\n}\n$i = 1;\n$grafBarra = \"\";\n$tableData = \"\";\n$class = \"\";\n\n$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha_fin_facturacion) mes, valor_sin_recargo, saldo_pendiente, valor_tarifa_aplicada\n    FROM \n        app_facturas\n    WHERE \n        id_contrato = \". $factura[\"id_contrato\"]. \" ORDER BY id DESC LIMIT 6\n\")->fetchAll();\n\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"], 0, \',\', \'.\');\n    $grafBarra .= \'<div class=\"barra\"><div class=\"sub_barra b\' . $i . \'\"><div class=\"tag_g\">\' . $consumo[\"consumo_actual\"] . \'</div><div class=\"tag_leyenda\">\' . $mes . \'</div></div></div>\';\n    $tableData .= \'<tr><td>\' . $mes . \'</td><td>\' . $consumo[\"consumo_actual\"] . \'</td><td>\' . $consumo[\"valor_tarifa_aplicada\"] . \'</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . (is_numeric($consumo[\"consumo_actual\"]) ? $consumo[\"consumo_actual\"] : 0) . \"%} \";\n    $i++;\n}\n\n$html = \'\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         list-style: none;\n         padding: 0;\n         text-decoration: none;\n      }\n\n    table.info, \n    .info td,\n    .info tr {\n        border-width: 0px !important;\n        border-style: none;\n        text-align:left\n    }\n      /* heading */\n\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n      }\n\n      table {\n         border-collapse: separate;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.56em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n\n      html {\n         font: 16px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.4in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.4em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n      table.inventory {\n         margin: 0 0 0.3em;\n      }\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 30%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 38%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      table.inventory td:nth-child(1) {\n         width: 26%;\n      }\n\n      table.inventory td:nth-child(2) {\n         width: 38%;\n      }\n\n      table.inventory td:nth-child(3) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(4) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(5) {\n         text-align: center;\n         width: 12%;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 40%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n      }\n      \n.board{\n    width: 100%;\n    height: 160px;\n    box-sizing: border-box;\n    overflow: hidden;\n}\n.titulo_grafica{\n    width: 100%;\n    height: 10%;\n}\n.titulo_grafica>h3{\n    padding: 0;\n    margin: 0px;\n    text-align: center;\n    color: #666666;\n}\n.sub_board{\n    width: 100%;\n    height: 100%;\n    margin-top: 0px;\n    overflow: hidden;\n    box-sizing: border-box;\n}\n.sep_board{\n    width: 100%;\n    height: 10%;\n}\n.cont_board{\n    width: 100%;\n    height: 80%;\n}\n.graf_board{\n    width: 90%;\n    height: 100%;\n    float: right;\n    margin-top: 0px;\n    background-color: darkgrey;\n    border-left: 2px solid #999999;\n    border-bottom: 2px solid #999999;\n    box-sizing: border-box;\n    display: flex;\n    background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, \n \n    rgba(0,0,0,0) 100%);\n    background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, \n    rgba(0,0,0,0) 100%);\n\n    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,\n    rgba(0,0,0,0) 100%);\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\"#00ffffff\", endColorstr=\"#00ffffff\",GradientType=0 );\n}\n.barra{\n    width:100%;\n    height: 100%;\n    margin-right: 9px;\n    margin-left: 9px;\n    background-color: none;\n    display: flex;\n    flex-wrap: wrap;\n    align-items: flex-end;\n}\n.sub_barra{\n    width: 100%;\n    height: 80%;\n    background: #00799b;\n    background: -moz-linear-gradient(top, #00799b 0%, #64d1be 100%);\n    \n    -webkit-border-radius: 12px 12px 0 0;\n    border-radius: 12px 12px 0 0;\n}\n.tag_g{\n    position: relative;\n    width: 100%;\n    height: 100%;\n    margin-bottom: 23px;\n    text-align: center;\n    margin-top: -20px;\n    z-index: 2;\n}\n.tag_leyenda{\n    text-align: center;\n    margin-top: 0px;\n}\n.tag_board{\n    height: 100%;\n    width: 15%;\n    border-bottom: 2px solid rgba(0,0,0,0);\n    box-sizing: border-box;\n}\n.sub_tag_board{\n    height: 85%;\n    width: 60%;\n    display: flex;\n    align-items: flex-end;\n    flex-wrap: wrap;\n}\n.sub_tag_board>div{\n    width: 100%;\n    height: 3%;\n    text-align: right;\n    padding-right: 3px;\n    box-sizing: border-box;\n}\n\'.$class.\'\nfooter{\n    position: absolute;\n    bottom: 0px;\n    width: 100%;\n    text-align: center;\n    font-size: 12px;\n    font-family: sans-serif;\n}\n   </style>\n\n    <script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>\n    \n    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n      <!-- BARCODE -->\n        <!--<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js\"></script>-->\n        \n		\n	\n		\n</head>\n\n<body id=\"Invoices\">\n   <article>\n      <img\n         src=\"data:image/png;base64,[encoded data, 74668 characters]\"\n         data-filename=\"logoASJ_.png\">\n      <!--<img src=\"./logoASJ_.png\">-->\n      <BR>\n      <BR>\n      <address style=\"width: 62%;\">\n         <div style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AGUAS DE SAN JERONIMO E.S.P</div>\n         <div style=\"font-size: 12px;\">NIT: 811018300-6</div>\n         <div style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</div>\n         <BR>\n         <table class=\"info\">\n            <tr>\n                <td>\n                    <p style=\"font-size: 14px;\">\n                        <span style=\"font-weight: bold;\">Contrato N° </span> \' . $factura[\"id_contrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Nombre: </span>\' . $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion_predio\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Estrato: </span>\' . $factura[\"estrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Consumo Periodo: </span>\' . $factura[\"fecha_inicio_facturacion\"] . \' - \' . $factura[\"fecha_fin_facturacion\"] . \' <br>\n                    </p>\n                </td>\n                <!--<td>\n\n                </td>-->\n            </tr>\n         </table>\n\n      </address>\n\n      <table class=\"meta\">\n         <tr>\n            <th style=\"width: 120px !important;\"><span>Factura</span></th>\n            <td><span>\' . $factura[\"id\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha sin recargo</span></th>\n            <td><span>\' . $factura[\"fecha_sin_recargo\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha con recargo</span></th>\n            <td><span>\' . $factura[\"fecha_con_recargo\"] . \'</span></td>\n         </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">INFORMACIÓN ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Medidor </span> \' . $factura[\"numero_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Diametro </span> 1/2\" <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Lectura actual </span> \' . $factura[\"lectura_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Lectura anterior </span> \' . $factura[\"lectura_anterior\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Estado medidor </span> \' . $estadoMedidor. \' <br>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                </p>\n            </td>\n        </tr>\n      </table>\n      <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n          <tr>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px; vertical-align: none !important;\">\n              <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n              \n                <tr>\n                  <th>MES</th>\n                  <th>M3</th>\n                  <th>CARGO FIJO</th>\n                  <th>TOTAL</th>\n                </tr>\n                \' . $tableData . \'\n              </table>\n            </td>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n               <div class=\"board\">\n                <div class=\"titulo_grafica\">\n                    <h3 class=\"t_grafica\">Consumos anteriores en metros cúbicos</h3>\n                </div>\n                <div class=\"sub_board\">\n                    <div class=\"cont_board\">\n                        <div class=\"graf_board\">\n                            \' . $grafBarra . \'\n                        </div>\n                        <div class=\"tag_board\">\n                            <div class=\"sub_tag_board\">\n                                <div>100</div>\n                                <div>90</div>\n                                <div>80</div>\n                                <div>70</div>\n                                <div>60</div>\n                                <div>50</div>\n                                <div>40</div>\n                                <div>30</div>\n                                <div>20</div>\n                                <div>10</div>\n                            </div>\n                        </div>\n                   </div>\n                </div>\n               </div>\n            </td>\n          </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">COSTOS REFERENCIA ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    \n                    <span>Cargo Fijo. = \' . $factura[\"valor_tarifa_aplicada\"] . \'</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    \n                    <span>CMO=Costo por consumo = \' . $factura[\"costo_medio_operacion\"] . \'</span>\n                </p>\n            </td>\n           \n        </tr>\n      </table>\n      <!--<table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Descripción</span></th>\n               <th><span>Cantidad</span></th>\n               <th style=\"background-color: #14406b;\"><span>Precio</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span>Consumo de agua m3</span></td>\n               <td><span>\' . $factura[\"consumo_actual\"] . \'</span></td>\n               <td style=\"text-align: center !important;\"><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"], 0, \',\', \'.\') . \'</span></td>\n            </tr>\n         </tbody>\n      </table> -->\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td><span>SUBTOTAL</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"] + $factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\'], 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>CUENTAS VENCIDAS</span></td>\n            <th><span data-prefix>$</span><span>\' . $saldoPendiente . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SALDO A FAVOR</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($saldoFavor, 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SUBSIDIO</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\']) . \'</span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 16px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span data-prefix>$</span><span>\' . $total . \'</span></th>\n         </tr>\n      </table>\n     <address style=\"width: 62%;\">\n      <table>\n            <tr>\n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                  <p style=\"font-size: 13px; vertical-align: middle; line-height: normal\">\n                     <span style=\"font-weight: bold;\"> Canales y medios disponibles para hacer el pago de tu\n                        factura</span>\n                     <br>\n                     <br>\n                     <span>Transferencia o consignación a la cuenta de:</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">Ahorros Bancolombia N°</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">240-000018-93</span>\n                  </p>\n               </td> \n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                    <img src=\"data:image/png;base64,[encoded data, 12256 characters]