<?php
ini_set("session.cookie_lifetime",60*60*10);
ini_set("session.gc_maxlifetime", 60*60*10);
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;
}
//
//-------------------------	
$StrGT="";	
$LStrMsg="";
$LStrFoc="";
$LStrMM="";

$LStrPag=V($_POST['TxtPag']);	
include("caja_fun.php");
$VP_RegXPag=15;
$EA=LIKE(GE("S"));
$WW="ID>0 AND EMPC LIKE '$EA' ";
$LStrTR=gn("count(*)","vcaja",$WW);
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
$TI=0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Caja chica</title>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="jquery.maskedinput.min.js" type="text/javascript"></script>
<script type="text/javascript" src="fe/funcionez.js"></script>
<script type="text/javascript" src="fe/caja.js"></script>
<script>
$(document).ready(function(){
   $("#TxtFec").mask("99-99-99"); 
   if(jVal(gv("TxtId"))==0){
	   //EM_OC();
   }   
});
</script>
<style type="text/css">
<!--
body {
	background-color: #CCC;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
     width:800px;
     height:600px;
     position:absolute;
     left:<?php echo "50%";?>;
     top:<?php echo "50%";?>;
	 background-color:#006699;
	 margin:<?php echo "-300px";?> 0 0 <?php echo "-400px";?>;
}
#Layer2 {
	position:absolute;
	left:409px;
	top:205px;
	width:82px;
	height:24px;
	z-index:1;
}
.Estilo1 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	color: #FFFFFF;
}
.x2 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF; font-size: 12px; }
.Estilo3 {color: #FFFFFF; font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
.x4 {color: #000099}
.Estilo5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?>>
<form id="Frm" name="Frm" method="post" action="caja_chica.php">
<center> 
  <div Id="DivFRM"  class="centrarFrm" >
    

<div id="layer3" style="position:absolute; left: 30px; top: 216px; width: 746px; height: 340px; overflow:auto">
<div align="left" class="x2">
<table width="719" height="19" border="1" cellpadding="0" cellspacing="0">
<tr  >
<td height="18" colspan="6" bgcolor="#666666" align="center">
<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
</td>
</tr>
<tr>
<td width="70" bgcolor="#999999"><span class="x4">FECHA</span></td>
<td width="163" bgcolor="#999999"><span class="x4">EMPRESA</span></td>
<td width="169" bgcolor="#999999"><span class="x4">ALMACEN</span></td>
<td width="223" bgcolor="#999999"><span class="x4">OBSERVACION</span></td>
<td width="68" bgcolor="#999999" style="text-align:right"><span class="x4">TOTAL</span></td>
<td width="12" bgcolor="#999999">&nbsp;</td>
</tr>
<?php
$s="SELECT ID,DATE_FORMAT(FEC,'%d-%m-%y'),
	ALMC,OBS,ROUND(TOT,1),EMPC 
	FROM vcaja WHERE $WW ORDER BY FEC DESC ";
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);				
$result = grs($s);
while ($row = $result->fetch_row()){
	echo "<tr ondblclick=\"fActivar($row[0]);\">";
	echo "<td bgcolor=\"#FFFFFF\">
	<span class=\"Estilo5\">$row[1]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\">
	<span class=\"Estilo5\">$row[5]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\">
	<span class=\"Estilo5\">$row[2]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\">
	<span class=\"Estilo5\">".VV($row[3])."</span></td>";
	echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right\">
	<span class=\"Estilo5\" 
	>$row[4]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\" align=\"center\">
	<a href=\"javascript:void(0)\" onclick=\"fActivar($row[0]);\">
	<img src=\"img/b_edit.png\"  border=\"0\"/>
	</a>
	</td>";
	echo "</tr>";
}

?>		  

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


<div id="layer" style="position:absolute; left: 116px; top: 21px; width: 412px; height: 45px; z-index: 100;">
<div align="left" class="Estilo1">
<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="SER_FEC" type="hidden" id="SER_FEC" value="<?php echo date("d-m-y");?>"/>
<input name="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<strong>CAJA CHICA</strong></div>
</div>
<div id="LblTit" style="position:absolute; left: 52px; top: 15px; width: 64px; z-index: 100;">
<div align="left" class="Estilo1"><img src="img/marcas.gif" width="48" height="48" /></div>
</div>
<div id="layer8" style="position:absolute; left: 0px; top: 0px; width: 800px; height: 79px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; z-index: 0;">
<div align="left" class="Estilo1">        
</div>
</div>

<div style="position:absolute; left: 30px; top: 140px; width: 54px;">
<div align="left" class="x2">FECHA </div>
</div>
<div style="position:absolute; left: 30px; top: 156px; width: 84px;">
<div align="left" class="x2">dd-mm-yy</div>
</div>
<input name="TxtFec" type="text" id="TxtFec"
style="position:absolute; left: 30px; top: 175px; width: 78px;"  
value="<?php echo $StrFec;?>"  
onkeydown="return SoloFec(this,event,'CboEmp');" 
tabindex="<?php echo ++$TI;?>" />


<div style="position:absolute; left:121px; top: 156px; width: 108px;">
<div align="left" class="x2">EMPRESA</div>
</div>
<select name="CboEmp" id="CboEmp" 
style="position:absolute; left:119px; top:175px; width: 129px;" 
onchange="EM_OC();" onkeydown="return SoloTextoEx(event,'CboAlm');" 
tabindex="<?php echo ++$TI;?>">
<?php 
	echo LE($StrEmp,"N","N");
?>
</select>

<div style="position:absolute; left: 265px; top: 156px; width: 110px;">
<div align="left" class="x2">ALMACEN</div>
</div>
<select name="CboAlm" id="CboAlm" 
style="position:absolute; left: 260px; top: 175px; width: 119px;" 
onkeydown="return SoloTextoEx(event,'TxtTot');" tabindex="<?php echo ++$TI;?>">
<?php 
echo LA($StrEmp,$StrAlm,"N","N"); 
?>
</select>

<div style="position:absolute; left: 388px; top: 158px; width: 83px;">
<div align="left" class="x2">TOTAL</div>
</div>
<input name="TxtTot" type="text" id="TxtTot" 
style="position:absolute; left: 388px; top: 175px; width: 86px; ; text-align:right" 
value="<?php echo $StrTot;?>"  
onkeydown="return SoloNum(this,event,'TxtObs');" 
tabindex="<?php echo ++$TI;?>" 
onfocus="selecciona_value(this);"
/>

<div style="position:absolute; left: 485px; top: 157px; width: 152px;">
<div align="left" class="x2">OBSERVACION</div>
</div>
<input name="TxtObs" type="text" id="TxtObs" 
style="position:absolute; left: 484px; top: 175px; width: 264px;" 
value="<?php echo $StrObs;?>"  
onKeyDown="return SoloTextoEx(event,'CmdG');" 
tabindex="<?php echo ++$TI;?>" />

<div style="position:absolute; left: 30px; top: 85px; width: 442px; height: 26px;">
    <div align="left" class="x2">
    <input name="CmdB" type="button" id="CmdG"
    <?php
    if(strlen($StrId)==0){
    echo "value=\"Guardar\"";
    }else{
    echo "value=\"Modificar\"";
    }
    ?>
    onclick="fGuardar();" style="width:80px" tabindex="<?php echo ++$TI;?>">
    <input name="CmdB" type="button" id="CmdC" value="Nuevo" 
    onclick="fCancelar();"  tabindex="<?php echo ++$TI;?>">
    <input name="CmdB" type="button" id="CmdE" value="Eliminar" onclick="fEliminar();"
    <?php
    if(strlen($StrId)==0){
    echo "disabled=\"disabled\"";
    }
    ?>
    tabindex="<?php echo ++$TI;?>">
    <input name="CmdB" type="button" id="CmdB" 
    value="Buscar" onclick="fBuscar('caja_buscar.php');"  tabindex="<?php echo ++$TI;?>">
    <input name="CmdB" type="button" id="CmdZ" 
    value="Menu" onclick="fBuscar('menu.php');"  tabindex="<?php echo ++$TI;?>">
    </div>
</div>


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