<?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 = 'DI1140A_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 ALMACEN</th>
      </tr>
      <tr>
        <th width="297"> <input name="r1" type="radio" value="clave" tabindex="1">
          Clave</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 dgalmacen");
	include("DE10000.php");
	?>
    <table border='1'>
      <tr>
        <th colspan="8"> <div align="left">
          <input type="button" name="Submit6" value="Agregar" onClick="openpage('DI11400_AG.php','_self')"/>
          <input type="Submit" name="bot3" value="Consultar"  onClick="openpage('DI11400_MO.php','_self')"/>
          <input type="button" name="bot2" value="Modificar" onClick="openpage('DI11400_MO.php','_self')"/>
          <input type="button" name="bot1" value="Eliminar" onClick=
"openpage('DI11400_EL.php','_self')"/>
          <input type="button" name="bot4" value="Imprimir " onClick="openpage('DI11400_IM.php','_self')"/>
          <input type="button" name="Submit" value="Mostrar todo" onClick="openpage('DI11400_PR.php','_self')"/>
        </div></th>
      </tr>
      <tr>
        <th colspan="8">Catalogo  Almacenes</th>
      </tr>
      <tr>
        <th><div align="center">Selc</div></th>
        <th><div align="center">Clave</div></th>
		<th><div align="center">Descripcion</div></th>
        <th><div align="center">Cuenta Costo</div></th>
        <th><div align="center">Cuenta Inventario</div></th>
        <th><div align="center">Cuenta Venta</div></th>
        <th><div align="center">Cuenta Dev/Vta</div></th>
        <th><div align="center">Cuenta Desctos/Bonif.</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 dgalmacen WHERE almacen = '".$_POST['tbus']."'");
		
	}elseif($_POST['r1']=="nombre")
	{
		echo '<input name="tip_bus" type="hidden" value="nombre">';
		@$sql = mysqli_query($con ,"SELECT * FROM dgalmacen WHERE desc_almacen like '%".$_POST['tbus']."%'");
	}
	while($reg = mysqli_fetch_array($sql))
	{
	  	echo "<tr>";
		echo '<td> <div align="center"><input name="bot" type="radio" value="'. $reg["almacen"].'"></div></td>';
		echo "<td> <div align='center'>" .$reg["almacen"] . "&nbsp;</div></td>";
		echo "<td> <div align='left'>" . $reg["desc_almacen"] . "&nbsp;</div></td>";
		echo "<td> <div align='right'>" . $reg["cta_cos"] . "&nbsp;</div></td>";
		echo "<td> <div align='right'>" . $reg["cta_inv"] . "&nbsp;</div></td>";
		echo "<td> <div align='right'>" . $reg["cta_vta"] . "&nbsp;</div></td>";
		echo "<td> <div align='right'>" . $reg["cta_devvta"] . "&nbsp;</div></td>";
		echo "<td> <div align='right'>" . $reg["cta_desbon"] . "&nbsp;</div></td>";
		echo "</tr>";
	}
	mysqli_close($con);
	?>
    </table>
  </form>
</div>
</body>
</html>