<?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(cdgpro,dscpro) {
	parent.opener.document.form_busqueda.cdgpro.value=cdgpro;
	parent.opener.document.form_busqueda.dscpro.value=dscpro;

	parent.opener.buscar();
	parent.window.close();
}

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


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

?>
<body>
<?php
	
   if ($result = $mysqli->query("SELECT * FROM proveedores  WHERE dscpro like '%$dscpro%' ORDER BY dscpro ASC")) {
   $nrs = $result->num_rows;
   $result->close();
}

?>
<div id="tituloForm2" >
<form id="form1" name="form1">
<?php if ($nrs>0) { ?>
		<table class="fuente8" width="98%" cellspacing=0 cellpadding=0 border=0>
		  <tr class="cabeceraTabla" >
			<td width="10%"><div align="center"><span class="cabeceraTabla"><b>CODIGO</b></span></div></td>
			<td width="60%"><div align="center"><span class="cabeceraTabla"><b>PROVEEDORES</b></span></div></td>
			<td width="20%"><div align="center"><span class="cabeceraTabla"><b>CEDULA</b></span></div></td>
			<td width="10%"><span class="totalResultado"></span></td>
		    <div align="center">
			
		  </tr>
		<?php
		
		$consulta2 = "SELECT * FROM proveedores  WHERE dscpro like '%$dscpro%' ORDER BY dscpro ASC";

        if ($resultado2 = $mysqli->query($consulta2)) 
        $contador=0;
		
		  while ($fila = $resultado2->fetch_assoc()) {
        $cdgpro = $fila["cdgpro"];
        $dscpro = $fila["dscpro"];
        $cedpro = $fila["cedpro"];
		$cdgpla = $fila["cdgpla"];

        $dscpro = substr($dscpro, 0, 50); 
		 if ( $contador % 2) { $fondolinea="itemParTabla"; } else { $fondolinea="itemImparTabla"; }?>
						<tr class="<?php echo $fondolinea?>">	
					<td>
        <div align="center"><?php echo $cdgpro;?></div></td>
					<td>
        <div align="left"><?php echo $dscpro;?></div></td>
					<td><div align="center"><?php echo $cedpro;?></div></td>
					<td align="center"><div align="center"><a href="javascript:pon_prefijo(<?php echo $cdgpro?>,'<?php echo $dscpro?>')"><img src="../img/Redo_32x32-32.png" border="0" title="Seleccionar"></a></div></td>					
				</tr>
                
			<?php }
		?>
  </table>
  
  		<?php } else { ?>
					<table class="fuente8" width="87%" cellspacing=0 cellpadding=3 border=0>
						<tr>
							<td width="100%" class="mensaje"><?php echo "No existe  cliente que cumpla con los criterios de b&uacute;squeda";?></td>
					    </tr>
					</table>					
					<?php } ?>	
  
  
<iframe id="frame_datos" name="frame_datos" width="0%" height="0" frameborder="0">
	<ilayer width="0" height="0" id="frame_datos" name="frame_datos"></ilayer>
</iframe>
<input type="hidden" id="accion" name="accion">
</form>
</div>
</body>
</html>
