<!DOCTYPE html>
<html lang="es-ES">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Parametros Reporte Empresa</title>
<link href="../../maincss.css" rel="stylesheet" type="text/css" />
<link href="../../chosen/chosen.css" rel="stylesheet" />
<!--
<script language="javascript" src="js/jquery-1.3.min.js"></script>
-->
<script language="javascript" src="../../js/jquery-3.4.1.js"></script>
<script type="text/javascript" src="../../chosen/chosen.jquery.js"></script>


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

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

//listado de empresas
$result1 = mysqli_query($link, "select pkyCompany as cod_emp, fldName as empresa
from
agnCompany 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");

//listado de NIT
$result2 = mysqli_query($link, "select distinct fldNIT as nit
from
agnCompany 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldNIT;");

//listado de rubros
$result3 = mysqli_query($link, "select pkyCompanyHeading as cod_rubro, fldName as rubro
from 
agnCompanyHeading 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");

//listado de tipos
$result4 = mysqli_query($link, "select pkyCompanyType as cod_tipo, fldName as tipo
from 
agnCompanyType 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");

//listado de ciudad
$result5 = mysqli_query($link, "select a.pkyCity as cod_ciu, a.fldName as ciudad, b.fldName as pais
from 
regCity a, regCountry b
where 
a.codCountry = b.pkyCountry and 
a.sysEnabled = 1 and a.sysAuthorized = 1 
order by ciudad, pais;");

//listado de canales
$result8 = mysqli_query($link, "select pkyChannel as cod_canal, fldName as canal
from 
agnChannel 
where
sysEnabled = 1 and sysAuthorized = 1 
order by fldName;");

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

?>
<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 Empresas</b></td></tr><tr><td>
<form id="miform" name="miform" method="post" action="report.php?rep=13&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;">
<input type="hidden" name="token" value="<?php echo $token; ?>">
</td></tr><tr><td>
<br/><b>Empresa:</b></td><td> <br/><!--<SELECT NAME="item" class="formulario">-->
	<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="empresa">
    <option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result1)) {   
	?> 
	<option value="<?php echo $row['cod_emp']?>"><?php echo $row['cod_emp']?> - <?php echo $row['empresa']?></option> 
	<?php 
	}  
	mysqli_free_result($result1);
	?>
    </select>    
</td></tr><tr><td>

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

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

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

<br/><b>Ciudad:</b></td><td> <br/><!--<SELECT NAME="tipoi" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="ciudad">
	<option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result5)) {   
	?> 
	<option value="<?php echo $row['cod_ciu']?>"><?php echo $row['cod_ciu']?> - <?php echo $row['ciudad']?> - <?php echo $row['pais']?></option> 
	<?php 
	}  
	mysqli_free_result($result5);
	?>
    </select>    
</td></tr><tr><td>

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

<br/><b>Empresas que son: </b></td><td> <br/><input type="radio" name="cliente_proveedor" checked="checked" value="0" class="formulario"> Todos
<br/><input type="radio" name="cliente_proveedor" value="1" class="formulario"> Cliente
<br/><input type="radio" name="cliente_proveedor" value="2" class="formulario"> Proveedor
<br/><input type="radio" name="cliente_proveedor" value="3" class="formulario"> Cliente y Proveedor

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

<br/><b>Canal:</b></td><td> <br/><!--<SELECT NAME="tipoi" class="formulario">-->
<select data-placeholder="Seleccione..." class="chzn-select" style="width:300px;" NAME="canal">
	<option value="0">Todos</option>
	<?php 
	while ($row = mysqli_fetch_array($result8)) {   
	?> 
	<option value="<?php echo $row['cod_canal']?>"><?php echo $row['cod_canal']?> - <?php echo $row['canal']?></option> 
	<?php 
	}  
	mysqli_free_result($result8);
	?>
    </select>    
</td></tr><tr><td>

<br/><b>Ordenado por: </b></td><td> <br/><input type="radio" name="orden" checked="checked" value="0" class="formulario"> Empresa
<br/><input type="radio" name="orden" value="1" class="formulario"> NIT
<br/><input type="radio" name="orden" value="2" class="formulario"> Rubro
<br/><input type="radio" name="orden" value="3" class="formulario"> Tipo
<br/><input type="radio" name="orden" value="4" class="formulario"> C&oacute;digo del Vendedor
 
</td></tr><tr><td>

<br/><b>Mostrar: </b></td><td> <br/><input type="checkbox" name="ciudad_ver" value="1" checked="checked" class="formulario"> Ciudad
<br/><input type="checkbox" name="cod_alt_ver" value="1" class="formulario"> C&oacute;digo Alternativo
<br/><input type="checkbox" name="tipo_ver" value="1" class="formulario"> Tipo
<br/><input type="checkbox" name="rubro_ver" value="1" class="formulario"> Rubro
<br/><input type="checkbox" name="web_ver" value="1" class="formulario"> Sitio Web
<br/><input type="checkbox" name="casilla_ver" value="1" class="formulario"> Casilla
<br/><input type="checkbox" name="totalventa_ver" value="1" class="formulario"> Total Venta
<br/><input type="checkbox" name="canal_ver" value="1" class="formulario"> Canal
<br/><input type="checkbox" name="vendedor_ver" value="1" class="formulario"> Vendedor
<br/><input type="checkbox" name="listaprecio_ver" value="1" class="formulario"> Lista de Precio
<br/><input type="checkbox" name="diascred_ver" value="1" class="formulario"> D&iacute;as de Cr&eacute;dito
<br/><input type="checkbox" name="diasfac_ver" value="1" class="formulario"> Max. D&iacute;a de Facturaci&oacute;n
<br/><input type="checkbox" name="desc_ver" value="1" class="formulario"> Descripci&oacute;n
<br/><input type="checkbox" name="direccion_ver" value="1" class="formulario"> Direcci&oacute;n
<br/><input type="checkbox" name="credito_ver" value="1" class="formulario"> Tarjeta de Cr&eacute;dito
<br/><input type="checkbox" name="contacto_ver" value="1" class="formulario"> Documentos del Contacto
<br/><input type="checkbox" name="email_ver" value="1" class="formulario"> E-mail
<br/><input type="checkbox" name="telefono_ver" value="1" class="formulario"> Tel&eacute;fono
 
</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>
