<?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="";
	$VP_RegXPag=10;
	$LStrMsg="";
	$LStrFoc="";
	$LStrMM="";
	$LStrPag=V($_POST['TxtPag']);	
	include("kardexp_fun.php");
	$StrHWND_K=$_SESSION['SYS_HW']."_K";
?>
<!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>Kardex</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/kardexp.js"></script>
<script type="text/javascript" src="fe/funcionez.js"></script>
<script>
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();			
		}
	}
}
function myStopFunction(){
	clearInterval(myVar);
}
</script>
<script language="javascript">
$(document).ready(function() {
	$("#TxtDex").mask("99-99-99"); 
	$(".botonExcel").click(function(event) {
		$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
		$("#FormularioExportacion").submit();
});
});
</script>
<style type="text/css">
<!--
.estilo888 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #003366;
	font-weight: bold;
}
#TAB_CAPTION .estilo888 {
	color: #000;
}
-->
</style>
<style type="text/css">
<!--
.estilo777 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #003366;
}
-->
</style>
<style type="text/css">
<!--
body {
	background-color: #CCC;
	background-image: url();
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
	width:1200px;
	height:800px;
	position:absolute;
	left:<?php echo "50%";?>;
	top:<?php echo "30%";?>;
	background-color:#006699;
	margin:<?php echo "-200px";?> 0 0 <?php echo "-600px";?>;
}
#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;
}
.f2 {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;}
.ss4 {color: #000099}
.Estilo5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}
#Frm center #DivFRM #layer3 .f2 table tr td {
	color: #000;
	text-align: left;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?> onunload="myStopFunction();">
<div Id="DivFRM"  class="centrarFrm" >
<form id="Frm" name="Frm" method="post" action="kardexp.php"  autocomplete="off">
<center>   
<div id="layer4" style="position:absolute; left: 36px; top: 85px; width: 217px; height: 26px;">
<div align="left" class="f2">
<input name="CmdB" type="button" id="CmdG" value="Procesar"		
onclick="fGuardar();" style="width:80px" tabindex="5"/>
<input name="CmdB" type="button" id="CmdC" value="Nuevo" onclick="fCancelarPHP();"  tabindex="6"/>
<input name="CmdB" type="button" id="CmdZ" 
value="Menu" onclick="fBuscar('menu.php');"  tabindex="7"/>
</div>
</div>





<div style="position:absolute; left: 37px; top: 214px; width: 1131px; height: 120px; z-index:2">
<div align="left" class="f2">
<table width="1128" height="19" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="8" bgcolor="#999999"><table width="101%" border="0" style="width:100%">
  <tr>
    <td width="8%" style="color:#000">KARDEX</td>
    <td width="12%">&nbsp;</td>
    <td width="1%">&nbsp;</td>
    <td width="79%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td style="color:#000">ALMACEN</td>
    <td style="color:#000">:</td>
    <td style="color:#000" align="left"><?php echo $StrAlm;?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td style="color:#000">CODIGO</td>
    <td style="color:#000">:</td>
    <td style="color:#000" align="left"><?php echo $StrCod;?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td style="color:#000">DESCRIPCION</td>
    <td style="color:#000">:</td>
    <td style="color:#000" align="left"><?php echo $StrDes;?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td style="color:#000">PRESENTACION</td>
    <td style="color:#000">:</td>
    <td style="color:#000" align="left"><?php echo $StrPre;?></td>
  </tr>
</table></td>
</tr>
<tr>
<td width="81" bgcolor="#999999"><span class="ss4">FECHA</span></td>
<td width="141" bgcolor="#999999"><span class="ss4">DOCUMENTO</span></td>
<td width="138" bgcolor="#999999" ><span class="ss4">NUMERO</span></td>
<td width="415" bgcolor="#999999" ><span class="ss4">CLIENTE/PROVEEDOR</span></td>
<td width="76" bgcolor="#999999" align="right"><span class="ss4">INICIAL</span></td>
<td width="87" bgcolor="#999999" align="right"><span class="ss4">INGRESO</span></td>
<td width="75" bgcolor="#999999" align="center"><span class="ss4">SALIDA</span></td>
<td width="97" bgcolor="#999999" align="center"><span class="ss4">SALDO</span></td>
</tr>
</table>
</div>
</div>





<div style="position:absolute; left: 37px; top: 214px; width: 1155px; height: 568px; overflow:auto; z-index:1">
<div align="left" class="f2">
<table id="Exportar_a_Excel" width="1128" height="19" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="8" bgcolor="#999999"><table width="101%" border="0" style="width:100%">
  <tr>
    <td width="8%" style="color:#000">KARDEX</td>
    <td width="12%">&nbsp;</td>
    <td width="1%">&nbsp;</td>
    <td width="79%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td style="color:#000">ALMACEN</td>
    <td style="color:#000">:</td>
    <td style="color:#000" align="left"><?php echo $StrAlm;?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td style="color:#000">CODIGO</td>
    <td style="color:#000">:</td>
    <td style="color:#000" align="left"><?php echo $StrCod;?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td style="color:#000">DESCRIPCION</td>
    <td style="color:#000">:</td>
    <td style="color:#000" align="left"><?php echo $StrDes;?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td style="color:#000">PRESENTACION</td>
    <td style="color:#000">:</td>
    <td style="color:#000" align="left"><?php echo $StrPre;?></td>
  </tr>
</table></td>
</tr>
<tr>
<td width="81" bgcolor="#999999"><span class="ss4">FECHA</span></td>
<td width="141" bgcolor="#999999"><span class="ss4">DOCUMENTO</span></td>
<td width="138" bgcolor="#999999" ><span class="ss4">NUMERO</span></td>
<td width="415" bgcolor="#999999" ><span class="ss4">CLIENTE/PROVEEDOR</span></td>
<td width="76" bgcolor="#999999" align="right"><span class="ss4">INICIAL</span></td>
<td width="87" bgcolor="#999999" align="right"><span class="ss4">INGRESO</span></td>
<td width="75" bgcolor="#999999" align="center"><span class="ss4">SALIDA</span></td>
<td width="97" bgcolor="#999999" align="center"><span class="ss4">SALDO</span></td>
</tr>
<?php
	$s="SELECT DATE_FORMAT(fec,'%d-%m-%y'),doc,num,SUBSTR(clipro,1,55),ini,ing,sal,fin 
		FROM kardex WHERE hwnd='$StrHWND_K' ORDER BY fec,gi";
	$result = grs($s);
	while ($row = $result->fetch_row()){
		if($row[0]=="01-01-00")$row[0]="";
		echo "<tr>";
		echo "<td bgcolor=\"#FFFFFF\" style=\"color:#000\">".VV($row[0])."</td>";
		echo "<td bgcolor=\"#FFFFFF\" style=\"color:#000\">".VV($row[1])."</td>";
		echo "<td bgcolor=\"#FFFFFF\" style=\"color:#000\">'".VV($row[2])."</td>";
		echo "<td bgcolor=\"#FFFFFF\" style=\"color:#000\">".VV($row[3])."</td>";
		echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right;color:#000\" >".VV($row[4])."</td>";
		echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right;color:#000\" >".VV($row[5])."</td>";
		echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right;color:#000\" >".VV($row[6])."</td>";
		echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right;color:#000\" >".VV($row[7])."</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="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="TxtHora" type="hidden" id="TxtHora" value="0" />
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<strong style="color:#000" >KARDEX POR PRESENTACION</strong></div>
<div id="DivDatosProd">
<input name="Pro_TxtId" type="hidden" id="Pro_TxtId" value="<?php echo vbval($StrPro_ID);?>"/>
<input name="Pro_TxtDes" type="hidden" id="Pro_TxtDes" value=""/>
<input name="Pro_TxtPre" type="hidden" id="Pro_TxtPre" value=""/>
<input name="Pro_TxtCod" type="hidden" id="Pro_TxtCod" value=""/>
</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/kardex.png" width="64" height="53" ></div>
</div>
<div id="layer8" style="position:absolute; left: 0px; top: 0px; width:1200px; 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: 37px; top: 158px; width: 121px;">
<div align="left" class="f2">EMPRESA</div>
</div>
<select name="CboEmp" id="CboEmp" 
style="position:absolute; left:37px; top:177px; width: 96px;" 
onchange="EM_OC();"
onkeydown="return SoloTextoEx(event,'CboAlm');" tabindex="1">
<?php 
	echo LE($StrEmp,"N","N");
?>
</select>

<div style="position:absolute; left: 149px; top: 158px; width: 121px;">
<div align="left" class="f2">ALMACEN</div>
</div>
<select name="CboAlm" id="CboAlm" style="position:absolute; left: 148px; top: 177px; width: 88px;" 
onkeydown="return SoloTextoEx(event,'TxtCod');" tabindex="1">
<?php 
echo LA($StrEmp,$StrAlm,"N","N"); 
?>
</select>

    <div id="layer5" style="position:absolute; left: 251px; top: 158px; width: 54px;">
      <div align="left" class="f2">CODIGO</div>
  </div>
        <input name="TxtCod" type="text" id="TxtCod" style="position:absolute; left: 249px; top: 177px; width: 101px;" 
          value="<?php echo $StrCod;?>"  
         onkeydown="return SoloTextoEx(event,'TxtDes');"
onkeyup="document.getElementById('TxtHora').value=GetHora();" 
          tabindex="2" />

<div id="layer16" style="position:absolute; left: 364px; top: 158px; width: 158px;">
<div align="left" class="f2">DESCRIPCION</div>
</div>
<input name="TxtDes" type="text" id="TxtDes" style="position:absolute; left: 363px; top: 177px; width: 208px;" 
value="<?php echo $StrDes;?>"  
onkeydown="return SoloTextoEx(event,'CboPre');"
onkeyup="document.getElementById('TxtHora').value=GetHora();" 
tabindex="3" />

<div id="layer16" style="position:absolute; left: 586px; top: 142px; width: 121px; height: 35px;">
<div align="left" class="f2">#PIEZAS / PRESENTACION</div>
</div>

<select name="CboPre" id="CboPre" style="position:absolute; left: 586px; top: 177px; width: 93px;" 
onkeydown="return SoloTextoEx(event,'TxtDex');" tabindex="4">
<?php
	echo FCBOO_("PIE","vis_prod_pre","COD='$StrCod'",$StrPre,"N","S","PIE");
?>
</select>

<div style="position:absolute; left: 700px; top: 158px; width: 50px;">
<div align="left" class="f2">DESDE</div>
</div>
<input name="TxtDex" type="text" id="TxtDex" 
style="position:absolute; left: 700px; top: 177px; width: 71px;" 
value="<?php echo $StrDex;?>"  
onkeydown="return SoloFec(this,event,'CmdG');" 
tabindex="5" />


<div id="TAB_AJAX" style="visibility: hidden; height:200px; width:808px; overflow-x:hidden; position:absolute; left: 60px; top: 222px; overflow-y:scroll; color: #0FF; background-color: #FFFFFF; layer-background-color: #CCCCCC; border: 1px none #000000; z-index:100" align="left"></div>
<div id="TAB_CAPTION" 
style="visibility: hidden; height:20px; width:808px; position:absolute; left: 60px; top: 202px; color: #0FF; background-color: #CCCCCC; layer-background-color: #CCCCCC; border: 1px none #000000; z-index:100" align="left">
<table width="700" border="1" cellpadding="0" cellspacing="0" bgcolor="#d4e3e5" class="estilo888">
<tbody>
<tr  height="10 px">
<td width="108" bgcolor="#CCCCCC">CODIGO</td>
<td width="473" bgcolor="#CCCCCC">DESCRIPCION</td>
<td width="65" align="right" bgcolor="#CCCCCC">PC DOL</td>
<td width="54" align="right" bgcolor="#CCCCCC">PC SOL</td>
</tr>
</tbody>
</table>
  <div style="position:absolute; top:0px; left:748px"><input name="CmdClose" type="button" value="Cerrar" onclick="CerrarDIV();" style="background-color:#F90" /></div>
</div>
<div id="layer2" style="position:absolute; left: 37px; top: 116px; width: 761px; z-index:0">
  <div align="left" class="f2">DOCUMENTO : AJUXTE hace referencia a los ajustes automaticos creados al modificar el stock desde el modulo productos</div>
</div>  
</center>	
</form>
<form action="ficheroExcel.php" 
method="post" target="_blank" 
id="FormularioExportacion" >
<div 
style="position:absolute; left: 290px; top: 86px; width: 109px; height: 14px;">  
<input name="" type="button" style="height: 23px;"  class="botonExcel" value="Exportar"  tabindex="9" />
<input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</div>
</form>
</div>
</body>
</html>
