<?php
header('Cache-Control: no-cache');
header('Pragma: no-cache'); 
?>
<html>
<head>
<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
</head>
<script language="javascript">

function pon_prefijo(cdgbar,cosart,dscart,desfac,cob_iv, ivporc,tarred) {
	parent.opener.document.formulario_lineas.cdgbar.value=cdgbar;
	parent.opener.document.formulario_lineas.dscart.value=dscart;
	parent.opener.document.formulario_lineas.cosart.value=cosart;
	parent.opener.document.formulario_lineas.desfac.value=desfac;
	parent.opener.document.formulario_lineas.cob_iv.value=cob_iv;
	parent.opener.document.formulario_lineas.ivporc.value=ivporc;
	parent.opener.document.formulario_lineas.tarred.value=tarred;
	parent.opener.document.formulario_lineas.canart.value=1.00;
	parent.opener.document.formulario_lineas.canart.select();
	parent.opener.document.formulario_lineas.canart.focus();
	parent.window.close();

}

</script>
<?php include ("../conexion.php"); 


$dscart=strtoupper($_POST["dscart"]);
//$cdgpro=$_POST["cdgpro"];
$numfacafe=$_POST["numfacafe"];

	
   if ($result = $mysqli->query("SELECT * FROM web_1001  WHERE dscart like '%$dscart%'   ")) {
   $nrs = $result->num_rows;
   $result->close();
}
?>
<div id="tituloForm2"  >
<form id="form1" name="form1">
<?php if ($nrs>0) { ?>
<div  class="totalResultado"> 
		<table class="fuente8" width="100%" cellspacing=0 cellpadding=0 border=0>
		 <tr class="cabeceraTabla" >
			<td width="20%">CODIGO</td>
			<td width="42%"><div align="center" class="cabeceraTabla">
			  <p>ARTICULO</p>
		   </div></td>
			<td width="9%">CANT.</td>
			<td width="16%">PRECIO</td>
			<td width="13%"><span class="totalResultado"><span class="totalResultado">
		    <div align="center">
			</span></td>
		  </tr>
       
		<?php
		
		
			
$consulta = "SELECT * FROM web_1001  WHERE dscart like '%$dscart%'  ";
if ($resultado = $mysqli->query($consulta)) 
$contador=0;
		
		 while ($fila = $resultado->fetch_assoc()) {

        $cdgbar  = $fila["CDGBAR"];
        $dscart  = $fila["DSCART"];
        $PRE002  = $fila["PRE002"];
		$PRE001  = $fila["PRE001"];
		$cosart  = $fila["cosart"];
		$exiact  = $fila["EXIACT"];
		$cob_iv  = $fila["COB_IV"];
		$utiart1 = $fila["utiart1"];
		$utiart2 = $fila["utiart2"];
     	$desart  = $fila["DESART"];
		$desfac  = $fila["DESFAC"];
		$fleart  = $fila["fleart"];
		$cdglin  = $fila["CDGLIN"];
		$cdgfam  = $fila["CDGFAM"];
		$ivporc  = $fila["ivporc"];		
		$tarred  = $fila["tarred"];
		

				 if ($contador % 2) { $fondolinea="itemParTabla"; } else { $fondolinea="itemImparTabla"; }?>
						<tr class="<?php echo $fondolinea?>">
					<td>
        <div align="center"><?php echo $cdgbar;?></div></td>
					<td>
        <div align="left"><?php echo $dscart;?></div></td>
					<td><div align="right"><?php echo number_format($exiact,2,".",",");?></div></td>
        
					<td><div align="right"><?php echo number_format($cosart,2,".",",");?></div></td>
				
                    
					<td align="center"><div align="center"><a href="javascript:pon_prefijo('<?php echo $cdgbar?>','<?php echo $cosart?>','<?php  echo htmlspecialchars( $dscart ) ?>','<?php echo $desfac?>','<?php echo $cob_iv ?>','<?php echo $ivporc?>','<?php echo $tarred?>')"><img src="../img/Redo_32x32-32.png" border="0" title="Seleccionar" width="25" height="25"></a></div></td>					
				</tr>
			<?php
			$contador++;
			}
		?>
  </table>
		<?php } else { ?>
					<table class="fuente8" width="87%" cellspacing=0 cellpadding=3 border=0>
						<tr>
							<td width="100%" class="mensaje"><?php echo "No existe articulo que cumpla con los criterios de b&uacute;squeda";?></td>
					    </tr>
					</table>					
					<?php } ?>	
<iframe id="frame_datos2" name="frame_datos2" width="0%" height="0" frameborder="0">
	<ilayer width="0" height="0" id="frame_datos2" name="frame_datos2"></ilayer>
</iframe>
<input type="hidden" id="accion" name="accion">
</form>
</div>
</body>
</html>
