<?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;}
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$REF_ID=vbval(V($_POST['REF_ID']));
//++++++++++++++++++++++++++
include("ges_referencias_bx.php");
//++++++++++++++++++++++++++
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Referencias - Consultar</title>
<!----------------------------------------->
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></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">
.tableFixHead          { overflow-y: auto; }
.tableFixHead thead th { position: sticky; top: 0; }

table  {border-collapse:collapse;width:100%;}
th, td {padding: 3px 3px;}
th     {background:#A0A0A0}

.cF {height:700px;width:1250px;position:relative;top:0px}
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}

.tzt{
	background-color:transparent; width:100%; font-size:11px; position:inherit!Important; border:none;
}

</style>

<!----------------------------------------->
<script>
$(document).ready(function(){  
   Inicializar();
   jF("ProCod");
});
</script>
<!----------------------------------------->
<script language="javascript">
$(document).ready(function() {
	$(".botonExcel").click(function(event) {
		$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
		$("#FormularioExportacion").submit();
});
});
</script>
<!----------------------------------------->
<body  <?php echo $LStrMsg;?>  >
<div align="center">

<div class="mM" align="left" style="font-size:12px">
<?php
echo GEN_MENU(vbval(V($_SESSION['SYS_USER_ID'])));
?>
</div>

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

<!----------------------------------------->
<div id="DivT" class="dT"  style="width:1250px;">
<img src="b.png" class="iT" />
<div class="tT">REFERENCIAS - CONSULTAR</div>
</div>

<!----------------------------------------->

<div class="s1" style="left: 35px; top:105px; width: 94px;">
PRODUCTO</div>

<div class="s1" style="left: 35px; top: 121px; width: 90px;">
CODIGO*</div>
<input name="ProCod" type="text" id="ProCod" 
class="lt" style="left: 35px; top: 138px; width: 133px;"
value="<?php echo $ProCod;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 176px; top:105px; width: 94px;">
PRODUCTO</div>
<div class="s1" style="left: 176px; top: 121px; width: 174px;">
*NOMBRE / DESCRIPCION*</div>

<input name="ProDes" type="text" id="ProDes" 
class="lt" style="left: 176px; top: 138px; width: 203px;"
value="<?php echo $ProDes;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left:391px; top: 119px; width: 96px;">MEASURES</div>
<input name="Mea" type="text" id="Mea" 
class="lt" style="left:391px; top: 138px; width: 78px;text-transform:none;"
value="<?php echo $Mea;?>"  
tabindex="<?php echo ++$TI;?>"/>



<div class="s1" style="left: 487px; top:105px; width: 107px;">
<b>REFRENCIAS</b> &gt;&gt;&gt;</div>

<div class="s1" style="left: 488px; top: 120px; width: 80px;">
EMPRESAS</div>
<select name="Emp" id="Emp" 
class="lt" style="left: 487px; top: 137px; width: 99px"
tabindex="<?php echo ++$TI;?>">
<?php 
echo FCBO_("emp_nom_cor","ges_empresas","id_emp>0",$Emp,"S","N");
?>
</select>

<div class="s1" style="left: 604px; top: 119px; width: 106px;">
INVOICE SERIE</div>
<input name="InvSer" type="text" id="InvSer" 
class="lt" style="left:601px; top: 138px; width: 110px;"
value="<?php echo $InvSer;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 730px; top: 119px; width: 123px;">
INVOICE NUMERO</div>
<input name="InvNum" type="text" id="InvNum" 
class="lt" style="left:729px; top: 138px; width: 159px;"
value="<?php echo $InvNum;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 901px; top: 119px; width: 122px;">
INVOICE ITEM</div>
<input name="InvIte" type="text" id="InvIte" 
class="lt" style="left:901px; top: 138px; width: 87px;"
value="<?php echo $InvIte;?>"  
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left:1007px; top: 119px; width: 96px;">DUA
</div>
<input name="Dua" type="text" id="Dua" 
class="lt" style="left:1006px; top: 138px; width: 115px;"
value="<?php echo $Dua;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left:1130px; top: 119px; width: 68px;">
DUA ITEM
</div>
<input name="DuaIte" type="text" id="DuaIte" 
class="lt" style="left:1131px; top: 138px; width: 81px;"
value="<?php echo $DuaIte;?>"  
tabindex="<?php echo ++$TI;?>"/>

<!----------------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width: 551px; height: 26px;">
<input name="CmdB" type="button" id="CmdB" class="btm"
value="Buscar" onClick="fFiltrar();"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdZ" class="btm"
value="Menu" onClick="fBuscar('menu.php');"  
tabindex="<?php echo ++$TI;?>" />

</div>

<div  style="position:absolute; top:165px; left:35px; height:27px; background-color:#FFF; width: 1180px;">
<table width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:11px" border="0">
<tr>
<td align="center">
	<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
</td>
</tr>
</table>
</div> 
    
<!----------------------------------------->
<div class="tableFixHead" style="position: absolute; left: 35px; top: 194px; width: 1180px; height: 473px; overflow:auto; border:solid 1px #363636">
<table id="Exportar_a_Excel" width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:11px">
<thead>
<tr>
<th width="160" align="left">></th>
<th width="160" align="left">></th>
<th width="160" align="left">></th>
<th width="160" align="left">CODIGO</th>
<th width="818" align="left">NOMBRE/DESCRIPCION</th>
<th width="818" align="left">MEASURES</th>
<th width="818" align="left">PRECIO</th>
<th width="6%" align="left">UNIDAD</th>

<th width="6%" align="left">EMPRESA</th>

<th width="6%" align="left">INV.FEC</th>
<th width="6%" align="left">INV.SERIE</th>
<th width="6%" align="left">INV.NUM</th>
<th width="4%">ITEM</th>


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

<th width="4%" align="left">OBSERVACION</th>
<th width="4%" align="left">MODO</th>
<th width="160" align="left">></th>
<th width="160" align="left">></th>
</tr>
</thead>
<tbody>
<?php
$LISTA="0|";	  		
$i=0;
$ST=0;
$CE=0;
$TF=0;
$s="SELECT * FROM vis_ges_productos_referencias 
	WHERE $FF ORDER BY ID_REF";
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
$rs=grs($s);				
while($r=$rs->fetch_assoc()){
	$TR_KOD="TR_".$r['ID_REF'];
	$i++;
	$CSS="";
	if($i%2==0)$CSS=" style=\"background-color:#E2E2E2\" ";
	$NEG="";
	if($r['R_INV_OK']==1)$NEG="font-weight:bold";
	//
	$TD_KOD="TD_".$r['ID_REF'];
	//
	$LISTA=$LISTA.$r['ID_REF']."|";
	$ZSS=' style="background-color:#FFF" ';
	if($REF_ID==$r['ID_REF']){
		$ZSS=' style="background-color:#00CC99" ';
	}
?>	
	<tr <?php echo $CSS;?> id="<?php echo $TR_KOD;?>">
    <td align="center">
    <a href="ges_productos.php?Id=<?php echo $r['ID_PRO'];?>&Pag=0" target="_blank" >
    <img src="open.png"  border="0"/></a></td>
    
    <td align="center" id="<?php echo $TD_KOD;?>" <?php echo $ZSS;?> >
    <a href="javascript:void(0)" onClick="PEdit('<?php echo $r['ID_REF'];?>','<?php echo $TD_KOD;?>');">
    <img src="img/b_edit.png"  border="0"/></a></td>
    
    
    <td align="center">
    <a href="javascript:void(0)" 
    onClick="KX(<?php echo $r['ID_REF']?>,'<?php echo $TR_KOD;?>')">
    <img src="img/el.png"  border="0"/></a></td>
	<!----------------------------------------------->
    <td><input type="text" class="tzt" readonly value="<?php echo $r['PRO_COD'];?>" style="width:80px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['PRO_DES'];?>" style="width:130px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['MEDIDAS'];?>" style="width:130px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['XLS_PRECIO'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['UND'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    
    
	<td><input type="text" class="tzt" readonly value="<?php echo $r['NC_EMP'];?>" style="width:100px;<?php echo $NEG;?>"></td>

    <td><input type="text" class="tzt" readonly value="<?php echo $r['INV_FEC_'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['INV_SER'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['INV_NUM'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['INV_ITE'];?>" style="width:35px;<?php echo $NEG;?>"></td>
    
    
    <td><input type="text" class="tzt" readonly value="<?php echo $r['DUA'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['DUA_ITEM'];?>" style="width:35px;<?php echo $NEG;?>"></td>
    
    
    <td><input type="text" class="tzt" readonly value="<?php echo $r['PAI_ORI'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['PAI_DES'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['PARTIDA'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['NOM_COM'];?>" style="width:150px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['ESTADO'];?>" style="width:60px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['FOB_USS'];?>" style="width:50px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['FOB_KG'];?>" style="width:50px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['UNIDAD'];?>" style="width:50px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['CANTIDAD'];?>" style="width:50px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['MODELO'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['CLASE'];?>" style="width:100px;<?php echo $NEG;?>"></td>
    
    
    
    <td><input type="text" class="tzt" readonly value="<?php echo $r['OBS'];?>" style="width:60px;<?php echo $NEG;?>"></td>
    <td><input type="text" class="tzt" readonly value="<?php echo $r['XLS_MODO'];?>" style="width:60px;<?php echo $NEG;?>"></td>
	<!----------------------------------------------->
    <td align="center">
    <a href="ges_productos.php?Id=<?php echo $r['ID_PRO'];?>&Pag=0" target="_blank" >
    <img src="open.png"  border="0"/></a></td>
    <td align="center">
    <a href="javascript:void(0)" 
    onClick="KX(<?php echo $r['ID_REF']?>,'<?php echo $TR_KOD;?>')">
    <img src="img/el.png"  border="0"/></a></td>
	</tr>
<?php	
}
?>		  
</tbody>
</table>
</div>
<script>
function KX(id_ref,id_fil){
	if(pre("Esta seguro que desea eliminar la referencia?")){
		var R=AX("KIL_REF",id_ref);
		var d=R.split("|");
		if(d[1]=="OK"){
			//alert(id_fil);
			document.getElementById(id_fil).style.display="none";
			alert("Registro eliminado");
		}
	}
}
function PEdit(IdP,td_id){
	PINTAR();
	document.getElementById(td_id).style.backgroundColor="#00CC99";
	sv("REF_ID",IdP)
	Ow("ges_prod_editar.php?PID="+IdP,1265,265);
}
function PINTAR(){
	var lista=gv("LISTA");
	var dat=lista.split("|");
	for(i=0;i<dat.length;i++){
		if(jVal(dat[i])>0){
			var td="TD_"+dat[i];
			document.getElementById(td).style.backgroundColor="#FFF";
		}
	}
}
</script>
<!----------------------------------------->
<?php include("ocultos.php");?>
<input name="LISTA" type="hidden" id="LISTA" value="<?php echo $LISTA;?>" />
<input name="REF_ID" type="hidden" id="REF_ID" value="<?php echo $REF_ID;?>" />
<div class="s1" style="left: 33px; top: 677px; width: 714px;">
Doble Click sobre el registro para activar Actualizacion | 
Lista ordena segun el orden de ingreso</div>

<div class="s1" style="left:615px; top: 677px; width: 599px;">
MODO : <b>REG</b>ULAR - <b>MAS</b>IVO - <b>INV</b>OICE - <b>MAN</b>UAL</div>

</form>

<form action="ficheroExcel.php" 
    method="post" target="_blank" id="FormularioExportacion" >    
    <div style="position: absolute; left: 313px; top: 71px; width: 45px; height: 15px;">  
    <input name="" type="button" class="botonExcel btm" value="Exportar"  />
    <input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
    </div>
</form>


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