<?
ini_set('error_reporting', 1);
session_start();
if ($_SESSION['estado'] != "ON")
		{
		?>
		<script>
			parent.location.href = 'index.php';
		</script>
		<? 
		exit();
		}
$id_empresa = $_SESSION['ss_empresa'];
$id_user = $_SESSION['ss_user'];
$id_autoriza=65;
$txtbuscar="";
?>
<?
/*Sesiones*/
include("../conex.php");
include("../autoriza.php");

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Mantenimiento de Bancos</title>
<style type="text/css">
<!--
.Estilo7 {
	font-size: small;
	color: #000099;
}
.Estilo11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; color: #000099; }
.Estilo13 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	color: #000099;
	text-decoration: underline;
}
.Estilo14 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	color: #000099;
}
.titulos2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #003366;
	background-color: #FFFFFF;
	font-style: normal;
	font-weight: bold;
}
.botones {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	height:26px;
}
-->
</style>
</head>

<body>
<form name="form3" method="post" action="muestra.php" target="_self">
<div align="center" class="titulos2">Mantenimiento Cuentas de Bancos
  <table width="50%" border="0">
    <tr>
      <td width="25%"><div align="center">Buscar:</div></td>
      <td width="50%">
        <input name="txtbuscar" type="text" id="txtbuscar" size="35">
      </td>
      <td width="25%"><input name="bproducto" type="button" class="botones" id="bproducto" value="Buscar" onClick="busca_dcto();">
        </td>
    </tr>
  </table>
  </div>
            <div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000080"><span lang="es-cl"><b>
   		<a onClick="JavaScript:post_letra('A');" style="cursor:pointer">A</a>
 		<a onClick="JavaScript:post_letra('B');" style="cursor:pointer">B</a>
 		<a onClick="JavaScript:post_letra('C');" style="cursor:pointer">C</a>
		<a onClick="JavaScript:post_letra('D');" style="cursor:pointer">D</a>
		<a onClick="JavaScript:post_letra('E');" style="cursor:pointer">E</a>
		<a onClick="JavaScript:post_letra('F');" style="cursor:pointer">F</a>
		<a onClick="JavaScript:post_letra('G');" style="cursor:pointer">G</a>
		<a onClick="JavaScript:post_letra('H');" style="cursor:pointer">H</a>
		<a onClick="JavaScript:post_letra('I');" style="cursor:pointer">I</a>
		<a onClick="JavaScript:post_letra('J');" style="cursor:pointer">J</a>
		<a onClick="JavaScript:post_letra('K');" style="cursor:pointer">K</a>
		<a onClick="JavaScript:post_letra('L');" style="cursor:pointer">L</a>
		<a onClick="JavaScript:post_letra('M');" style="cursor:pointer">M</a>
		<a onClick="JavaScript:post_letra('N');" style="cursor:pointer">N</a>
		<a onClick="JavaScript:post_letra('O');" style="cursor:pointer">O</a>
		<a onClick="JavaScript:post_letra('P');" style="cursor:pointer">P</a>
		<a onClick="JavaScript:post_letra('Q');" style="cursor:pointer">Q</a>
		<a onClick="JavaScript:post_letra('R');" style="cursor:pointer">R</a>
		<a onClick="JavaScript:post_letra('S');" style="cursor:pointer">S</a>
		<a onClick="JavaScript:post_letra('T');" style="cursor:pointer">T</a>
		<a onClick="JavaScript:post_letra('U');" style="cursor:pointer">U</a>
		<a onClick="JavaScript:post_letra('V');" style="cursor:pointer">V</a>
		<a onClick="JavaScript:post_letra('W');" style="cursor:pointer">W</a>
		<a onClick="JavaScript:post_letra('X');" style="cursor:pointer">X</a>
		<a onClick="JavaScript:post_letra('Y');" style="cursor:pointer">Y</a>
		<a onClick="JavaScript:post_letra('Z');" style="cursor:pointer">Z</a>
		<br></b></span></font> </div>
</form>

<form name="form4" method="post" action="crea.php" target="mainFrame">
  <table width="50%" border="0" align="center">
    <tr><div align="center">
      <td width="70%">
          <input name="Submit" type="button" class="botones" style="width:168px" value="Crear Nueva Cta.Banco" onClick="nuevo_dcto();">
		</td>
		<td width="30%">
		  <input type="button" name="salir" class="botones" value="Salir" onClick="window.top.open('','_parent','');window.top.close();">
		</td>
    </div></tr>
  </table>
</form>

<form name="form1" method="post" action="" target="mainFrame">
  <table width="90%" border="1" align="center" cellspacing="0">
  <tr bgcolor="#00CCFF" class="detalle_tablas_II_negrita">
	<th width="80%" scope="col">Cuenta de Banco</th>
    <th width="10%" scope="col">Editar</th>
    <th width="10%" scope="col">Borrar</th>
    </tr>
	<? 
		$cont=0;	
	$caract=$_GET["caracter"];
	if (isset($caract)) 
		{
		$bsql = "SELECT id AS codigo, descripcion FROM banco_cuentas WHERE descripcion LIKE '$caract%' ORDER BY descripcion ASC";
		$resultado =mysql_query($bsql,$enlace);
		}
	else if ( $txtbuscar !='')
				{
				$bsql = "SELECT id AS codigo, descripcion FROM banco_cuentas WHERE descripcion LIKE '%$txtbuscar%' ORDER BY descripcion ASC";
				$resultado = mysql_query($bsql,$enlace);
				}
			else
				{
				$bsql = "SELECT id AS codigo, descripcion FROM banco_cuentas WHERE descripcion LIKE '%' ORDER BY descripcion ASC";
				$resultado = mysql_query($bsql,$enlace);
				}

while (mysql_fetch_object ($resultado))
	{
	?>
	<tr bgcolor="#CBFEC2">
    <td class="Estilo14">
    <?=mysql_result($resultado, $cont, "descripcion");?></td>
    <td class="Estilo14"><div align="center">
        <span align="center" class="Estilo13" onClick="javascript:enviar('editar.php?cp=<?=mysql_result($resultado, $cont, "codigo");?>')" style="cursor:pointer" title="Click aqui para modificar datos">
		<img src="../Images/edit.gif" width="14" height="13"></span>	</td>
    <td class="Estilo14"><div align="center">
		<span align="center" class="Estilo13" onClick="javascript:if(confirm('¿Desea eliminar?')) { enviar('eliminar.php?cp=<?=mysql_result($resultado, $cont, "codigo");?>') }" style="cursor:pointer" title="Click aqui para eliminar">
		<img src="../Images/delete.gif"></span>
	</td>
    </tr>
  <?
  $cont=$cont+1;
}

?>
</table>
</form>


</body>
</html>
<script language="javascript" type="text/javascript">
function post_letra(letra)
	{
	
	document.form1.action = "muestra.php?caracter="+letra;
	document.form1.submit();
	}
function nuevo_dcto()
	{
	document.form1.action = "crea.php";
	document.form1.submit();
	}
function busca_dcto()
	{
	document.form1.action = "muestra.php";
	document.form1.submit();
	}

function enviar(aux){
	document.form1.action = aux;
	document.form1.submit();
} 

</script>
