	{\n						$JavaScriptInforme=PCO_ReemplazarVariablesPHPEnCadena(trim($registro_informe[\"javascript\"]));\n					}\n			}\n\n		//Determina si se deben ocultar elementos por banderas o porque el informe asi lo obliga\n		$ComplementoAnulacionPiePagina=\'\';\n		if ($anular_piepagina==1 || $registro_informe[\"ocultar_piepagina\"]==1) $ComplementoAnulacionPiePagina=\' style=\"display:none; visibility:hidden;\" \';\n		$ComplementoAnulacionEncabezado=\'\';\n		if ($anular_encabezado==1 || $registro_informe[\"ocultar_encabezado\"]==1) $ComplementoAnulacionEncabezado=\' style=\"display:none; visibility:hidden;\" \';\n		if ($anular_acciones==0 && $registro_informe[\"anular_acciones\"]==1) $anular_acciones=1;\n\n		if ($SQLPuro==\"\")\n			{\n				//Si el informe usa una conexion externa busca su configuracion\n				if($registro_informe[\"conexion_origen_datos\"]!=\"\")\n					{\n						$registro_conexiones=PCO_EjecutarSQL(\"SELECT id,\".$ListaCamposSinID_replicasbd.\" FROM \".$TablasCore.\"replicasbd WHERE nombre=\'\".$registro_informe[\"conexion_origen_datos\"].\"\' \")->fetch();\n						global ${$registro_conexiones[\"nombre\"]};\n						$NombreConexionExtra=${$registro_conexiones[\"nombre\"]};\n					}\n				//Si no encuentra informe presenta error\n				if ($registro_informe[\"id\"]==\"\") PCO_Mensaje($MULTILANG_ErrorTiempoEjecucion,$MULTILANG_ObjetoNoExiste.\" \".$MULTILANG_ContacteAdmin.\"<br>(\".$MULTILANG_Informes.\" $informe)\", \'\', \'fa fa-times fa-5x icon-red texto-blink\', \'alert alert-danger alert-dismissible\');\n			}\n\n		//Identifica si el informe requiere un formulario de filtrado previo\n		if ($registro_informe[\"formulario_filtrado\"]!=\"\")\n			{\n				//Determina si solicita el informe desde el formulario de filtrado apropiado, sino redirecciona a este\n				global $PCO_FormularioActivo;\n				if ($registro_informe[\"formulario_filtrado\"]!=$PCO_FormularioActivo)\n					{\n						echo \'<form name=\"precarga_form_filtro\" action=\"\'.$ArchivoCORE.\'\" method=\"POST\" target=\"_self\">\n							<input type=\"Hidden\" name=\"PCO_Accion\" value=\"PCO_CargarObjeto\">\n							<input type=\"Hidden\" name=\"PCO_InformeFiltro\" value=\"\'.$registro_informe[\"id\"].\'\">\n							<input type=\"Hidden\" name=\"PCO_Objeto\" value=\"frm:\'.$registro_informe[\"formulario_filtrado\"].\':1\">\n							<input type=\"Hidden\" name=\"Presentar_FullScreen\" value=\"\'.@$Presentar_FullScreen.\'\">\n							<input type=\"Hidden\" name=\"Precarga_EstilosBS\" value=\"\'.@$Precarga_EstilosBS.\'\">\n							</form>\n						<script type=\"\" language=\"JavaScript\"> document.precarga_form_filtro.submit();  </script>\';\n						die();\n					}\n			}\n\n		//Si hay variables de filtro definidas busca su valor en el contexto global\n		if($registro_informe[\"variables_filtro\"]!=\"\")\n			{\n				$arreglo_variables_filtro = @explode(\",\",$registro_informe[\"variables_filtro\"]);\n				//Busca y convierte cada variable recibida en global\n				foreach ($arreglo_variables_filtro as $nombre_variable_filtro)\n					{\n						//if (isset(${$nombre_variable_filtro}))  // {Deprecated}\n							global ${$nombre_variable_filtro};\n					}\n			}\n\n		//Si no hay SQL explicito entonces Genera la consulta en SQL para el informe a partir de los parametros\n		if (strlen($registro_informe[\"consulta_sql\"])<5)\n			{\n				if ($SQLPuro==\"\")\n					$consulta=PCO_ConstruirConsultaInforme($informe,0); //Construye query del informe sin evitar campos ocultos (0)\n				else\n					$consulta=PCO_ReemplazarVariablesPHPEnCadena($SQLPuro);\n			}\n		else\n			$consulta=PCO_ReemplazarVariablesPHPEnCadena($registro_informe[\"consulta_sql\"]);\n\n		// Si el informe tiene formato_final = T (tabla de datos)\n		if ($registro_informe[\"formato_final\"]==\"T\" || $SQLPuro!=\"\")\n			{\n				$SalidaFinalInforme=\'\';\n				if ($en_ventana)\n					{\n						//Cuando es embebido (=1) no imprime el boton de retorno pues se asume dentro de un formulario\n						if (!$embebido)\n							echo \'<div align=center id=\"PCOContenedor_BotonEscritorio\"><button type=\"Button\" onclick=\"document.PCO_FormVerMenu.submit()\" class=\"btn btn-warning\"><i class=\"fa fa-home fa-fw\"></i> \'.$MULTILANG_IrEscritorio.\'</button></div><br>\';\n\n						$TituloVentanaInforme=PCO_ReemplazarVariablesPHPEnCadena($registro_informe[\"titulo\"]);\n						//Define si requiere o no boton de exportacion en la barra de titulo\n						if ($registro_informe[\"genera_pdf\"]!=\'N\' && $embebido!=1)\n							{\n								//Formato nativo\n								if ($registro_informe[\"genera_pdf\"]==\'S\' || $registro_informe[\"genera_pdf\"]==\'A\')\n									{\n										$TituloVentanaInforme=\'\n										<a class=\"btn btn-primary btn-xs pull-right\" data-toggle=\"modal\" href=\"#myModalEXPORTACION\">\n											<div><i class=\"fa fa-floppy-o fa-fw\"></i> \'.$MULTILANG_Exportar.\'</div>\n										</a>\'.$TituloVentanaInforme;\n									}\n							}\n\n						//Define si requiere o no boton de exportacion en la barra de titulo\n						//Formato CSV por AJAX - Solo genera el marco, el boton se agrega luego cuando se conozca el ID de la cache de informe (mas abajo)\n						if ($registro_informe[\"genera_pdf\"]==\'C\' || $registro_informe[\"genera_pdf\"]==\'A\')\n							{\n								$TituloVentanaInforme=\'<div id=\"PCO_MarcoBotonCSVInforme\'.$informe.\'\" class=\"pull-right\" style=\"margin-left:5px;\"></div>\'.$TituloVentanaInforme;\n							}\n\n						//Carga la ventana con el informe\n						PCO_AbrirVentana($TituloVentanaInforme.$ComplementoIdObjetoEnTitulo,\'panel panel-info\',$registro_informe[\"ancho\"]);\n\n						//Agrega la descripcion del informe en caso de contar con ella\n						if ($registro_informe[\"descripcion\"]!=\'\')\n							{\n								 PCO_Mensaje(\'<i class=\"fa fa-flag fa-fw\"></i>\',PCO_ReemplazarVariablesPHPEnCadena($registro_informe[\"descripcion\"]), \'\', \'\', \'alert alert-success alert-dismissible\');\n							}\n					}\n\n				// Si se ha definido un tamano fijo entonces crea el marco\n				if ($registro_informe[\"ancho\"]!=\"\" && $registro_informe[\"alto\"]!=\"\")\n					echo \'<DIV style=\"DISPLAY: block; OVERFLOW: auto; POSITION: relative; WIDTH: \'.$registro_informe[\"ancho\"].\' !important; HEIGHT: \'.$registro_informe[\"alto\"].\' !important\">\';\n\n				//Genera enlaces a las opciones de descarga\n				if (($registro_informe[\"genera_pdf\"]==\'S\' || $registro_informe[\"genera_pdf\"]==\'A\')  && $embebido!=1)\n					include_once(\"core/marco_export.php\");\n\n					//DEPRECATED echo \'	<html>		<body leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\" marginheight=\"0\" style=\"font-size: 12px; font-family: Arial, Verdana, Tahoma;\">\';\n\n					//Agrega titulo o encabezado si esta definido\n					if ( $registro_informe[\"encabezado_html\"] != \'\' )\n						$SalidaFinalInforme.= \'<div id=\"titulo-informe-ID\'.$registro_informe[\"id\"].\'\">\'.PCO_ReemplazarVariablesPHPEnCadena($registro_informe[\"encabezado_html\"]).\'</div>\';\n\n					//Agrega clases para convertir la tabla a responsive si aplica\n					$ComplementoResponsiveTabla=\'\';\n					if ( $registro_informe[\"tabla_responsive\"] == \'S\' )\n						$ComplementoResponsiveTabla= \'responsive nowrap\';\n\n					$SalidaFinalInforme.= \'<!--<div class=\"table-responsive\">-->\n											<table width=\"100%\" class=\"btn-xs table table-condensed table-hover order-column table-striped table-unbordered  \'.$ComplementoResponsiveTabla.\'  \'.$estilo.\'\" id=\"TablaInforme_\'.$registro_informe[\"id\"].\'\"><thead id=\"PCO_EncabezadosInforme_\'.$registro_informe[\"id\"].\'\" \'.$ComplementoAnulacionEncabezado.\'>\';\n\n					//Busca si tiene acciones (botones) para cada registro y los genera\n					if (!$anular_acciones)\n						{\n							$cadena_generica_botones_principio=PCO_GenerarBotonesInforme($informe,1);\n							$cadena_generica_botones=PCO_GenerarBotonesInforme($informe);\n						}\n					else\n						{\n							$cadena_generica_botones_principio=\'\';\n							$cadena_generica_botones=\"\";\n						}\n\n					//Si el informe tiene botones al comienzo entonces agrega columna adicional\n					if ($cadena_generica_botones_principio!=\"\")\n						{\n							$SalidaFinalInforme.= \'<th></th>\';\n						}\n\n					//Determina si el informe tiene o no campos ocultos\n					$PCO_ColumnasOcultas=PCO_DeterminarCamposOcultos($informe);\n\n					//Obtiene ColumnasVisibles, NumerosColumnasOcultas, NumeroColumnas dentro de EtiquetasConsulta\n					$EtiquetasConsulta=PCO_GenerarEtiquetasConsulta($consulta,$informe); //Enviar el informe para que se determinen tambien sus columnas ocultas\n\n					//Genera HTML con las columnas\n					//Busca los campos definidos en el informe como visibles y luego determina si el campo tiene o no titulo arbitrario\n					$ListaCampos_TitutloArbitrario=array();\n					$consulta_titulosarbitrarios=PCO_EjecutarSQL(\"SELECT id,\".$ListaCamposSinID_informe_campos.\" FROM \".$TablasCore.\"informe_campos WHERE informe=? AND visible=1 ORDER BY peso,id\",\"$informe\");\n					while ($registro_titulosarbitrarios = $consulta_titulosarbitrarios->fetch())\n							$ListaCampos_TitutloArbitrario[]=$registro_titulosarbitrarios[\"titulo_arbitrario\"];\n					$ConteoPosicionColumna=0;   //Utilizado para conocer la columna actual y luego buscar si tiene titulo arbitrario\n					$ListaColumnasInforme=\"\";   //Acumula las columnas para ser usadas luego en los DataTables (si aplica)\n					foreach($EtiquetasConsulta[0][\"ColumnasVisibles\"] as $EtiquetaColumna)\n						{\n							$TituloFinalColumna=$EtiquetaColumna;\n							//Si la columna actual tiene un titulo arbitrario definido entonces lo agrega\n							if (@$ListaCampos_TitutloArbitrario[$ConteoPosicionColumna]!=\"\")\n								$TituloFinalColumna=PCO_ReemplazarVariablesPHPEnCadena($ListaCampos_TitutloArbitrario[$ConteoPosicionColumna]);\n							$SalidaFinalInforme.= \'<th>\'.$TituloFinalColumna.\'</th>\';\n							$ListaColumnasInforme.=$TituloFinalColumna.\',\';\n							$ConteoPosicionColumna++;\n						}\n					$ListaColumnasInforme=substr($ListaColumnasInforme, 0, -1);//Elimina la coma sobrante del informe\n					//Si el informe tiene botones al final entonces agrega columna adicional\n					if ($cadena_generica_botones!=\"\")\n						{\n							$SalidaFinalInforme.= \'<th></th>\';\n						}\n					$SalidaFinalInforme.= \'</tr></thead><tbody>\';\n\n					//Busca los campos y tablas reales del informe para construir luego los ID unicos\n					$CamposReales=PCO_CamposRealesInforme($informe);\n\n					// Imprime registros del resultado\n					$numero_filas=0;\n\n					//Si el informe usa una conexion externa usa su configuracion\n					if($registro_informe[\"conexion_origen_datos\"]!=\"\")\n						$consulta_ejecucion=PCO_EjecutarSQL($consulta,\"\",${$registro_conexiones[\"nombre\"]});\n					else\n						$consulta_ejecucion=PCO_EjecutarSQL($consulta);\n						\n					//Asigna el total dde registros a variable global para posible uso fuera de la funcion\n					$PCOVAR_ConteoRegistrosUltimoInforme=$consulta_ejecucion->rowCount();\n\n					//Lleva informe a la cache siempre y cuando no sea un informe interno del framework\n					$IdCacheInformes=0;\n					PCO_EjecutarSQLUnaria(\"INSERT INTO {$TablasCore}informe_cache (informe,usuario,conexion,script_sql,columnas) VALUES(\'{$informe}\',\'{$PCOSESS_LoginUsuario}\',\'{$NombreConexionExtra}\',?,\'{$ListaColumnasInforme}\') \",\"{$consulta}\");\n					$IdCacheInformes=PCO_ObtenerUltimoIDInsertado();\n\n					//Ahora que se tiene una cache, determina si se requiere boton de exportacion CSV por AJAX y lo agrega\n					if ($registro_informe[\"genera_pdf\"]==\'C\' || $registro_informe[\"genera_pdf\"]==\'A\')\n						{\n							echo \"<script language=\'JavaScript\'>\n								$(\'#PCO_MarcoBotonCSVInforme{$informe}\').html(\'<a class=\\\"btn btn-success btn-xs pull-right\\\" href=\\\"core/ajax.php?PCO_Accion=PCO_ExportacionQueryCacheCSV&amp;IdRegistro_CacheSQL={$IdCacheInformes}\\\"> <i class=\\\"fa fa-file-excel-o fa-fw\\\"></i> {$MULTILANG_Exportar} CSV </a>\');\n							</script>\";\n						}\n\n					//Si el informe va a soportar datatable entonces lo agrega a las tablas que deben ser convertidas en el pageonload\n					if ($registro_informe[\"soporte_datatable\"]==\"S\")\n						{\n							@$PCO_InformesDataTable.=\"TablaInforme_\".$registro_informe[\"id\"].\"|\";\n							@$PCO_InformesDataTablePaginaciones.=$registro_informe[\"tamano_paginacion\"].\"|\"; //Agrega tamano predefinido para la tabla\n							@$PCO_InformesDataTableTotales.=$registro_informe[\"subtotales_columna\"].\"|\";\n							@$PCO_InformesDataTableFormatoTotales.=$registro_informe[\"subtotales_formato\"].\"|\";\n							@$PCO_InformesDataTableExrpotaCLP.=$registro_informe[\"exportar_dtclp\"].\"|\";\n							@$PCO_InformesDataTableExrpotaCSV.=$registro_informe[\"exportar_dtcsv\"].\"|\";\n							@$PCO_InformesDataTableExrpotaXLS.=$registro_informe[\"exportar_dtxls\"].\"|\";\n							@$PCO_InformesDataTableExrpotaPDF.=$registro_informe[\"exportar_dtpdf\"].\"|\";\n							@$PCO_InformesDataTableDefineCOLS.=$registro_informe[\"definir_cols\"].\"|\";\n							@$PCO_InformesIdCache.=$IdCacheInformes.\"|\";\n							@$PCO_InformesListaColumnasDT.=$ListaColumnasInforme.\"|\";\n							@$PCO_InformesDataTable_pane_activado.=$registro_informe[\"pane_activado\"].\"|\";\n							@$PCO_InformesDataTable_pane_cascada.=$registro_informe[\"pane_cascada\"].\"|\";\n							@$PCO_InformesDataTable_pane_colapsado.=$registro_informe[\"pane_colapsado\"].\"|\";\n							@$PCO_InformesDataTable_pane_columnas.=$registro_informe[\"pane_columnas\"].\"|\";\n							@$PCO_InformesDataTable_pane_subtotalesrelativos.=$registro_informe[\"pane_subtotalesrelativos\"].\"|\";\n							@$PCO_InformesDataTable_pane_conteos.=$registro_informe[\"pane_conteos\"].\"|\";\n							@$PCO_InformesDataTable_pane_controles.=$registro_informe[\"pane_controles\"].\"|\";\n							@$PCO_InformesDataTable_pane_control_colapsar.=$registro_informe[\"pane_control_colapsar\"].\"|\";\n							@$PCO_InformesDataTable_pane_control_ordenar.=$registro_informe[\"pane_control_ordenar\"].\"|\";\n						}\n\n					if ($registro_informe[\"usar_ajax\"]==0)\n						{\n							//Define banderas para determinar si el informe se recupera por AJAX o no posteriormente en marco_abajo\n							if ($registro_informe[\"soporte_datatable\"]==\"S\")\n								$PCO_InformesRecuperacionAJAX.=\"0\".\"|\";\n		\n							//Procesa resultados solo si es diferente de 1 que es el valor retornado cuando hay errores evitando el fatal error del fetch(), rowCount() y demas metodos\n							while($consulta_ejecucion!=\"1\" && $registro_datos_informe=$consulta_ejecucion->fetch())\n								{\n									$SalidaFinalInforme.= \'<tr>\';\n		\n									//Si el informe tiene botones al comienzo los agrega\n									if ($cadena_generica_botones_principio!=\"\")\n										{\n											//Transforma la cadena generica con los datos especificos del registro, toma por ahora el primer campo (OCULTO O NO)\n											$cadena_botones_registro=str_replace(\"DELFRMVALVALOR\",$registro_datos_informe[0],$cadena_generica_botones_principio);\n											$cadena_botones_registro=str_replace(\"DETFRMVALBASE\",$registro_datos_informe[0],$cadena_botones_registro);\n											//Muestra los botones preparados para el registro\n											$SalidaFinalInforme.= \'<td>\'.$cadena_botones_registro.\'</td>\';\n										}\n		\n									for ($i=0;$i<$EtiquetasConsulta[0][\"NumeroColumnas\"];$i++)\n										{\n											//Muestra la columna solo si no se trata de una de las ocultas\n											if (@!in_array($i,$EtiquetasConsulta[0][\"NumerosColumnasOcultas\"]))\n												{\n													$ValorCampoIdentificador=$registro_datos_informe[0]; //Toma por ahora el primer campo (OCULTO O NO)\n													$Nombre_CampoLlave=@$CamposReales[0][\"ListaCampos_NombreSimple\"][0]; //Toma por ahora el primer campo (OCULTO O NO)\n													$Nombre_CampoEditable=@$CamposReales[0][\"ListaCampos_NombreSimple\"][$i];\n													$Nombre_TablaEditable=@$CamposReales[0][\"ListaTablas_NombreSimple\"][$i];\n													$IdentificadorDeCampoEditable=\"$Nombre_TablaEditable:$Nombre_CampoEditable:$Nombre_CampoLlave:$ValorCampoIdentificador\";\n		\n													//Determina la activacion o no de la cadena de edicion del campo\n													$CadenaActivadora_Edicion=\"\";\n													if (@$CamposReales[0][\"ListaCampos_PermitirEdicion\"][$i]==1)\n														$CadenaActivadora_Edicion=\' id=\"\'.$IdentificadorDeCampoEditable.\'\" contenteditable=\"true\" \';\n		\n													$ValorVisibleFinal=$registro_datos_informe[$i];\n													if ($ModoDesarrolladorPractico==1) $ValorVisibleFinal=PCO_ReemplazarVariablesPHPEnCadena($ValorVisibleFinal);\n		\n													$SalidaFinalInforme.= \'\n														<td \'.$CadenaActivadora_Edicion.\'>\'.$ValorVisibleFinal.\'</td>\';\n												}\n										}\n		\n									//Si el informe tiene botones al final los agrega\n									if ($cadena_generica_botones!=\"\")\n										{\n											//Transforma la cadena generica con los datos especificos del registro, toma por ahora el primer campo (OCULTO O NO)\n											$cadena_botones_registro=str_replace(\"DELFRMVALVALOR\",$registro_datos_informe[0],$cadena_generica_botones);\n											$cadena_botones_registro=str_replace(\"DETFRMVALBASE\",$registro_datos_informe[0],$cadena_botones_registro);\n											//Muestra los botones preparados para el registro\n											$SalidaFinalInforme.= \'<td>\'.$cadena_botones_registro.\'</td>\';\n										}\n		\n									$SalidaFinalInforme.= \'</tr>\';\n									$numero_filas++;\n								}\n						}\n					else\n						{\n							//Define banderas para determinar si el informe se recupera por AJAX o no posteriormente en marco_abajo\n							if ($registro_informe[\"soporte_datatable\"]==\"S\")\n								$PCO_InformesRecuperacionAJAX.=\"1\".\"|\";\n						}\n\n					$SalidaFinalInforme.= \'</tbody>\';\n\n					//Si se desea tabla responsive oculta el pie de pagina (libreria datatables no soporta responsive con tfooter ni recupareacion ajax con tfooter)\n					if ($registro_informe[\"tabla_responsive\"] == \'N\' &&  $registro_informe[\"usar_ajax\"]==\"0\")\n						{\n							$SalidaFinalInforme.= \'<tfoot id=\"PCO_PiePaginaInforme_\'.$registro_informe[\"id\"].\'\" \'.$ComplementoAnulacionPiePagina.\'>\';\n							//Cuando es embebido (=1) no agrega los totales de registro\n							//if (!$embebido)\n							$CantidadColumnasSpan=$ConteoPosicionColumna-1;\n							@$SalidaFinalInforme.= \'\n								<tr>\n									<th colspan=\'.$CantidadColumnasSpan.\'>\n										<b>\'.$MULTILANG_TotalRegistros.\': </b>\'.$numero_filas.\'\n									</th>\n								</tr>\';\n							//Cierra pie de pagina, tabla y marco responsive para la tabla\n							$SalidaFinalInforme.= \'</tfoot>\';\n						}\n					\n					$SalidaFinalInforme.= \'\n							</table>\n							<!--</div>-->\';\n				// DEPRECATED $SalidaFinalInforme.= \'</body></html>\';\n\n				//Imprime el HTML generado para el informe\n				echo $SalidaFinalInforme;\n\n				// Si se ha definido un tamano fijo entonces cierra el marco\n				if ($registro_informe[\"ancho\"]!=\"\" && $registro_informe[\"alto\"]!=\"\")\n					echo \'</DIV>\';\n\n			} // Fin si informe es T (tabla)\n\n/*\n		//Verifica si es un informe grafico sin dimensiones\n		if ($registro_informe[\"formato_final\"]==\"G\" && ( $registro_informe[\"ancho\"]==\"\" || $registro_informe[\"alto\"]==\"\" ))\n			{\n				echo \'<form name=\"cancelarXTamano\" action=\"\'.$ArchivoCORE.\'\" method=\"POST\">\n					<input type=\"Hidden\" name=\"PCO_Accion\" value=\"PCO_VerMenu\">\n					<input type=\"Hidden\" name=\"PCO_ErrorTitulo\" value=\"\'.$MULTILANG_ErrorDatos.\'\">\n					<input type=\"Hidden\" name=\"PCO_ErrorDescripcion\" value=\"\'.$MULTILANG_InfErrTamano.\'\">\n					</form>\n					<script type=\"\" language=\"JavaScript\"> document.cancelarXTamano.submit();  </script>\';\n			}\n*/\n		// Si el informe tiene formato_final = G (grafico)\n		if ($registro_informe[\"formato_final\"]==\"G\")\n			{\n				// Si se ha definido un tamano fijo entonces crea el marco\n				if ($registro_informe[\"ancho\"]!=\"\" && $registro_informe[\"alto\"]!=\"\" && $registro_informe[\"ancho\"]!=\"0\" && $registro_informe[\"alto\"]!=\"0\")\n					echo \'<DIV style=\"DISPLAY: block; OVERFLOW: no; POSITION: relative; WIDTH: \'.$registro_informe[\"ancho\"].\' !important; HEIGHT: \'.$registro_informe[\"alto\"].\' !important\">\';\n\n				//Consulta el formato de grafico y datos de series para ponerlo en los campos\n				//Dado por: Tipo|Nombre1!NombreN|Etiqueta1!EtiquetaN|Valor1!ValorN|\n				$formato_base=explode(\"|\",$registro_informe[\"formato_grafico\"]);\n				$tipo_grafico=$formato_base[0];\n				$lista_nombre_series=explode(\"!\",$formato_base[1]);\n				$lista_etiqueta_series=explode(\"!\",$formato_base[2]);\n				$lista_valor_series=explode(\"!\",$formato_base[3]);\n				//Carga detalles extendidos para el formato de grafico y los corrige en el caso de graficos viejos\n				$barra_apilada=$formato_base[4];	if ($barra_apilada==\"\") $barra_apilada=\"false\";\n				$ocultar_grilla=$formato_base[5];   if ($ocultar_grilla==\"\") $ocultar_grilla=\"false\";\n				$ocultar_ejes=$formato_base[6];	 if ($ocultar_ejes==\"\") $ocultar_ejes=\"false\";\n				$unidades_pre=$formato_base[7];	 if ($unidades_pre==\"\") $unidades_pre=\"\";\n				$unidades_pos=$formato_base[8];	 if ($unidades_pos==\"\") $unidades_pos=\"\";\n				$barras_horizontales=\"false\";  //Asume barras verticales por defecto\n				if ($tipo_grafico==\"barrah\")  $barras_horizontales=\"true\";\n				$tipo_grafico_circular=\"donut\";  //Asume barras verticales por defecto\n				if ($tipo_grafico==\"torta\" || $tipo_grafico==\"tortap\")  $tipo_grafico_circular=\"pie\";\n				$presentar_porcentaje=\"false\";  //Asume que el grafico no es con porcentajes en tortas\n				if ($tipo_grafico==\"donap\" || $tipo_grafico==\"tortap\")  $presentar_porcentaje=\"true\";\n\n				$presentar_datalabels=\"false\";  //Asume que no se presentan las etiquetas con valores de datos\n				$cadenaubicacion_datalabels=\"\";\n				if($formato_base[9]!=\"false\" && $formato_base[9]!=\"\") $presentar_datalabels=\"true\";\n				if($formato_base[9]==\"true_outside\") $cadenaubicacion_datalabels=\"dataLabelsPosition: \'outside\',\";\n				if($formato_base[9]==\"true_inside\") $cadenaubicacion_datalabels=\"dataLabelsPosition: \'inside\',\";\n\n				$cadena_arreglo_colores=\"\";\n				if($formato_base[10]!=\"\") $cadena_arreglo_colores=\"colors: \".$formato_base[10].\",\";\n\n				//Elimina los nombres de tabla en caso de tener punto y usa los alias si los tiene\n				for ($i=0;$i<5;$i++)\n					{\n						//Elimina nombres de tabla encontrando el punto y seleccionando siguiente palabra\n						if (strpos($lista_etiqueta_series[$i], \".\"))\n							{\n								$tmp=explode(\".\",$lista_etiqueta_series[$i]);\n								$lista_etiqueta_series[$i]=$tmp[1];\n							}\n						if (strpos($lista_valor_series[$i], \".\"))\n							{\n								$tmp=explode(\".\",$lista_valor_series[$i]);\n								$lista_valor_series[$i]=$tmp[1];\n							}\n						// Prefiere los alias sobre los nombres de campo cuando encuentra un AS\n						if (strpos($lista_etiqueta_series[$i], \" AS \"))\n							{\n								$tmp=explode(\" AS \",$lista_etiqueta_series[$i]);\n								$lista_etiqueta_series[$i]=$tmp[1];\n							}\n						if (strpos($lista_valor_series[$i], \" AS \"))\n							{\n								$tmp=explode(\" AS \",$lista_valor_series[$i]);\n								$lista_valor_series[$i]=$tmp[1];\n							}\n					}\n				$nombre_serie_1=preg_replace(\'~[^a-zA-Z0-9_]~\', \'\', str_replace ( \" \" , \"_\", $lista_nombre_series[0] ) );\n				$nombre_serie_2=preg_replace(\'~[^a-zA-Z0-9_]~\', \'\', str_replace ( \" \" , \"_\", $lista_nombre_series[1] ) );\n				$nombre_serie_3=preg_replace(\'~[^a-zA-Z0-9_]~\', \'\', str_replace ( \" \" , \"_\", $lista_nombre_series[2] ) );\n				$nombre_serie_4=preg_replace(\'~[^a-zA-Z0-9_]~\', \'\', str_replace ( \" \" , \"_\", $lista_nombre_series[3] ) );\n				$nombre_serie_5=preg_replace(\'~[^a-zA-Z0-9_]~\', \'\', str_replace ( \" \" , \"_\", $lista_nombre_series[4] ) );\n				$campo_etiqueta_serie_1=$lista_etiqueta_series[0];\n				$campo_etiqueta_serie_2=$lista_etiqueta_series[1];\n				$campo_etiqueta_serie_3=$lista_etiqueta_series[2];\n				$campo_etiqueta_serie_4=$lista_etiqueta_series[3];\n				$campo_etiqueta_serie_5=$lista_etiqueta_series[4];\n				$campo_valor_serie_1=$lista_valor_series[0];\n				$campo_valor_serie_2=$lista_valor_series[1];\n				$campo_valor_serie_3=$lista_valor_series[2];\n				$campo_valor_serie_4=$lista_valor_series[3];\n				$campo_valor_serie_5=$lista_valor_series[4];\n				// CREA OBJETO SEGUN TIPO DE GRAFICO\n				$TipoObjetoGraficoMorris	 = \"Morris.Area\";  //Por defecto define tipo Area para cualquiera de los definidos sin compatibilidad conocida\n				if ($tipo_grafico==\"area\")\n					$TipoObjetoGraficoMorris = \"Morris.Area\";\n				if ($tipo_grafico==\"barra\" || $tipo_grafico==\"barrah\" || $tipo_grafico==\"barrav\" || $tipo_grafico==\"barrah_multiples\" || $tipo_grafico==\"barrav_multiples\")\n					$TipoObjetoGraficoMorris = \"Morris.Bar\";\n				if ($tipo_grafico==\"linea\" || $tipo_grafico==\"linea_multiples\")\n					$TipoObjetoGraficoMorris = \"Morris.Line\";\n				if ($tipo_grafico==\"dona\"  || $tipo_grafico==\"donap\" || $tipo_grafico==\"torta\" || $tipo_grafico==\"tortap\")\n					$TipoObjetoGraficoMorris = \"Morris.Donut\";\n\n				//Define la cadena de llaves para el grafico\n				$CadenaLlaves=\"\'$nombre_serie_1\'\";				//\'Operaciones\',\'Usuarios\',\'UsoAPI\'\n				if ($nombre_serie_2!=\"\") $CadenaLlaves.=\",\'$nombre_serie_2\'\";\n				if ($nombre_serie_3!=\"\") $CadenaLlaves.=\",\'$nombre_serie_3\'\";\n				if ($nombre_serie_4!=\"\") $CadenaLlaves.=\",\'$nombre_serie_4\'\";\n				if ($nombre_serie_5!=\"\") $CadenaLlaves.=\",\'$nombre_serie_5\'\";\n\n				//Define la cadena de etiquetas para el grafico\n				$CadenaEtiquetas=\"\'$nombre_serie_1\'\";	 //\'Operaciones\',\'Usuarios\',\'UsoAPI\'\n				if ($nombre_serie_2!=\"\") $CadenaEtiquetas.=\",\'$nombre_serie_2\'\";\n				if ($nombre_serie_3!=\"\") $CadenaEtiquetas.=\",\'$nombre_serie_3\'\";\n				if ($nombre_serie_4!=\"\") $CadenaEtiquetas.=\",\'$nombre_serie_4\'\";\n				if ($nombre_serie_5!=\"\") $CadenaEtiquetas.=\",\'$nombre_serie_5\'\";\n			?>\n			<?php\n				//Determina si se debe o no crear cadena para el tooltipo con titulo del informe\n				$CadenaComplementoToolTipTitulo=\"\";\n				if ( $registro_informe[\"tooltip_titulo\"] == \'S\' )\n					$CadenaComplementoToolTipTitulo=\'title=\"\'.PCO_ReemplazarVariablesPHPEnCadena($registro_informe[\"titulo\"]).\'\" data-toggle=\"tooltip\"\';\n\n				//Agrega titulo o encabezado si esta definido\n				if ( $registro_informe[\"encabezado_html\"] != \'\' )\n					echo \'<div id=\"titulo-informe-ID\'.$registro_informe[\"id\"].\'\">\'.$registro_informe[\"encabezado_html\"].\'</div>\';\n			?>\n				<div <?php echo $CadenaComplementoToolTipTitulo; ?> id=\"marco-informe-grafico-ID<?php echo $registro_informe[\"id\"]; ?>\" style=\"height: auto !important;\"></div>\n				<script language=\"JavaScript\">\n					//Genera el codigo Morris para el grafico\n					$(function() {\n						<?php echo $TipoObjetoGraficoMorris; ?>({\n							//Nombre del marco que tiene el grafico\n							element: \'marco-informe-grafico-ID<?php echo $registro_informe[\"id\"]; ?>\',\n							data: [\n							<?php\n								//Inicia la generacion del arreglo con los datos\n								//Si el informe usa una conexion externa usa su configuracion\n								if($registro_informe[\"conexion_origen_datos\"]!=\"\")\n									$resultado_consulta=PCO_EjecutarSQL($consulta,\"\",${$registro_conexiones[\"nombre\"]});\n								else\n									$resultado_consulta=PCO_EjecutarSQL($consulta);\n\n								$cadena_datos=\"\";\n								while ($registro_consulta = $resultado_consulta->fetch())\n									{\n										//Crea series de datos para los graficos de Barra, Linea o area que utilizan los mismos parametros\n										if ($TipoObjetoGraficoMorris!=\"Morris.Donut\")\n											{\n												$cadena_datos.= \"\n													{\";\n												//Agrega datos al arreglo del grafico segun las series disponibles\n												if ($nombre_serie_1 != \"\")\n													{\n														$NombreVisibleCampo=$registro_consulta[$campo_etiqueta_serie_1];\n														$ValorVisibleCampo=$registro_consulta[$campo_valor_serie_1];\n														$cadena_datos.= \"\n														\".$nombre_serie_1.\": \".$ValorVisibleCampo.\",\n														etiqueta_ejex: \'$NombreVisibleCampo\'\";\n													}\n												if ($nombre_serie_2 != \"\")\n													{\n														$NombreVisibleCampo=$registro_consulta[$campo_etiqueta_serie_2];\n														$ValorVisibleCampo=$registro_consulta[$campo_valor_serie_2];\n														$cadena_datos.= \",\n														\".$nombre_serie_2.\": \".$ValorVisibleCampo;\n													}\n												if ($nombre_serie_3 != \"\")\n													{\n														$NombreVisibleCampo=$registro_consulta[$campo_etiqueta_serie_3];\n														$ValorVisibleCampo=$registro_consulta[$campo_valor_serie_3];\n														$cadena_datos.= \",\n														\".$nombre_serie_3.\": \".$ValorVisibleCampo;\n													}\n												if ($nombre_serie_4 != \"\")\n													{\n														$NombreVisibleCampo=$registro_consulta[$campo_etiqueta_serie_4];\n														$ValorVisibleCampo=$registro_consulta[$campo_valor_serie_4];\n														$cadena_datos.= \",\n														\".$nombre_serie_4.\": \".$ValorVisibleCampo;\n													}\n												if ($nombre_serie_5 != \"\")\n													{\n														$NombreVisibleCampo=$registro_consulta[$campo_etiqueta_serie_5];\n														$ValorVisibleCampo=$registro_consulta[$campo_valor_serie_5];\n														$cadena_datos.= \",\n														\".$nombre_serie_5.\": \".$ValorVisibleCampo;\n													}\n												$cadena_datos.= \"\n													},\";\n											}\n										//Crea series de datos para graficos tipo dona\n										if ($TipoObjetoGraficoMorris==\"Morris.Donut\")\n											{\n												$cadena_datos.= \"\n													{\";\n														$NombreVisibleCampo=$registro_consulta[$campo_etiqueta_serie_1];\n														$ValorVisibleCampo=$registro_consulta[$campo_valor_serie_1];\n														$cadena_datos.= \"\n														label: \'\".$NombreVisibleCampo.\"\', value: \".$ValorVisibleCampo;\n												$cadena_datos.= \"\n													},\";\n											}\n									}\n								$cadena_datos = substr($cadena_datos, 0, -1);\n								if ($cadena_datos!=\"\")\n									echo $cadena_datos;\n								if ($cadena_datos==\"\")\n									$PCO_InformesGraficosSinDatos.=\'marco-informe-grafico-ID\'.$registro_informe[\"id\"].\'|\'; //Si no tiene datos lo lleva al arreglo para cambiar luego su valor html y evitar el NaN\n							?>\n							],\n							xkey: [\'etiqueta_ejex\'],\n							ykeys: [<?php echo $CadenaLlaves; ?>],\n							labels: [<?php echo $CadenaEtiquetas; ?>],\n							pointSize: 2,\n							hideHover: \'auto\',\n							resize: true,\n							stacked: <?php echo $barra_apilada; ?>,\n							preUnits: \'<?php echo $unidades_pre; ?>\',\n							postUnits: \'<?php echo $unidades_pos; ?>\',\n							grid: <?php echo $ocultar_grilla; ?>,\n							horizontal: <?php echo $barras_horizontales; ?>,\n							<?php echo $cadena_arreglo_colores; ?>\n\n							dataLabels: <?php echo $presentar_datalabels; ?>,\n							<?php echo $cadenaubicacion_datalabels; ?>  // EJ: dataLabelsPosition: \'outside\', //inside\n\n							showPercentage: <?php echo $presentar_porcentaje; ?>,\n							donutType: \'<?php echo $tipo_grafico_circular; ?>\',\n							<?php\n								//Agrega las unidades para los tipos de grafico Donut\n								if ($TipoObjetoGraficoMorris==\"Morris.Donut\")\n									echo \"formatter: function (value, data) { return \'$unidades_pre\'+ (value) + \'$unidades_pos\'; },\";\n							?>\n							axes: <?php echo $ocultar_ejes; ?>\n						});\n					});\n				</script>\n			<?php\n			// Si se ha definido un tamano fijo entonces cierra el marco\n			if ($registro_informe[\"ancho\"]!=\"\" && $registro_informe[\"alto\"]!=\"\" && $registro_informe[\"ancho\"]!=\"0\" && $registro_informe[\"alto\"]!=\"0\")\n				echo \'</DIV>\';\n\n			} // Fin si informe es G (grafico)\n\n		if ($en_ventana) PCO_CerrarVentana();\n\n		//Si el usuario es admin le muestra el query generador.\n		if (PCO_EsAdministrador(@$PCOSESS_LoginUsuario) && $ModoDepuracion)\n			PCO_Mensaje($MULTILANG_MonCommSQL, $consulta, \'\', \'fa fa-fw fa-2x fa-database\', \'alert alert-info alert-dismissible \');\n\n		//Ejecuta script POST para el informe\n		if ($CadenaPOSTScriptPHP!=\"\")\n			{\n				PCO_EvaluarCodigo($CadenaPOSTScriptPHP,1,\"Detalles: POST-Code Rep ID=\".$informe);\n			}\n\n		//Ejecuta script POST para el informe llevandolo a la misma cadena de formularios que se agrega en marco_abajo\n		if ($JavaScriptInforme!=\"\")\n			{\n				$PCO_FuncionesJSInternasFORM .= \'<script type=\"text/javascript\">\n				\'.$JavaScriptInforme.\'\n				</script>\';\n			}\n	}','A');
INSERT INTO `core_pcoder_historial` VALUES (230,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-06-27 09:07:00','admin',784,152167,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n/*include_once \'../../core/configuracion.php\';\ninclude_once \'../../core/conexiones.php\';\ninclude_once \'../../inc/practico/def_basedatos.php\';\ninclude_once \'../../core/comunes.php\';*/\n\n//echo \"$builder\";\n$saldoFavor = $factura[\"saldo_pendiente\"] < 0 ? -$factura[\"saldo_pendiente\"] : 0;\n$saldoPendienteValor = $factura[\"saldo_pendiente\"] > 0 ? $factura[\"saldo_pendiente\"] : 0;\n$saldoPendiente = number_format($saldoPendienteValor, 0, \',\', \'.\');\n\n$descargar = 0;\nif ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1;\n$fechaSinRecargoBr = str_replace(\"-\", \"\", $factura[\"fecha_sin_recargo\"]);\n$totalValor =  number_format($factura[\"valor_sin_recargo\"] + $saldoPendienteValor - $saldoFavor, 0, \',\', \'.\');\n$total = $totalValor > 0 ? $totalValor : 0;\n$totalBr = str_replace(\".\", \"\", $total);\n$codigobarra=\"7709998678439\";\n$Barcode = $codigobarra.$factura[\"id_contrato\"].\"$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n//$Barcode = \"(415)7709998678439(8020)12345(3900)50000(96)20220524\";\n//$Barcode = \"41577099986784398020123453900500009620220524\";\n//$Barcode = \"12345670\";\n\n$rayaDesprendibleBanco = str_repeat(\"- \", 34);\n\n$estadoMedidor = \"Bueno\";\nif($factura[\"estado_medidor\"] == 2) $estadoMedidor = \"Dañado\";\nif($factura[\"estado_medidor\"] == 3) $estadoMedidor = \"N/A\";\n\nfunction getMesEsp($mes) {\n    $mesesArray = [\"\",\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"];\n    return $mesesArray[$mes];\n}\n$i = 1;\n$grafBarra = \"\";\n$tableData = \"\";\n$class = \"\";\n\n$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha_fin_facturacion) mes, valor_sin_recargo, saldo_pendiente, valor_tarifa_aplicada\n    FROM \n        app_facturas\n    WHERE \n        id_contrato = \". $factura[\"id_contrato\"]. \" ORDER BY id DESC LIMIT 6\n\")->fetchAll();\n\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"], 0, \',\', \'.\');\n    $grafBarra .= \'<div class=\"barra\"><div class=\"sub_barra b\' . $i . \'\"><div class=\"tag_g\">\' . $consumo[\"consumo_actual\"] . \'</div><div class=\"tag_leyenda\">\' . $mes . \'</div></div></div>\';\n    $tableData .= \'<tr><td>\' . $mes . \'</td><td>\' . $consumo[\"consumo_actual\"] . \'</td><td>\' . $consumo[\"valor_tarifa_aplicada\"] . \'</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . (is_numeric($consumo[\"consumo_actual\"]) ? $consumo[\"consumo_actual\"] : 0) . \"%} \";\n    $i++;\n}\n\n$html = \'\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         list-style: none;\n         padding: 0;\n         text-decoration: none;\n      }\n\n    table.info, \n    .info td,\n    .info tr {\n        border-width: 0px !important;\n        border-style: none;\n        text-align:left\n    }\n      /* heading */\n\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n      }\n\n      table {\n         border-collapse: separate;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.56em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n\n      html {\n         font: 16px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.4in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.4em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n      table.inventory {\n         margin: 0 0 0.3em;\n      }\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 30%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 38%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      table.inventory td:nth-child(1) {\n         width: 26%;\n      }\n\n      table.inventory td:nth-child(2) {\n         width: 38%;\n      }\n\n      table.inventory td:nth-child(3) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(4) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(5) {\n         text-align: center;\n         width: 12%;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 40%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n      }\n      \n.board{\n    width: 100%;\n    height: 160px;\n    box-sizing: border-box;\n    overflow: hidden;\n}\n.titulo_grafica{\n    width: 100%;\n    height: 10%;\n}\n.titulo_grafica>h3{\n    padding: 0;\n    margin: 0px;\n    text-align: center;\n    color: #666666;\n}\n.sub_board{\n    width: 100%;\n    height: 100%;\n    margin-top: 0px;\n    overflow: hidden;\n    box-sizing: border-box;\n}\n.sep_board{\n    width: 100%;\n    height: 10%;\n}\n.cont_board{\n    width: 100%;\n    height: 80%;\n}\n.graf_board{\n    width: 90%;\n    height: 100%;\n    float: right;\n    margin-top: 0px;\n    background-color: darkgrey;\n    border-left: 2px solid #999999;\n    border-bottom: 2px solid #999999;\n    box-sizing: border-box;\n    display: flex;\n    background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, \n \n    rgba(0,0,0,0) 100%);\n    background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, \n    rgba(0,0,0,0) 100%);\n\n    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,\n    rgba(0,0,0,0) 100%);\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\"#00ffffff\", endColorstr=\"#00ffffff\",GradientType=0 );\n}\n.barra{\n    width:100%;\n    height: 100%;\n    margin-right: 9px;\n    margin-left: 9px;\n    background-color: none;\n    display: flex;\n    flex-wrap: wrap;\n    align-items: flex-end;\n}\n.sub_barra{\n    width: 100%;\n    height: 80%;\n    background: #00799b;\n    background: -moz-linear-gradient(top, #00799b 0%, #64d1be 100%);\n    \n    -webkit-border-radius: 12px 12px 0 0;\n    border-radius: 12px 12px 0 0;\n}\n.tag_g{\n    position: relative;\n    width: 100%;\n    height: 100%;\n    margin-bottom: 23px;\n    text-align: center;\n    margin-top: -20px;\n    z-index: 2;\n}\n.tag_leyenda{\n    text-align: center;\n    margin-top: 0px;\n}\n.tag_board{\n    height: 100%;\n    width: 15%;\n    border-bottom: 2px solid rgba(0,0,0,0);\n    box-sizing: border-box;\n}\n.sub_tag_board{\n    height: 85%;\n    width: 60%;\n    display: flex;\n    align-items: flex-end;\n    flex-wrap: wrap;\n}\n.sub_tag_board>div{\n    width: 100%;\n    height: 3%;\n    text-align: right;\n    padding-right: 3px;\n    box-sizing: border-box;\n}\n\'.$class.\'\nfooter{\n    position: absolute;\n    bottom: 0px;\n    width: 100%;\n    text-align: center;\n    font-size: 12px;\n    font-family: sans-serif;\n}\n   </style>\n\n    <script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>\n    \n    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n      <!-- BARCODE -->\n        <!--<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js\"></script>-->\n        \n		\n	\n		\n</head>\n\n<body id=\"Invoices\">\n   <article>\n      <img\n         src=\"data:image/png;base64,[encoded data, 74668 characters]\"\n         data-filename=\"logoASJ_.png\">\n      <!--<img src=\"./logoASJ_.png\">-->\n      <BR>\n      <BR>\n      <address style=\"width: 62%;\">\n         <div style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AGUAS DE SAN JERONIMO E.S.P</div>\n         <div style=\"font-size: 12px;\">NIT: 811018300-6</div>\n         <div style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</div>\n         <BR>\n         <table class=\"info\">\n            <tr>\n                <td>\n                    <p style=\"font-size: 14px;\">\n                        <span style=\"font-weight: bold;\">Contrato N° </span> \' . $factura[\"id_contrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Nombre: </span>\' . $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion_predio\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Estrato: </span>\' . $factura[\"estrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Consumo Periodo: </span>\' . $factura[\"fecha_inicio_facturacion\"] . \' - \' . $factura[\"fecha_fin_facturacion\"] . \' <br>\n                    </p>\n                </td>\n                <!--<td>\n\n                </td>-->\n            </tr>\n         </table>\n\n      </address>\n\n      <table class=\"meta\">\n         <tr>\n            <th style=\"width: 120px !important;\"><span>Factura</span></th>\n            <td><span>\' . $factura[\"id\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha sin recargo</span></th>\n            <td><span>\' . $factura[\"fecha_sin_recargo\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha con recargo</span></th>\n            <td><span>\' . $factura[\"fecha_con_recargo\"] . \'</span></td>\n         </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">INFORMACIÓN ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Medidor </span> \' . $factura[\"numero_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Diametro </span> 1/2\" <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Lectura actual </span> \' . $factura[\"lectura_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Lectura anterior </span> \' . $factura[\"lectura_anterior\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Estado medidor </span> \' . $estadoMedidor. \' <br>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                </p>\n            </td>\n        </tr>\n      </table>\n      <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n          <tr>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px; vertical-align: none !important;\">\n              <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n              \n                <tr>\n                  <th>MES</th>\n                  <th>M3</th>\n                  <th>CARGO FIJO</th>\n                  <th>TOTAL</th>\n                </tr>\n                \' . $tableData . \'\n              </table>\n            </td>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n               <div class=\"board\">\n                <div class=\"titulo_grafica\">\n                    <h3 class=\"t_grafica\">Consumos anteriores en metros cúbicos</h3>\n                </div>\n                <div class=\"sub_board\">\n                    <div class=\"cont_board\">\n                        <div class=\"graf_board\">\n                            \' . $grafBarra . \'\n                        </div>\n                        <div class=\"tag_board\">\n                            <div class=\"sub_tag_board\">\n                                <div>100</div>\n                                <div>90</div>\n                                <div>80</div>\n                                <div>70</div>\n                                <div>60</div>\n                                <div>50</div>\n                                <div>40</div>\n                                <div>30</div>\n                                <div>20</div>\n                                <div>10</div>\n                            </div>\n                        </div>\n                   </div>\n                </div>\n               </div>\n            </td>\n          </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">COSTOS REFERENCIA ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    \n                    <span>Cargo Fijo. = \' . $factura[\"valor_tarifa_aplicada\"] . \'</span>\n                </p>\n            </td>\n           <!–  <td>\n                <p>\n                    \n                    <span>CMO=Costo por consumo = \' . $factura[\"costo_medio_operacion\"] . \'</span>\n                </p>\n            </td> –>\n           \n        </tr>\n      </table>\n      <!--<table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Descripción</span></th>\n               <th><span>Cantidad</span></th>\n               <th style=\"background-color: #14406b;\"><span>Precio</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span>Consumo de agua m3</span></td>\n               <td><span>\' . $factura[\"consumo_actual\"] . \'</span></td>\n               <td style=\"text-align: center !important;\"><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"], 0, \',\', \'.\') . \'</span></td>\n            </tr>\n         </tbody>\n      </table> -->\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td><span>SUBTOTAL</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"] + $factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\'], 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>CUENTAS VENCIDAS</span></td>\n            <th><span data-prefix>$</span><span>\' . $saldoPendiente . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SALDO A FAVOR</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($saldoFavor, 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SUBSIDIO</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\']) . \'</span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 16px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span data-prefix>$</span><span>\' . $total . \'</span></th>\n         </tr>\n      </table>\n     <address style=\"width: 62%;\">\n      <table>\n            <tr>\n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                  <p style=\"font-size: 13px; vertical-align: middle; line-height: normal\">\n                     <span style=\"font-weight: bold;\"> Canales y medios disponibles para hacer el pago de tu\n                        factura</span>\n                     <br>\n                     <br>\n                     <span>Transferencia o consignación a la cuenta de:</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">Ahorros Bancolombia N°</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">240-000018-93</span>\n                  </p>\n               </td> \n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                    <img src=\"data:image/png;base64,[encoded data, 21620 characters]\" data-filename=\"Firma Ignacio Digital.png\"\n                    data-filename=\"Firma Ignacio Digital.png\" style=\"width: 220px; height: 70px;\">\n                    <p style=\"font-size: 10.3px; font-weight: bold;\">JORGE IGNACIO AREIZA CASTRILLON <BR> GERENTE</p>\n               </td>\n            </tr>\n         </table> \n\n      <BR>\n       </address> \n   </article>\n   <BR>\n   <BR>\n   <p style=\"font-size:10px;\">\' . $rayaDesprendibleBanco . \' DESPRENDIBLE PARA EL BANCO \' . $rayaDesprendibleBanco . \'</p>\n  \n   <BR>\n   <table style=\"border-collapse: collapse; border:none; border-width: 0px; style=\"vertical-align: middle !important;\">\n        <tr style=\"float: middle; !important;\">\n            <!-- <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width: 30%\">\n                <img \n                	<img src=\"data:image/png;base64,[encoded data, 32188 characters]\"\n	                style=\"width: 208px;\" data-filename=\"Logo2.png\">\n            </td> -->\n            <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width:70%\">\n                <img id=\"barcodeTarget\"/>\n                <canvas id=\"mycanvas\" width=\"200\" height=\"100\"></canvas>\n            </td>\n        </tr>\n    </table>\n</body>\n    <script>\n        //https://parzibyte.me/blog/2019/08/19/codigos-barras-javascript-jsbarcode/\n        const options = {\n            bcid:        \"gs1-128\",       // Barcode type\n            text:        \"\' . $BarcodeParent. \'\",    // Text to encode\n            scale:       2,               // 3x scaling factor\n            height:      9,              // Bar height, in millimeters\n            includetext: true,            // Show human-readable text\n            textxalign:  \"center\",        // Always good to set this\n        };\n        const hola2 = () => {\n            try {\n                bwipjs.toCanvas(\"mycanvas\", options);\n            } catch (e) { console.log({e}); }\n        };\n        const hola3 = () => {\n            const canvas = document.createElement(\"canvas\");\n            try {\n                bwipjs.toCanvas(canvas, options);\n                document.getElementById(\"barcodeTarget\").src = canvas.toDataURL(\"image/png\");\n            } catch (e) { console.log({e}); }\n        };\n        //addEventListener(\"DOMContentLoaded\", () => {\n            hola3();\n        //});\n\n         /* JsBarcode(\"#barcodeTarget\", \"\' . $Barcode. \'\", {\n            format: \"CODE128C\",// El formato\n    		width: 2.67, // La anchura de cada barra\n    		height: 65, // La altura del código\n    		displayValue: true, // ¿Mostrar el valor (como texto) del código de barras?\n    		text: \"\' . $BarcodeParent . \'\", // Texto (no código) que acompaña al barcode\n    		fontSize: 14, // Tamaño de la fuente\n    		fontOptions: \"bold\", // Opciones de la fuente del texto del barcode\n    		ean128: true,\n    	}); */\n	</script>\n   <script> \n      document.addEventListener(\"DOMContentLoaded\", function (event) {\n        //setTimeout(function(){ hola(); }, 1000);\n        var descargar = \' . $descargar . \';\n        if(descargar == 1) {\n             var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . str_replace(\' \', \'\', $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"]) . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n    		 setTimeout(function(){ window.close(); }, 1650);\n        }\n        });\n        \n        function hola(){\n            var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . $factura[\"contrato\"] . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n        }\n   </script>\n</html>\';\n\necho $html;\ndie();','A'),(231,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-06-27 09:09:00','admin',784,152168,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n/*include_once \'../../core/configuracion.php\';\ninclude_once \'../../core/conexiones.php\';\ninclude_once \'../../inc/practico/def_basedatos.php\';\ninclude_once \'../../core/comunes.php\';*/\n\n//echo \"$builder\";\n$saldoFavor = $factura[\"saldo_pendiente\"] < 0 ? -$factura[\"saldo_pendiente\"] : 0;\n$saldoPendienteValor = $factura[\"saldo_pendiente\"] > 0 ? $factura[\"saldo_pendiente\"] : 0;\n$saldoPendiente = number_format($saldoPendienteValor, 0, \',\', \'.\');\n\n$descargar = 0;\nif ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1;\n$fechaSinRecargoBr = str_replace(\"-\", \"\", $factura[\"fecha_sin_recargo\"]);\n$totalValor =  number_format($factura[\"valor_sin_recargo\"] + $saldoPendienteValor - $saldoFavor, 0, \',\', \'.\');\n$total = $totalValor > 0 ? $totalValor : 0;\n$totalBr = str_replace(\".\", \"\", $total);\n$codigobarra=\"7709998678439\";\n$Barcode = $codigobarra.$factura[\"id_contrato\"].\"$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n//$Barcode = \"(415)7709998678439(8020)12345(3900)50000(96)20220524\";\n//$Barcode = \"41577099986784398020123453900500009620220524\";\n//$Barcode = \"12345670\";\n\n$rayaDesprendibleBanco = str_repeat(\"- \", 34);\n\n$estadoMedidor = \"Bueno\";\nif($factura[\"estado_medidor\"] == 2) $estadoMedidor = \"Dañado\";\nif($factura[\"estado_medidor\"] == 3) $estadoMedidor = \"N/A\";\n\nfunction getMesEsp($mes) {\n    $mesesArray = [\"\",\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"];\n    return $mesesArray[$mes];\n}\n$i = 1;\n$grafBarra = \"\";\n$tableData = \"\";\n$class = \"\";\n\n$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha_fin_facturacion) mes, valor_sin_recargo, saldo_pendiente, valor_tarifa_aplicada\n    FROM \n        app_facturas\n    WHERE \n        id_contrato = \". $factura[\"id_contrato\"]. \" ORDER BY id DESC LIMIT 6\n\")->fetchAll();\n\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"], 0, \',\', \'.\');\n    $grafBarra .= \'<div class=\"barra\"><div class=\"sub_barra b\' . $i . \'\"><div class=\"tag_g\">\' . $consumo[\"consumo_actual\"] . \'</div><div class=\"tag_leyenda\">\' . $mes . \'</div></div></div>\';\n    $tableData .= \'<tr><td>\' . $mes . \'</td><td>\' . $consumo[\"consumo_actual\"] . \'</td><td>\' . $consumo[\"valor_tarifa_aplicada\"] . \'</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . (is_numeric($consumo[\"consumo_actual\"]) ? $consumo[\"consumo_actual\"] : 0) . \"%} \";\n    $i++;\n}\n\n$html = \'\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         list-style: none;\n         padding: 0;\n         text-decoration: none;\n      }\n\n    table.info, \n    .info td,\n    .info tr {\n        border-width: 0px !important;\n        border-style: none;\n        text-align:left\n    }\n      /* heading */\n\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n      }\n\n      table {\n         border-collapse: separate;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.56em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n\n      html {\n         font: 16px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.4in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.4em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n      table.inventory {\n         margin: 0 0 0.3em;\n      }\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 30%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 38%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      table.inventory td:nth-child(1) {\n         width: 26%;\n      }\n\n      table.inventory td:nth-child(2) {\n         width: 38%;\n      }\n\n      table.inventory td:nth-child(3) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(4) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(5) {\n         text-align: center;\n         width: 12%;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 40%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n      }\n      \n.board{\n    width: 100%;\n    height: 160px;\n    box-sizing: border-box;\n    overflow: hidden;\n}\n.titulo_grafica{\n    width: 100%;\n    height: 10%;\n}\n.titulo_grafica>h3{\n    padding: 0;\n    margin: 0px;\n    text-align: center;\n    color: #666666;\n}\n.sub_board{\n    width: 100%;\n    height: 100%;\n    margin-top: 0px;\n    overflow: hidden;\n    box-sizing: border-box;\n}\n.sep_board{\n    width: 100%;\n    height: 10%;\n}\n.cont_board{\n    width: 100%;\n    height: 80%;\n}\n.graf_board{\n    width: 90%;\n    height: 100%;\n    float: right;\n    margin-top: 0px;\n    background-color: darkgrey;\n    border-left: 2px solid #999999;\n    border-bottom: 2px solid #999999;\n    box-sizing: border-box;\n    display: flex;\n    background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, \n \n    rgba(0,0,0,0) 100%);\n    background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, \n    rgba(0,0,0,0) 100%);\n\n    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,\n    rgba(0,0,0,0) 100%);\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\"#00ffffff\", endColorstr=\"#00ffffff\",GradientType=0 );\n}\n.barra{\n    width:100%;\n    height: 100%;\n    margin-right: 9px;\n    margin-left: 9px;\n    background-color: none;\n    display: flex;\n    flex-wrap: wrap;\n    align-items: flex-end;\n}\n.sub_barra{\n    width: 100%;\n    height: 80%;\n    background: #00799b;\n    background: -moz-linear-gradient(top, #00799b 0%, #64d1be 100%);\n    \n    -webkit-border-radius: 12px 12px 0 0;\n    border-radius: 12px 12px 0 0;\n}\n.tag_g{\n    position: relative;\n    width: 100%;\n    height: 100%;\n    margin-bottom: 23px;\n    text-align: center;\n    margin-top: -20px;\n    z-index: 2;\n}\n.tag_leyenda{\n    text-align: center;\n    margin-top: 0px;\n}\n.tag_board{\n    height: 100%;\n    width: 15%;\n    border-bottom: 2px solid rgba(0,0,0,0);\n    box-sizing: border-box;\n}\n.sub_tag_board{\n    height: 85%;\n    width: 60%;\n    display: flex;\n    align-items: flex-end;\n    flex-wrap: wrap;\n}\n.sub_tag_board>div{\n    width: 100%;\n    height: 3%;\n    text-align: right;\n    padding-right: 3px;\n    box-sizing: border-box;\n}\n\'.$class.\'\nfooter{\n    position: absolute;\n    bottom: 0px;\n    width: 100%;\n    text-align: center;\n    font-size: 12px;\n    font-family: sans-serif;\n}\n   </style>\n\n    <script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>\n    \n    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n      <!-- BARCODE -->\n        <!--<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js\"></script>-->\n        \n		\n	\n		\n</head>\n\n<body id=\"Invoices\">\n   <article>\n      <img\n         src=\"data:image/png;base64,[encoded data, 74668 characters]\"\n         data-filename=\"logoASJ_.png\">\n      <!--<img src=\"./logoASJ_.png\">-->\n      <BR>\n      <BR>\n      <address style=\"width: 62%;\">\n         <div style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AGUAS DE SAN JERONIMO E.S.P</div>\n         <div style=\"font-size: 12px;\">NIT: 811018300-6</div>\n         <div style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</div>\n         <BR>\n         <table class=\"info\">\n            <tr>\n                <td>\n                    <p style=\"font-size: 14px;\">\n                        <span style=\"font-weight: bold;\">Contrato N° </span> \' . $factura[\"id_contrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Nombre: </span>\' . $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion_predio\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Estrato: </span>\' . $factura[\"estrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Consumo Periodo: </span>\' . $factura[\"fecha_inicio_facturacion\"] . \' - \' . $factura[\"fecha_fin_facturacion\"] . \' <br>\n                    </p>\n                </td>\n                <!--<td>\n\n                </td>-->\n            </tr>\n         </table>\n\n      </address>\n\n      <table class=\"meta\">\n         <tr>\n            <th style=\"width: 120px !important;\"><span>Factura</span></th>\n            <td><span>\' . $factura[\"id\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha sin recargo</span></th>\n            <td><span>\' . $factura[\"fecha_sin_recargo\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha con recargo</span></th>\n            <td><span>\' . $factura[\"fecha_con_recargo\"] . \'</span></td>\n         </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">INFORMACIÓN ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Medidor </span> \' . $factura[\"numero_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Diametro </span> 1/2\" <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Lectura actual </span> \' . $factura[\"lectura_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Lectura anterior </span> \' . $factura[\"lectura_anterior\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Estado medidor </span> \' . $estadoMedidor. \' <br>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                </p>\n            </td>\n        </tr>\n      </table>\n      <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n          <tr>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px; vertical-align: none !important;\">\n              <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n              \n                <tr>\n                  <th>MES</th>\n                  <th>M3</th>\n                  <th>CARGO FIJO</th>\n                  <th>TOTAL</th>\n                </tr>\n                \' . $tableData . \'\n              </table>\n            </td>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n               <div class=\"board\">\n                <div class=\"titulo_grafica\">\n                    <h3 class=\"t_grafica\">Consumos anteriores en metros cúbicos</h3>\n                </div>\n                <div class=\"sub_board\">\n                    <div class=\"cont_board\">\n                        <div class=\"graf_board\">\n                            \' . $grafBarra . \'\n                        </div>\n                        <div class=\"tag_board\">\n                            <div class=\"sub_tag_board\">\n                                <div>100</div>\n                                <div>90</div>\n                                <div>80</div>\n                                <div>70</div>\n                                <div>60</div>\n                                <div>50</div>\n                                <div>40</div>\n                                <div>30</div>\n                                <div>20</div>\n                                <div>10</div>\n                            </div>\n                        </div>\n                   </div>\n                </div>\n               </div>\n            </td>\n          </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">COSTOS REFERENCIA ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    \n                    <span>Cargo Fijo. = \' . $factura[\"valor_tarifa_aplicada\"] . \'</span>\n                </p>\n            </td>\n           <!–  <td>\n                <p>\n                    \n                    <span>CMO=Costo por consumo = \' . $factura[\"costo_medio_operacion\"] . \'</span>\n                </p>\n            </td> -–>\n           \n        </tr>\n      </table>\n      <!--<table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Descripción</span></th>\n               <th><span>Cantidad</span></th>\n               <th style=\"background-color: #14406b;\"><span>Precio</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span>Consumo de agua m3</span></td>\n               <td><span>\' . $factura[\"consumo_actual\"] . \'</span></td>\n               <td style=\"text-align: center !important;\"><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"], 0, \',\', \'.\') . \'</span></td>\n            </tr>\n         </tbody>\n      </table> -->\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td><span>SUBTOTAL</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"] + $factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\'], 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>CUENTAS VENCIDAS</span></td>\n            <th><span data-prefix>$</span><span>\' . $saldoPendiente . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SALDO A FAVOR</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($saldoFavor, 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SUBSIDIO</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\']) . \'</span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 16px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span data-prefix>$</span><span>\' . $total . \'</span></th>\n         </tr>\n      </table>\n     <address style=\"width: 62%;\">\n      <table>\n            <tr>\n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                  <p style=\"font-size: 13px; vertical-align: middle; line-height: normal\">\n                     <span style=\"font-weight: bold;\"> Canales y medios disponibles para hacer el pago de tu\n                        factura</span>\n                     <br>\n                     <br>\n                     <span>Transferencia o consignación a la cuenta de:</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">Ahorros Bancolombia N°</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">240-000018-93</span>\n                  </p>\n               </td> \n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                    <img src=\"data:image/png;base64,[encoded data, 21620 characters]\" data-filename=\"Firma Ignacio Digital.png\"\n                    data-filename=\"Firma Ignacio Digital.png\" style=\"width: 220px; height: 70px;\">\n                    <p style=\"font-size: 10.3px; font-weight: bold;\">JORGE IGNACIO AREIZA CASTRILLON <BR> GERENTE</p>\n               </td>\n            </tr>\n         </table> \n\n      <BR>\n       </address> \n   </article>\n   <BR>\n   <BR>\n   <p style=\"font-size:10px;\">\' . $rayaDesprendibleBanco . \' DESPRENDIBLE PARA EL BANCO \' . $rayaDesprendibleBanco . \'</p>\n  \n   <BR>\n   <table style=\"border-collapse: collapse; border:none; border-width: 0px; style=\"vertical-align: middle !important;\">\n        <tr style=\"float: middle; !important;\">\n            <!-- <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width: 30%\">\n                <img \n                	<img src=\"data:image/png;base64,[encoded data, 32188 characters]\"\n	                style=\"width: 208px;\" data-filename=\"Logo2.png\">\n            </td> -->\n            <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width:70%\">\n                <img id=\"barcodeTarget\"/>\n                <canvas id=\"mycanvas\" width=\"200\" height=\"100\"></canvas>\n            </td>\n        </tr>\n    </table>\n</body>\n    <script>\n        //https://parzibyte.me/blog/2019/08/19/codigos-barras-javascript-jsbarcode/\n        const options = {\n            bcid:        \"gs1-128\",       // Barcode type\n            text:        \"\' . $BarcodeParent. \'\",    // Text to encode\n            scale:       2,               // 3x scaling factor\n            height:      9,              // Bar height, in millimeters\n            includetext: true,            // Show human-readable text\n            textxalign:  \"center\",        // Always good to set this\n        };\n        const hola2 = () => {\n            try {\n                bwipjs.toCanvas(\"mycanvas\", options);\n            } catch (e) { console.log({e}); }\n        };\n        const hola3 = () => {\n            const canvas = document.createElement(\"canvas\");\n            try {\n                bwipjs.toCanvas(canvas, options);\n                document.getElementById(\"barcodeTarget\").src = canvas.toDataURL(\"image/png\");\n            } catch (e) { console.log({e}); }\n        };\n        //addEventListener(\"DOMContentLoaded\", () => {\n            hola3();\n        //});\n\n         /* JsBarcode(\"#barcodeTarget\", \"\' . $Barcode. \'\", {\n            format: \"CODE128C\",// El formato\n    		width: 2.67, // La anchura de cada barra\n    		height: 65, // La altura del código\n    		displayValue: true, // ¿Mostrar el valor (como texto) del código de barras?\n    		text: \"\' . $BarcodeParent . \'\", // Texto (no código) que acompaña al barcode\n    		fontSize: 14, // Tamaño de la fuente\n    		fontOptions: \"bold\", // Opciones de la fuente del texto del barcode\n    		ean128: true,\n    	}); */\n	</script>\n   <script> \n      document.addEventListener(\"DOMContentLoaded\", function (event) {\n        //setTimeout(function(){ hola(); }, 1000);\n        var descargar = \' . $descargar . \';\n        if(descargar == 1) {\n             var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . str_replace(\' \', \'\', $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"]) . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n    		 setTimeout(function(){ window.close(); }, 1650);\n        }\n        });\n        \n        function hola(){\n            var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . $factura[\"contrato\"] . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n        }\n   </script>\n</html>\';\n\necho $html;\ndie();','A'),(232,'mod/app_facturas/pdf_factura_descargar_tarifa_dinamica.php','2023-06-27 09:10:00','admin',784,152169,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n/*include_once \'../../core/configuracion.php\';\ninclude_once \'../../core/conexiones.php\';\ninclude_once \'../../inc/practico/def_basedatos.php\';\ninclude_once \'../../core/comunes.php\';*/\n\n//echo \"$builder\";\n$saldoFavor = $factura[\"saldo_pendiente\"] < 0 ? -$factura[\"saldo_pendiente\"] : 0;\n$saldoPendienteValor = $factura[\"saldo_pendiente\"] > 0 ? $factura[\"saldo_pendiente\"] : 0;\n$saldoPendiente = number_format($saldoPendienteValor, 0, \',\', \'.\');\n\n$descargar = 0;\nif ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1;\n$fechaSinRecargoBr = str_replace(\"-\", \"\", $factura[\"fecha_sin_recargo\"]);\n$totalValor =  number_format($factura[\"valor_sin_recargo\"] + $saldoPendienteValor - $saldoFavor, 0, \',\', \'.\');\n$total = $totalValor > 0 ? $totalValor : 0;\n$totalBr = str_replace(\".\", \"\", $total);\n$codigobarra=\"7709998678439\";\n$Barcode = $codigobarra.$factura[\"id_contrato\"].\"$totalBr96$fechaSinRecargoBr\";\n$BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n//$Barcode = \"(415)7709998678439(8020)12345(3900)50000(96)20220524\";\n//$Barcode = \"41577099986784398020123453900500009620220524\";\n//$Barcode = \"12345670\";\n\n$rayaDesprendibleBanco = str_repeat(\"- \", 34);\n\n$estadoMedidor = \"Bueno\";\nif($factura[\"estado_medidor\"] == 2) $estadoMedidor = \"Dañado\";\nif($factura[\"estado_medidor\"] == 3) $estadoMedidor = \"N/A\";\n\nfunction getMesEsp($mes) {\n    $mesesArray = [\"\",\"Ene\", \"Feb\", \"Mar\", \"Abr\", \"May\", \"Jun\", \"Jul\", \"Ago\", \"Sep\", \"Oct\", \"Nov\", \"Dic\"];\n    return $mesesArray[$mes];\n}\n$i = 1;\n$grafBarra = \"\";\n$tableData = \"\";\n$class = \"\";\n\n$consumos = PCO_EjecutarSQL(\"SELECT consumo_actual, MONTH(fecha_fin_facturacion) mes, valor_sin_recargo, saldo_pendiente, valor_tarifa_aplicada\n    FROM \n        app_facturas\n    WHERE \n        id_contrato = \". $factura[\"id_contrato\"]. \" ORDER BY id DESC LIMIT 6\n\")->fetchAll();\n\nforeach ($consumos as $consumo) {\n    $mes = getMesEsp($consumo[\"mes\"]);\n    $totalMes =  number_format($consumo[\"valor_sin_recargo\"], 0, \',\', \'.\');\n    $grafBarra .= \'<div class=\"barra\"><div class=\"sub_barra b\' . $i . \'\"><div class=\"tag_g\">\' . $consumo[\"consumo_actual\"] . \'</div><div class=\"tag_leyenda\">\' . $mes . \'</div></div></div>\';\n    $tableData .= \'<tr><td>\' . $mes . \'</td><td>\' . $consumo[\"consumo_actual\"] . \'</td><td>\' . $consumo[\"valor_tarifa_aplicada\"] . \'</td><td>\' . $totalMes . \'</td></tr>\';\n    $class .= \".b$i { height: \" . (is_numeric($consumo[\"consumo_actual\"]) ? $consumo[\"consumo_actual\"] : 0) . \"%} \";\n    $i++;\n}\n\n$html = \'\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         list-style: none;\n         padding: 0;\n         text-decoration: none;\n      }\n\n    table.info, \n    .info td,\n    .info tr {\n        border-width: 0px !important;\n        border-style: none;\n        text-align:left\n    }\n      /* heading */\n\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n      }\n\n      table {\n         border-collapse: separate;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.56em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n\n      html {\n         font: 16px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.4in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.4em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n      table.inventory {\n         margin: 0 0 0.3em;\n      }\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 30%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 38%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      table.inventory td:nth-child(1) {\n         width: 26%;\n      }\n\n      table.inventory td:nth-child(2) {\n         width: 38%;\n      }\n\n      table.inventory td:nth-child(3) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(4) {\n         text-align: center;\n         width: 12%;\n      }\n\n      table.inventory td:nth-child(5) {\n         text-align: center;\n         width: 12%;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 40%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n      }\n      \n.board{\n    width: 100%;\n    height: 160px;\n    box-sizing: border-box;\n    overflow: hidden;\n}\n.titulo_grafica{\n    width: 100%;\n    height: 10%;\n}\n.titulo_grafica>h3{\n    padding: 0;\n    margin: 0px;\n    text-align: center;\n    color: #666666;\n}\n.sub_board{\n    width: 100%;\n    height: 100%;\n    margin-top: 0px;\n    overflow: hidden;\n    box-sizing: border-box;\n}\n.sep_board{\n    width: 100%;\n    height: 10%;\n}\n.cont_board{\n    width: 100%;\n    height: 80%;\n}\n.graf_board{\n    width: 90%;\n    height: 100%;\n    float: right;\n    margin-top: 0px;\n    background-color: darkgrey;\n    border-left: 2px solid #999999;\n    border-bottom: 2px solid #999999;\n    box-sizing: border-box;\n    display: flex;\n    background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, \n \n    rgba(0,0,0,0) 100%);\n    background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, \n    rgba(0,0,0,0) 100%);\n\n    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,\n    rgba(0,0,0,0) 100%);\n    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\"#00ffffff\", endColorstr=\"#00ffffff\",GradientType=0 );\n}\n.barra{\n    width:100%;\n    height: 100%;\n    margin-right: 9px;\n    margin-left: 9px;\n    background-color: none;\n    display: flex;\n    flex-wrap: wrap;\n    align-items: flex-end;\n}\n.sub_barra{\n    width: 100%;\n    height: 80%;\n    background: #00799b;\n    background: -moz-linear-gradient(top, #00799b 0%, #64d1be 100%);\n    \n    -webkit-border-radius: 12px 12px 0 0;\n    border-radius: 12px 12px 0 0;\n}\n.tag_g{\n    position: relative;\n    width: 100%;\n    height: 100%;\n    margin-bottom: 23px;\n    text-align: center;\n    margin-top: -20px;\n    z-index: 2;\n}\n.tag_leyenda{\n    text-align: center;\n    margin-top: 0px;\n}\n.tag_board{\n    height: 100%;\n    width: 15%;\n    border-bottom: 2px solid rgba(0,0,0,0);\n    box-sizing: border-box;\n}\n.sub_tag_board{\n    height: 85%;\n    width: 60%;\n    display: flex;\n    align-items: flex-end;\n    flex-wrap: wrap;\n}\n.sub_tag_board>div{\n    width: 100%;\n    height: 3%;\n    text-align: right;\n    padding-right: 3px;\n    box-sizing: border-box;\n}\n\'.$class.\'\nfooter{\n    position: absolute;\n    bottom: 0px;\n    width: 100%;\n    text-align: center;\n    font-size: 12px;\n    font-family: sans-serif;\n}\n   </style>\n\n    <script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>\n    \n    <link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">\n    <script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n      <!-- BARCODE -->\n        <!--<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js\"></script>-->\n        \n		\n	\n		\n</head>\n\n<body id=\"Invoices\">\n   <article>\n      <img\n         src=\"data:image/png;base64,[encoded data, 74668 characters]\"\n         data-filename=\"logoASJ_.png\">\n      <!--<img src=\"./logoASJ_.png\">-->\n      <BR>\n      <BR>\n      <address style=\"width: 62%;\">\n         <div style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AGUAS DE SAN JERONIMO E.S.P</div>\n         <div style=\"font-size: 12px;\">NIT: 811018300-6</div>\n         <div style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</div>\n         <BR>\n         <table class=\"info\">\n            <tr>\n                <td>\n                    <p style=\"font-size: 14px;\">\n                        <span style=\"font-weight: bold;\">Contrato N° </span> \' . $factura[\"id_contrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Nombre: </span>\' . $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Vereda: </span>\' . $factura[\"zona\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Dirección: </span>\' . $factura[\"direccion_predio\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Estrato: </span>\' . $factura[\"estrato\"] . \' <br>\n                        <span style=\"font-weight: bold;\">Consumo Periodo: </span>\' . $factura[\"fecha_inicio_facturacion\"] . \' - \' . $factura[\"fecha_fin_facturacion\"] . \' <br>\n                    </p>\n                </td>\n                <!--<td>\n\n                </td>-->\n            </tr>\n         </table>\n\n      </address>\n\n      <table class=\"meta\">\n         <tr>\n            <th style=\"width: 120px !important;\"><span>Factura</span></th>\n            <td><span>\' . $factura[\"id\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha sin recargo</span></th>\n            <td><span>\' . $factura[\"fecha_sin_recargo\"] . \'</span></td>\n         </tr>\n         <tr>\n            <th><span>Fecha con recargo</span></th>\n            <td><span>\' . $factura[\"fecha_con_recargo\"] . \'</span></td>\n         </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">INFORMACIÓN ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Medidor </span> \' . $factura[\"numero_medidor\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Diametro </span> 1/2\" <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Lectura actual </span> \' . $factura[\"lectura_actual\"] . \' <br>\n                    <span style=\"font-weight: bold;\">Lectura anterior </span> \' . $factura[\"lectura_anterior\"] . \' <br>\n                </p>\n            </td>\n            <td>\n                <p>\n                    <span style=\"font-weight: bold;\">Estado medidor </span> \' . $estadoMedidor. \' <br>\n                    <span style=\"font-weight: bold;\">Consumo (m3)</span> \' . $factura[\"consumo_actual\"] . \' <br>\n                </p>\n            </td>\n        </tr>\n      </table>\n      <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n          <tr>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px; vertical-align: none !important;\">\n              <table style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n              \n                <tr>\n                  <th>MES</th>\n                  <th>M3</th>\n                  <th>CARGO FIJO</th>\n                  <th>TOTAL</th>\n                </tr>\n                \' . $tableData . \'\n              </table>\n            </td>\n            <td width=\"50%\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n               <div class=\"board\">\n                <div class=\"titulo_grafica\">\n                    <h3 class=\"t_grafica\">Consumos anteriores en metros cúbicos</h3>\n                </div>\n                <div class=\"sub_board\">\n                    <div class=\"cont_board\">\n                        <div class=\"graf_board\">\n                            \' . $grafBarra . \'\n                        </div>\n                        <div class=\"tag_board\">\n                            <div class=\"sub_tag_board\">\n                                <div>100</div>\n                                <div>90</div>\n                                <div>80</div>\n                                <div>70</div>\n                                <div>60</div>\n                                <div>50</div>\n                                <div>40</div>\n                                <div>30</div>\n                                <div>20</div>\n                                <div>10</div>\n                            </div>\n                        </div>\n                   </div>\n                </div>\n               </div>\n            </td>\n          </tr>\n      </table>\n      <table class=\"info\" style=\"border-collapse: collapse; border:none; border-width: 0px;\">\n        <tr>\n            <td colspan=\"3\" style=\"font-weight: bold;\">COSTOS REFERENCIA ACUEDUCTO</tr>\n        </tr>\n        <tr>\n            <td>\n                <p>\n                    \n                    <span>Cargo Fijo. = \' . $factura[\"valor_tarifa_aplicada\"] . \'</span>\n                </p>\n            </td>\n           <!–-  <td>\n                <p>\n                    \n                    <span>CMO=Costo por consumo = \' . $factura[\"costo_medio_operacion\"] . \'</span>\n                </p>\n            </td> -–>\n           \n        </tr>\n      </table>\n      <!--<table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Descripción</span></th>\n               <th><span>Cantidad</span></th>\n               <th style=\"background-color: #14406b;\"><span>Precio</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span>Consumo de agua m3</span></td>\n               <td><span>\' . $factura[\"consumo_actual\"] . \'</span></td>\n               <td style=\"text-align: center !important;\"><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"], 0, \',\', \'.\') . \'</span></td>\n            </tr>\n         </tbody>\n      </table> -->\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td><span>SUBTOTAL</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\"valor_sin_recargo\"] + $factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\'], 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>CUENTAS VENCIDAS</span></td>\n            <th><span data-prefix>$</span><span>\' . $saldoPendiente . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SALDO A FAVOR</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($saldoFavor, 0, \',\', \'.\') . \'</span></th>\n         </tr>\n         <tr>\n            <td><span>SUBSIDIO</span></td>\n            <th><span data-prefix>$</span><span>\' . number_format($factura[\'valor_subsidio\'] + $factura[\'valor_subsidio_cargo_fijo\']) . \'</span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 16px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span data-prefix>$</span><span>\' . $total . \'</span></th>\n         </tr>\n      </table>\n     <address style=\"width: 62%;\">\n      <table>\n            <tr>\n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                  <p style=\"font-size: 13px; vertical-align: middle; line-height: normal\">\n                     <span style=\"font-weight: bold;\"> Canales y medios disponibles para hacer el pago de tu\n                        factura</span>\n                     <br>\n                     <br>\n                     <span>Transferencia o consignación a la cuenta de:</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">Ahorros Bancolombia N°</span>\n                     <br>\n                     <br>\n                     <span style=\"font-weight: bold;\">240-000018-93</span>\n                  </p>\n               </td> \n               <td style=\"border-radius: 0 !important; border-style: none !important;\">\n                    <img src=\"data:image/png;base64,[encoded data, 21620 characters]\" data-filename=\"Firma Ignacio Digital.png\"\n                    data-filename=\"Firma Ignacio Digital.png\" style=\"width: 220px; height: 70px;\">\n                    <p style=\"font-size: 10.3px; font-weight: bold;\">JORGE IGNACIO AREIZA CASTRILLON <BR> GERENTE</p>\n               </td>\n            </tr>\n         </table> \n\n      <BR>\n       </address> \n   </article>\n   <BR>\n   <BR>\n   <p style=\"font-size:10px;\">\' . $rayaDesprendibleBanco . \' DESPRENDIBLE PARA EL BANCO \' . $rayaDesprendibleBanco . \'</p>\n  \n   <BR>\n   <table style=\"border-collapse: collapse; border:none; border-width: 0px; style=\"vertical-align: middle !important;\">\n        <tr style=\"float: middle; !important;\">\n            <!-- <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width: 30%\">\n                <img \n                	<img src=\"data:image/png;base64,[encoded data, 32188 characters]\"\n	                style=\"width: 208px;\" data-filename=\"Logo2.png\">\n            </td> -->\n            <td style=\"border-radius: 0 !important; border-style: none !important; vertical-align: middle !important; width:70%\">\n                <img id=\"barcodeTarget\"/>\n                <canvas id=\"mycanvas\" width=\"200\" height=\"100\"></canvas>\n            </td>\n        </tr>\n    </table>\n</body>\n    <script>\n        //https://parzibyte.me/blog/2019/08/19/codigos-barras-javascript-jsbarcode/\n        const options = {\n            bcid:        \"gs1-128\",       // Barcode type\n            text:        \"\' . $BarcodeParent. \'\",    // Text to encode\n            scale:       2,               // 3x scaling factor\n            height:      9,              // Bar height, in millimeters\n            includetext: true,            // Show human-readable text\n            textxalign:  \"center\",        // Always good to set this\n        };\n        const hola2 = () => {\n            try {\n                bwipjs.toCanvas(\"mycanvas\", options);\n            } catch (e) { console.log({e}); }\n        };\n        const hola3 = () => {\n            const canvas = document.createElement(\"canvas\");\n            try {\n                bwipjs.toCanvas(canvas, options);\n                document.getElementById(\"barcodeTarget\").src = canvas.toDataURL(\"image/png\");\n            } catch (e) { console.log({e}); }\n        };\n        //addEventListener(\"DOMContentLoaded\", () => {\n            hola3();\n        //});\n\n         /* JsBarcode(\"#barcodeTarget\", \"\' . $Barcode. \'\", {\n            format: \"CODE128C\",// El formato\n    		width: 2.67, // La anchura de cada barra\n    		height: 65, // La altura del código\n    		displayValue: true, // ¿Mostrar el valor (como texto) del código de barras?\n    		text: \"\' . $BarcodeParent . \'\", // Texto (no código) que acompaña al barcode\n    		fontSize: 14, // Tamaño de la fuente\n    		fontOptions: \"bold\", // Opciones de la fuente del texto del barcode\n    		ean128: true,\n    	}); */\n	</script>\n   <script> \n      document.addEventListener(\"DOMContentLoaded\", function (event) {\n        //setTimeout(function(){ hola(); }, 1000);\n        var descargar = \' . $descargar . \';\n        if(descargar == 1) {\n             var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . str_replace(\' \', \'\', $factura[\"nombres\"] . \' \' . $factura[\"apellidos\"]) . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n    		 setTimeout(function(){ window.close(); }, 1650);\n        }\n        });\n        \n        function hola(){\n            var element = document.getElementById(\"Invoices\");\n             \n             var opt = {\n                filename: \"\' . $factura[\"contrato\"] . \'.pdf\",\n                image: { type: \"jpeg\", quality: 0.98 },\n                html2canvas: { scale: 2, useCORS: true, letterRendering: true },\n                jsPDF: { unit: \"mm\", format: \"letter\", orientation: \"portrait\" }\n             };\n    		 html2pdf(element, opt);\n        }\n   </script>\n</html>\';\n\necho $html;\ndie();','A'),