<?
include("../fnc.php");
enlinea_a();


if($idtg){

 $id_tg=dec($idtg);
 $qver=mysql_query("select * from pr_tiposgastos where id = '$id_tg'");
 if(mysql_num_rows($qver)==0){
  $tipo="Add";
 }else{
  $info=mysql_fetch_array($qver);
  $tipo="Update";
 }
}else{
 $tipo="Add";
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>e-Ducativo - Bienvenido</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../estilo1.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../jsincludes/overlib.js"></script>
<script language="javascript">
function foco(){
  document.form1.txttipogasto.focus();
}

function confirmar_eliminar(url){
  var respuesta;
  respuesta=confirm("Está seguro de eliminar este tipo de gasto?");
  if(respuesta){
    self.location='mnt_pr_tiposgastos.php?tipo_trn=Delete&'+url;
  }
  return (false);
}
</script>
<style type="text/css">
<!--
body {
	background-image: url(../images/tema/bg_pagina.png);
}
-->
</style></head>



<body onload="foco();">
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
  <tr>
    <td>    <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">
      <tr bgcolor="#FFFFFF">
        <td width="40%"><img src="../images/logo_5.gif" width="300" height="50"></td>
        <td width="60%" background="../images/back_header_admin.gif" bgcolor="#FFFFFF"><div align="right" class="usuario_nombre_enc"><strong><?echo "$unombre $uapellido";?><br>
          </strong>Tiene <?=mensajes($uuser);?> mensaje(s) sin leer</div></td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td height="15" colspan="2" background="../images/barra_encabezado.gif">&nbsp;</td>
        </tr>
    </table>
      <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC">
        <tr>
          <td width="20%" valign="top" background="../images/tema/bg_contenido.png" bgcolor="#FFFFCC"><?php include("menu.php"); ?>&nbsp;</td>
          <td width="80%" valign="top" background="../images/tema/bg_contenido.png" bgcolor="#FFFFCC"><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">
            <tr align="center" valign="middle" bgcolor="#FFFFCC">
              <td height="20" class="titulo_pagina"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="65" background="../images/tema/bg_contenido.png">&nbsp;</td>
                  <td background="../images/tema/bg_contenido.png"><div align="center" class="titulo_pagina"><strong>ADMINISTRACI&Oacute;N DE TIPOS DE GASTOS </strong></div></td>
                  <td width="65" background="../images/tema/bg_contenido.png"><div align="right"><a href="inicio.php" class="link_parrafo">Inicio<img src="../images/ic_home.png" width="21" height="21" border="0"></a></div></td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td align="left" valign="top" background="../images/tema/bg_contenido.png" bgcolor="#FFFFCC"><div align="left" class="parrafo">
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td background="../images/tema/bg_contenido.png"><form name="form1" method="post" action="mnt_pr_tiposgastos.php">
                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="6%" background="../images/tema/bg_titulo_frm.png"><img src="../images/tema/ic_formularios.png" width="35" height="32"></td>
                              <td width="94%" background="../images/tema/bg_titulo_frm.png" class="titulo_formulario"><div align="left">Informaci&oacute;n del tipo de gasto</div></td>
                            </tr>
                          </table></td>
                          </tr>
                        <tr>
                          <td width="13%" background="../images/tema/bg_frm_campos.png" class="lbl_campo"><div align="left">Descripci&oacute;n:</div></td>
                          <td width="87%" background="../images/tema/bg_frm_campos.png"><div align="left">
                            <input name="txttipogasto" type="text" class="textbox" id="txttipogasto" size="100" maxlength="100" value="<?=$info[tipo];?>">
                            <input name="tipo_trn" type="hidden" id="tipo_trn" value="<?=$tipo;?>">
                            <input name="idtg" type="hidden" id="idtg" value="<?=$idtg;?>">
                          </div></td>
                        </tr>
                        <tr>
                          <td background="../images/tema/bg_frm_campos.png">&nbsp;</td>
                          <td background="../images/tema/bg_frm_campos.png"><input name="Submit" type="submit" class="boton_guardar" value="Guardar Tipo de Gasto"></td>
                        </tr>
                      </table>
                      </form></td>
                  </tr>
                </table>
                <br>
                <br>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="6%" background="../images/tema/bg_titulo_frm.png"><img src="../images/tema/ic_editar.png" width="35" height="32"></td>
                        <td width="94%" background="../images/tema/bg_titulo_frm.png" class="titulo_formulario">Tipos de gastos existentes </td>
                      </tr>
                    </table></td>
                    </tr>
                  <tr>
                    <td width="79%" background="../images/tema/bg_frm_campos.png" class="lbl_campo">Descripci&oacute;n del tipo de gasto </td>
                    <td width="21%" background="../images/tema/bg_frm_campos.png" class="lbl_campo"><div align="center">Acciones</div></td>
                  </tr>
                  <?
                  $qtgs=mysql_query("select * from pr_tiposgastos order by tipo");
                  while($itg=mysql_fetch_array($qtgs)){
                  $i++;
                  ?>
                  <tr bgcolor="<?=color_fila($i);?>">
                    <td><?=$itg[tipo];?></td>
                    <td><div align="center"><a href="frm_pr_tiposgastos.php?idtg=<?=enc($itg[id]);?>" class="link_parrafo">Modificar</a> | <a href="#" class="link_parrafo" onclick="confirmar_eliminar('<?="idtg=".enc($itg[id]);?>')">Eliminar</a> </div></td>
                  </tr>
                  <?
                  }
                  ?>
                </table>
              </div></td>
              </tr>
          </table></td>
        </tr>
    </table>    </td>
  </tr>
</table>
</body>
</html>
