<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
$HW=$_SESSION['SYS_HW'];
$StrGT="";$LStrMsg="";$LStrFoc="";$LStrMM="";
//
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$LStrPag=V($_POST['TxtPag']);
//
include("stock_minimo_fun.php");
//
$VP_RegXPag=12;
$LStrTR=gn("count(*)","vis_stockm","ID>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;

$IdUsu=$_SESSION['SYS_USER_ID'];
$AT=gs("at","usuarios","id_usuario=$IdUsu");
?>

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>COMTROL STOCK MINIMO</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/stock_minimo.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();
});


var myVar=setInterval(function(){myTimer()},500);
function myTimer(){
t=GetHora();
tt=document.getElementById("TxtHora").value;
	if(tt>0){		
		if(t-tt>=1){
		document.getElementById("TxtHora").value=0;
		fGetTabla();			
		}
	}
}

/*var FOCO=0;
var myVar=window.setInterval(function(){myTimer()},500);

function myTimer(){
	t=GetHora();
	tt=document.getElementById("TxtHora").value;
	if(tt>0){	
		if(t-tt>=1){
			document.getElementById("TxtHora").value=0;
			fGetTabla();			
		}
	}
}
function myStopFunction(){
	clearInterval(myVar);
}*/

$(document).keydown(function(e){
	var AT=gv("TxtAT");
	
	if(e.which==71 && e.altKey){		
		if(AT=="1"){	
		document.getElementById("CmdG").click();
		return;
		}
	}
	
	if(e.which==78 && e.altKey){
		if(AT=="1"){
		document.getElementById("CmdC").click();
		return;
		}
	}
	
	if(e.which==75 && e.altKey){
		if(AT=="1"){	
		document.getElementById("CmdE").click();
		return;
		}
	}

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

	if(e.which==77 && 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.php" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="img/marcas.gif" class="iT" />
<div class="tT">CONTROL STOCK MINIMO</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left: 37px; top: 117px; width: 79px;">
ALMACEN</div>
<select name="CboAlm" id="CboAlm" 
class="lt" style="left: 37px; top: 134px; width: 379px" 
tabindex="<?php echo ++$TI;?>">
<?php echo ListALM($StrAlm); ?>
</select>

<div class="s1" style="left: 37px; top: 181px; width: 54px;">
CODIGO</div>
<input name="TxtCod" type="text" id="TxtCod" 
class="lt" style="left: 36px; top: 198px; width: 113px" 
value="<?php echo $StrCod;?>"  
onkeyup="document.getElementById('TxtHora').value=GetHora();"
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 166px; top: 181px; width: 100px;">
DESCRIPCION</div>
<input name="TxtDes" type="text" id="TxtDes" 
class="lt" style="left: 164px; top: 198px; width: 251px" 
value="<?php echo $StrDes;?>"  
onkeyup="document.getElementById('TxtHora').value=GetHora();"
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 434px; top: 181px; width: 133px;">
MARCA</div>
<input name="TxtMar" type="text" id="TxtMar" 
class="lt" style="left: 432px; top: 198px; width: 152px" 
value="<?php echo $StrMar;?>"
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 598px; top: 181px; width: 62px;">
STOCK.MIN</div>
<input name="TxtCan" type="text" id="TxtCan" 
class="ndd" style="left: 598px; top: 198px; width: 65px; text-align: right" 
value="<?php echo $StrCan;?>"
tabindex="<?php echo ++$TI;?>"/>

<!--INI_BOTONES-------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width:1000px; height: 26px;">
<input name="CmdB" type="button" id="CmdG" class="btm" 
<?php GOM($StrId);?>
onclick="fGuardar();"  
tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdC"  class="btm" 
value="Nuevo" onClick="fCancelar();"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdE" class="btm" 
value="Eliminar" onClick="fEliminar();"
<?php DIS($StrId);?>
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdB" class="btm"
value="Buscar" onClick="fBuscar('stock_minimo_buscar.php');"  
tabindex="<?php echo ++$TI;?>" />

</div>
<!--FIN_BOTONES-------------------------------->

<div class="datagrid" style="position: absolute; left: 35px; top: 236px; width: 1180px; height: 324px; overflow: auto;">
<table width="100%">
<thead>
<tr>
<td colspan="10" height="18" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>
<tr>
<th width="16%">ALMACEN</th>
<th width="7%">CODIGO.P</th>
<th width="14%">FABRICANTE</th>
<th width="16%">MODELO</th>
<th width="36%">DESCRIPCION</th>
<th width="8%">STOCK.MIN</th>
<th width="3%">&nbsp;</th>
</tr>
</thead>
<tbody>

<?php
	$s="SELECT ID,ALM,COD,DES,CAN,FAB,MODELO FROM vis_stockm WHERE ID>0 ORDER BY DES";
	$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
	$result = grs($s);
	while ($row = $result->fetch_row()){
	?>
	<tr class="Estilo5" bgcolor="#FFFFFF" onDblClick="fActivar(<?php echo $row[0];?>);">
	<!----------------------------------------------->
	<td><?php echo vbl($row[1],25);?></td>
    <td><?php echo $row[2];?></td>
    <td><?php echo vbl($row[5],25);?></td>
    <td><?php echo vbl($row[6],25);?></td>
    <td><?php echo vbl($row[3],57);?></td>
    <td><?php echo $row[4];?></td>
	<!----------------------------------------------->
	<td align="center">
	<a href="javascript:void(0)" onClick="fActivar(<?php echo $row[0];?>);">
	<img src="img/b_edit.png"  border="0"/></a></td>
	</tr>
	<?php
	}
?>
</tbody>
</table>
</div>

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

<div id="DivDatosProd" class="s1">
<input name="T_ID" type="hidden" id="T_ID" value=""/>
<input name="TCod" type="hidden" id="TCod" value=""/>
<input name="TDes" type="hidden" id="TDes" value=""/>
<input name="TMar" type="hidden" id="TMar" value=""/>
<input name="TxtHora" type="hidden" id="TxtHora" value="0" />
</div>


<!-----GRID.OCULTOS----->
<div id="TAB_AJAX" class="datagrid" style="visibility: hidden; height: 290px; width: 1180px; left: 35px; top: 278px; position: absolute; overflow-y: scroll; color: #0FF; background-color: #FFFFFF; layer-background-color: #CCCCCC; border: 1px none #000000;" align="left">
</div>

<div id="TAB_CAPTION" class="datagrid" style="visibility: hidden; height: 20px; width: 1180px; left: 35px; top: 255px; position: absolute; color: #0FF; overflow-y: scroll; background-color: #CCCCCC; layer-background-color: #CCCCCC; border: 1px none #000000;" align="left">
<table width="1125px" border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr style="background:#FFFFFF; color:#000;" height="10px">
<td width="100" bgcolor="#CCCCCC">CODIGO</td>
<td width="100" bgcolor="#CCCCCC">FABRICANTE</td>
<td width="100" bgcolor="#CCCCCC">MODELO</td>
<td width="400" bgcolor="#CCCCCC">DESCRIPCION</td>
<td width="100" bgcolor="#CCCCCC">MARCA</td>
<td width="40" bgcolor="#CCCCCC">&nbsp;</td>
</tr>
</tbody>
</table>
<div style="position: absolute; top: 0px; left: 1120px">
<input name="CmdClose" type="button" value="Cerrar" onClick="CerrarDIV();" style="background-color:#F90" />
</div>
</div>

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

