Este es ventana madre
Código HTML:
Ver original<?
/////////////// DESPLIEGA LISTADO DE Clientes///////////////////////////////////////
if (!empty($_POST['cut'])){
$cut = $_POST['cut'];
$apellido = $_POST['apellido'];
$nombre = $_POST['nombre'];
}
?>
<table width="504" height="299" border="1"> <td width="438" height="8" bgcolor="#0000FF"><span class="Estilo3">-
<span class="Estilo14"> Electro Integral - Alta Boletas - Paso1
</span></span></td> <td height="8" bgcolor="#000000"><form id="formulario" name="formulario" method="post" action="altaboleta1.php"> <input name="cut" type="text" class="Estilo16" id="cut" value="<?php echo $cut; ?>" size="30" />
<input name="nombre" type="text" class="Estilo16" id="nombre" value="<?php echo $nombre; ?>" size="30" />
<input name="apellido" type="text" class="Estilo16" id="apellido" value="<?php echo $apellido; ?>" size="30" />
Este es la ventana hija. que se llama indexo
que incluye, el funciones.js
y la pagina de busqueda.php
Código PHP:
Ver original$busqueda=$_POST['busqueda'];
// DEBO PREPARAR LOS TEXTOS QUE VOY A BUSCAR si la cadena existe
if ($busqueda<>''){
//CUENTA EL NUMERO DE PALABRAS
if ($numero==1) {
//SI SOLO HAY UNA PALABRA DE BUSQUEDA SE ESTABLECE UNA INSTRUCION CON LIKE
$cadbusca="SELECT * FROM clientes WHERE apellido LIKE '%$busqueda%' OR CUT LIKE '%$busqueda%' LIMIT 10;";
} elseif ($numero>1) {
//SI HAY UNA FRASE SE UTILIZA EL ALGORTIMO DE BUSQUEDA AVANZADO DE MATCH AGAINST
//busqueda de frases con mas de una palabra y un algoritmo especializado
$cadbusca="SELECT * , MATCH ( apellido, CUT ) AGAINST ( '$busqueda' ) AS Score FROM clientes WHERE MATCH ( apellido, CUT ) AGAINST ( '$busqueda' ) ORDER BY Score DESC LIMIT 50;";
}
function limitarPalabras($cadena, $longitud, $elipsis = "..."){
if (count($palabras) > $longitud) else
return $cadena;
}
?><title>Busqueda</title>
<style type="text/css">
<!--
.Estilo1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.Estilo2 {font-size: 12px}
.Estilo7 {font-size: 10px; font-weight: bold; }
.Estilo8 {font-size: 10px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; }
-->
</style>
<table style="width:100%;" border="1px">
<tbody>
<tr>
<td width="14%" bgcolor="#99CCFF" class="Estilo2 Estilo1 titulo"><span class="Estilo7">Codigo</span></td>
<td width="42%" bgcolor="#99CCFF" class="Estilo8"><span class="Estilo7">Apellido</span></td>
<td width="8%" bgcolor="#99CCFF" class="Estilo8"><span class="Estilo7">Nombre</span></td>
<td width="8%" bgcolor="#99CCFF" class="Estilo8"><span class="Estilo7">Domicilio</span></td>
<td width="11%" bgcolor="#99CCFF" class="Estilo8"><span class="Estilo7">CUT</span></td>
<td width="17%" bgcolor="#99CCFF" class="Estilo2 Estilo1 autor"><span class="Estilo7">OP</span></td>
</tr>
esta es la parte importante de la pagina la pongo aparte.
Código PHP:
Ver original<?php
$i=1;
echo "
<tr>
<td class=\"titulo\">".$row['id']."</td>
<td class=\"contenido\">".limitarPalabras($row['nombre'],20)."</td>
<td class=\"ubicacion\">".$row['nombre']."</td>
<td class=\"stock\">".$row['domicilio']."</td>
<td class=\"imp\">".$row['CUT']."</td><td>
<a href='javascript:close();' title='pasar valor' onClick='
window.opener.document.formulario.cut.value = ".$row['CUT'].",
window.opener.document.formulario.apellido.value = ".$row['apellido'].",
window.opener.document.formulario.nombre.value = ".$row['nombre'].";
window.opener.document.forms[0].submit(); ' >Agregar </a >
</td>
</tr>";
$i++;
}
}?>