<?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>
<?php
 
$ayuda = 'DI1120A_PR.php';
include("DYAYUDA.php");
?>
<div align="center">
  <form name="form1" method="post" action="">
    <table width="458"  align="center">
      <tr>
        <th colspan="2">CATALOGO DE GRUPOS</th>
      </tr>
      <tr>
        <th width="297"> <input name="r1" type="radio" value="clave" tabindex="1">
          Grupo</th>
        <th width="297"><input name="r1" type="radio" value="nombre" tabindex="2">
         Descripcion</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>
<div align="center">
  <form name="frm1" method="post" action="" >
    <?php
 
	$sql = mysqli_query($con ,"SELECT * FROM dgbasico order by gpo_basico");
	include("DE10000.php");
	?>
    <table width="682" border='1'>
      <tr>
        <th colspan="7"> <div align="left">
          <input type="button" name="Submit6" value="Agregar" onClick="openpage('DI11200_AG.php','_self')"/>
          <input type="Submit" name="bot3" value="Consultar"  onClick="openpage('DI11200_MO.php','_self')"/>
          <input type="button" name="bot2" value="Modificar" onClick="openpage('DI11200_MO.php','_self')"/>
          <input type="button" name="bot1" value="Eliminar" onClick=
"openpage('DI11200_EL.php','_self')"/>
          <input type="button" name="bot4" value="Imprimir " onClick="openpage('DI11200_IM.php','_self')"/>
          <input type="button" name="Submit" value="Mostrar todo" onClick="openpage('DI11200_PR.php','_self')"/>
        </div></th>
      </tr>
      <tr>
        <th colspan="7">Concepto de Grupos</th>
      </tr>
      <tr>
        <th width="20"><div align="center">Sel</div></th>
        <th width="43"><div align="center">Grupo</div></th>
		<th width="43"><div align="center">Foto_grup</div></th>
        <th width="100"><div align="center">Descripcion</div></th>
		<th width="160"><div align="center">Rango Vta1 Hasta</div></th>
        <th width="160"><div align="center">Rango Vta2 Hasta</div></th>
		<th width="159"><div align="center">Rango Vta3 +/= De</div></th>
      </tr>
      <?php

	echo '<input name="txt_bus" type="hidden" value="'.$_POST['tbus'].'">';
	if($_POST['r1']=="clave")
	{
		echo '<input name="tip_bus" type="hidden" value="clave">';
	  	@$sql = mysqli_query($con ,"SELECT * FROM dgbasico WHERE gpo_basico = '".$_POST['tbus']."'");
		
	}elseif($_POST['r1']=="nombre")
	{
		echo '<input name="tip_bus" type="hidden" value="nombre">';
		@$sql = mysqli_query($con ,"SELECT * FROM dgbasico WHERE des_basico like '%".$_POST['tbus']."%'");
	}
	while($reg = mysqli_fetch_array($sql))
	{
	  	echo "<tr>";
		echo '<td> <div align="center"><input name="bot" type="radio" value="'. $reg["gpo_basico"].'"></div></td>';
		echo "<td> <div align='center'>" . $reg["gpo_basico"] . "&nbsp;</div></td>";
		$fotografia = 'foto/dgbasico/NO_'. $reg["gpo_basico"] .'.JPG';
		if (file_exists($fotografia)) {
			echo '<td class="inputcodigo"><div align="center"><img src="foto/dgbasico/NO_'.$reg["gpo_basico"].'.JPG" width="32" height="40">&nbsp</div></td>';
		}else{
			echo '<td class="inputcodigo"><div align="center"><img src="foto/sin_producto.jpg" width="40" height="40">&nbsp</div></td>';
		}
		echo "<td> <div align='left'>" . $reg["des_basico"] . "&nbsp;</div></td>";
		echo "<td> <div align='right'>" . $reg["lim_vta1"] . "&nbsp;</div></td>";
		echo "<td> <div align='right'>" . $reg["lim_vta2"] . "&nbsp;</div></td>";
		echo "<td> <div align='right'>" . $reg["lim_vta3"] . "&nbsp;</div></td>";
		echo "</tr>";
	}
	mysqli_close($con);
	?>
    </table>
  </form>
</div>
</body>
</html>