<?

include("../fnc.php");

enlinea_a();

?>

<!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 language="javascript">

function validar(formulario){

 if(document.form2.txtdesccargo.value==""){

   alert("Ingrese la descripción del cargo");

   document.form2.txtdesccargo.focus();

   return (false);

 }



 if(document.form2.txtvcargo.value==""){

   alert("Ingrese el valor del cargo");

   document.form2.txtvcargo.focus();

   return (false);

 }



return (true);

}

</script>

</head>



<body>

<table width="750" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">

  <tr>

    <td bgcolor="#336699">    <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" bgcolor="#FFFFCC"><?php include("menu.php"); ?>&nbsp;</td>

          <td width="80%" valign="top" bgcolor="#FFFFCC"><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">

            <tr align="center" valign="middle" bgcolor="#FFFFCC">

              <td height="20" bgcolor="#FFFFCC" class="titulo_pagina"><div align="center" class="titulo_seccion">

                <div align="left">

                  <table width="100%" border="0" cellspacing="0" cellpadding="0">

                    <tr>

                      <td><div align="center" class="titulo_pagina">

                        <div align="left" class="parrafo">CONTROL DE PAGOS <img src="../images/flecha_3.jpg" width="9" height="9"> Pago de alumnos </div>

                      </div></td>

                      <td width="65"><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>

                </div>

              </div></td>

            </tr>

            <tr>

              <td align="left" valign="top" bgcolor="#FFFFCC"><div align="left" class="parrafo">

                <table width="100%"  border="0" cellspacing="0" cellpadding="1">

                  <tr>

                    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                      <tr>

                        <td><form name="form1" method="post" action="<?=$PHP_SELF;?>">

                          <table width="100%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">

                            <tr>

                              <td width="27%" bgcolor="#CFDFEF"><strong>Seleccione un alumno </strong></td>

                              <td width="61%" bgcolor="#ECF2F9">

                               <select name="txtalumno" class="textbox" id="txtalumno">

                                <option value="SV" selected>Seleccione uno...</option>

                               <?

                               $qalum=mysql_query("select carnet, apellido, nombre

                                                   from alumnos

                                                   order by apellido, nombre");

                               while($ialum=mysql_fetch_array($qalum)){

                                echo "<option value='{$ialum[carnet]}'>{$ialum[apellido]}, {$ialum[nombre]}</option>";

                               }

                               ?>

                               </select>

                              </td>

                              <td width="12%" rowspan="2" bgcolor="#ECF2F9"><input name="Submit" type="submit" class="boton_guardar" value="Continuar"></td>

                            </tr>

                            <tr>

                              <td bgcolor="#CFDFEF"><strong>o ingrese n&uacute;mero de carn&eacute;:</strong></td>

                              <td bgcolor="#ECF2F9"><input name="txtcarnet" type="text" class="textbox" id="txtcarnet" size="15" maxlength="15"></td>

                              </tr>

                          </table>

                          <?

                          if(!$txtalumno and !$txtcarnet){

                           exit();

                          }

                          if($txtalumno<>'SV'){

                           $p_alumno=$txtalumno;

                          }else{

                           $p_alumno=$txtcarnet;

                          }



                          $qalm=mysql_query("select * from alumnos where carnet = '$p_alumno'");

                          if(mysql_num_rows($qalm)==0){

                            alert("El alumno no existe","javascript:history.go(-1)");

                          }

                          $ialm=mysql_fetch_array($qalm);

                          $qvam=mysql_query("select * from grados where id = {$ialm[grado_estudio]}");

                          if(mysql_num_rows($qvam)==0){

                           alert("ERROR:\\nEl alumno no está inscrito en ningun grado","javascript:history.go(-1)");

                          }

                          $ivam=mysql_fetch_array($qvam);

                          ?>

                          </form>

                          <table width="100%"  border="0" cellspacing="0" cellpadding="0">

                            <tr>

                              <td><form name="form2" method="post" action="mnt_pago.php" onsubmit="return validar(this.form2);">

                                <table width="125%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">

                                  <tr>

                                    <td width="20%" bgcolor="#CFDFEF"><strong># Carn&eacute;:</strong></td>

                                    <td width="80%" bgcolor="#ECF2F9" class="lbl_formulario"><?=$ialm[carnet];?>

                                      <input name="txtcarnet" type="hidden" id="txtcarnet" value="<?=$p_usuario;?>"></td>

                                  </tr>

                                  <tr>

                                    <td bgcolor="#CFDFEF"><strong>Alumno:</strong></td>

                                    <td bgcolor="#ECF2F9"><span class="lbl_formulario">

                                      <?=$ialm[apellido].", ".$ialm[nombre];?>

                                    </span></td>

                                  </tr>

                                </table>

                                <hr size="1">

                                <table width="100%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">

                                  <tr bgcolor="#CFDFEF">

                                    <td width="7%"><div align="center"><strong>TIPO</strong></div></td>

                                    <td width="21%"><div align="center"><strong>FECHA DEL CARGO </strong></div></td>

                                    <td width="48%"><div align="center"><strong>DESCRIPCION</strong></div></td>

                                    <td width="12%"><div align="center"><strong>SALDO</strong></div></td>

                                    <td width="12%"><div align="center"><strong>SELECCIONE</strong></div></td>

                                  </tr>

                                  <?

                                  $qcargo=mysql_query("select * from cp_cargos where carnet='$p_alumno' and year='$df_year_actual' order by mes");

                                  $i=0;

                                  $suma_cargo=0;

                                  $suma_saldo=0;

                                  while($icargo=mysql_fetch_array($qcargo)){

                                  $i++;

                                  $suma_cargo+=$icargo[valor];

                                  $suma_saldo+=$icargo[saldo];

                                  ?>

                                  <tr bgcolor="<?=color_fila($i);?>">

                                    <td height="21"><div align="center">

                                        <?=$icargo[tipo];?>

                                    </div></td>

                                    <td><div align="center">

                                        <?=fecha($icargo[fecha_cargo]);?>

                                    </div></td>

                                    <td><div align="left">

                                        <?=($icargo[descripcion]);?>

                                    </div></td>

                                    <td><div align="right">

                                        <input name="txtvalor1" type="hidden" id="txtvalor1">

                                        <?=sprintf("Q%.2f",$icargo[saldo]);?>

                                    </div></td>

                                    <td><div align="center">

                                      <input name="txt1" type="checkbox" id="txt1" value="checkbox">

</div></td>

                                  </tr>

                                  <?

                                  }

                                  ?>

                                  <tr bgcolor="#CFDFEF">

                                    <td><div align="center">&nbsp;</div></td>

                                    <td><div align="left"><strong>TOTALES</strong></div></td>

                                    <td>&nbsp;</td>

                                    <td><div align="right"><strong>

                                        <?=sprintf("Q%.2f",$suma_saldo);?>

                                    </strong></div></td>

                                    <td><div align="center">

                                      <input name="Submit2" type="submit" class="boton_guardar" value="Operar pagos">

</div></td>

                                  </tr>

                                </table>

                              </form>

                                </td>

                            </tr>

                          </table></td>

                      </tr>

                    </table></td>

                    </tr>

                </table>

                </div></td>

              </tr>

          </table></td>

        </tr>

    </table>    </td>

  </tr>

</table>

</body>

</html>