<?
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=38;
$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 Tipo Pago...</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_pago.php" target="_self">
<div align="center" class="titulos2">
  <p>Mantenimiento de Tipo de Pago  </p>
  <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_pago();">
        </td>
    </tr>
  </table>
  </div>
</form>

<form name="form4" method="post" action="crea_pago.php" target="mainFrame">
  <table width="50%" border="0" align="center">
    <tr><div align="center">
      <td width="70%"><input type="button" name="salir" class="botones" value="Salir" onClick="window.top.open('','_parent','');window.top.close();">		
	  <input name="Submit" type="button" class="botones" style="width:17px; visibility:hidden" readonly="1" value="Crear Nuevo Tipo de Pago" onClick="nuevo_pago();"></td>
		<td width="30%">&nbsp;
		  </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="90%" scope="col">Tipo de Pago </th>
    <th width="10%" scope="col">Editar</th>
    </tr>
	<? 
		$cont=0;	
			if ( $txtbuscar !='')
				{
				$bsql = "SELECT id AS codigo, descripcion FROM tipo_pago WHERE descripcion LIKE '%$txtbuscar%' ORDER BY descripcion ASC";
				$resultado = mysql_query($bsql,$enlace);
				}
			else
				{
				$bsql = "SELECT id AS codigo, descripcion FROM tipo_pago 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_pago.php?cp=<?=mysql_result($resultado, $cont, "codigo");?>')" style="cursor:pointer" title="Click aqui para modificar datos del tipo de pago">
		<img src="../Images/edit.gif"></span></div>
	</td>

    </tr>
  <?
  $cont=$cont+1;
}

?>
</table>
</form>

<form name="form2" method="post" action="" target="mainFrame">
  <input name="cod_bodega" type="hidden" id="cod_bodega">
</form>

</body>
</html>
<script language="javascript" type="text/javascript">

function nuevo_pago()
	{
	document.form4.action = "crea_pago.php";
	document.form4.submit();
	}
function busca_pago()
	{
	document.form3.action = "muestra_pago.php";
	document.form3.submit();
	}

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

</script>
