(2,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-01-30 09:41:00','rafael',770,151511,'<?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$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha) mes, valor_sin_recargo, saldo_pendiente\n        FROM app_facturas\n        WHERE id = \'$PCO_Valor\' ORDER BY id DESC LIMIT 6 \")->fetchAll();\n\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$Barcode = \"41577099986784398020\" . $factura[\"id_contrato\"] . \"3900$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)7709998678439(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\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 = \"\";\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"] - $consumo[\"saldo_pendiente\"], 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>13690</td><td>8901</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . $consumo[\"consumo_actual\"] . \"%} \";\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    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\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.5/dist/JsBarcode.all.min.js\"></script>\n     <!--   <script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/barcodes/JsBarcode.ean-upc.min.js\"></script>-->\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;\">Estrato: </span>\' . $factura[\"estrato\"] . \'<br>-->\n                        <span style=\"font-weight: bold;\"> Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion\"] . \' <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 Y ALCANTARILLADO</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 del medidor </span> \' . $factura[\"estado_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Periodo consumo </span> \' . $factura[\"dias_facturados\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Vertimiento (m3)</span> 9 <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>V/ACU</th>\n                  <th>V/ALC</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                    <span>Tar. C. fijo = CMA</span><br>\n                    <span>CMA=Costo medio de admin. = 6736.1</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span>Tar. cons = CMO + CMI + CMT</span><br>\n                    <span>CMO=Costo medio operación = 902.49</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span>CMI=Costo medio inversión = 954.17</span><br>\n                    <span>CMT=Costo medio tasas = 7.83</span>\n                </p>\n            </td>\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\"], 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>OTROS</span></td>\n            <th><span data-prefix>$</span><span>0</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                        factur</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=\"barcodeTarget2\"/>\n                <svg id=\"barcodeTarget\"></svg>\n            </td>\n        </tr>\n    </table>\n</body>\n    <script>\n        JsBarcode(\"#barcodeTarget\", \"\' . $BarcodeParent . \'\", {\n        format: \"codabar\",// El formato\n    		width: 1.3, // La anchura de cada barra\n    		height: 60, // 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    		//textAlign: \"left\", // En dónde poner el texto. center, left o right\n    		//textPosition: \"top\", // Poner el texto arriba (top) o abajo (bottom)\n    		//textMargin: 10, // Margen entre el texto y el código de barras\n    		//background: \"#8bc34a\", // Color de fondo\n    		//lineColor: \"#FF0000\", // Color de cada barra\n    		//marginTop: 10, // Margen superior\n    		//marginRight: 10, // Margen derecho\n    		//marginBottom: 5, // Margen inferior\n    		//marginLeft: 35, // Margen izquierdo\n    	});\n    	\n    	\n\n\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();\n\n\n?>','A'),(3,'mod/app_facturas/index.php','2023-01-31 21:09:00','admin',314,18845,'<?php\nfunction Cargar_mensaje_titulo_descripcion($titulo, $descripcion, $color=\'warning\', $icono=\'envelope-open\')\n{\n    PCO_Mensaje($titulo, $descripcion, \'\', \"fa fa-$icono fa-3x\", \"alert alert-$color alert-dismissible $PCO_ErrorEstilo\");\n}\n\nfunction consultarConfig()\n{\n    return PCO_EjecutarSQL(\"SELECT dia_mes_sin_recargo, dias_despues_recargo, (porcentaje_valor_recargo/100) as porcentaje_valor_recargo FROM app_config WHERE id = 1 \")->fetch();\n}\n\nfunction redondearPesoColombiano($number) { return ceil($number / 50) * 50; }\n\n\nfunction calcularSaldoPendienteFactura($factAnt) //Lo que se devuelve aca se debe sumar a la fecha sin recargo el proximo mes\n{\n    //No tiene factura anterior\n    if(!$factAnt)\n        return 0;\n\n    $valor_pagado = $factAnt[\"valor_pagado\"];\n    $valor_sin_recargo = $factAnt[\"valor_sin_recargo\"];\n    $valor_con_recargo = $factAnt[\"valor_con_recargo\"];\n    if(is_nan($factAnt[\"saldo_pendiente\"]))\n        $factAnt[\"saldo_pendiente\"] = 0;\n\n    if(is_nan($factAnt[\"valor_pagado\"]))\n        $valor_pagado = 0;\n\n    /*if($valor_pagado == 0 || !$valor_pagado)\n        return $factAnt[\"saldo_pendiente\"] + $factAnt[\"valor_con_recargo\"] - $valor_pagado;*/\n\n    //$fecha_sin_recargo  = strtotime($factAnt[\"fecha_sin_recargo\"]);\n    $fecha_con_recargo  = strtotime($factAnt[\"fecha_con_recargo\"]);\n    $fecha_pago         = strtotime($factAnt[\"fecha_pago\"]);\n\n    if($fecha_pago < $fecha_con_recargo && $valor_pagado >= $valor_sin_recargo) {\n        return $factAnt[\"saldo_pendiente\"] + $valor_sin_recargo - $valor_pagado;\n    }\n    else { //pago con valor recargo\n        /*if($valor_pagado >= $factAnt[\"valor_con_recargo\"]) //pago a tiempo\n            return $valor_pagado - ($factAnt[\"valor_con_recargo\"] + $factAnt[\"saldo_pendiente\"]);\n        else*/\n            return $factAnt[\"saldo_pendiente\"] + $valor_con_recargo - $valor_pagado;\n    }\n}\n\nfunction dateDiffBetween2Dates($date1, $date2)\n{\n    $datetime1 = new DateTime($date1);\n    $datetime2 = new DateTime($date2);\n    $interval = $datetime1->diff($datetime2);\n    //echo $interval->format(\'%R%a days\');\n    return $interval->format(\'%a\');\n}\n\n\n/*function. calcularSaldoPendienteALaFecha($idContrato) //Lo que se devuelve aca se debe sumar a la fecha sin recargo el proximo mes\n{\n    //No tiene factura anterior\n    if(!$idContrato) \n        return 0;\n    $config = consultarConfig();\n\n    $facturas = PCO_EjecutarSQL(\"SELECT * FROM app_facturas WHERE id_contrato = \'$idContrato\' AND estado = 0 \")->fetchAll();\n\n    $saldo_pendiente = 0;\n    foreach ($facturas as $factura) {\n\n        $valor_pagado = $factura[\"valor_pagado\"];\n        $valorTotalPagarSinRecargo = $factura[\"valor_sin_recargo\"];\n        $valorTotalPagarConRecargo = $factura[\"valor_con_recargo\"];\n\n        $fecha_sin_recargo  = strtotime($factura[\"fecha_sin_recargo\"]);\n        $fecha_con_recargo  = strtotime($factura[\"fecha_con_recargo\"]);\n        $fecha_pago         = strtotime($factura[\"fecha_pago\"]);\n\n        if($fecha_pago < $fecha_con_recargo) {\n            if($valor_pagado == $valorTotalPagarSinRecargo) {//pago a tiempo\n            }\n            else\n                $saldo_pendiente .= redondearPesoColombiano(($valorTotalPagarSinRecargo - $valor_pagado) * (1 + $config[\'porcentaje_valor_recargo\']));\n        }\n        else { //pago con valor recargo\n            if($valor_pagado == $valorTotalPagarConRecargo) {//pago a tiempo\n            }\n            else\n                $saldo_pendiente .= redondearPesoColombiano($valorTotalPagarConRecargo - $valor_pagado);// * (1 + $config[\'porcentaje_valor_recargo\']));\n        }\n    }\n\n    return $saldo_pendiente;\n}*/\n\nif($PCO_Accion == \"FACTURAS_ImprimirFacturaWeb\") {\n    //include \'crear_pdf_factura.php\';\n    /*$factura = PCO_EjecutarSQL(\"SELECT z.nombre as zona, f.*, cl.nombres, cl.apellidos, cl.telefono, cl.celular, cl.correo, cl.direccion, cl.tipo_documento, cl.numero_documento, co.estrato, co.numero_medidor \n        FROM app_facturas f, app_contratos co, app_clientes cl, app_zona_cobertura z \n        WHERE cl.id = f.id_cliente AND co.id = f.id_contrato AND co.id_zona_cobertura = z.id AND f.id = \'$PCO_Valor\' \")->fetch();*/\n    $factura = PCO_EjecutarSQL(\"SELECT z.nombre as zona, z.numero_cuenta_acueducto, z.imagen_qr, f.*, cl.nombres, cl.apellidos, cl.telefono, cl.celular, cl.correo, cl.direccion, cl.tipo_documento, cl.numero_documento, cl.estrato, t.tarifa_dinamica, co.numero_medidor\n        FROM app_facturas f, app_clientes cl, app_zona_cobertura z, app_contratos co, app_tarifas t \n        WHERE f.id_contrato = co.id AND cl.id = f.id_cliente AND co.id_zona_cobertura = z.id AND t.id = co.id_tarifa AND f.id = \'$PCO_Valor\'\n    \")->fetch();\n    //include \'pdf_factura_descargar.php\';\n    if ($factura[\'tarifa_dinamica\'] == 0)\n        include \'pdf_factura_descargar.php\';\n    else\n        include \'pdf_factura_descargar_tarifa_dinamica.php\';\n}\n\nif($PCO_Accion == \"FACTURAS_FacturarConsumoMes\") {\n\n    $config = consultarConfig();\n\n    $mes = date(\"m\");\n    $year = date(\"Y\");\n    $existeMes = PCO_EjecutarSQL(\"SELECT COUNT(id) FROM app_facturacion_mes WHERE mes = \'$mes\' AND year = \'$year\' \")->fetchColumn();\n\n    if($existeMes == 0) {\n        $contratos = PCO_EjecutarSQL(\"\n            SELECT co.id, co.id_cliente, t.nombre as tarifa_aplicada, \'\' cargo_fijo, t.tarifa_dinamica, t.porcentaje_subsidios, t.subsidio_m3, t.valor_metro_cubico, co.lectura_inicial_contador, (costo * (1 + \" . $config[\'porcentaje_valor_recargo\'] . \")) as valor_con_recargo, t.costo as valor_sin_recargo, \'$year-$mes-\" . $config[\"dia_mes_sin_recargo\"] .\"\' AS fecha_sin_recargo\n                FROM app_tarifas t, app_contratos co\n                WHERE co.id_tarifa = t.id AND t.tarifa_dinamica = 0 AND co.activo = 1\n            UNION\n            SELECT co.id, co.id_cliente, t.nombre as tarifa_aplicada, t.costo cargo_fijo, t.tarifa_dinamica, t.porcentaje_subsidios, t.subsidio_m3, t.valor_metro_cubico, co.lectura_inicial_contador, \'\' valor_con_recargo, t.costo as valor_sin_recargo, \'$year-$mes-\" . $config[\"dia_mes_sin_recargo\"] .\"\' AS fecha_sin_recargo\n                FROM app_tarifas t, app_contratos co\n                WHERE co.id_tarifa = t.id AND t.tarifa_dinamica = 1 AND co.activo = 1\n        \")->fetchAll();\n        /*$contratos = PCO_EjecutarSQL(\"\n            SELECT co.id, co.id_cliente, t.nombre tarifa_aplicada, t.costo cargo_fijo, t.tarifa_dinamica, t.porcentaje_subsidios, t.subsidio_m3, t.valor_metro_cubico, co.lectura_inicial_contador, \'\' valor_con_recargo, t.costo as valor_sin_recargo, \'$year-$mes-\" . $config[\"dia_mes_sin_recargo\"] .\"\' AS fecha_sin_recargo\n                FROM app_tarifas t, app_contratos co\n                WHERE co.id_tarifa = t.id AND co.activo = 1 AND t.tarifa_dinamica = 1 ORDER BY co.id\n        \")->fetchAll();*/\n\n\n        /*$mes_anterior = date(\'m\', strtotime(\'-1 month\'));\n        $year_mes_anterior = date(\'Y\', strtotime(\'-1 month\'));*/\n        $yearMes = date(\"Y-m\", strtotime(\"-1 month\"));\n\n        $i=0;\n        foreach($contratos as $contrato) {\n//$i++;\n            $fecha_con_recargo = date(\"Y-m-d\", strtotime($contrato[\"fecha_sin_recargo\"] . \"+ \" . $config[\"dias_despues_recargo\"] . \" days\"));\n\n            //$factura[\'fecha_inicio_facturacion\'] = $fecha_inicio_facturacion;\n            $factura_anterior = PCO_EjecutarSQL(\"\n                SELECT valor_pagado, fecha_pago, valor_sin_recargo, valor_con_recargo, fecha_sin_recargo, fecha_con_recargo, saldo_pendiente\n                    FROM app_facturas\n                    WHERE id_contrato = \'\" . $contrato[\"id\"] . \"\' ORDER BY id DESC LIMIT 1\")->fetch();\n\n            $saldo_pendiente = calcularSaldoPendienteFactura($factura_anterior);\n            if($contrato[\"tarifa_dinamica\"] == 0) {\n                $fecha_inicio_facturacion = $yearMes . \'-01\';\n\n                PCO_EjecutarSQLUnaria(\"\n                    INSERT INTO app_facturas (id_cliente, id_contrato, fecha_sin_recargo, fecha_con_recargo, valor_sin_recargo, valor_con_recargo, saldo_pendiente, tarifa_aplicada, fecha_inicio_facturacion, fecha) \n                    VALUES (?,?,?,?,?,?,?,?,?,?)\", \n                    $contrato[\'id_cliente\'] . \"$_SeparadorCampos_\" . $contrato[\"id\"] . \"$_SeparadorCampos_\" . $contrato[\"fecha_sin_recargo\"] . \"$_SeparadorCampos_$fecha_con_recargo$_SeparadorCampos_\" . $contrato[\"valor_sin_recargo\"] . \"$_SeparadorCampos_\" . $contrato[\"valor_con_recargo\"] . \"$_SeparadorCampos_$saldo_pendiente$_SeparadorCampos_\" . $contrato[\"tarifa_aplicada\"] . \"$_SeparadorCampos_$fecha_inicio_facturacion$_SeparadorCampos_$PCO_FechaOperacionGuiones\"\n                );\n            } else { //Tarifa dinamica\n                $medidor = PCO_EjecutarSQL(\"\n                    SELECT cm.lectura_actual, cm.fecha_lectura, cm.estado_medidor, cm.determinacion_consumo\n                        FROM app_contratos co, app_consumo_medidor cm\n                        WHERE co.id = cm.id_contrato AND co.id = \" . $contrato[\"id\"] . \" ORDER BY cm.id DESC LIMIT 2\n                \")->fetchAll();\n                $determinacion_consumo = $medidor[0][\'determinacion_consumo\']; // app_consumo_medidor\n                $fecha_fin_facturacion = $medidor[0][\"fecha_lectura\"];\n                $estado_medidor = $medidor[0][\'estado_medidor\']; // app_consumo_medidor\n                $lectura_actual = $medidor[0][\'lectura_actual\']; // app_consumo_medidor\n                $lectura_anterior_medidor = $medidor[1][\'lectura_actual\']; // app_consumo_medidor\n                $lectura_anterior = $lectura_anterior_medidor ? $lectura_anterior_medidor : $contrato[\'lectura_inicial_contador\']; //factura anterior\n\n                $consumo_actual = $lectura_actual - $lectura_anterior; //diferencia entre lectura actual - lectura anterior\n                $fecha_inicio_facturacion = $medidor[1][\'fecha_lectura\'] ? $medidor[1][\'fecha_lectura\'] : date(\"Y-m-d\", strtotime($medidor[0][\"fecha_lectura\"] . \"-1 month\"));\n\n                $dias_facturados = dateDiffBetween2Dates($fecha_fin_facturacion, $fecha_inicio_facturacion); // resta lectura anterior\n                \n                $cantidadM3ConsumidosSubsidio = $consumo_actual >= $contrato[\'subsidio_m3\'] ? $contrato[\'subsidio_m3\'] : 0;\n                \n                $valor_subsidio = round($cantidadM3ConsumidosSubsidio * $contrato[\'valor_metro_cubico\'] * $contrato[\'porcentaje_subsidios\']/100, 2);\n\n                $valor_sin_recargo = $consumo_actual * $contrato[\'valor_metro_cubico\'] - $valor_subsidio + $contrato[\'cargo_fijo\'];\n\n                $valor_con_recargo = $valor_sin_recargo * (1 + $config[\"porcentaje_valor_recargo\"]);\n\n                //echo \"INSERT INTO app_facturas (id_cliente, id_contrato, fecha_sin_recargo, fecha_con_recargo, valor_sin_recargo, valor_con_recargo, saldo_pendiente, tarifa_aplicada, fecha_inicio_facturacion, fecha_fin_facturacion, fecha, valor_subsidio, determinacion_consumo, lectura_actual, lectura_anterior, estado_medidor, consumo_actual, dias_facturados)<BR>\";\n                //echo $contrato[\'id_cliente\'] . \"$_SeparadorCampos_\" . $contrato[\"id\"] . \"$_SeparadorCampos_\" . $contrato[\"fecha_sin_recargo\"] . \"$_SeparadorCampos_$fecha_con_recargo$_SeparadorCampos_$valor_sin_recargo$_SeparadorCampos_$valor_con_recargo$_SeparadorCampos_$saldo_pendiente$_SeparadorCampos_\" . $contrato[\"tarifa_aplicada\"] . \"$_SeparadorCampos_$fecha_inicio_facturacion$_SeparadorCampos_$fecha_fin_facturacion$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_$valor_subsidio$_SeparadorCampos_$determinacion_consumo$_SeparadorCampos_$lectura_actual$_SeparadorCampos_$lectura_anterior$_SeparadorCampos_$estado_medidor$_SeparadorCampos_$consumo_actual$_SeparadorCampos_$dias_facturados<BR>\";\n\n                PCO_EjecutarSQLUnaria(\"\n                    INSERT INTO app_facturas (id_cliente, id_contrato, fecha_sin_recargo, fecha_con_recargo, valor_sin_recargo, valor_con_recargo, saldo_pendiente, tarifa_aplicada, fecha_inicio_facturacion, fecha_fin_facturacion, fecha, valor_subsidio, determinacion_consumo, lectura_actual, lectura_anterior, estado_medidor, consumo_actual, dias_facturados)\n                    VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)\",\n                    $contrato[\'id_cliente\'] . \"$_SeparadorCampos_\" . $contrato[\"id\"] . \"$_SeparadorCampos_\" . $contrato[\"fecha_sin_recargo\"] . \"$_SeparadorCampos_$fecha_con_recargo$_SeparadorCampos_$valor_sin_recargo$_SeparadorCampos_$valor_con_recargo$_SeparadorCampos_$saldo_pendiente$_SeparadorCampos_\" . $contrato[\"tarifa_aplicada\"] . \"$_SeparadorCampos_$fecha_inicio_facturacion$_SeparadorCampos_$fecha_fin_facturacion$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_$valor_subsidio$_SeparadorCampos_$determinacion_consumo$_SeparadorCampos_$lectura_actual$_SeparadorCampos_$lectura_anterior$_SeparadorCampos_$estado_medidor$_SeparadorCampos_$consumo_actual$_SeparadorCampos_$dias_facturados$_SeparadorCampos_\"\n                );\n            }\n        }\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_facturacion_mes (mes, year) VALUES (?,?)\", \"$mes$_SeparadorCampos_$year\");\n        $titulo = \'¡Facturación creada exitosamente!\';\n        $descripcion = \'Se ha generado la facturación del mes actual.\';\n        $color = \'success\';\n        $icono = \'check-square-o\';\n    }\n    else {\n        $titulo = \'Facturación\';\n        $descripcion = \'La facturación del mes actual ya ha sido generada!\';\n        $color = \'danger\';\n        $icono = \'fa fa-close\';\n    }\n    Cargar_mensaje_titulo_descripcion($titulo, $descripcion, $color, $icono);\n    PCO_CargarFormulario(7);\n}\n\nif($PCO_Accion == \"FACTURAS_consultarFacturasMes\") {\n\n    $condiciones = \"\";\n    \n    if($zona)\n        $condiciones = \" AND c.id_zona_cobertura = $zona \";\n    \n    if($tipo_facturacion) {\n        $cond = \"=\";\n        if($tipo_facturacion != 1)\n            $cond = \"!=\";\n        $condiciones .= \" AND f.determinacion_consumo $cond 1 \";\n    }\n        \n    $result = PCO_EjecutarSQL(\"SELECT mes, year FROM app_facturacion_mes WHERE id = \'$idMes\' \")->fetch();\n\n    echo json_encode(PCO_EjecutarSQL(\"SELECT f.id FROM app_facturas f, app_clientes c WHERE f.id_cliente = c.id AND YEAR(f.fecha) = \'\" . $result[\"year\"] . \"\' AND MONTH(f.fecha) = \'\" . $result[\"mes\"] . \"\' $condiciones \")->fetchAll());\n    die();\n}\n\nif($PCO_Accion == \"FACTURAS_descargarFactura\") {\n    $factura = PCO_EjecutarSQL(\"SELECT z.nombre as zona, z.numero_cuenta_acueducto, z.imagen_qr, f.*, cl.nombres, cl.apellidos, cl.telefono, cl.celular, cl.correo, cl.direccion, cl.tipo_documento, cl.numero_documento, cl.estrato, t.tarifa_dinamica, co.numero_medidor\n        FROM app_facturas f, app_clientes cl, app_zona_cobertura z, app_contratos co, app_tarifas t \n        WHERE f.id_contrato = co.id AND cl.id = f.id_cliente AND co.id_zona_cobertura = z.id AND t.id = co.id_tarifa AND f.id = \'$id_registro_datos\'\n    \")->fetch();\n    //$factura[\'saldo_pendiente\'] = calcularSaldoPendienteALaFecha($factura[\'id_contrato\']);\n    $PCO_Valor = $id_registro_datos;\n    if ($factura[\'tarifa_dinamica\'] == 0)\n        include \'pdf_factura_descargar.php\';\n    else\n        include \'pdf_factura_descargar_tarifa_dinamica.php\';\n}\n\n/*if($PCO_Accion == \"FACTURAS_sleep\") {\n    sleep(1);\n    echo \"Hola\";\n    die();\n}*/\n\nif($PCO_Accion == \"FACTURAS_consultarInformacionFacturaPorCliente\") {\n\n    $config = consultarConfig();\n\n        $yearMes = PCO_EjecutarSQL(\"SELECT CONCAT(year,\'-\',mes) FROM app_facturacion_mes WHERE id = \'$idFactMes\' \")->fetchColumn();\n        $date = new DateTime(\"$yearMes-01\");\n        $date->modify(\'-1 month\');\n        $fecha_inicio_facturacion = date(\"Y-m-d\", strtotime(\"-1 month\"));\n\n    $factura_anterior = PCO_EjecutarSQL(\"\n        SELECT valor_pagado, fecha_pago, valor_sin_recargo, valor_con_recargo, fecha_sin_recargo, fecha_con_recargo, saldo_pendiente\n            FROM app_facturas\n            WHERE id_contrato = \'$idContrato\' ORDER BY id DESC LIMIT 1\")->fetch();\n\n    $factura = PCO_EjecutarSQL(\"\n        SELECT t.nombre as tarifa_aplicada, t.costo as valor_sin_recargo, \'$yearMes-\" . $config[\"dia_mes_sin_recargo\"] .\"\' AS fecha_sin_recargo \n            FROM app_contratos co, app_tarifas t \n            WHERE t.id = co.id_tarifa AND co.id = \'$idContrato\' \")->fetch();\n\n    $fecha_con_recargo = date(\"Y-m-d\", strtotime($factura[\"fecha_sin_recargo\"] . \"+ \" . $config[\"dias_despues_recargo\"] . \" days\"));\n    $factura[\'fecha_con_recargo\'] = $fecha_con_recargo;\n    $factura[\'valor_con_recargo\'] = redondearPesoColombiano($factura[\"valor_sin_recargo\"] * (1 + $config[\'porcentaje_valor_recargo\']));\n    $factura[\'fecha_inicio_facturacion\'] = $fecha_inicio_facturacion;\n    $factura[\'saldo_pendiente\'] = calcularSaldoPendienteFactura($factura_anterior, 0);\n    echo json_encode($factura);\n    die();\n}\n\nif($PCO_Accion == \"FACTURAS_crearFacturaCliente\") {\n\n    /*$fechaSeleccionada = PCO_EjecutarSQL(\"SELECT CONCAT(year, \'-\', mes, \'-01\') FROM app_facturacion_mes WHERE id = \'$mes_factura\' \")->fetchColumn();\n    $date = new DateTime($fechaSeleccionada);\n    $date->modify(\'-1 month\');\n    $yearMes = date(\"Y-m\", strtotime(\"-1 month\"));\n    $fecha_inicio_facturacion = $yearMes . \'-01\';*/\n        $yearMes = PCO_EjecutarSQL(\"SELECT CONCAT(year,\'-\',mes) FROM app_facturacion_mes WHERE id = \'$idFactMes\' \")->fetchColumn();\n        $date = new DateTime(\"$yearMes-01\");\n        $date->modify(\'-1 month\');\n        $fecha_inicio_facturacion = date(\"Y-m-d\", strtotime(\"-1 month\"));\n\n    $existeFacturaMes = PCO_EjecutarSQL(\"SELECT COUNT(id) FROM app_facturas \n                                            WHERE id_contrato = \'$id_contrato\' AND MONTH(fecha_inicio_facturacion) = MONTH(\'$fecha_inicio_facturacion\') \")->fetchColumn();\n\n    if($existeFacturaMes == 0) {\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_facturas (id_cliente, id_contrato, fecha_sin_recargo, fecha_con_recargo, valor_sin_recargo, valor_con_recargo, saldo_pendiente, tarifa_aplicada, fecha_inicio_facturacion) VALUES (?,?,?,?,?,?,?,?,?)\", \"$id_cliente$_SeparadorCampos_$id_contrato$_SeparadorCampos_$fecha_sin_recargo$_SeparadorCampos_$fecha_con_recargo$_SeparadorCampos_$valor_sin_recargo$_SeparadorCampos_$valor_con_recargo$_SeparadorCampos_$saldo_pendiente$_SeparadorCampos_$tarifa_aplicada$_SeparadorCampos_$fecha_inicio_facturacion\" );\n        $titulo = \'Factura\';\n        $descripcion = \'Se ha creado la factura exitosamente\';\n        $color = \'success\';\n        $icono = \'fa fa-close\';\n    } else {\n        $titulo = \'Factura\';\n        $descripcion = \'Ya se ha generado una factura para ese contrato, en ese mes seleccionado\';\n        $color = \'danger\';\n        $icono = \'fa fa-close\';\n    }\n    Cargar_mensaje_titulo_descripcion($titulo, $descripcion, $color, $icono);\n    PCO_CargarFormulario(5);\n}\n\nif($PCO_Accion == \"FACTURAS_consultarMesesFacturacion\") {\n\n    echo json_encode(PCO_EjecutarSQL(\"SELECT id, mes, year FROM app_facturacion_mes WHERE 1 ORDER BY id DESC LIMIT 12 \")->fetchAll());\n    die();\n}','A');
INSERT INTO `core_pcoder_historial` VALUES (4,'mod/app_facturas/pdf_factura_descargar.php','2023-01-31 21:10:00','admin',508,73539,'<?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/*include_once \'../../core/configuracion.php\';\ninclude_once \'../../core/conexiones.php\';\ninclude_once \'../../inc/practico/def_basedatos.php\';\ninclude_once \'../../core/comunes.php\';*/\n\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$totalValor =  number_format($factura[\"valor_sin_recargo\"] + $saldoPendienteValor - $saldoFavor, 0, \',\', \'.\');\n$total = $totalValor > 0 ? $totalValor : 0;\n\n$descargar = 0;\nif ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1;\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         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\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         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\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.5in;\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         content: \"\";\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.5em 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 1.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: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\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   </style>\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</head>\n<body id=\"Invoices\">\n\n   <article>\n      <img\n         src=\"data:image/png;base64,[encoded data, 37384 characters]\"\n         data-filename=\"logoASJ_.png\">\n      <!--<img src=\"./logoASJ_.png\">-->\n      <BR>\n      <BR>\n      <BR>\n      <address>\n         <p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AGUAS DE SAN JERONIMO E.S.P</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p>\n         <BR>\n         <p style=\"font-size: 14px;\"><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;\">Estrato: </span>\' . $factura[\"estrato\"] . \'<br>-->\n            <span style=\"font-weight: bold;\"> Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n            <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion\"] . \' <br>\n         </p>\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=\"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>1</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\"], 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>OTROS</span></td>\n            <th><span data-prefix>$</span><span>0</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        <tr>\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: 252px;\">\n            </td>\n        <tr>\n            <td colspan=\"2\" style=\"border-radius: 0 !important; border-style: none !important;\">\n                <p style=\"text-align:center; font-size: 11px; font-weight: bold;\">JORGE IGNACIO AREIZA CASTRILLON</p>\n                <p style=\"text-align:center; font-size: 11px; font-weight: bold;\">GERENTE</p>\n            </td>\n        </tr>\n         </tr>\n      </table>\n      <address style=\"width: 62%;\">\n         <table>\n            <th style=\"border: 1px solid black; font-size: 13px;\" colspan=\"2\">Canales y medios disponibles para hacer el pago de tu\n               factura</th>\n            <tr>\n               <td>\n                  <BR>\n                     <BR>\n                  <p style=\"font-size: 12px; vertical-align: middle; line-height: normal; display: inline-block;\">\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;\">\' . $factura[\"numero_cuenta_acueducto\"] . \'</span>\n                  </p>\n               </td>\n               <td>\n                  <p style=\"font-size: 11.5px;\">Escanea el código QR para pagar por la aplicación móvil\n                     Bancolombia<br><br>\n                     <img\n                        src=\"\' . $factura[\"imagen_qr\"] . \'\"\n                        data-filename=\"qrBanco.jpeg\">\n                  </p>\n               </td>\n            </tr>\n         </table>\n      </address>\n      </div>\n         <table style=\"border: 1px solid #1f60a0;\">\n            <tr>\n               <td>\n                  <p style=\"line-height: 115%; font-size:14px; font-weight: bold;\">\n                     <strong>Por favor enviar copia del soporte de pago mediante alguno de nuestros canales de pago\n                        autorizados.</strong>\n                  </p>\n                  <br>\n                  <p style=\"text-align:left !important;\" style=\"line-height: 115%; font-size:13px;\">\n                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class=\"fas fa-envelope-square fa-lg\"></i><span\n                        style=\"font-weight: bold;\"> Correo electr&oacute;nico: </span>\n                     <a\n                        href=\"mailto:acueductosveredales@aguasdesanjeronimo.gov.co\">acueductosveredales@aguasdesanjeronimo.gov.co</a>\n                     <BR>\n                     <BR>\n                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class=\"fab fa-whatsapp-square fa-lg\"></i><span\n                        style=\"font-weight: bold;\"> WhatsApp:</span> 323 581 9252\n                  </p>\n               </td>\n            </tr>\n         </table>\n      </address>\n   </article>\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</body>\n</html>\';\n\necho $html;\ndie();\n\n\n?>','A'),(5,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-02-01 09:45:00','admin',770,151511,'<?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$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha) mes, valor_sin_recargo, saldo_pendiente\n        FROM app_facturas\n        WHERE id = \'$PCO_Valor\' ORDER BY id DESC LIMIT 6 \")->fetchAll();\n\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$Barcode = \"41577099986784398020\" . $factura[\"id_contrato\"] . \"3900$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)7709998678439(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\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 = \"\";\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"] - $consumo[\"saldo_pendiente\"], 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>13690</td><td>8901</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . $consumo[\"consumo_actual\"] . \"%} \";\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    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\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.5/dist/JsBarcode.all.min.js\"></script>\n     <!--   <script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/barcodes/JsBarcode.ean-upc.min.js\"></script>-->\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;\">Estrato: </span>\' . $factura[\"estrato\"] . \'<br>-->\n                        <span style=\"font-weight: bold;\"> Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion\"] . \' <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 Y ALCANTARILLADO</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 del medidor </span> \' . $factura[\"estado_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Periodo consumo </span> \' . $factura[\"dias_facturados\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Vertimiento (m3)</span> 9 <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>V/ACU</th>\n                  <th>V/ALC</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                    <span>Tar. C. fijo = CMA</span><br>\n                    <span>CMA=Costo medio de admin. = 6736.1</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span>Tar. cons = CMO + CMI + CMT</span><br>\n                    <span>CMO=Costo medio operación = 902.49</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span>CMI=Costo medio inversión = 954.17</span><br>\n                    <span>CMT=Costo medio tasas = 7.83</span>\n                </p>\n            </td>\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\"], 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>OTROS</span></td>\n            <th><span data-prefix>$</span><span>0</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                        factur</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=\"barcodeTarget2\"/>\n                <svg id=\"barcodeTarget\"></svg>\n            </td>\n        </tr>\n    </table>\n</body>\n    <script>\n        JsBarcode(\"#barcodeTarget\", \"\' . $BarcodeParent . \'\", {\n        format: \"codabar\",// El formato\n    		width: 1.3, // La anchura de cada barra\n    		height: 60, // 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    		//textAlign: \"left\", // En dónde poner el texto. center, left o right\n    		//textPosition: \"top\", // Poner el texto arriba (top) o abajo (bottom)\n    		//textMargin: 10, // Margen entre el texto y el código de barras\n    		//background: \"#8bc34a\", // Color de fondo\n    		//lineColor: \"#FF0000\", // Color de cada barra\n    		//marginTop: 10, // Margen superior\n    		//marginRight: 10, // Margen derecho\n    		//marginBottom: 5, // Margen inferior\n    		//marginLeft: 35, // Margen izquierdo\n    	});\n    	\n    	\n\n\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();\n\n\n?>','A'),(6,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-02-01 09:46:00','admin',770,151512,'<?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$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha) mes, valor_sin_recargo, saldo_pendiente\n        FROM app_facturas\n        WHERE id = \'$PCO_Valor\' ORDER BY id DESC LIMIT 6 \")->fetchAll();\n\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$Barcode = \"41577099986784398020\" . $factura[\"id_contrato\"] . \"3900$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)7709998678439(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\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 = \"\";\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"] - $consumo[\"saldo_pendiente\"], 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>13690</td><td>8901</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . $consumo[\"consumo_actual\"] . \"%} \";\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    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\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.5/dist/JsBarcode.all.min.js\"></script>\n     <!--   <script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/barcodes/JsBarcode.ean-upc.min.js\"></script>-->\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;\">Estrato: </span>\' . $factura[\"estrato\"] . \'<br>-->\n                        <span style=\"font-weight: bold;\"> Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion\"] . \' <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 Y ALCANTARILLADO</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 del medidor </span> \' . $factura[\"estado_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Periodo consumo </span> \' . $factura[\"dias_facturados\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Vertimiento (m3)</span> 9 <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>V/ACU</th>\n                  <th>V/ALC</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                    <span>Tar. C. fijo = CMA</span><br>\n                    <span>CMA=Costo medio de admin. = 6736.1</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span>Tar. cons = CMO + CMI + CMT</span><br>\n                    <span>CMO=Costo medio operación = 902.49</span>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span>CMI=Costo medio inversión = 954.17</span><br>\n                    <span>CMT=Costo medio tasas = 7.83</span>\n                </p>\n            </td>\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\"], 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>OTROS</span></td>\n            <th><span data-prefix>$</span><span>0</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                        factur</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, 6418 characters]