<?php
	session_start();
	include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
	if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
	//-------------------------	
	$StrGT="";	$LStrMsg="";	$LStrFoc="";	$LStrMM="";
	$StrCmd=V($_POST['TxtAc']);
	$StrAlm=V($_POST['CboAlm']);
	$StrCod=V($_POST['TxtCod']);
	$StrDes=V($_POST['TxtDes']);
	
	$IdUsu=$_SESSION['SYS_USER_ID'];
	if($_SESSION['SYS_USER_ALM']=="%"){
		if(strlen($StrAlm)==0)$StrAlm=T($StrAlm);//$StrAlm=GetSO("alm_nombre","almacenes","","alm_nombre");
	}else{
		$StrAlm=$_SESSION['SYS_USER_ALM'];
	}
	
	$StrAlm=T($StrAlm);


	$StrCodT=$StrCod."%";
	$StrDesT=$StrDes."%";
	
	$w="ID>0 AND ALM LIKE '$StrAlm'	AND COD LIKE '$StrCodT'	AND DES LIKE '$StrDesT' ";
	$LStrPag=V($_POST['TxtPag']);
	if($StrCmd=="F"){$LStrPag="1";}	
	$VP_RegXPag=20;
	$LStrTR=gn("count(*)","vis_stockm",$w);
	$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
	

$AT=gs("at","usuarios","id_usuario=$IdUsu");
?>

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Buscar - Control Stock Minimo</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/marcas.js"></script>
<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="css/estiloss.css"  />
<link rel="stylesheet" type="text/css" href="css/basic.css"  />
<link rel="stylesheet" type="text/css" href="css/mnu.css"  />

<style type="text/css">
.cF {height:600px;width:1250px;position:relative;top:0px}
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}

</style>
<script>
$(document).ready(function(){  
   Inicializar();
});


$(document).keydown(function(e){
	var AT=gv("TxtAT");

	if(e.which==66 && e.altKey){
		if(AT=="1"){	
		document.getElementById("CmdB").click();
		return;
		}
	}

	if(e.which==86 && e.altKey){
		if(AT=="1"){
		document.getElementById("CmdZ").click();
		return;
		}
	}
  
});
</script>
</head>

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

<div class="mM" align="left" style="font-size:12px">
<?php
$HTM=file_get_contents("http://inversionessounduniversal.com/ventas/phpmnu.php?USER_ID=$IdUsu");
echo $HTM;
?>
</div>

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;">
<form id="Frm" name="Frm" method="post" action="stock_minimo_buscar.php" style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!----------------------------------------->
<div id="DivT" class="dT"  style="width:1250px;">
<img src="b.png" class="iT" />
<div class="tT">CONTROL STOCK MINIMO - BUSCAR</div>
</div>
<!----------------------------------------->


<div class="s1" style="left: 35px; top: 117px; width: 79px;">
ALMACEN</div>
<select name="CboAlm" id="CboAlm" 
class="lt"  style="left: 35px; top: 134px; width: 168px" 
tabindex="<?php echo ++$TI;?>">
<?php 
	if($IdUsu>=1  && V($_SESSION['SYS_USER_ALM'])!="%"){
		echo ListALM($StrAlm); 
	}else{
    	echo FCBO("alm_nombre","almacenes","id_almacen>0",$StrAlm,"S","N");
    }
?>
</select>

<div class="s1" style="left: 214px; top: 117px; width: 54px;">
CODIGO</div>
<input name="TxtCod" type="text" id="TxtCod" 
class="lt"  style="left: 213px; top: 134px; width: 113px" 
value="<?php echo $StrCod;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 336px; top: 117px; width: 100px;">
DESCRIPCION</div>
<input name="TxtDes" type="text" id="TxtDes" 
class="lt"  style="left: 334px; top: 134px; width: 279px" 
value="<?php echo $StrDes;?>"  
tabindex="<?php echo ++$TI;?>"/>

<!----------------------------------------->
<?php $VOLVER="stock_minimo.php";?>
<?php include("botones_b.php");?>;

<!----------------------------------------->  

<div class="datagrid" style="position: absolute; left: 35px; top: 165px; width: 1180px; height: 416px; overflow: auto">
<table width="100%">
<thead>
<tr>
<td colspan="13" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>

<tr>
<th width="17%">ALMACEN</th>
<th width="7%">CODIGO.P</th>
<th width="65%">DESCRIPCION</th>
<th width="8%" style="text-align:right;">STOCK.MIN</th>
<th width="3%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
	$s="SELECT ID,ALM,COD,DES,CAN FROM vis_stockm WHERE $w ORDER BY DES";
	$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
	$result = grs($s);
	while ($row = $result->fetch_row()){
		?>
		<tr class="Estilo5" bgcolor="#FFFFFF" onDblClick="location.href='stock_minimo.php?Id=<?php echo $row[0]?>&Pag=0';">
		<!----------------------------------------------->
        <td><?php echo vbl($row[1],27);?></td>
		<td><?php echo $row[2];?></td>
		<td><?php echo $row[3];?></td>
		<td style="text-align:right;"><?php echo $row[4];?></td>
		<!----------------------------------------------->
		<td ><a href="stock_minimo.php?Id=<?php echo $row[0]?>&Pag=0" >
		<img src="img/b_edit.png"  border="0"/></a>
		</td>
		</tr>
		<?php
	}
?>

</tbody>
</table>
</div>

<!----------------------------------------->    
<?php include("ocultos.php");?>

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