<?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("egresos_fun.php");
//
$VP_RegXPag=15;
$LStrTR=gn("count(*)","vegresos","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>Egresos</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/egresos.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==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="egresos.php" style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="img/egresos2.png" class="iT" />
<div class="tT">REGISTRO DE EGRESOS</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left: 35px; top: 101px; width: 54px;">FECHA *</div>
<div class="s1" style="left: 35px; top: 117px; width: 84px;">dd-mm-yy</div>
<?php if(strlen($StrFec)==0){$StrFec=date("d-m-y");}?>
<input name="TxtFec" type="text" id="TxtFec" 
class="fe" style="left: 35px; top: 134px; width: 80px" 
value="<?php echo $StrFec;?>"  
tabindex="<?php echo ++$TI;?>"/>

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

<div class="s1" style="left: 322px; top: 117px; width: 137px;">
TIPO DE EGRESO *</div>
<select name="CboTde" id="CboTde" 
class="lt" style="left: 320px; top: 134px; width: 328px" 
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO_("nombre","egresos_tipos","id_et>0",$StrTde,"N","S")?>
</select>

<div class="s1" style="left: 656px; top: 117px; width: 71px;">
TOTAL *</div>
<input name="TxtTot" type="text" id="TxtTot" 
class="ndd" style="left: 654px; top: 134px; width: 80px" 
value="<?php echo $StrTot;?>"  
onfocus="selecciona_value(this);"
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 749px; top: 117px; width: 71px;">
OBSERVACION</div>
<input name="TxtObs" type="text" id="TxtObs" 
class="lt" style="left: 748px; top: 134px; width: 465px" 
value="<?php echo $StrObs;?>"  
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('egresos_buscar.php');"  
tabindex="<?php echo ++$TI;?>" />
</div>
<!--FIN_BOTONES-------------------------------->


<div class="datagrid" style="position: absolute; left: 35px; top: 171px; width: 1180px; height: 388px;">
<table width="100%">
<thead>
<tr>
<td colspan="10" height="18" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>
<tr>
<th width="10%">FECHA</th>
<th width="45%">ALMACEN</th>
<th width="32%" >TIPO DE EGRESO</th>
<th width="9%" style="text-align:right">TOTAL</th>
<th width="4%">&nbsp;</th>
</tr>
</thead>
<tbody>

<?php

	$s="SELECT ID,DATE_FORMAT(FEC,'%d-%m-%y'),
		ALM,TDE,TOT FROM vegresos WHERE ID>0 ORDER BY FEC DESC ";
							
	$result = grs($s);
	while ($r = $result->fetch_assoc()){
		?>
		<tr onDblClick="fActivar(<?php echo $r['ID'];?>);">
		<!----------------------------------------------->
		<td ><?php echo $r[1];?></td>
		<td ><?php echo $r[2];?></td>
		<td ><?php echo $r[3];?></td>
		<td style="text-align:right"><?php echo $r[4];?></td>
		<!----------------------------------------------->
		<td align="center">
		<a href="javascript:void(0)" onClick="fActivar(<?php echo $r['ID'];?>);">
		<img src="img/b_edit.png"  border="0"/></a></td>
		</tr>
		<?php	
	}

?>		  


</tbody>
</table>
</div>
    
<!--INI_OCULTOS-------------------------------->
<?php include("ocultos.php");?>
<!--FIN_OCULTOS-------------------------------->

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