<?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;
}
//
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$StrEmp=V($_POST['CboEmp']);	
$StrAlm=V($_POST['CboAlm']);	
$StrCod=V($_POST['TxtCod']);	
$StrNom=V($_POST['TxtNom']);	
$StrDex=V($_POST['TxtDex']);		
$StrHax=V($_POST['TxtHax']);		
//
if(strlen($StrEmp)==0)$StrEmp=GE("S");
if(strlen($StrAlm)==0)$StrAlm=GA($StrEmp,"S");
//
$StrEmp_=LIKE($StrEmp);
$StrAlm_=LIKE($StrAlm);
$StrCod_=$StrCod."%";
$StrNomT=$StrNom."%";
$StrDex_=val_dex($StrDex);
$StrHax_=val_hax($StrHax);
//-------------------------
$FF="ID>0 AND  EMPC LIKE '$StrEmp_' AND ALM LIKE '$StrAlm_' AND 
	FEC >= '$StrDex_' AND 
	FEC <= '$StrHax_' AND 
	DES_PRO LIKE '$StrNomT' AND COD LIKE '$StrCod_' ";

$LStrTR=gn("count(*)","vis_transformaciones",$FF);
$VP_RegXPag=50;
//-------------------------
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
$LStrPag=V($_POST['TxtPag']);	
if($StrCmd=="F"){$LStrPag="1";}
$VP_RegXPag=1000;	
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
$LStrFoc="document.getElementById('TxtNom').focus();";
$LStrMsg="onload=\"$LStrFoc;\"";
?>
<!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>BUSCAR - TRASFORMACIONES</title>
<?php AddJs();?>
<script type="text/javascript" src="fe/funcionez.js"></script>
<script>
$(document).ready(function(){
   $("#TxtDex").mask("99-99-99");   
   $("#TxtHax").mask("99-99-99");   
});

function EM_OC(){	
	var Emp=gv("CboEmp");	
	var r=AX("03",Emp);
	if(r=="X"){
		CBO_CLS("CboAlm",1);
	}else{
		CBO_FILL("CboAlm",r,0);
	}
}
</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:1000px;
     height:600px;
     position:absolute;
     left:50%;
     top:50%;
	 background-color:#006699;
	 margin:-300px 0 0 -500px;

}
#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}

-->
</style>

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



    <div id="layer5" style="position:absolute; left: 116px; top: 50px; width: 85px; height: 28px;">
      <div align="left" class="x2">
        <input name="CmdV" type="button" id="CmdV" 
        value="Volver" onclick="fVolver('transformaciones.php');" />
      </div>
    </div>

<div id="layer3" style="position:absolute; left: 25px; top: 138px; width: 973px; height: 405px; overflow:auto">
<div align="left" class="x2">
<table width="956" border="1" cellpadding="0" cellspacing="0">

<tr >
<td height="18" colspan="11" bgcolor="#666666" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>

<tr>
<td width="60" bgcolor="#999999"><span class="x4">EMPRESA</span></td>
<td width="60" bgcolor="#999999"><span class="x4">FECHA</span></td>
<td width="116" bgcolor="#999999"><span class="x4">ALMACEN</span></td>
<td width="116" bgcolor="#999999"><span class="x4">CODIGO</span></td>
<td width="220" bgcolor="#999999"><span class="x4">PRODUCTO</span></td>
<td width="103" bgcolor="#999999"><span class="x4">CANT.Unidad(es)</span></td>
<td width="67" bgcolor="#999999"><span class="x4">DE.Caja(s)</span></td>
<td width="74" bgcolor="#999999"><span class="x4">Uni_x_Caja</span></td>
<td width="86" bgcolor="#999999"><span class="x4">HACIA.Caja(s)</span></td>
<td width="78" bgcolor="#999999"><span class="x4">DE.unidad(es)</span></td>          
<td width="15" bgcolor="#999999">&nbsp;</td>
</tr>
<?php		  		
$s="SELECT ID,DATE_FORMAT(FEC,'%d-%m-%y'),ALM,DES_PRO,
	CAN,D_CAJA,D_U_X_CAJA,A_CAJA,A_U_X_CAJA,COD,EMPC
	FROM vis_transformaciones 
	WHERE $FF ORDER BY ID DESC ";

$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);		  				
$X1="<td bgcolor=\"#FFFFFF\"><span class=\"Estilo5\">";
$X2="</span></td>";
$result = grs($s);				
while ($row = $result->fetch_row()){
	echo "<tr 
	ondblclick=\"location.href='transformaciones.php?Id=$row[0]&Pag=0';\">";
	echo $X1.VV($row[10]).$X2;
	echo $X1.VV($row[1]).$X2;
	echo $X1.VV($row[2]).$X2;
	echo $X1.VV($row[9]).$X2;
	echo $X1.VV($row[3]).$X2;
	echo $X1.VV($row[4]).$X2;
	echo $X1.VV($row[5]).$X2;
	echo $X1.VV($row[6]).$X2;
	echo $X1.VV($row[7]).$X2;
	echo $X1.VV($row[8]).$X2;
	echo "<td bgcolor=\"#FFFFFF\" align=\"center\">
	<a href=\"transformaciones.php?Id=$row[0]&Pag=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: 30px; width: 412px; height: 24px;">
<div align="left" class="Estilo1">BUSCAR - TRASFORMACIONES
  <input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
	<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
	<input name="TxtAc" type="hidden" id="TxtAc" value="" />
</div>
</div>


<div id="layer6" style="position:absolute; left:24px; top: 85px; width: 85px;">
<div align="left" class="x2">EMPRESA</div>
</div>
<select name="CboEmp" id="CboEmp" 
style="position:absolute; left:24px; top:104px; width: 118px;" 
onchange="EM_OC();"
onkeydown="return SoloTextoEx(event,'CboAlm');" tabindex="1">
<?php 
	echo LE($StrEmp,"S","N"); 
?>
</select>

<div style="position:absolute; left:151px; top: 85px; width: 85px;">
<div align="left" class="x2">ALMACEN</div>
</div>
<select name="CboAlm" id="CboAlm" 
style="position:absolute; left: 151px; top: 104px; width: 125px;" 
onkeydown="return SoloTextoEx(event,'TxtCod');" tabindex="1">
<?php
	echo LA($StrEmp,$StrAlm,"S","N");
?>
</select>


<div id="layer6" style="position:absolute; left: 284px; top: 85px; width: 85px;">
<div align="left" class="x2">CODIGO</div>
</div>
<input name="TxtCod" type="text" id="TxtCod" 
style="position:absolute; left:284px; top: 104px; width: 103px;" 
value="<?php echo $StrCod;?>"  onkeydown="return SoloTextoEx(event,'TxtNom');"  
tabindex="1" />

<div id="layer6" style="position:absolute; left: 401px; top: 85px; width: 184px;">
<div align="left" class="x2">PRODUCTO</div>
</div>
<input name="TxtNom" type="text" id="TxtNom" 
style="position:absolute; left: 401px; top:104px; width: 297px;" 
value="<?php echo $StrNom;?>"  onkeydown="return SoloTextoEx(event,'TxtDex');"  
tabindex="2" />

<div id="layer7" style="position:absolute; left: 720px; top: 85px; width: 53px;">
<div align="left" class="x2">DESDE</div></div>
<input name="TxtDex" type="text" id="TxtDex" 
style="position:absolute; left: 717px; top:104px; width: 70px;" value="<?php echo $StrDex;?>"  
onkeydown="return SoloFec(this,event,'TxtHax');"
tabindex="3" />

<div id="layer11" style="position:absolute; left: 803px; top: 85px; width: 55px;">
<div align="left" class="x2">HASTA</div></div>
<input name="TxtHax" type="text" id="TxtHax" 
style="position:absolute; left: 802px; top:104px; width: 70px;" 
value="<?php echo $StrHax;?>"  
onkeydown="return SoloFec(this,event,'CmdB');"
tabindex="4" />

<div id="LblTit" style="position:absolute; left: 57px; top: 25px; width: 64px;">
<div align="left" class="Estilo1"><img src="img/buscar.png" width="57" height="60" /></div></div>	
<input name="CmdB" type="button" id="CmdB" 
style="position:absolute; left: 884px; top:104px; width: 57px;"
value="Filtrar" onclick="fFiltrar();"/>
  </div>
</center>	
</form>
</body>
</html>
