<?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;}
$PID=vbval(V($_GET['PID']));
$HWN=V($_GET['HWN']);
if($PID==0){
	$PID=vbval(V($_POST['TXT_PID']));
	$HWN=V($_POST['TXT_HWN']);
}
$r=gr("vis_ges_invoice_det_t","CX=$PID");
$Cod=$r['COD'];
$Des=$r['DES'];
$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'];
//
$SYS_CLOSE="N";
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Productos - Editar referencia</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/ges_productos_editar.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:200px;width:1050px;position:relative;top:0px}
</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_productos_editar.php" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" style="width:1050px" >
<img src="png/descuento2.png" class="iT" />
<div class="tT">PRODUCTOS - EDITAR REFERENCIA</div>
</div>
<!--FIN_TITULO--------------------------------->


<center> 
<div id="DivLAST">
</div>
  <div Id="DivFRM"  class="centrarFrm" >

<div class="s1" style="left: 35px; top: 84px; width: 86px;" > CODIGO
</div>
<input name="Cod" type="text" id="Cod" 
class="roi" style="left: 35px; top: 101px; width: 91px" 
value="<?php echo $Cod;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 138px; top: 84px; width: 239px;">
NOMBRE / DESCRIPCION</div>
<input name="Des" type="text" id="Des" 
class="roi" style="left: 137px; top: 101px; width: 234px" 
value="<?php echo $Des;?>"  
tabindex="<?php echo ++$TI;?>"/>

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

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

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


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


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



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


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


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


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

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

<input name="TXT_PID" type="hidden" id="TXT_PID" value="<?php echo $PID;?>"/>
<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>