<!DOCTYPE html>
<html lang="es-ES">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Parametros Reporte Libro Mayor</title>
<link href="../../maincss.css" rel="stylesheet" type="text/css" />
<link href="../../chosen/chosen.css" rel="stylesheet" />
<link href="../../tcal.css" rel="stylesheet" type="text/css" />

<script language="javascript" src="../../js/tcal.js" type="text/javascript"></script>
<script language="javascript" src="../../js/jquery-3.4.1.js"></script>
<script type="text/javascript" src="../../chosen/chosen.jquery.js"></script>
<script language="javascript" src="../../js/validar.js"></script>

<script language="javascript">
	$(document).ready(function(){
		$("#cbx_cuentaelegido1").change(function () {
			$("#cbx_cuentaelegido1 option:selected").each(function () {
				cuentaelegido1 = $(this).val();
				$.post("cuentaelegido1.php", { cuentaelegido1: cuentaelegido1 }, function(data){
					$("#cbx_cuentaelegido2").html(data);
				});            
			});
		})
	});
</script>

</head>
<?php
include "../../conn.php";
include "../../general.php";
include "../../token.php";

//$usuario = $_GET["user"];

//tipo de cc
$result2 = mysqli_query($link, "select pkyCostCenterType as codigo, fldName as nombre 
from 
actCostCenterType 
where 
sysEnabled = 1 and sysAuthorized = 1;");

//lista contexto
$result3 = mysqli_query($link, "select pkyContext as cod_contexto, fldName as contexto, codCostCenter as cod_cc 
from srvContext
where 
sysEnabled = 1 and sysAuthorized = 1;");

//tipo
$result4 = mysqli_query($link, "select pkyAccountEntryType as cod_tipo, fldName as tipo
from actAccountEntryType
where 
sysEnabled = 1 and sysAuthorized = 1;");

//
$result5 = mysqli_query($link, "select pkyComponent AS codigo, txtModuleDescription AS modulo, txtDescription AS componente, fldName AS comparar 
FROM
srvComponent 
WHERE 
codType = 3 and 
pkyComponent NOT IN (203107, 203182, 203266, 203149, 203220, 203032, 203136, 203226, 203272, 203223, 203233, 203234, 203259, 203218, 203222, 203235, 203236, 203128, 203129, 203263, 203202, 203144, 203201) and 
sysEnabled = 1 and sysAuthorized = 1 
ORDER BY modulo, componente;");

/*
//calculo de inicio de gestion
$ano_det = substr($fecha_hoy,0,4);
$resultano = mysqli_query($link, "select codStartMonth as mes_ini
from actFiscalYear 
where
pkyFiscalYear = '$ano_det';");
while ($row = mysqli_fetch_array($resultano)) {
	$mes_ini = $row['mes_ini'];
}
mysqli_free_result($resultano);

if($mes_ini < 10) { $mes_ini = '0'.$mes_ini; }

$fechaini_gest = $ano_det.'-'.$mes_ini.'-01';
*/
//echo $estructura_cuenta;
$nro_mayores = substr($estructura_cuenta, -1);
//echo $nro_mayores;

//listado de cuentas
/*
$result = mysqli_query($link, "select pkyAccount as cod_cta, fldName as cuenta
from
actAccount
where
sysEnabled = 1 and sysAuthorized = 1 
order by pkyAccount;");
*/

?>
<body>

<?php 
//Inicio reporte Libro Mayor

?>
<table border="0" align="left" width="100%" cellpadding="5">
<tr><td><b>Empresa: <?php echo $nombre_empresa; ?><br/>NIT: <?php echo $mi_nit; ?></b>
</td><td align="right"><b>Fecha: <?php echo date("Y-m-d"); ?><br/>Hora: <?php echo date("H:i:s"); ?><br/>Usuario: <?php echo $usuario; ?><br/>C-FH</b>
</td></tr></table><br/>
<table border="0" align="center" cellpadding="5"><tr><td colspan="2" align="center">
<b>Par&aacute;metros Reporte Libro Mayor</b></td></tr><tr><td>
<form id="miform" name="miform" method="post" action="report.php?rep=9&tipo=1" onsubmit="return Validar()">
<br/><b>Usuario: </b></td><td> <br/><input type="text" name="usuario" value="<?php echo $usuario; ?>" size="20" readonly="readonly" class="formulario" style="color:#999;">
<input type="hidden" name="token" value="<?php echo $token; ?>">
</td></tr><tr><td>
<br/><b>Asiento con CC: </b></td><td> <br/><input type="radio" name="asientocc" checked="checked" value="0" class="formulario"> No
<br/><input type="radio" name="asientocc" value="1" class="formulario"> Si

</td></tr><tr><td>
<br/><b>Cuenta inicial: </b></td><td> <br/><!--<SELECT NAME="cuentaini" id="cbx_cuentaelegido1" class="formulario">-->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="cuentaini" id="cbx_cuentaelegido1">
    <?php 
	$query = "select pkyAccount as cod, fldName as cuenta
	from
	actAccount
	where
	sysEnabled = 1 and sysAuthorized = 1 
	order by pkyAccount";
	$resultado=$mysqli->query($query);
	?>
	<option value="0">Todos</option>
	<?php while($row = $resultado->fetch_assoc()) { ?>
		<option value="<?php echo $row['cod']; ?>"><?php echo $row['cod'].' - '.$row['cuenta']; ?></option>
	<?php } 
	$resultado->close(); ?> 
	</select>
</td></tr><tr><td>
<br/><b>Cuenta final: </b></td><td> <br/><SELECT NAME="cuentafin" id="cbx_cuentaelegido2" style="width:300px;" class="select-css">
<!--<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="cuentafin" id="cbx_cuentaelegido2"> -->
<option value="0">Todos</option>
</select>
</td></tr><tr><td>

<br/><b>Tipo: </b></td><td> <br/><!--<SELECT NAME="concepto_pago" class="formulario">-->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="tipo_asiento">
    <option value="-1">Todos</option>
    <option value="-2">Autom&aacute;tico</option>
    <option value="-3">Manual</option>
	<?php 
	while ($row = mysqli_fetch_array($result4)) {   
	?> 
	<option value="<?php echo $row['cod_tipo']?>"><?php echo $row['cod_tipo']?> - <?php echo $row['tipo']?></option> 
	<?php 
	}  
	mysqli_free_result($result4);
	?> 
    </select>
</td></tr><tr><td>

<br/><b>Componente: </b></td><td> <br/><!--<SELECT NAME="concepto_pago" class="formulario">-->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="tipo_componente">
    <option value="todos">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result5)) {   
	?> 
	<option value="<?php echo $row['comparar']?>"><?php echo $row['modulo']?> - <?php echo $row['componente']?></option> 
	<?php 
	}  
	mysqli_free_result($result5);
	?> 
    </select>
</td></tr><tr><td>

<br/><b>Contexto: </b></td><td> <br/><!--<SELECT NAME="concepto_pago" class="formulario">-->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="contexto">
    <option value="-1">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result3)) {   
	?> 
	<option value="<?php echo $row['cod_contexto']?>"><?php echo $row['cod_contexto']?> - <?php echo $row['contexto']?></option> 
	<?php 
	}  
	mysqli_free_result($result3);
	?> 
    </select>
</td></tr><tr><td>

<br/><b>Centros de Costo: </b></td><td><br/><!--<SELECT NAME="cliente" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="centrocosto">
	<option value="-1">Ninguno</option>
	<?php 
	while ($row = mysqli_fetch_array($result2)) {   
	?> 
	<option value="<?php echo $row['codigo']?>"><?php echo $row['codigo']?> - <?php echo $row['nombre']?></option> 
	<?php 
	}  
	mysqli_free_result($result2);
	?>
    </select>
</td></tr><tr><td>

<br/><b>Formato: </b></td><td> <br/><input type="radio" name="formato" checked="checked" value="0" class="formulario"> Libro Mayor
<br/><input type="radio" name="formato" value="1" class="formulario"> Reporte

</td></tr><tr><td>

<br/><b>De Fecha: </b></td><td> <br/><div><input type="text" id="fechaini" name="fechaini" value="<?php echo $fechaini_gest; ?>" length="10" maxlength="10" class="tcal" title="aaaa-mm-dd"> </div>aaaa-mm-dd
</td></tr><tr><td>
<br/><b>A Fecha: </b></td><td> <br/><div><input type="text" id="fechafin" name="fechafin" value="<?php echo $fecha_hoy; ?>" length="10" maxlength="10" class="tcal" title="aaaa-mm-dd"> </div>aaaa-mm-dd

</td></tr><tr><td>
<br/><b>Mostrar sin movimiento: </b></td><td> <br/><input type="radio" name="mostrar" checked="checked" value="0" class="formulario"> No
<br/><input type="radio" name="mostrar" value="1" class="formulario"> Si
<!--
</td></tr><tr><td>
<br/><b>Ordenado por: </b></td><td> <br/><input type="radio" name="orden" checked="checked" value="0" class="formulario"> Fecha
<br/><input type="radio" name="orden" value="1" class="formulario"> Cliente

</td></tr><tr><td>
<br/><b>Mostrar Anuladas: </b></td><td> <br/><input type="radio" name="mostrar" checked="checked" value="0" class="formulario"> No
<br/><input type="radio" name="mostrar" value="1" class="formulario"> Si
-->
</td></tr>
<tr><td colspan="2" align="center">
<br/><br/><INPUT TYPE="submit" VALUE="Generar Reporte" class="boton_generar"></td></tr>
<script type="text/javascript"> $(".chzn-select").chosen({no_results_text: "No se encontraron resultados con "}); $(".chzn-select-deselect").chosen({allow_single_deselect:true}); </script>
</form>
</table>

</body>
</html>
