<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
//+++
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
if(vbval($_SESSION['SYS_USER_GI'])!=USU_GET_GI($_SESSION['SYS_USER_ID'])){
	JsDir("cerrar.php");	
	return;
}
//+++
$HW=$_SESSION['SYS_HW'];
$StrGT="";$LStrMsg="";$LStrFoc="";$LStrMM="";
$LStrPag=V($_POST['TxtPag']);
//+++
include("lq_permisos_fun.php");
//
$VP_RegXPag=20;
$LStrTR=gn("count(*)","vcotizaciones_det_permisos",$FF);
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Actualizar estado del producto</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="fe/funcionex.js"></script>

<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="estilox.css"  />
<link rel="stylesheet" type="text/css" href="basix.css"  />
<style type="text/css">
.cF {height:800px;width:1140px;position:relative; <?php echo "top:0px";?>}
.tzt{
	border:none; width:80px; background-color:transparent; position:inherit!Important; font-size:11px;
}
}
</style>
<script>
$(document).ready(function(){  
   Inicializar();   
});
</script>
<script language="javascript">
$(document).ready(function() {
	$(".botonExcel").click(function(event) {
		$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
		$("#FormularioExportacion").submit();
});
});


</script>
</head>

<body  <?php echo $LStrMsg;?>  >
<div align="center">

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;" >
<form id="Frm" name="Frm" method="post" action="lq_permisos.php">
<!--INI_TITULO-->
<div id="DivT" class="dT"  style="width:1140px">
<img src="img/unidades.png" class="iT" />
<div class="tT" style="width:926px">REPORTE DE PERMISIOS ASIGNADOS (PRECIOS/STOCK)</div>
</div>
<!--FIN_TITULO-->
<div class="s1" style="left:177px; top: 106px; width: 142px; height: 18px;">
  <?php
	if(strlen($_PDF)>0){
		echo "<a href=\"$_PDF\" target=\"_new\">DESCARGAR</a>";	
	}
?>
  
</div>
<div class="s1" style="left:35px; top: 132px; width: 54px; height: 18px;">CODIGO</div>
<input name="Cod"  type="text" 
class="lt"  id="Cod" 
style="left:35px; top: 149px; width: 95px;"
maxlength="11" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Cod;?>"   />

<div class="s1" style="left:138px; top: 132px; width: 156px; height: 18px;">DESCRIPCION</div>
<input name="Des"  type="text" 
class="lt"  id="Des" 
style="left:138px; top: 149px; width: 115px;"
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Des;?>"   />

<div class="ad" style="left:261px; top:132px; width: 93px; height: 18px;">VENDEDOR</div>
<select name="Ven" id="Ven" 
class="lt" style="left:262px; top:149px; width: 116px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
echo FCBO_("NOMBRE","vpersonal","ID>0 AND CARGO='VENDEDOR'",$Ven,"N","S");
?>
</select>

<div class="ad" style="left:390px; top:116px; width: 69px; height: 18px;">
PRECIO MENOR
</div>
<select name="Pre" id="Pre" 
class="lt" style="left:389px; top:149px; width: 61px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
echo FCBO("au_item","auxiliar","au_tab='SI_NO'",$Pre,"S","N");
?>
</select>

<div class="ad" style="left:460px; top:114px; width: 86px; height: 32px;">
AUTORIZADO POR</div>
<select name="UsuP" id="UsuP" 
class="lt" style="left:460px; top:149px; width: 86px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
echo FCBO("nom","usuarios","id_usuario>=0",$UsuP,"S","N");
?>
</select>

<div class="ad" style="left:560px; top:114px; width: 72px; height: 18px;">
CANTIDAD MAYOR
</div>
<select name="Can" id="Can" 
class="lt" style="left:557px; top:149px; width: 72px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
echo FCBO("au_item","auxiliar","au_tab='SI_NO'",$Can,"S","N");
?>
</select>

<div class="ad" style="left:640px; top:114px; width: 86px; height: 32px;">
AUTORIZADO POR</div>
<select name="UsuC" id="UsuC" 
class="lt" style="left:640px; top:149px; width: 86px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
echo FCBO("nom","usuarios","id_usuario>=0",$UsuC,"S","N");
?>
</select>

<div class="s1" style="left:737px; top: 132px; width: 86px; height: 18px;">
DESDE</div>
<input name="Dex"  type="text" 
class="fe tcal"  id="Dex" 
style="left:737px; top: 149px; width: 88px;"
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Dex;?>"   />

<div class="s1" style="left:835px; top: 132px; width: 86px; height: 18px;">
HASTA</div>
<input name="Hax"  type="text" 
class="fe tcal"  id="Hax" 
style="left:835px; top: 149px; width: 88px;"
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $´Hax;?>"   />

<div class="s1" style="left:931px; top: 132px; width: 86px; height: 18px;">
CLIENTE</div>
<input name="Cli"  type="text" 
class="lt"  id="Cli" 
style="left:931px; top: 149px; width: 95px;"
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Cli;?>"   />


<input name="CmdF" type="button" id="CmdF"  style="position:absolute; top:149px; left:1037px; width: 80px;"
value="Filtrar" onClick="fFiltrar();"  
tabindex="<?php echo ++$TI;?>" />

<!--INI_TABLA----->
<div class="s1"
style="background:#ECF9FF; position:absolute; left: 35px; top: 182px; width: 1083px; height: 550px; overflow:auto;">
<div class="s1" style="left: 0px; top: 0px; width: 1105px;">
  <table id="Exportar_a_Excel" class="f4t" width="1060" border="1" style="border-collapse: collapse">
   <tr>
      <td colspan="14" bgcolor="#CCCCCC" height="18" align="center">
      <?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
      </td>
      </tr>   
    <tr>
      <td width="80" bgcolor="#CCCCCC">FECHA</td>
      <td width="80" bgcolor="#CCCCCC">NUMERO</td>
      <td width="80" bgcolor="#CCCCCC">CODIGO</td>
      <td width="244" bgcolor="#CCCCCC">DESCRIPCION</td>
      <td width="75" bgcolor="#CCCCCC">PIEZAS</td>
      <td width="32" bgcolor="#CCCCCC">CANT</td>
      <td width="49" bgcolor="#CCCCCC">PRECIO EMITIDO</td>
      <td width="49" bgcolor="#CCCCCC">PRECIO MINIMO</td>
      <td width="49" bgcolor="#CCCCCC">PRECIO MENOR</td>
      <td width="79" bgcolor="#CCCCCC">AUTORIZADO</td>
      <td width="48" bgcolor="#CCCCCC">CANT EMITIDO</td>
      <td width="72" bgcolor="#CCCCCC">STOCK DISPONIBLE</td>
      <td width="41" bgcolor="#CCCCCC">CANT MAYOR</td>
      <td width="79" bgcolor="#CCCCCC">AUTORIZADO</td>
    </tr>   
    <?php
		$s="SELECT * 
			FROM vcotizaciones_det_permisos WHERE $FF 
			ORDER BY ID ";
		$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
		//echo $s."<br>";
		$rs = grs($s);
		while ($r = $rs->fetch_assoc()){
			$ID=$r['ID'];
			$SER_NUM=$r['SER']."-".$r['NUM'];
			//
			if($r['BIT_PRECIO_EX']==0)$r['BIT_PRECIO_EX']="NO";
			if($r['BIT_PRECIO_EX']==1)$r['BIT_PRECIO_EX']="SI";
			//
			if($r['BIT_STOCK_EX']==0)$r['BIT_STOCK_EX']="NO";
			if($r['BIT_STOCK_EX']==1)$r['BIT_STOCK_EX']="SI";
	?>
    <tr>
        <td>
        <input name=""  readonly type="text" 
        value="<?php echo $r['FEC_']?>" class="tzt">
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $SER_NUM?>" class="tzt">
        </td>       
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['COD']?>" class="tzt">
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['DES']?>" class="tzt" style="width:100%">
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['UNI']?>" class="tzt" style="text-align:right" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['KA']?>" class="tzt" style="text-align:right" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['PR']?>" class="tzt" style="text-align:right" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['BIT_PRECIO_MIN']?>" class="tzt" style="text-align:right" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['BIT_PRECIO_EX']?>" class="tzt" style="text-align:center" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['USU_PRECIO']?>" class="tzt" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['KA']?>" class="tzt" style="text-align:right" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['BIT_STOCK_DIS']?>" class="tzt" style="text-align:right" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['BIT_STOCK_EX']?>" class="tzt" style="text-align:center" >
        </td>
        <td>
        <input name="" readonly type="text" 
        value="<?php echo $r['USU_STOCK']?>" class="tzt" >
        </td> 
    </tr>			
    <?php
		}
	?>
  </table>
</div>
</div>
<!--FIN_TABLA----->
<!--INI_OCULTOS-------------------------------->
<?php include("ocultox.php");?>
<!--FIN_OCULTOS-------------------------------->
<!--INI_BOTONES----->
<div id="DivBtn"  align="left"
style="position:absolute; left: 33px; top: 71px; width: 703px; height: 26px;">
  <input name="CmdB" type="button" id="CmdZ" class="btm"
value="Menu" onClick="fBuscar('menu.php');"  
tabindex="<?php echo ++$TI;?>" />
</div>
<!--FIN_BOTONES-->
</form>
<form action="ficheroExcel.php" 
method="post" target="_blank" 
id="FormularioExportacion" >
</form>

</div>
</div>
</body>
</html>
