<?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;
}
//
$IdU=$_SESSION['SYS_USER_ID'];
//
$POL_USU_ET=gs("et","usuarios","id_usuario=$IdU");
//	
$StrGT="";
$VP_RegXPag=10;
$LStrMsg="";
$LStrFoc="";
$LStrMM="";
$LStrPag=V($_POST['TxtPag']);	
include("transferencias_fun.php");
include("trasferencias_b_fun.php");
?>
<!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>Transferencias</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/transferencias.js"></script>
<script type="text/javascript" src="fe/funcionez.js"></script>
<script type="text/javascript" src="fe/leo.js"></script>
<script>
$(document).ready(function(){
   $("#TxtFec").mask("99-99-99");  
});
</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>
<!--CSS_NEW------------------------------------->
<link rel="stylesheet" type="text/css" href="estiloss.css"  />
<link rel="stylesheet" type="text/css" href="basic.css"  />
<!--CSS_NEW------------------------------------->
<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:1100px;
	height:600px;
	position:absolute;
	left:<?php echo "50%";?>;
	top:<?php echo "50%";?>;
	background-color:#006699;
	margin:<?php echo "-300px";?> 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;
}
.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;}
.s4 {color: #000099}
.Estilo5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}
#Frm center #DivFRM #layer3 .x2 table tr td {
	color: #000;
}
#Frm center #DivFRM #layer3 .x2 table {
	color: #999;
}
#DivFRM #Frm #layer3 .x2 table tr td {
	color: #000;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?> onunload="myStopFunction();">
<div Id="DivFRM"  class="centrarFrm" >
<form id="Frm" name="Frm" method="post" action="transferencias.php"  autocomplete="off">

<div class="dT" style="left: 0px; top: 0px; width:1100px; height: 79px;">

<div class="ICONO" style=" left: 52px; top: 15px; width: 64px; z-index: 100;">
<img src="img/transferencias.png" width="56" height="52" / onclick="fGetProdDatos_Id('2');"></div>

<div class="TITULO" style="left: 116px; top: 30px; width: 412px; height: 24px;">TRANSFERENCIAS</div>

</div>
  
    <div id="layer4" style="position:absolute; left: 42px; top: 85px; width: 672px; 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\"";
			
			$StrAnu=gs("anu","transferencias","id_trans=$StrId");
			if($StrAnu=="S"){
				echo " disabled=\"disabled\"";
			}
		}
		?>
		onclick="fGuardar_CORREGIDO();" style="width:80px" tabindex="13"/>
		<input name="CmdB" type="button" id="CmdC" value="Nuevo" onclick="fCancelarPHP();"  tabindex="14"/>
        
        <input name="CmdB" type="button" id="CmdA" value="Anular" onclick="TRANS_ANULAR();"
		<?php
		if(strlen($StrId)==0){
			echo " disabled=\"disabled\" ";
		}else{
			$_YA="";
			$StrAnu=gs("anu","transferencias","id_trans=$StrId");
			if($StrAnu=="S"){
				echo " disabled=\"disabled\" ";
				$_YA="S";
			}
			if($POL_USU_ET=="0" && strlen($_YA)==0){
				echo " disabled=\"disabled\" ";
			}
		}
		?>
		tabindex="15"/>
        
		<input name="CmdB" type="button" id="CmdE" value="Eliminar" onclick="TRANS_ELIMINAR();"
		<?php
		if(strlen($StrId)==0){
			echo "disabled=\"disabled\"";
		}else{
			$_YA="";
			$StrAnu=gs("anu","transferencias","id_trans=$StrId");
			if($StrAnu=="S"){
				echo " disabled=\"disabled\" ";
				$_YA="S";
			}
			if($POL_USU_ET=="0" && strlen($_YA)==0){
				echo " disabled=\"disabled\" ";
			}
		}
		?>
		tabindex="16"/>

<input name="CmdB" type="button" id="CmdB" 
value="Buscar" onclick="fBuscar('transferencias_buscar.php');"  tabindex="17"/>
<input name="CmdB" type="button" id="CmdB" 
value="Buscar detallado" onclick="fBuscar('transferencias_buscar_det.php');"  tabindex="18"/>

<input name="CmdPDF" type="button" id="CmdPDF" 
value="Generar PDF" onclick="fGenPDF();" tabindex="19"
	<?php
    if(strlen($StrId)==0){
        echo "disabled=\"disabled\"";
    }else{
        $StrAnu=gs("anu","transferencias","id_trans=$StrId");
        if($StrAnu=="S"){
            echo "disabled=\"disabled\"";
        }
    }
    ?>
/>

<input name="CmdB" type="button" id="CmdZ" 
value="Menu" onclick="fBuscar('menu.php');"  tabindex="20"/>

      </div>
  </div>


<div id="layer3" style="position:absolute; left: 42px; top: 242px; width: 1048px; height: 327px; overflow:auto">
<div align="left" class="x2">
<table width="1027" height="19" border="1" cellpadding="0" cellspacing="0">
<tr >
<td width="30" bgcolor="#999999"><span class="z4">Nº</span></td>
<td width="109" bgcolor="#999999"><span class="z4">CODIGO</span></td>
<td width="443" bgcolor="#999999"><span class="z4">DESCRIPCION</span></td>
<td width="207" bgcolor="#999999"><span class="z4">LINEA</span></td>
<td width="62" bgcolor="#999999" align="right"><span class="z4">CANT</span></td>
<td width="96" bgcolor="#999999" align="right"><span class="z4">PIEZAS</span></td>
<td width="20" bgcolor="#999999" align="center">&nbsp;</td>
<td width="16" bgcolor="#999999" align="center">&nbsp;</td>
<td width="24" bgcolor="#999999" align="center"><a href="javascript:void(0)" onclick="ChK();" ><img src="img/eliminar.png" width="16" height="16" ></a></td>
</tr>

<?php
	$_IT=0;
	$TOT_CA=0;
	$StrHWND_T=$_SESSION['SYS_HW']."_T";
	$SEPARADOR=gs("aux_des","auxiliares","aux_tip='SIM'");
	if(strlen($SEPARADOR)==0){$SEPARADOR="-";}
	//
	$s="SELECT * FROM temp_compras WHERE cod_temc='$StrHWND_T' ORDER BY temc_index";
	$result = grs($s);
	while ($row = $result->fetch_row()){
		$CH="ZH".vbr("00000".$row[5],5);
		$X_ID=$row[1];
		$X_CO=VV(gs("COD","vproductos","ID=$X_ID"));
		$X_DE=VV(gs("DESCRIPCION","vproductos","ID=$X_ID"));
		$X_MA=VV(gs("LINEA","vproductos","ID=$X_ID"));
		$X_CA=$row[2];
		$TOT_CA=$TOT_CA + $X_CA;	
		$X_CAU=$row[8];
		$_IT++;
?>
    <tr style="color:#000">
    <td bgcolor="#FFFFFF"><?php echo $_IT;?></td>
    <td bgcolor="#FFFFFF"><?php echo $X_CO.$SEPARADOR.$X_CAU;?></td>
    <td bgcolor="#FFFFFF"><?php echo $X_DE;?></td>
    <td bgcolor="#FFFFFF"><?php echo $X_MA;?></td>
    <td bgcolor="#FFFFFF" align="right"><?php echo $X_CA;?></td>
    <td bgcolor="#FFFFFF" align="right"><?php echo $X_CAU;?></td>
    <td bgcolor="#FFFFFF" align="center">
    <a href="javascript:void(0)" onclick="fKiller('<?php echo $row[5];?>');" >
    <img src="img/eliminar.png" width="16" height="16" />
    </a>
    </td>
    <td bgcolor="#FFFFFF" align="center">
    <a href="javascript:void(0)" onclick="fEditar('<?php echo $row[5];?>');" >
    <img src="img/b_edit.png"  border="0"/>
    </a>
    </td>
    <td bgcolor="#FFFFFF" align="center"><input name="<?php echo $CH;?>" id="<?php echo $CH;?>" type="checkbox" value="" /></td>
    </tr>
<?php
	}	
?>
<tr>
<td width="30" bgcolor="#CCCCCC">&nbsp;</td>
<td width="109" bgcolor="#CCCCCC">&nbsp;</td>
<td width="443" bgcolor="#CCCCCC">&nbsp;</td>
<td width="207" bgcolor="#CCCCCC" align="right">TOTAL CAJAS</td>
<td width="62" bgcolor="#CCCCCC" align="right"><?php echo $TOT_CA;?></td>
<td width="96" bgcolor="#CCCCCC" align="right">&nbsp;</td>
<td width="20" bgcolor="#CCCCCC" align="center">&nbsp;</td>
<td width="16" bgcolor="#CCCCCC" align="center">&nbsp;</td>
<td width="24" bgcolor="#CCCCCC" align="center">&nbsp;</td>
</tr>
<tr>
  
  </tr>
        </table>
      </div>
    </div>

<div style="position:absolute; left: 116px; top: 21px; width: 412px; height: 45px;">
<input type="button" name="CmdUP" id="CmdUP" value="UP" 
onclick="fLoad();" 
style="position:absolute; left: 83px; top: -282px; width: 49px; visibility:hidden"/>
<input name="TxtHW" type="hidden" id="TxtHW" value="<?php echo $StrHWND_T;?>"/>
<?php
	$_NLM=gn("nl","doc_nl","doc='TRA'");
?>
<input name="NL_M" type="hidden" id="NL_M" value="<?php echo $_NLM;?>"/>
<input name="NL_A" type="hidden" id="NL_A" value="<?php echo $_IT;?>"/>

<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="TxtDAT" type="hidden" id="TxtDAT" value="" />
<input name="TxtHora" type="hidden" id="TxtHora" value="0" />
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<input name="TxtRuc_" type="hidden" id="TxtRuc_"  />
<input name="FEC_SERVER" type="hidden" id="FEC_SERVER" value="<?php echo date("d-m-y");?>"/>        

<div id="DivDatosProd">
    <input name="Pro_TxtId" type="hidden" id="Pro_TxtId" value=""/>
    <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=""/>
    <input name="Pro_TxtMarca" type="hidden" id="Pro_TxtMarca" value=""/>
</div>
</div>

    



<div id="layer6" style="position:absolute; left: 42px; top: 121px; width: 54px;">
<div align="left" class="x2">FECHA </div></div>
<div class="EV" style="left: 42px; top: 137px; width: 88px; color:#FF0">
<u><a onclick="fFecServer('TxtFec')">(dd-mm-yy) +</a></u></div>
<input name="TxtFec" type="text" id="TxtFec" 
style="position:absolute; left: 42px; top: 156px; width: 70px;" 
value="<?php echo $StrFec;?>"  
onkeydown="return SoloFec(this,event,'CboEmp');"
tabindex="1" />

<div style="position:absolute; left:122px; top:119px; width: 189px;">
<div align="center" class="x2">ORIGEN</div></div>

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

<div style="position:absolute; left: 222px; top: 137px; width: 77px;">
<div align="left" class="x2">ALMACEN </div></div>
<select name="CboAlm" id="CboAlm" 
style="position:absolute; left: 219px; top: 156px; width:90px;" 
onkeydown="return SoloTextoEx(event,'CboEmpD');" tabindex="2">
<?php echo LA($StrEmp,$StrAlm,"N","N"); ?>
</select>
<div style="position:absolute; left:324px; top:122px; width: 170px; height: 17px;">
  <div align="center" class="x2">DESTINO</div>
</div>
<div style="position:absolute; left:319px; top: 137px; width: 85px; height: 20px;">
<div align="left" class="x2">EMPRESA </div>
</div>
<select name="CboEmpD" id="CboEmpD" 
style="position:absolute; left:317px; top:156px; width:90px;" 
onchange="EM_OCD();"
onkeydown="return SoloTextoEx(event,'CboAlmD');" tabindex="1">
<?php 
	echo FCBO_("emp_nomc","empresas","id_emp>0",$StrEmpD,"N","S");
?>
</select>

<div style="position:absolute; left: 416px; top: 137px; width: 90px;">
<div align="left" class="x2">ALMACEN </div>
</div>
<select name="CboAlmD" id="CboAlmD" 
style="position:absolute; left: 414px; top: 156px; width:90px;" 
onkeydown="return SoloTextoEx(event,'TraSer');" tabindex="4">
<?php 
	echo FCBO_("ANC","vis_almacenes","IDA>0 AND ENC='$StrEmpD'",$StrAlmD,"N","N");
?>
</select>

<div id="layer5" style="position:absolute; left: 521px; top: 121px; width: 134px;">
<div align="left" class="x2">TRANSFERENCIA</div></div>

<div id="layer5" style="position:absolute; left: 520px; top: 137px; width: 45px;">
<div align="left" class="x2">SERIE</div></div>

<input name="TraSer" type="text" id="TraSer"  
class="ps" style="position:absolute; left: 520px; top: 156px; width: 42px;" 
value="<?php echo $StrTSer;?>"   onblur="_S(this);"
onkeydown="return SoloEnterosEx(this,event,'TraNum');" 
tabindex="5" />

<div id="layer5" style="position:absolute; left: 571px; top: 137px; width: 62px;">
<div align="left" class="x2">NUMERO</div></div>

<input name="TraNum" type="text" id="TraNum"  
class="ps" style="position:absolute; left: 570px; top: 156px; width: 55px;" 
value="<?php echo $StrTNum;?>"   onblur="_N(this);"
onkeydown="return SoloEnterosEx(this,event,'CboCom');" 
tabindex="6" />

<div id="layer5" style="position:absolute; left: 639px; top: 124px; width: 77px; height: 28px;">
<div align="left" class="x2">CARGAR DESDE</div></div>


<select name="CboCom" id="CboCom" 
style="left: 638px; top:156px; width:90px;" 
onkeydown="return SoloTextoEx(event,'TxtPSER');" 
tabindex="20"  
>
<?php
	echo FCBO_("com_nombre","comprobantes",
			  "com_nombre='CONTENEDOR' OR com_nombre='PROFORMA'",$StrCom,"N","S");
?>
</select>

<div id="layer5" style="position:absolute; left: 738px; top: 137px; width: 45px;">
<div align="left" class="x2">SERIE</div></div>
<input name="TxtPSER" type="text" id="TxtPSER"  
class="ps" style="position:absolute; left: 737px; top: 156px; width: 48px;" 
value="<?php echo $StrPSER;?>"  
onkeydown="return SoloTextoEx(event,'TxtPNUM');"
tabindex="21" />

<div id="layer5" style="position:absolute; left: 797px; top: 137px; width: 64px;">
<div align="left" class="x2">NUMERO</div></div>
<input name="TxtPNUM" type="text" id="TxtPNUM"  
class="ps" style="position:absolute; left: 796px; top: 156px; width: 65px;" 
value="<?php echo $StrPNUM;?>"  
onkeydown="return SoloTextoEx(event,'CmdCar');"
tabindex="22" />

<input type="button" name="CmdCar" 
style="position:absolute; left: 871px; top: 156px; width: 56px;"
id="CmdCar" value="Cargar" onclick="fCargar();" tabindex="23"/>



<div id="layer5" style="position:absolute; left:938px; top: 137px; width: 131px;">
<div align="left" class="x2">CARRETILLERO</div></div>

<select name="TxtCar" id="TxtCar" 
style="left:938px; top:156px; width:150px;" 
onkeydown="return SoloTextoEx(event,'TxtCod');" 
tabindex="20"  
>
<?php
echo FCBO_("NOMBRE","vpersonal","ID>0 AND CARGO='CARRETILLERO'",$StrCar,"N","S");
?>
</select>

<div class="EL" style="left: 42px; top: 191px; width: 84px;"><u><a onclick="fLimDet()">CODIGO +</a></u></div>

<input name="TxtCod" type="text" id="TxtCod" 
style="position:absolute; left: 42px; top: 209px; width: 90px;" 
value="<?php echo $StrCod;?>"  
onkeydown="return SoloTextoEx(event,'TxtDes');"
onkeyup="document.getElementById('TxtHora').value=GetHora();" 
tabindex="7" />
  
  

<div id="layer16" style="position:absolute; left: 154px; top: 191px; width: 105px;">
  <div align="left" class="x2">DESCRIPCION</div></div>
<input name="TxtDes" type="text" id="TxtDes" 
style="position:absolute; left: 151px; top: 209px; width: 312px;" 
value="<?php echo $StrDes;?>"  
onkeydown="return SoloTextoEx(event,'TxtMarca');"
onkeyup="document.getElementById('TxtHora').value=GetHora();" 
tabindex="8" />

<input type="button" name="CmdSel" id="CmdSel" value="Trasformaciones" 
onClick="Ow('transformaciones_2.php',905*ZO(),390*ZO());"
style="position:absolute; left: 339px; top: 184px; width: 126px;"
/>

<div id="layer20" style="position:absolute; left: 660px; top: 191px; width: 45px;">
<div align="left" class="x2">CANT</div></div>
<input name="TxtCant" type="text" id="TxtCant" 
class="ps" style="position:absolute; left: 659px; top: 209px; width: 55px;" 
value="<?php echo $StrCant;?>"  
onkeydown="return SoloNum(this,event,'TxtCUni');"           
onfocus="selecciona_value(this);"          
tabindex="10" />

<div id="layer20" style="position:absolute; left: 726px; top: 191px; width: 52px;">
<div align="left" class="x2">PIEZAS</div></div>
<input name="TxtCUni" type="text" id="TxtCUni" 
class="ps" style="position:absolute; left: 727px; top: 209px; width: 55px;" 
value="<?php echo $StrCUni;?>"  
onkeydown="return SoloNum(this,event,'CmdAdd');"           
onfocus="selecciona_value(this);"          
tabindex="11" />

<input type="button" name="CmdAdd" 
style="position:absolute; left: 795px; top: 209px; width: 62px;"
id="CmdAdd" value="Agregar" onclick="fAgregar();" tabindex="12"/>


<div id="TAB_AJAX" 
style="visibility: hidden; height:200px; width:874px; overflow-x:hidden; position:absolute; left: 42px; top: 261px; overflow-y:scroll; color: #0FF; background-color: #FFFFFF; layer-background-color: #CCCCCC; border: 1px none #000000;" align="left"></div>
<div id="TAB_CAPTION" 
style="visibility: hidden; height:20px; width:814px; position:absolute; left: 42px; top: 242px; color: #0FF; background-color: #CCCCCC; layer-background-color: #CCCCCC; border: 1px none #000000;" align="left">
<table width="822" border="1" cellpadding="0" cellspacing="0" bgcolor="#d4e3e5" class="estilo888">   
<tr  height="10px">
<td width="136" bgcolor="#CCCCCC">CODIGO</td>
<td width="365" bgcolor="#CCCCCC">DESCRIPCION</td>
<td width="121" bgcolor="#CCCCCC">LINEA</td>
<td width="100" align="right" bgcolor="#CCCCCC">CANT</td>
<td width="100" align="right" bgcolor="#CCCCCC">PIEZAS</td>
</tr>   
</table>
<div style="position:absolute; top:0px; left:825px"><input name="CmdClose" type="button" value="Cerrar" onclick="CerrarDIV();" style="background-color:#F90" /></div>
</div>





<input name="TxtMarca" type="text" id="TxtMarca" 
style="position:absolute; left: 476px; top: 209px; width: 166px;" 
value="<?php echo $StrMARCA;?>"  
onkeydown="return SoloTextoEx(event,'TxtCant');"
onkeyup="document.getElementById('TxtHora').value=GetHora();"
tabindex="9" />


<div id="layer11" style="position:absolute; left: 478px; top: 191px; width: 73px;">
  <div align="left" class="x2">LINEA</div>
</div>


</form>
<?php
if(strlen($StrDESCARGAR)>0){
echo "<div id=\"layer51\" 
	  style=\"position:absolute; left: 496px; top: 114px; 
	  width: 90px; background-color: #FFCC00; layer-background-color: #FFCC00; 
	  border: 1px none #000000; height: 17px;\">";
echo "<div align=\"center\" class=\"x2\"> ";
echo " <a href=\"$StrDESCARGAR\" download>Descarga.PDF</a> ";
echo "</div>";
echo "</div>";
}
?>

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