<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
include("phpmnu_fun.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
$TMP_KOD=vbval(V($_GET['TMP_KOD']));
$HWN=V($_GET['HWN']);
if($TMP_KOD==0){
	$TMP_KOD=vbval(V($_POST['TMP_KOD']));
	$HWN=V($_POST['TXT_HWN']);
}
$r=gr("vis_ges_invoice_det_t","CX=$TMP_KOD");
$Cod=$r['COD'];
$Des=$r['DES'];
$Mea=$r['MEDIDAS'];
$Pie=$r['PIE'];
$Caj=$r['CAJ'];
$Und=$r['UND'];
$TotPie=$r['TOT_PIE'];
$TotUni=$r['TOT_UNI'];
$TotUwi=$r['TOT_UWI'];
$Pre=$r['PRE'];
$Imp=$r['IMP'];
$DET_PRO=$r['ID_PRO'];
//
$SYS_CLOSE="N";
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Editar item</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/ges_invoice_editar3.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">
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}
.cF {height:450px;width:1250px;position:relative;top:0px}

.tableFixHead          { overflow-y: auto; overflow:auto; border:solid 1px #363636;position: absolute; }
.tableFixHead thead th { position: sticky; top: 0; }
table  {border-collapse:collapse;width:100%;}
th, td {padding: 3px 3px;}
th     {background:#CCC}
.tzt{
	background-color:transparent; width:100%; font-size:11px; position:inherit!Important; border:none;
}
</style>
<script>
$(document).ready(function(){  
   Inicializar();
   jF("Pie");
   if(gv("TXT_CLOSE")=="S"){
	   window.close();
   }
});
//
var UNI_TOT=<?php echo gn("count(*)","ges_unidades","id_und>0");?>;
var UNI_ABR=new Array();
var UNI_FAC=new Array();
//
<?php
$IDX=0;
$s="SELECT * FROM ges_unidades WHERE id_und>0";
$rs=grs($s);
while($r=$rs->fetch_assoc()){
	$A=$r['und_abr'];
	$F=$r['und_factor'];
	$IDX++;
?>
UNI_ABR[<?php echo $IDX;?>]="<?php echo $A;?>";
UNI_FAC[<?php echo $IDX;?>]=<?php echo $F;?>;
<?php
}
?>
</script>
</head>
<body >
<div align="center">

<div Id="DivFRM"  class="cF" style="background-color:#FFC">
<form id="Frm" name="Frm" method="post"  autocomplete="off"
action="ges_invoice_editar.php" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" style="width:1250px" >
<img src="png/descuento2.png" class="iT" />
<div class="tT">EDITAR ITEM</div>
</div>
<!--FIN_TITULO--------------------------------->
<?php
$CLS="lt";
if(strlen($Cod)>0)$CLS="roi";
?>
<div class="s1" style="left: 35px; top: 84px; width: 86px;" > CODIGO
</div>
<input name="Cod" type="text" id="Cod" 
class="<?php echo $CLS;?>" style="left: 35px; top: 101px; width: 91px" 
value='<?php echo $Cod;?>'  
tabindex='<?php echo ++$TI;?>'/>

<?php
$CLS="lt";
if(strlen($Des)>0)$CLS="roi";
?>
<div class="s1" style="left: 138px; top: 84px; width: 239px;">
NOMBRE / DESCRIPCION</div>
<input name="Des" type="text" id="Des" 
class="<?php echo $CLS;?>" style="left: 137px; top: 101px; width: 252px" 
value='<?php echo $Des;?>'  
tabindex='<?php echo ++$TI;?>'/>

<div class="s1" style="left:397px; top: 84px; width: 92px;">
MEASURES</div>
<input name="Mea" type="text" id="Mea" 
class="<?php echo $CLS;?>" style="left: 396px; top: 101px; width: 126px;text-transform:none;" 
value='<?php echo $Mea;?>'  
tabindex='<?php echo ++$TI;?>'/>

<div class="s1" style="left: 534px; top: 84px; width: 63px;">PIEZAS</div>
<input name="Pie"  type="text" id="Pie"
class="ned" style="left:534px; top: 101px; width:65px;"
value='<?php echo $Pie;?>' onKeyUp="fImporte();"
onfocus="selecciona_value(this);"
tabindex='<?php echo ++$TI;?>'/>

<div class="s1" style="left: 606px; top: 84px; width: 63px;">CAJAS</div>
<input name="Caj"  type="text" id="Caj"
class="ned" style="left:606px; top: 101px; width: 70px;"
value='<?php echo $Caj;?>' onKeyUp="fImporte();"
onfocus="selecciona_value(this);"
tabindex='<?php echo ++$TI;?>'/>

<div class="s1" style="left:689px; top: 84px; width: 54px;">UNIDAD</div>
<select name="Und" id="Und"  onChange="fImporte()"
class="lt" style="left:688px; top: 101px; width: 75px" 
tabindex="<?php echo ++$TI;?>">
<?php 
	echo FCBO("und_abr","ges_unidades","id_und>0",$Und,"N","S");
?>
</select>


<div class="s1" style="left:770px; top: 69px; width: 55px;">
TOTAL PIEZAS</div>
<input name="TotPie"  type="text" id="TotPie"
class="rod" style="left:770px; top: 101px; width: 73px;"
value='<?php echo $TotPie;?>' 
tabindex='<?php echo ++$TI;?>'/>


<div class="s1" style="left:853px; top: 69px; width: 91px;">
TOTAL UNIDADES (1)</div>
<input name="TotUni"  type="text" id="TotUni"
class="rod" style="left:853px; top: 101px; width: 88px;"
value='<?php echo $TotUni;?>' 
tabindex="<?php echo ++$TI;?>"/>



<div class="s1" style="left:949px; top: 69px; width: 90px;">
TOTAL UNIDADES (2)</div>
<input name="TotUwi"  type="text" id="TotUwi"
onKeyUp="cImporte();" class="ndd" style="left:950px; top: 101px; width: 91px;"
value='<?php echo $TotUwi;?>' 
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left: 1049px; top: 84px; width: 53px;">PRECIO</div>
<input name="Pre"  type="text" id="Pre"
class="ndd" style="left: 1049px; top: 101px; width: 56px;" 
value='<?php echo $Pre;?>' onKeyUp="cImporte();"
onfocus="selecciona_value(this);"
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left: 1114px; top: 84px; width: 72px;">IMPORTE</div>
<input name="Imp"  type="text" id="Imp"
class="rod" style="left: 1113px; top: 101px; width: 101px;"
value='<?php echo $Imp;?>'/>


<input name="CmdG" type="button" id="CmdG" 
style="position:absolute; left:952px; top:136px; width: 151px;"
value="Modificar item" onClick="fAplicar();"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdX" type="button" id="CmdX" 
style="position:absolute; left:1114px; top:136px; width: 100px;"
value="Cerrar" onClick="window.close();"  
tabindex="<?php echo ++$TI;?>" />



<div class="tableFixHead" style="left:35px; top: 175px; width: 1175px; height: 242px; background-color:#FFF">
<table width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:11px" >
<thead>
<tr>
<th width="6%">EMPRESA</th>
<th width="6%">INV.FEC</th>
<th width="6%">INV.SERIE</th>
<th width="6%">INV.NUM</th>
<th width="4%">ITEM</th>

<th width="8%">DUA</th>
<th width="4%">ITEM</th>


<th width="7%">PAIS ORI.</th>
<th width="6%">PAIS DES.</th>
<th width="7%">PARTIDA</th>
<th width="9%">NOM.COMERCIAL</th>
<th width="6%">ESTADO</th>
<th width="5%">FobUSS</th>
<th width="5%">FobKG</th>
<th width="5%">UNIDAD</th>
<th width="5%">CANT.</th>
<th width="5%">MODELO</th>
<th width="8%">CLASE</th>

<th width="4%">LINK</th>
<th width="4%">OBSERVACION</th>
<th width="4%">IR</th>
<th width="2%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$PX=0;
$s="SELECT * FROM vis_ges_productos_referencias WHERE ID_PRO=$DET_PRO ORDER BY INV_FEC DESC ";	
$rs=grs($s);
while($r=$rs->fetch_assoc()){	
	$PX++;
	$CSS="";
	if($PX%2==0)$CSS=' style="background-color:#D4D4D4" ';
	$TXT_URL="URL_".$r['ID_REF'];
?>
    <tr  <?php echo $CSS;?>>
    <!----------------------------------------------->
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['NC_EMP'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['INV_FEC_'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['INV_SER'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['INV_NUM'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['INV_ITE'];?>" style="width:50px"></td>
    
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['DUA'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['DUA_ITEM'];?>" style="width:50px"></td>
    
    
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['PAI_ORI'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['PAI_DES'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['PARTIDA'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['NOM_COM'];?>" style="width:250px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['ESTADO'];?>" style="width:90px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['FOB_USS'];?>" style="width:75px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['FOB_KG'];?>" style="width:75px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['UNIDAD'];?>" style="width:90px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['CANTIDAD'];?>" style="width:60px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['MODELO'];?>" style="width:100px"></td>
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['CLASE'];?>" style="width:100px"></td>
    
    
    <td><input name="<?php echo $TXT_URL;?>" id="<?php echo $TXT_URL;?>" type="text" class="tzt" readonly value="<?php echo $r['LINK'];?>" style="width:100px"></td>    
    <td><input name="" type="text" class="tzt" readonly value="<?php echo $r['OBS'];?>" style="width:100px"></td>

    <!----------------------------------------------->
    <td align="center">
    <a href="javascript:void(0)" onClick="fIr(<?php echo $r['ID_REF'];?>);">
    <img src="png/ir.png"   border="0"/></a></td>
    <td align="center">
    <a href="javascript:void(0)" onClick="fEr(<?php echo $r['ID_REF'];?>);">
    <img src="img/eliminar.png" style="display:none"  border="0"/></a></td>
    </tr>
<?php
}
?>		  

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


<a href="http://www.google.com" id="LNK" target="_new" style="display:none" >IR</a>


<input name="TMP_KOD" type="hidden" id="TMP_KOD" value="<?php echo $TMP_KOD;?>"/>
<input name="TXT_HWN" type="hidden" id="TXT_HWN" value="<?php echo $HWN;?>"/>
<input name="TXT_CLOSE" type="hidden" id="TXT_CLOSE" value="<?php echo $SYS_CLOSE;?>"/>
<!--FIN_OCULTOS-------------------------------->

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