<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Parametros Reporte Activos Fijos</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/jquery-1.3.min.js"></script>
-->
<script language="javascript" src="../../js/tcal.js" type="text/javascript"></script>
<script language="javascript" src="../../js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="../../chosen/chosen.jquery.js"></script>

<script language="javascript">
$(document).ready(function(){
	// Parametros para el combo1
   $("#combo1").change(function () {
   		$("#combo1 option:selected").each(function () {
			//alert($(this).val());
				elegido=$(this).val();
				$.post("combo1.php", { elegido: elegido }, function(data){
				$("#combo2").html(data);
				$("#combo3").html("");
			});			
        });
   })
	// Parametros para el combo2
	$("#combo2").change(function () {
   		$("#combo2 option:selected").each(function () {
			//alert($(this).val());
				elegido=$(this).val();
				$.post("combo2.php", { elegido: elegido }, function(data){
				$("#combo3").html(data);
			});			
        });
   })
	// Parametros para el combo3
	$("#combo3").change(function () {
   		$("#combo3 option:selected").each(function () {
			//alert($(this).val());
				elegido=$(this).val();
				$.post("combo3.php", { elegido: elegido }, function(data){
				$("#combo4").html(data);
			});			
        });
   })
});
</script>

<script language="javascript">
$(document).ready(function(){
	// Parametros para el otrocombo1
   $("#marcacombo1").change(function () {
   		$("#marcacombo1 option:selected").each(function () {
			//alert($(this).val());
				elegido=$(this).val();
				$.post("marcacombo1.php", { elegido: elegido }, function(data){
				$("#marcacombo2").html(data);
				$("#marcacombo3").html("");
			});			
        });
   })
	// Parametros para el otrocombo2
	$("#marcacombo2").change(function () {
   		$("#marcacombo2 option:selected").each(function () {
			//alert($(this).val());
				elegido=$(this).val();
				$.post("marcacombo2.php", { elegido: elegido }, function(data){
				$("#marcacombo3").html(data);
			});			
        });
   })
	// Parametros para el otrocombo3
	$("#marcacombo3").change(function () {
   		$("#marcacombo3 option:selected").each(function () {
			//alert($(this).val());
				elegido=$(this).val();
				$.post("marcacombo3.php", { elegido: elegido }, function(data){
				$("#marcacombo4").html(data);
			});			
        });
   })
});
</script>

</head>
<?php
include "../../conn2.php";//para la conexion del query de familia, subfamilia, grupo y subgrupo
include "../../mysql.class.php";
include "../../conn.php";
include "../../general.php";

$usuario = $_GET["user"];
?>
<body>

<?php 
//Inicio reporte activos fijos

//listado de activos fijos
$result2 = mysqli_query($link, "select pkyFixedAsset as codigo, fldName as item, fldFactoryKey as cod_fabrica, fldAlternativeKey as cod_alt
from 
fasFixedAsset
where
sysEnabled = 1 and sysAuthorized = 1
order by item;");

//listado de empleados
$result3 = mysqli_query($link, "select pkyPerson as codigo, case when fldMiddleName is NULL then concat(fldLastName,', ',fldFirstName) else concat(fldLastName,' ',fldMiddleName,', ',fldFirstName) end as empleado
from agnPerson
where
fldIsEmployee = 1 and
sysEnabled = 1 and sysAuthorized = 1
order by empleado;");

//listado de sucursales
$result4 = mysqli_query($link, "select pkyCompanyBranch as cod_sucursal, fldName as sucursal
from 
agnCompanyBranch 
where 
sysEnabled = 1 and sysAuthorized = 1
order by sucursal;");

/*
function sumaDia($ffecha,$fdia)
	{	list($year,$mon,$day) = explode('-',$ffecha);
		return date('Y-m-d',mktime(0,0,0,$mon,$day+$fdia,$year));		
	};
function cambiarFormatoFecha($fecha5){
    list($anio,$mes,$dia)=explode("-",$fecha5);
    return $dia."-".$mes."-".$anio;
	};  
*/
?>
<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 Activos Fijos</b></td></tr><tr><td>
<form id="miform" name="miform" method="post" action="report.php?rep=9&tipo=1">
<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;">
</td></tr><tr><td>

<br/><b>Mostrar por Sucursal: </b></td><td> <br/><input type="radio" name="mostrarsuc" checked="checked" value="0" class="formulario"> No
<br/><input type="radio" name="mostrarsuc" value="1" class="formulario"> Si
</td></tr><tr><td>

<br/><b>Solo Consolidado: </b></td><td> <br/><input type="radio" name="consolidado" checked="checked" value="0" class="formulario"> No
<br/><input type="radio" name="consolidado" value="1" class="formulario"> Si
</td></tr><tr><td>

<br/><b>Activo Fijo:</b></td><td> <br/><!--<SELECT NAME="almacen" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="afijo">
	<option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result2)) {   
	?> 
	<option value="<?php echo $row['codigo']?>"><?php echo $row['codigo']?> - <?php echo $row['cod_fabrica']?> - <?php echo $row['cod_alt']?> - <?php echo $row['item']?></option>  
	<?php 
	}  
	mysqli_free_result($result2);
	?>
    </select>    
    
</td></tr><tr><td>
<br/><b>Sucursal: </b></td><td> <br/><!--<SELECT NAME="vendedor" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="sucursal">
	<option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result4)) {   
	?> 
    
	<option value="<?php echo $row['cod_sucursal']?>"><?php echo $row['sucursal']?></option> 
	<?php 
	}  
	mysqli_free_result($result4);
	?> 
    </select>
    
</td></tr><tr><td>
<br/><b>Responsable: </b></td><td> <br/><!--<SELECT NAME="vendedor" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="empleado">
	<option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result3)) {   
	?> 
    
	<option value="<?php echo $row['codigo']?>"><?php echo $row['empleado']?></option> 
	<?php 
	}  
	mysqli_free_result($result3);
	?> 
    </select>

</td></tr><tr><td>
<br/><b>Marca: </b></td><td> <br/><!--<SELECT NAME="familia" id="combo1" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="marca" id="marcacombo1">
<option value="0">Todos</option>
<?php
$db = new MySQL();  
$db->open();
$consulta = $db->consulta("select pkyBrand as cod, fldName as marca 
from invBrand 
where 
sysEnabled = 1 and sysAuthorized = 1
order by fldName");
if ($row = $db->fetch_array($consulta)) {
	do {
		echo 
		'<option value="'.$row[cod].'">'.$row[marca].'</option>';
	}while($row = $db->fetch_array($consulta));
}
?> 
</select>
</td></tr>

<tr><td width="135">
<br/><b>Modelo: </b></td><td> <br/><SELECT NAME="modelo" id="marcacombo2" class="formulario">	
<option value="0">Todos</option>
</select>

</td></tr><tr><td>
<br/><b>Familia: </b></td><td> <br/><!--<SELECT NAME="familia" id="combo1" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="familia" id="combo1">
<option value="0">Todos</option>
<?php
$db = new MySQL();  
$db->open();
$consulta = $db->consulta("select pkyFixedAssetCategory as cod, fldName as categoria
from
fasFixedAssetCategory
where
fldLevel = 1 and
sysEnabled = 1 and sysAuthorized = 1 
order by categoria");
if ($row = $db->fetch_array($consulta)) {
	do {
		echo 
		'<option value="'.$row[cod].'">'.$row[categoria].'</option>';
	}while($row = $db->fetch_array($consulta));
}
?> 
</select>

</td></tr><tr><td>
<br/><b>Sub Familia: </b></td><td> <br/><SELECT NAME="subfamilia" id="combo2" class="formulario">	
<option value="0">Todos</option>
</select>
</td></tr><tr><td>

<br/><b>Grupo: </b></td><td> <br/><SELECT NAME="grupo" id="combo3" class="formulario">	
<option value="0">Todos</option>
</select>
</td></tr><tr><td>

<br/><b>Sub Grupo: </b></td><td> <br/><SELECT NAME="subgrupo" id="combo4" class="formulario">
<option value="0">Todos</option>
</select>
</td></tr><tr><td>
<!--
<br/><b>De Fecha: </b></td><td> <br/><select name="mesini" class="formulario"> 
<option value="1">Enero</option>
<option value="2">Febrero</option>
<option value="3">Marzo</option>
<option value="4">Abril</option>
<option value="5">Mayo</option>
<option value="6">Junio</option>
<option value="7">Julio</option>
<option value="8">Agosto</option>
<option value="9">Septiembre</option>
<option value="10">Octubre</option>
<option value="11">Noviembre</option>
<option value="12">Diciembre</option>
</select>
<input type="text" name="anoini" value="<?php echo $ano_ini; ?>" size="4" length="4" maxlength="4" title="aaaa"><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;aaaa
</td></tr><tr><td>
-->
<br/><b>A Fecha: </b></td><td> <br/><select name="mesfin" class="formulario"> 
<option value="1">Enero</option>
<option value="2">Febrero</option>
<option value="3">Marzo</option>
<option value="4">Abril</option>
<option value="5">Mayo</option>
<option value="6">Junio</option>
<option value="7">Julio</option>
<option value="8">Agosto</option>
<option value="9">Septiembre</option>
<option value="10">Octubre</option>
<option value="11">Noviembre</option>
<option value="12">Diciembre</option>
</select>
<input type="text" name="anofin" value="<?php echo $ano_ini; ?>" size="4" length="4" maxlength="4" title="aaaa"><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;aaaa
</td></tr><tr><td>

<br/><b>Ordenado por: </b></td><td> <br/><input type="radio" name="orden" checked="checked" value="0" class="formulario"> Item
<br/><input type="radio" name="orden" value="1" class="formulario"> C&oacute;digo
<br/><input type="radio" name="orden" value="2" class="formulario"> Cod. Alt.

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