<!DOCTYPE html>
<html lang="es-ES">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Parametros Reporte Producción por Item</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-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"> 
 
function oculta(id){
	 var elDiv = document.getElementById(id); //se define la variable "elDiv" igual a nuestro div
	 elDiv.style.display='none'; //damos un atributo display:none que oculta el div	 
	}
 
function muestra(id){
	 var elDiv = document.getElementById(id); //se define la variable "elDiv" igual a nuestro div
	 elDiv.style.display='block';//damos un atributo display:block que  el div	 
	}
 
window.onload = function(){/*hace que se cargue la función */
/* "Mandamos como parametro el nombre de la Div para ocultar" */
oculta('Plinea');
muestra('Pagrupalinea');
}
</script>

</head>
<?php

include "../../conn.php";
include "../../general.php";

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

<?php

//listado de items
$result3 = mysqli_query($link, "select pkyItem as cod_item, fldName as item, fldFactoryKey as cod_fabrica
from invItem
where
sysEnabled = 1 and sysAuthorized = 1
order by fldName;");

//monedas para el reporte (menos la principal)
$result1 = mysqli_query($link, "select pkyCurrency as codigo, fldName as moneda
from actCurrency
where
pkyCurrency != '$cod_moneda_principal' and
sysEnabled = 1 and sysAuthorized = 1;");

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

//lista lineas de producción
$result5 = mysqli_query($link, "select pkyProductionLine as cod_linea, fldName as linea 
from prdProductionLine
where 
sysEnabled = 1 and sysAuthorized = 1;");


?>
<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 Producci&oacute;n por Item</b></td></tr><tr><td>
<form id="miform" name="miform" method="post" action="report.php?rep=14&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;">
</td></tr><tr><td>
<br/><b>Agrupado por Item<br /> y Concepto: </b></td><td> 
<br/><input type="radio" name="agrupar" checked="checked" value="0" class="formulario" onClick="oculta('Plinea'), muestra('Pagrupalinea')"> Si
<br/><input type="radio" name="agrupar" value="1" class="formulario" onClick="muestra('Plinea'), oculta('Pagrupalinea')"> No

</td></tr><tr><td colspan="2">
<table border="0" id="Pagrupalinea">
<tr><td width="110">
<br/><b>Agrupado por L&iacute;nea<br />de Producci&oacute;n: </b></td><td> 
<br/><input type="radio" name="agruparlinea" value="0" class="formulario" onClick="muestra('Plinea')"> Si
<br/><input type="radio" name="agruparlinea" checked="checked" value="1" class="formulario" onClick="oculta('Plinea')"> No
</td></tr>
</table>

</td></tr><tr><td colspan="2">
<table border="0" id="Plinea">
<tr><td width="105">
<br/><b>L&iacute;nea de Producci&oacute;n: </b></td><td> <br/>&nbsp;&nbsp;<!--<SELECT NAME="vendedor" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="linea">
	<option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result5)) {   
	?> 
    
	<option value="<?php echo $row['cod_linea']?>"><?php echo $row['cod_linea']?> - <?php echo $row['linea']?></option> 
	<?php 
	}  
	mysqli_free_result($result5);
	?> 
    </select>
</td></tr>
</table>

</td></tr><tr><td>
<br/><b>Item: </b></td><td> <br/><!--<SELECT NAME="item" class="formulario">-->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:450px;" NAME="item">
    <option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result3)) {   
	?> 
	<option value="<?php echo $row['cod_item']?>"><?php echo $row['cod_item']?> - <?php echo $row['cod_fabrica']?> - <?php echo $row['item']?></option> 
	<?php 
	}  
	mysqli_free_result($result3);
	?>
    </select>    
</td></tr><tr><td>

<br/><b>Contexto: </b></td><td> <br/><!--<SELECT NAME="contexto" 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($result4)) {   
	?> 
	<option value="<?php echo $row['cod_contexto']?>"><?php echo $row['cod_contexto']?> - <?php echo $row['contexto']?></option> 
	<?php 
	}  
	mysqli_free_result($result4);
	?> 
    </select>
</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>Valorar en: </b></td><td> <br/>
<input name="otra_moneda" type="radio" value="<?php echo $cod_moneda_principal; ?>" checked="checked"> Moneda original<br/>
<?php 
while($row = mysqli_fetch_array($result1)){ 
 echo "<input name='otra_moneda' type='radio' value='".$row['codigo']."'> ".$row['moneda']."<br>";
 } 
mysqli_free_result($result1);
	
	?>

</td></tr><tr><td>
<br/><b>Ordenado por: </b></td><td> 
<br/><input type="radio" name="ordenar" checked="checked" value="0" class="formulario"> Item
<br/><input type="radio" name="ordenar" value="1" class="formulario"> C&oacute;digo de Item
<br/><input type="radio" name="ordenar" value="2" class="formulario"> C&oacute;digo de F&aacute;brica
<br/><input type="radio" name="ordenar" value="3" class="formulario"> Fecha Orden de Producci&oacute;n (solo en NO agrupado)

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

<br/><b>Mostrar: </b></td><td> 
<br/><input type="checkbox" name="insumosu_ver" value="1" class="formulario"> Insumos utilizados
<br/><input type="checkbox" name="insumose_ver" value="1" class="formulario"> Insumos extras
<br/><input type="checkbox" name="costosi_ver" value="1" class="formulario"> Costos indirectos

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