<?php
 
if(session_id()=="") 
	session_start();
$com="AS";	
require_once("DMMYSQLG.php");
require_once("DFJQUERY.inc");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>


<body id="bodyVENTESP">
 <form name="formbascps" id="formbascps" method="post" action="">
   <img src="logos/mover.gif" width="30" height="30" /><img src="logos/cerrar.gif" alt="cerrar" width="30" height="30" onClick="<?php
echo "cloLayAndCpy({idLayer:'".$_POST['layerToLoad']."'},{})";?>"/>
   <input type="hidden", name="layerToLoad" id="layerToLoad" value="<?php
echo $_POST['layerToLoad'];?>">
<input type="hidden", name="idRetObj" id="idRetObj" value="<?php
echo $_POST['idRetObj'];?>">
<input type="hidden", name="nomRetObj" id="nomRetObj" value="<?php
echo $_POST['nomRetObj'];?>">
<table width="308"  border="0" align="center">
      <tr> 
        <td colspan="3" style="#CCCCCC"><div align="center" id="titleTableEsp" class="Estilo2">CATALOGO DE PROVEEDORES </div></td>
      </tr>
	  <tr> 
        <td width="138"  style="#3399FF">
          
          <div align="center">
            <input name="tipBusCat" type="radio" value="nom" onClick=" 	
			loadOnLayer(
			{
				action:'DYCPBASCPS.php',
				idLayer:document.getElementById('layerToLoad').value
			},			
			{	
				textBus:document.getElementById('textBus').value,
				idRetObj:document.getElementById('idRetObj').value,
				nomRetObj:document.getElementById('nomRetObj').value,
				tipBusCat:getValRadChe('tipBusCat')
			});" />
            Nombre</div></td>
        <td width="118" style="#3399FF"><input name="tipBusCat" type="radio"  value="id" onClick=" 	
			loadOnLayer(
			{
				action:'DYCPBASCPS.php',
				idLayer:document.getElementById('layerToLoad').value
			},			
			{	
				textBus:document.getElementById('textBus').value,
				idRetObj:document.getElementById('idRetObj').value,
				nomRetObj:document.getElementById('nomRetObj').value,
				tipBusCat:getValRadChe('tipBusCat')
			});" />
Clave </td>
        <td width="38"  style="#3399FF"><input type="button" name="salirLayerEsp" id="salirLayerEsp" value="Salir" onClick="<?php
echo "cloLayAndCpy({idLayer:'".$_POST['layerToLoad']."'},{})";?>" class="clase3" /></td>
	  </tr>
	  <tr>
        <td colspan="3" style="#3399FF"><div align="center">
          <input name="textBus" id="textBus" type="text" size="50"  value="<?php
echo $_POST['textBus'];?>"  maxlength="255" onKeyPress="return  loadOnLayerByKey(
			{
				action:'DYCPBASCPS.php',
				idLayer:document.getElementById('layerToLoad').value,
				accKey:13
			}
			,			
			{	
				textBus:document.getElementById('textBus').value,
				idRetObj:document.getElementById('idRetObj').value,
				nomRetObj:document.getElementById('nomRetObj').value,
				tipBusCat:'nom'
			});"/>
        </div></td>
      </tr>
    </table>
    <table align = "center">
      <tr>
        <td nowrap style="#CCCCCC"><div align="center" class="Estilo2">Sel. </div></td>
        <td nowrap style="#CCCCCC"><div align="center" class="Estilo2">Nombre/Empresa </div></td>
        <td nowrap style="#CCCCCC"><div align="center" class="Estilo2">Apellido Paterno </div></td>
        <td nowrap style="#CCCCCC"><div align="center" class="Estilo2">Apellido Materno </div></td>
        <td nowrap style="#CCCCCC"><div align="center" class="Estilo2">RFC</div></td>
      </tr>
      <?php
 
if($_REQUEST['textBus']!=''){
	
	if($_REQUEST['tipBusCat']=="id"){
		@$sql = mysqli_query($con ,"SELECT 
								* 
							FROM 
								dxbascps 
							WHERE 
								codigo like '%".$_REQUEST['textBus']."%' 
								
							ORDER BY nombre,ap_paterno,ap_materno");
	}elseif($_REQUEST['tipBusCat']=="nom"){
		$sq_retrieve = "SELECT 
							* 
						FROM 
							dxbascps 
						WHERE  
							CONCAT(nombre,' ',ap_paterno,' ',ap_materno) like '%".$_REQUEST['textBus']."%'
							OR CONCAT(ap_paterno,' ',ap_materno,' ',nombre) like '%".$_REQUEST['textBus']."%'
						ORDER BY 
							nombre,ap_paterno,ap_materno";
		@$sql = mysqli_query($con ,$sq_retrieve);
	}

$arrStyles=array("styTabEspA","styTabEspB");
$i=0;
	while(@$reg = mysqli_fetch_array($sql)){
		echo '<tr class="'.$arrStyles[($i%2)].'">';
	  	echo "<td>
				<input type=\"button\" name=\"boton\" value=\"$reg['codigo']\" class=\"clase3\" onclick=\"
					cloLayAndCpy(
						{
							idLayer:'".$_POST['layerToLoad']."'
						},
						{
							$_POST['idRetObj']: '".$reg['codigo']."',
							$_POST['nomRetObj']: '$reg['nombre'] $reg['ap_paterno'] $reg['ap_materno']'
						}
					);
				\">
			</td>";
		echo '<td> <div align="left">' . $reg['nombre'] . '&nbsp;</div></td>';
		echo '<td> <div align="left">' . $reg['ap_paterno'] . '&nbsp;</div></td>';
		echo '<td> <div align="left">' . $reg['ap_materno'] . '&nbsp;</div></td>';
		echo '<td> <div align="left">' . $reg['rfc'] . '&nbsp;</div></td>';
		echo '</tr>';
	$i++;
	}
}
?>
    </table>
 </form>
</body>
</html>