<?php
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
//+++
$SER=V($_GET['SER']);
$NUM=vbval(V($_GET['NUM']));
$KODIGO=vbval(V($_GET['KODIGO']));
//++++++
if($KODIGO>0){
	$KOD=gn("id_in","ges_invoice","id_in=$KODIGO");
}else{
	$KOD=gn("id_in","ges_invoice","in_pro_ser='$SER' AND in_pro_num_=$NUM");
}
if($KOD==0){
	echo '<body>';
	echo '<form id="Frm" name="Frm" >';
	echo '<input id="RPT"  type="text" value="Serie y numero no registrado" />';
	echo '</form>';
	echo '</body>';
	return;
}
//++++
$StrId=$KOD;
$StrCmd="AR";
$TRADUCCION="";
include("ges_invoice_print_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>
<style type="text/css">
input[type="text"] {
	width:95%;
	position:inherit;
	/*cursor: not-allowed;*/
	/*pointer-events:none;*/
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Imprimir</title>
</head>
<body>
<form id="Frm" name="Frm" >
    <table width="80%" border="0">
    <tr>
    <td width="1%">KOD</td>
    <td width="99%">
    <input id="KOD" type="text" value="<?php echo $KOD;?>" />
    </td>    
    </tr>
    <tr>
    <td width="1%">PROVEEDOR</td>
    <td width="99%">
    <input id="PRV_NC" type="text" value="<?php echo $PrvNc;?>" />
    </td>    
    </tr>
    
    <tr>
    <td width="1%">PROVEEDOR_DIR</td>
    <td width="99%">
    <input id="PRV_DIR" type="text" value="<?php echo $PrvDir;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">PROVEEDOR_TEL</td>
    <td width="99%">
    <input id="PRV_TEL" type="text" value="<?php echo $PrvTel;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">PROVEEDOR_FAX</td>
    <td width="99%">
    <input id="PRV_FAX" type="text" value="<?php echo $PrvFax;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">PROVEEDOR_EMAIL</td>
    <td width="99%">
    <input id="PRV_EMA" type="text" value="<?php echo $PrvEma;?>" />
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td width="1%">EMPRESA_TO</td>
    <td width="99%">
    <input id="EMP_TO" type="text" value="<?php echo $EmpNc;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">EMPRESA_DIR</td>
    <td width="99%">
    <input id="EMP_ADD" type="text" value="<?php echo $EmpDir;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">EMPRESA_RUC</td>
    <td width="99%">
    <input id="EMP_RUC" type="text" value="<?php echo $EmpRuc;?>" />
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td width="1%">PRO_SER</td>
    <td width="99%">
    <input id="PRO_SER" type="text" value="<?php echo $ProSer;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">PRO_NUM</td>
    <td width="99%">
    <input id="PRO_NUM" type="text" value="<?php echo $ProNum;?>" />
    </td>
    </tr>
    
    
    <tr>
    <td width="1%">INV_SER</td>
    <td width="99%">
    <input id="INV_SER" type="text" value="<?php echo $InvSer;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">INV_NUM</td>
    <td width="99%">
    <input id="INV_NUM" type="text" value="<?php echo $InvNum;?>" />
    </td>
    </tr>
    
        
    <tr>
    <td width="1%">INV_FEC</td>
    <td width="99%">
    <input id="INV_FEC" type="text" value="<?php echo $InvFec;?>" />
    </td>
    </tr>
    
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td width="1%">PUE_ORI</td>
    <td width="99%">
    <input id="PUE_ORI" type="text" value="<?php echo $PtoOri;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">PUE_DES</td>
    <td width="99%">
    <input id="PUE_DES" type="text" value="<?php echo $PtoDes;?>" />
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td colspan="2">    
    	
        <table width="100%" border="1">
        <tr>
        <td>NO.</td>
        <td>MODEL NUMBER</td>
        <td>PARTIDA</td>
        <td>DESCRIPTION</td>
        <td>MEDIDAS</td>
        <td>PIEZAS/<b>PACKAGE</b></td>
        <td>CAJAS/<b>CTNs</b></td>
        <td>CANT/<b>CAJAS</b></td>
        <td>
        <?php
		$LIS_UNI="";
		$s="SELECT UND_NC FROM vis_ges_invoice_det 
			WHERE ID_INV=$StrId GROUP BY UND_NC 
			ORDER BY UND_NC";
		$rs=grs($s);
		while($r=$rs->fetch_assoc()){
			$LIS_UNI=$LIS_UNI.$r['UND_NC']."/";
		}
		if(strlen($LIS_UNI)>0){
			$LIS_UNI=vbmid($LIS_UNI,1,strlen($LIS_UNI)-1);
		}
		?>
        <input id="LIS_UNI" type="text" value="<?php echo $LIS_UNI;?>" />
        </td>
        <td>PRECIO</td>
        <td>AMO</td>
        </tr>
        <?php
		$TOT_CAJAS=0;
		$TOT_IMPORTE=0;
		$PX=0;
		$s="SELECT * FROM vis_ges_invoice_det WHERE ID_INV=$StrId ORDER BY ID_DET";
		$rs=grs($s);
		while($r=$rs->fetch_assoc()){
			$PX++;
			$TOT_CAJAS=$TOT_CAJAS + $r['CAJ'];
			$TOT_IMPORTE=$TOT_IMPORTE + $r['IMPORTE'];
		?>
        <tr>
        <td>
        <input id="NRO_<?php echo $PX;?>" type="text" value="<?php echo $r['CX'];?>" />
        </td>
        <td>
        <input id="COD_<?php echo $PX;?>" type="text" value="<?php echo $r['COD'];?>" />
        </td>
        <td>
        <input id="PARTIDA_<?php echo $PX;?>" type="text" value="<?php echo $r['PARTIDA'];?>" />
        </td>
        <td>
        <input id="DES_<?php echo $PX;?>" type="text" value="<?php echo $r['DES'];?>" />
        </td>
        <td>
        <input id="MED_<?php echo $PX;?>" type="text" value="<?php echo $r['MEDIDAS'];?>" />
        </td>
        <td>
        <input id="PIE_<?php echo $PX;?>" type="text" value="<?php echo $r['PIE'];?>" />
        </td>
        <td>
        <input id="CAJ_<?php echo $PX;?>" type="text" value="<?php echo $r['CAJ'];?>" />
        </td>
        <td>
        <input id="CAN_<?php echo $PX;?>" type="text" value="<?php echo $r['TOT_UWI'];?>" />
        </td>
        <td>
        <input id="UND_<?php echo $PX;?>" type="text" value="<?php echo $r['UND_NC'];?>" />
        </td>
        <td>
        <input id="PRE_<?php echo $PX;?>" type="text" value="<?php echo $r['PRE'];?>" />
        </td>
        <td>
        <input id="IMP_<?php echo $PX;?>" type="text" value="<?php echo $r['IMPORTE'];?>" />
        </td>
        </tr>
        <?php
		}
		?>
        </table>   
    
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td width="1%">TOT_ITEMS</td>
    <td width="99%">
    <input id="TOT_ITEMS"  type="text" value="<?php echo $PX;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">TOT_CAJAS</td>
    <td width="99%">
    <input id="TOT_CAJAS"  type="text" value="<?php echo $TOT_CAJAS;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">TOT_IMPORTE</td>
    <td width="99%">
    <input id="TOT_IMPORTE"  type="text" value="<?php echo $TOT_IMPORTE;?>" />
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td width="1%">FLE_SON</td>
    <td width="99%">
    <input id="FLE_SON"  type="text" value="<?php echo $FleSon;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">FLE_TAG</td>
    <td width="99%">
    <input id="FLE_TAG"  type="text" value="<?php echo $FleTag;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">FLE_PRE</td>
    <td width="99%">
    <input id="FLE_PRE"  type="text" value="<?php echo $FlePre;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">FLE_NUM</td>
    <td width="99%">
    <input id="FLE_CAN"  type="text" value="<?php echo $FleNum;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">FLE_AMO</td>
    <td width="99%">
    <input id="FLE_AMO"  type="text" value="<?php echo $FleAmo;?>" />
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
        
    <tr>
    <td width="1%">FOB_PRE</td>
    <td width="99%">
    <input id="FOB_PRE"  type="text" value="<?php echo $FobPre;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">FOB_NUM</td>
    <td width="99%">
    <input id="FOB_CAN"  type="text" value="<?php echo $FobNum;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">FOB_AMO</td>
    <td width="99%">
    <input id="FOB_AMO"  type="text" value="<?php echo $FobAmo;?>" />
    </td>
    </tr>
    
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    
    <tr>
    <td width="1%">CFR_TAG</td>
    <td width="99%">
    <input id="CFR_TAG"  type="text" value="<?php echo $CfrTag;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">CFR_PRE</td>
    <td width="99%">
    <input id="CFR_PRE"  type="text" value="<?php echo $CfrPre;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">CFR_NUM</td>
    <td width="99%">
    <input id="CFR_CAN"  type="text" value="<?php echo $CfrNum;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">CFR_AMO</td>
    <td width="99%">
    <input id="CFR_AMO"  type="text" value="<?php echo $CfrAmo;?>" />
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td width="1%">TOTAL</td>
    <td width="99%">
    <input id="TOTAL"  type="text" value="<?php echo $TotAmo;?>" />
    </td>
    </tr>
    
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    
    <tr>
    <td width="1%">PAY_TER</td>
    <td width="99%">
    <input id="PAY_TER"  type="text" value="<?php echo $PayTer;?>" />
    </td>
    </tr>
    
    
    <tr>
    <td width="1%">FIN_TIM</td>
    <td width="99%">
    <input id="FIN_TIM"  type="text" value="<?php echo $FinTim;?>" />
    </td>
    </tr>
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td width="1%">TOTAL_AMO</td>
    <td width="99%">
    <input id="TOTAL_AMO"  type="text" value="<?php echo $TotAmo;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">TOTAL_AMO_LET</td>
    <td width="99%">
    <input id="TOTAL_AMO_LET"  type="text" value="<?php echo $TotAmoLet;?>" />
    </td>
    </tr>
    
    
    <tr>
    <td width="1%">TRADUCCION</td>
    <td width="99%">
    <input id="TRADUCCION"  type="text" value="<?php echo $TRADUCCION;?>" />
    </td>
    </tr>
    
    
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    <tr>
    <td width="1%">BAN_EXP_AGE</td>
    <td width="99%">
    <input id="BAN_EXP_AGE"  type="text" value="<?php echo $BanExpAge;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">BAN_EXP_AGE_ACC</td>
    <td width="99%">
    <input id="BAN_EXP_AGE_ACC"  type="text" value="<?php echo $BanExpAgeAcc;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">BAN_NOM</td>
    <td width="99%">
    <input id="BAN_NOM"  type="text" value="<?php echo $BanNom;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">BAN_DIR</td>
    <td width="99%">
    <input id="BAN_DIR"  type="text" value="<?php echo $BanDir;?>" />
    </td>
    </tr>
    
    <tr>
    <td width="1%">BAN_SWI</td>
    <td width="99%">
    <input id="BAN_SWI"  type="text" value="<?php echo $BanSwi;?>" />
    </td>
    </tr>
    
    
    
    </table>
	<input id="RPT"  type="text" value="OK" />
</form>
</body>
</html>