<!DOCTYPE html>
<html lang="es-ES">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Parametros Reporte Libro Diario</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"];

?>
<body>

<?php 
//Inicio reporte Libro Diario

//listado de modulos
//cuando se hace un asiento directamente tiene NULL en el campo fldName
$result = mysqli_query($link, "select case when rtrim(fldName) = 'ComponentAccountEntry' then NULL else rtrim(fldName) end as comp, txtDescription as nom_comp, txtModuleDescription as nom_modulo 
from srvComponent 
where 
codType = 3 or 
codType = 5 and 
sysEnabled = 1 and sysAuthorized = 1
order by nom_modulo, nom_comp;");

//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;");

//listado de grupo de usuario
$result5 = mysqli_query($link, "select pkyGroup as cod_grupo, fldName as usuario
from accGroup
where 
sysEnabled = 1 and sysAuthorized = 1 
order by usuario;");

?>
<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/>F</b>
</td></tr></table><br/>
<table border="0" align="center" cellpadding="5"><tr><td colspan="2" align="center">
<b>Par&aacute;metros Reporte Libro Diario</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>M&oacute;dulo - Componente: </b></td><td><br/><!-- <SELECT NAME="proveedor" class="formulario"> -->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="modulo">
	<option value="Todos">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result)) {   
	?> 
	<option value="<?php echo $row['comp']; ?>"><?php echo $row['nom_modulo']; ?> - <?php echo $row['nom_comp']; ?></option> 
	<?php 
	}  
	mysqli_free_result($result);
	?>
    </select>
	</td></tr><tr><td>

<br/><b>Cuenta inicial <br /> (en el asiento): </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 <br /> (en el asiento): </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>Usuario que registró: </b></td><td> <br/><!--<SELECT NAME="usuario_lista" class="formulario">-->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="usuario_lista">
    <option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result5)) {   
	?> 
	<option value="<?php echo $row['cod_grupo']?>"><?php echo $row['usuario']?></option> 
	<?php 
	}  
	mysqli_free_result($result5);
	?> 
    </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>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 Diario
<br/><input type="radio" name="formato" value="1" class="formulario"> Reporte

</td></tr><tr><td>
<br/><b>Ver Log (Fecha Reg.): </b></td><td> <br/><input type="radio" name="ver_usuario_reg" checked="checked" value="0" class="formulario"> No
<br/><input type="radio" name="ver_usuario_reg" value="1" class="formulario"> Si
 
</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: </b></td><td> <br/><input type="radio" name="mostrar" checked="checked" value="0" class="formulario"> Solo V&aacute;lidos
<br/><input type="radio" name="mostrar" value="1" class="formulario"> V&aacute;lidos y Anulados
<br/><input type="radio" name="mostrar" value="2" class="formulario"> Solo Anulados

</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>
