<?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,dscart,cosart,utiart1,utiart2, PRE001, PRE002, cob_iv, desart, desfac,cdgfam,cdglin, fleart,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.utiart1.value=utiart1;
	parent.opener.document.formulario_lineas.utiart2.value=utiart2;
	parent.opener.document.formulario_lineas.tarred.value=tarred;
	parent.opener.document.formulario_lineas.despro.value=desart;
	parent.opener.document.formulario_lineas.desfac.value=desfac;
	parent.opener.document.formulario_lineas.fleart.value=fleart;
	parent.opener.document.formulario_lineas.PRE001.value=PRE001;
	parent.opener.document.formulario_lineas.PRE002.value=PRE002;
	parent.opener.document.formulario_lineas.cdglin.value=cdglin;
	parent.opener.document.formulario_lineas.cdgfam.value=cdgfam;
	parent.opener.document.formulario_lineas.cob_iv.value=cob_iv;
	parent.opener.document.formulario_lineas.ivporc.value=ivporc;
	parent.opener.document.formulario_lineas.importe.value="";
	parent.opener.document.formulario_lineas.impuesto_producto.value="";
	parent.opener.document.formulario_lineas.impuesto_factura.value="";
	parent.opener.document.formulario_lineas.descuento_producto.value="";
	parent.opener.document.formulario_lineas.descuento_factura.value="";
		parent.window.close();
	parent.opener.document.getElementById("canart").focus();
	parent.opener.document.getElementById("canart").select();


}



function actualizar_articulo(cdgart,cdgbar,cdgbar_xml,barras,borrado,cdgpro){

parent.actualizar_articulo(cdgart,cdgbar,cdgbar_xml,barras,borrado,cdgpro)


}


function actualizar_articulo_unidad_empaque(cdgart,uniemp){

parent.actualizar_articulo_unidad_empaque(cdgart,uniemp)

}


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



$cdgbar_xml=$_POST["cdgbar"];
$cdgpro=$_POST["cdgpro"];

$dscart=strtoupper($_POST["dscart"]);

	if ($result = $mysqli->query("SELECT * FROM web_1001 WHERE dscart like '%$dscart%' OR cdgbar like '%$dscart%'  and estart = 1  ORDER BY dscart ASC LIMIT 300" )) {
   $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="11%">CODIGO</td>
			<td width="11%">BARRAS 2</td>
			<td width="11%">BARRAS 3</td>
			<td width="32%"><div align="center" class="cabeceraTabla">
			  <p>ARTICULO</p>
		   </div></td>
		   <td width="7%">PROVEEDOR</td>
		   <td width="10%">UNID. EMPAQUE</td>
			<td width="7%">CANT.</td>
			<td width="11%">PRECIO</td>
			<!--<td width="11%"><span class="totalResultado"><span class="totalResultado">
		    <div align="center">
			</span></td>-->
		  </tr>
       
		<?php

			
$consulta = "SELECT * FROM web_1001 WHERE dscart like '%$dscart%' OR cdgbar like '%$dscart%'  and estart = 1  ORDER BY dscart ASC LIMIT 300 ";
if ($resultado = $mysqli->query($consulta)) 
$contador=0;
		
		 while ($fila = $resultado->fetch_assoc()) {

        $cdgbar  = $fila["CDGBAR"];
		$cdgart = $fila["CDGART"];
		$cdgbar2  = $fila["CDGBAR2"];
		$cdgbar3  = $fila["CDGBAR3"];
		
        $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"];
		$cdgpro2 = $fila["cdgpro"];
		$uniemp  = $fila["uniemp"];		
		
		$dscart = substr(($dscart), 0,45);	
				
				
				 if ($contador % 2) { $fondolinea="itemParTabla"; } else { $fondolinea="itemImparTabla"; }?>
						<tr class="<?php echo $fondolinea?>">
					<td><div align="center"><?php echo $cdgbar;?></div></td>
					 <?php //if ( $cdgbar2 == ""){?>
					 
					<td><div align="center"> <input type="text"   value="<?php echo $cdgbar2; ?>"  name="cdghac" id="cdghac"  onkeypress=""  style='text-align:right;' onDblClick="actualizar_articulo('<?php echo $cdgart ?>',this.value,'<?php echo $cdgbar_xml?>','<?php echo 2 ?>','<?php echo 0 ?>','<?php echo $cdgpro ?>')" onChange="actualizar_articulo('<?php echo $cdgart ?>',this.value,'<?php echo $cdgbar_xml?>','<?php echo 2 ?>','<?php echo 1 ?>','<?php echo $cdgpro ?>')"     maxlength="25" size="10" autocomplete="off"/> </div></td>
					<?php //} else {?>
					<!--<td> <div align="center"><?php //echo $cdgbar2;?></div></td>-->
					<?php //} ?>
					
					 <?php //if ( $cdgbar3 == ""){?>
					<td><div align="center"><input type="text"   value="<?php echo $cdgbar3; ?>"  name="cdghac" id="cdghac"  onkeypress=""  style='text-align:right;' onDblClick="actualizar_articulo('<?php echo $cdgart ?>',this.value,'<?php echo $cdgbar_xml?>','<?php echo 3 ?>','<?php echo 0 ?>','<?php echo $cdgpro ?>')" onChange="actualizar_articulo('<?php echo $cdgart ?>',this.value,'<?php echo $cdgbar_xml?>','<?php echo 3 ?>','<?php echo 1 ?>','<?php echo $cdgpro ?>')"      maxlength="25" size="10" autocomplete="off"/></div></td>
					
										<?php //} else {?>
				<!--	<td> <div align="center"><?php //echo $cdgbar3;?></div></td>-->
					<?php //} ?>
					
					<td> <div align="left"><?php echo $dscart;?></div></td>
					<td> <div align="right"><?php echo $cdgpro2 ;?></div></td>
						<td><div align="right"><input type="text"   value="<?php echo $uniemp; ?>"  name="uniemp" id="uniemp"  onkeypress=""  style='text-align:right;' onChange="actualizar_articulo_unidad_empaque('<?php echo $cdgart ?>',this.value)"     maxlength="25" size="10" autocomplete="off"/></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>
				
                    
<?php /*?><!--					<td align="center"><div align="center"><a href="javascript:pon_prefijo('<?php echo $cdgbar?>','<?php echo htmlspecialchars( $dscart ) ?>','<?php echo $cosart?>','<?php echo $utiart1?>','<?php echo $utiart2?>','<?php echo $PRE001?>','<?php echo $PRE002?>','<?php echo $cob_iv?>','<?php echo $desart?>','<?php echo $desfac?>','<?php echo $cdgfam?>','<?php echo $cdglin?>','<?php echo $fleart?>','<?php echo $ivporc?>','<?php echo $tarred?>')"><img src="../img/Redo_32x32-32.png" border="0" title="Seleccionar" width="25" height="25"></a></div></td>-->	<?php */?>				
				<!--</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>
