<?php
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;
}
*/
$HW=V($_SESSION['SYS_HW']);
$StrGT="";$LStrMsg="";$LStrFoc="";$LStrMM="";
$LStrPag=V($_POST['TxtPag']);
//++++++++
include("compras_apdv_imprimir_pie_fun.php");
//
$VP_RegXPag=20;
$LStrTR=0;//gn("count(*)","vproductos",$FF);
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Consultar precios de ventas - Segun compra</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="fe/funciones_basico.js"></script>
<script type="text/javascript" src="fe/compras_apdv_pie.js"></script>
<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="estilox.css"  />
<link rel="stylesheet" type="text/css" href="basix.css"  />
<style type="text/css">
.cF {height:550px;width:1100px;position:relative; <?php echo "top:0px";?>}
</style>
<script>
$(document).ready(function(){  
   Inicializar(); 
  
});
</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>
</head>

<body  style="border:none; padding:0 0 0 0; margin:0 0 0 0"  >
<div align="center"></div>
<div id="DivFRM"  class="cF" style="background-color:#FFFFFF;" >
  <form id="Frm" name="Frm" method="post" action="compras_apdv_imprirmir_pie.php">
    <!--INI_TITULO-->
    <div id="DivT" class="dT"  style="width:1100px"> <img src="img/categoria.png" class="iT" />
      <div class="tT" style="width:500px">CONSULTAR PRECIOS DE VENTA - SEGUN COMPRA</div>
    </div>
    <!--FIN_TITULO-->
    <div class="s1" style="left:177px; top: 114px; width: 142px; height: 18px;">
      <?php
	if(strlen($_PDF)>0){
		echo "<a href=\"$_PDF\" target=\"_new\">DESCARGAR</a>";	
	}
?>
    </div>
    
<div class="ad" style="left:35px; top:70px; width: 139px; height: 18px;">COMPROBANTE</div>
<select name="Com" id="Com" 
class="lty" style="left:35px; top:87px; width: 139px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
echo FCBO_("com_nombre","comprobantes","com_nombre IN ('FACTURA','BOLETA','CONTENEDOR')",$Com,"N","S");
?>
</select>
    
    
<div class="s1" style="left:184px; top: 70px; width: 54px; height: 18px;">SERIE</div>
<input name="Ser"  type="text" 
id="Ser" style="left:184px; top: 87px; width: 67px; position:absolute"
maxlength="11" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Ser;?>"   />

<div class="s1" style="left:260px; top: 70px; width: 89px; height: 18px;"> NUMERO</div>
<input name="Num"  type="text" 
id="Num" style="left:259px; top: 87px; width: 97px; position:absolute "
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Num;?>"   />

<div class="s1" style="left:365px; top: 70px; width: 89px; height: 18px;"> DAM</div>
<input name="Dam"  type="text" 
id="Dam" style="left:365px; top: 87px; width: 97px; position:absolute"
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Dam;?>"   />

    <input name="CmdF" type="button" id="CmdF"  
style="position:absolute; top:87px; left:468px; width: 92px;"
value="Filtrar" onClick="flFiltrar();"  
tabindex="<?php echo ++$TI;?>" />
    <!--INI_TABLA----->
    <div class="s1"
style="background:#ECF9FF; position:absolute; left: 35px; top: 118px; width: 1040px; height: 401px; overflow:auto;">
      <div class="s1" style="left: 0px; top: 0px; width: 1030px;">
        <table id="Exportar_a_Excel" class="f4t" width="1020" border="1" style="border-collapse: collapse">
          <tr>
            <td width="7" bgcolor="#CCCCCC"><b>#</b></td>
            <td width="90" bgcolor="#CCCCCC"><b>COMPROBANTE</b></td>
            <td width="48" bgcolor="#CCCCCC"><b>SERIE</b></td>
            <td width="66" bgcolor="#CCCCCC"><b>NUMERO</b></td>
            <td width="78" bgcolor="#CCCCCC"><b>DAM</b></td>
            <td width="90" bgcolor="#CCCCCC"><b>CODIGO</b></td>
            <td width="255" bgcolor="#CCCCCC"><b>DESCRIPCION</b></td>
            <td width="50" bgcolor="#CCCCCC"><b>PIEZAS</b></td>
            <td width="70" bgcolor="#CCCCCC" align="right"><b>PRECIO REGULAR</b></td>
            <td width="70" bgcolor="#CCCCCC" align="right"><b>PRECIO OCULTO</b></td>
            <td width="50" bgcolor="#CCCCCC"><b>UND</b></td>
            <td width="70" bgcolor="#CCCCCC"><b>N°COPIAS</b></td>
          </tr>
	<?php
		$ZX=0;
		$s="SELECT ID,COM,SER,NUM,DAM,ID_PRO,COD,DES,LINEA ,PIEZAS
			FROM vcompras_det_ WHERE $FF 
			GROUP BY ID,COM,SER,NUM,DAM,ID_PRO,COD,DES,LINEA 
			ORDER BY COD";
		$rs = grs($s);
		while ($r = $rs->fetch_assoc()){
			$ZX++;
			$CSS="";
			if($ZX%2==0){
				$CSS=" style=\"background-color:#DADADA\" ";
			}
			$UND=PRO_UND_GET($r['ID_PRO']);
			$PV_MAX=gn("pro_pv_max","productos","id_producto=".$r['ID_PRO']);	
			$TXT_COD="TXT_COD_".$ZX;	
			$TXT_DES="TXT_DES_".$ZX;
			$TXT_PIE="TXT_PIE_".$ZX;
			$TXT_PRE="TXT_PRE_".$ZX;
			$TXT_BRE="TXT_BRE_".$ZX;
			$TXT_NDC="TXT_NDC_".$ZX;
			$TXT_UND="TXT_UND_".$ZX;
	?>
          <tr <?php echo $CSS; ?>>
            <td ><?php echo $ZX;?></td>
            <td><?php echo $r['COM'];?></td>
            <td><?php echo $r['SER'];?></td>
            <td><?php echo $r['NUM'];?></td>
            <td><?php echo $r['DAM'];?></td>
            
            <td>
            <input name="<?php echo $TXT_COD;?>" id="<?php echo $TXT_COD;?>" readonly  
            style="position:inherit; width:90px; border:none; background-color:transparent; font-size:12px"  
            type="text" value="<?php echo $r['COD'];?>" >
            </td>
                       
            <td>
            <input name="<?php echo $TXT_DES;?>" id="<?php echo $TXT_DES;?>" readonly  
            style="position:inherit; width:100%; border:none; background-color:transparent; font-size:12px"  
            type="text" value="<?php echo $r['DES'];?>" >
            </td>
            
            <td>
            <input name="<?php echo $TXT_PIE;?>" id="<?php echo $TXT_PIE;?>"  
            style="position:inherit; width:50px; border:none; background-color:transparent; text-align:right; padding-right:8px"   
            type="text" value="<?php echo $r['PIEZAS'];?>"  >
            </td>
            
            <td>
            <input name="<?php echo $TXT_PRE;?>" id="<?php echo $TXT_PRE;?>"  
            style="position:inherit; width:70px; border:none; background-color:transparent; text-align:right; padding-right:8px"   
            type="text" value="<?php echo NF2($PV_MAX,3);?>"  >
            </td>
            <td>
            <input name="<?php echo $TXT_BRE;?>" id="<?php echo $TXT_BRE;?>"  
            style="position:inherit; width:70px; border:none; background-color:transparent; text-align:right; padding-right:8px"   
            type="text" value="<?php echo COMBI(NF2($PV_MAX,3));?>"  >
            </td>
            <td>
            <input name="<?php echo $TXT_UND;?>" id="<?php echo $TXT_UND;?>"  
            style="position:inherit; width:50px; border:none; background-color:transparent; padding-right:8px"   
            type="text" value="<?php echo $UND;?>"  >
            </td>
            
            <td>
            <input name="<?php echo $TXT_NDC;?>" id="<?php echo $TXT_NDC;?>"  
            onFocus="this.select()"
            class="ned" style="position:inherit; width:70px; padding-right:15px"  
            type="text" value="1" tabindex="<?php echo ++$TI;?>" >
            </td>
          </tr>
          <?php
		}
	
	?>
        </table>
      </div>
    </div>
    <input name="TXT_CX" type="hidden" id="TXT_CX" value="<?php echo $ZX;?>" />
    <!--FIN_TABLA----->
    <!--INI_OCULTOS-------------------------------->
    <?php include("ocultox.php");?>   
    <!--FIN_OCULTOS-------------------------------->
    <!--INI_BOTONES----->
    <!--FIN_BOTONES-->
  </form>
  

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