<?php
 
session_start();
include("DMMYSQLG.php");
//include("DSA1000.php");
include("DMMYSQLG.php");

?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="">
    <table width="458"  align="center">
      <tr> 
        <th width="594" colspan="2">CATALOGO DE CLIENTES </th>
      </tr>
      <tr> 
        <th> <input name="r1" type="radio" value="clave" tabindex="1">
          Clave </th>
        <th><input name="r1" type="radio" value="nombre" tabindex="2">
          Nombre </th>
      </tr>
      <tr>
        <td colspan="2"><input name="tbus" type="text"  onBlur="may(this)" size="75"/></td>
      </tr>
      <tr> 
        <td colspan="2"><div align="center">
            <input type="submit" name="Submit" value="Buscar">
          </div></td>
      </tr>
    </table>
  </form>
</div>
<form id="pp" name="pp" action="">
<table align = center>
<tr>
		<th width="28"><div align="center">Sel</div></th>
      	<th><div align="center">Codigo </div></th>
	  	<th><div align="center">Nombre o Empresa </div></th>
		<th><div align="center">Apellido Paterno </div></th>
      	<th><div align="center">Apellido Materno </div></th>
		<th><div align="center">RFC</div></th>
      </tr>
<?php
 

//$sql = mysqli_query($con ,"SELECT * FROM dgcatcli");
if($_POST['r1']=="clave"){
	@$sql = mysqli_query($con ,"SELECT * FROM dgcatcli WHERE cod_cli like '%".$_POST['tbus']."%'");
}elseif($_POST['r1']=="nombre"){
	@$sql = mysqli_query($con ,"SELECT * FROM dgcatcli WHERE nom_cli  like '%".$_POST['tbus']."%' or ap_pat_cli  like '%".$_POST['tbus']."%' or ap_mat_cli  like '%".$_POST['tbus']."%'");
}
while(@$reg = mysqli_fetch_array($sql)){
		/* @$sql1 = mysqli_query($con ,"SELECT * FROM dxdelmun WHERE cve_delmun = '".$reg['cve_delmun']."'");
		$re1 = mysqli_fetch_array($sql1);
		@$sql2 = mysqli_query($con ,"SELECT * FROM dxestado WHERE cve_estado = '".$reg['cve_estado']."'");
		$re2 = mysqli_fetch_array($sql2);
		@$sql3 = mysqli_query($con ,"SELECT * FROM dxpaises WHERE cve_pais = '".$reg['cve_pais']."'");
		$re3 = mysqli_fetch_array($sql3); */
	  	echo '<tr>';
?>
		<td> <div align="center">
		<input type="button" name="button" value="OK" onClick="sendValue1('<?php
 echo str_replace(chr(34), " ", $reg['cod_cli']) ?>','<?php
 echo str_replace(chr(34), " ", $reg['nom_cli']) ?>','<?php
 echo str_replace(chr(34), " ", $reg['ap_pat_cli']) ?>','<?php
 echo str_replace(chr(34), " ", $reg['ap_mat_cli']) ?>')">
		</div></td>
<?php

		echo '<td> <div align="center">' . $reg['cod_cli'] . '&nbsp;</div></td>';
		echo '<td> <div align="center">' . $reg['nom_cli'] . '&nbsp;</div></td>';
		echo '<td> <div align="center">' . $reg['ap_pat_cli'] . '&nbsp;</div></td>';
		echo '<td> <div align="center">' . $reg['ap_mat_cli'] . '&nbsp;</div></td>';
		echo '<td> <div align="center">' . $reg['rfc_cli'] . '&nbsp;</div></td>';
		echo '</tr>';
}
?>
</table>
</form>
</body>
</html>