<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
include("phpmnu_fun.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("almacenes_fun.php");
//
$VP_RegXPag=15;
$LStrTR=gn("count(*)","almacenes","id_almacen>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;

$IdUsu=V($_SESSION['SYS_USER_ID']);
$IdU=vbval(V($_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>Almacenes</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/almacenes.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==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==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 GEN_MENU(vbval(V($_SESSION['SYS_USER_ID'])));
?>
</div>

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;">
<form id="Frm" name="Frm" method="post" autocomplete="off" 
action="almacenes.php" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">
<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="img/almacen2.png" class="iT" />
<div class="tT">ALMACENES</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left:35px; top: 117px; width: 187px;">
NOMBRE *</div>
<input name="TxtNom" type="text" id="TxtNom" 
class="lt" style="left:35px; top: 134px; width: 232px; background-color:#CCC" 
value="<?php echo $StrNom;?>"   readonly
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 276px; top: 117px; width: 161px;">
NOMBRE CORTO *</div>
<input name="TxtObs" type="text" id="TxtObs" 
class="lt" style="left: 276px; top: 134px; width: 232px;background-color:#CCC" 
value="<?php echo $StrObs;?>" maxlength="5"  readonly
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 519px; top: 117px; width: 157px;">
DIRECCION</div>
<input name="TxtDir" type="text" id="TxtDir" 
class="lt" style="left: 519px; top: 134px; width: 694px;background-color:#CCC" 
value="<?php echo $StrDir;?>"   readonly 
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left:35px; top: 172px; width: 265px;">OPERACIONES OPCIONALES</div>

<input name="CheRes" type="checkbox" id="CheRes"  disabled
value="1" class="lt" style="left: 33px; top: 198px;"
<?php if($StrRes=="1"){echo "checked=\"checked\"";}?>/>
<div class="s1" style="left: 55px; top: 201px; width: 216px;">
<label for="CheRes">RESTRINGIR VENTAS POR STOCK</label></div>

<input name="CheBus" type="checkbox" id="CheBus"  
value="1" class="lt" style="left: 33px; top: 223px; display:none" disabled
<?php if($StrBus=="1"){echo "checked=\"checked\"";}?>/>
<div class="s1" style="left: 55px; top: 227px; width: 214px; display:none">
<label for="CheBus" >FILTRAR DESCRIPCION AVANZADO </label> </div>

<input name="CmdB" type="button" id="CmdB" disabled
style="position: absolute; left: 276px; top: 195px; width: 128px;" 
value="Aplicar a Todos" onClick="fResT();" />

<input name="CmdB" type="button" id="CmdB" 
style="position: absolute; left: 276px; top: 225px; width: 105px; display:none" 
disabled
value="Aplicar a Todos" onClick="fBusT();" />



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

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

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

<div class="datagrid" style="position: absolute; left: 35px; top: 261px; width: 1180px; height: 299px;">
<table width="100%">
<thead>
<tr>
<td colspan="10" height="18" align="center">
<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
</td>
</tr>
<tr>
<th width="33%">NOMBRE</th>
<th width="24%">NOMBRE CORTO</th>
<th width="40%">DIRECCION</th>
<th width="3%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
	$s="SELECT id_almacen,alm_nombre,alm_obs,alm_dir 
		FROM almacenes
		WHERE id_almacen> 0 
		ORDER BY id_almacen";
		
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);		  				
$result = grs($s);
while ($r = $result->fetch_assoc()){
	?>
	<tr >
	<!----------------------------------------------->
	<td ><?php echo $r['alm_nombre'];?></td>
    <td ><?php echo $r['alm_obs'];?></td>
    <td ><?php echo $r['alm_dir'];?></td>
	<!----------------------------------------------->
	<td align="center">&nbsp;</td>
	</tr>
	<?php	
}

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


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

<div class="s1" style="left: 0px; top: 0px; width: 700px;">
<input name="TxtId2" type="hidden" id="TxtId2" value="<?php echo $StrId;?>"/>
<input name="TxtAc2" type="hidden" id="TxtAc2" value="" />
<input name="TxtPag2" type="hidden" id="TxtPag2" value="<?php echo $LStrPag; ?>" />
</div>
<!--FIN_OCULTOS-------------------------------->

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