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

if($idp){
 $id_p=($idp);
 $q=mysql_query("select * from alumnos where carnet = '$id_p'");
 $info=mysql_fetch_array($q);
}
$tipo="App_Beca";

$qgral=mysql_query("select * from general where id = 1");
$igral=mysql_fetch_array($qgral);
?>
<!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" type="text/JavaScript">
function mostrar_carnet(){
  if(document.form2.idp.value != "#"){
    document.form2.txtcarnet.value=document.form2.idp.value;
    return(false);
  }
  document.form2.txtcarnet.value="";
}

function seleccionar_alumno(){
  var combo = document.form2.idp;
  var mcarnet = document.form2.txtcarnet.value;
  var respuesta;

  for(i=0;i<combo.length;i++){
    if(combo.options[i].value==mcarnet){
         combo.selectedIndex = i;
         return (false);
    }
    combo.selectedIndex = 0;
  }
}

function validar(){
  var respuesta;
  
  if(eval(document.form1.txtbi.value)==0 && eval(document.form1.txtbm.value)==0){
    alert("El alumno no tiene asignado ningún valor de BECA");
    return (false);
  }
  
  if(isNaN(eval(parseFloat(document.form1.txtyear.value)))){
    alert("Debe ingresar un año válido para efectuar los descuentos.");
    document.form1.txtyear.value="<?=get_ciclo_inscripcion();?>";
    document.form1.txtyear.focus();
    return (false);
  }
  
  respuesta = confirm("Está seguro de aplicar la BECA al alumno?");
  
  if(respuesta){
    return (true);
  }
  return (false);
}
</script>
<script language="JavaScript" type="text/JavaScript">

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
</script>
<style type="text/css">
<!--
body {
	background-image: url(../images/tema/bg_pagina.png);
}
-->
</style></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%" bgcolor="#FFFFD2"><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" background="../images/tema/bg_contenido.png" class="titulo_pagina"><div align="center" class="titulo_seccion">
                <div align="left" class="titulo_pagina">APLICAR BECA A ALUMNO </div>
              </div></td>
            </tr>
            <tr>
              <td align="left" valign="top" background="../images/tema/bg_contenido.png"><div align="left" class="parrafo">
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td>
                     <form action="<?=$PHP_SELF;?>" method="post" name="form2" id="form2">
                      <strong class="lbl_campo">Seleccione un alumno</strong>
                      <select name="idp" class="textbox" id="idp" onchange="mostrar_carnet();">
                       <option value="#" selected>Seleccione uno...</option>
                       <?
                       $qpr=mysql_query("select * from alumnos order by apellido");
                       while($ipr=mysql_fetch_array($qpr)){
                       $sel="";
                       if(dec($idp)==$ipr[carnet]){
                         $sel="selected class='selected_option'";
                       }
                       ?>
                        <option value="<?=$ipr[carnet];?>"<?=$sel;?>><?=$ipr[apellido].", ".$ipr[nombre];?></option>
                       <?}?>
                      </select>

                      <input name="Submit" type="submit" class="boton_guardar" value="Continuar">
                      <br>
                      <strong>o ingrese el n&uacute;mero de carn&eacute;</strong>
                      <input name="txtcarnet" type="text" class="textbox" id="txtcarnet" onKeyUp="seleccionar_alumno();" size="15" maxlength="15">
                      <br>
                          </form></td>
                  </tr>
                </table>
                <br>
                <?if(!$idp){exit();}?>
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><form action="mnt_alumno_info.php" method="post" name="form1" id="form1" onsubmit="return validar();">
                      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
                              <tr bgcolor="#6699CC">
                                <td colspan="2" class="titulo_seccion"><table width="100%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#CFDFEF">
                                    <tr bgcolor="#6699CC">
                                      <td bgcolor="#6699CC" class="titulo_formulario"><div align="left">
                                        <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">Informaci&oacute;n general del alumno
                                              <input name="idp2" type="hidden" id="idp2" value="<?=$idp;?>">
                                              <input name="txtyear_actual" type="hidden" value="<?=$info[year_estudio];?>">
                                              <input name="txtalumno" type="hidden" id="txtalumno" value="<?=$info[carnet];?>"></td>
                                          </tr>
                                        </table>
                                      </div>
                                        <div align="right"></div></td>
                                      </tr>
                                </table></td>
                              </tr>
                              <tr bgcolor="#A4DBFF" class="font_red_11">
                                <td align="left" valign="middle" background="../images/tema/bg_frm_campos.png" class="lbl_roja">Grado:</td>
                                <td width="82%" background="../images/tema/bg_frm_campos.png" class="lbl_roja">
                                  <select name="txtgrado" class="textbox" id="txtgrado">
                                    <?
                    $qgrado=mysql_query("select grados.id as idgrado, grados.grado, niveles.nivel, niveles.id as idnivel
                                         from grados inner join niveles on niveles.id = grados.nivel
                                         where grados.id = '{$info[grado_estudio]}'
                                         order by niveles.id, grados.id");
                                         
                    while($igrado=mysql_fetch_array($qgrado)){
                     echo "<option value='$igrado[idgrado]' selected>{$igrado[grado]} {$igrado[nivel]}</option>";
                    }                 
                    ?>
                                </select>                                  <strong>Secci&oacute;n:
                                  <input name="txtseccion" type="text" class="font_red_11" id="txtseccion" value="A" size="5" maxlength="5" readonly="true">
                                  </strong></td>
                              </tr>
                              <tr bgcolor="#A4DBFF" class="font_red_11">
                                <td align="left" valign="middle" background="../images/tema/bg_frm_campos.png" class="font_red_11"><strong class="lbl_roja">A&ntilde;o escolar: </strong></td>
                                <td background="../images/tema/bg_frm_campos.png"><input name="txtyear_estudio" type="text" class="font_red_11" id="txtyear_estudio" value="<?=$igral[ciclo_inscripcion];?>" size="4" maxlength="4" readonly="true"></td>
                              </tr>
                              <tr bgcolor="#E8E8E8">
                                <td align="left" valign="middle" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Carn&eacute;</td>
                                <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtcarnet" type="text" class="textbox" id="txtnombre" value="<?=$info[carnet];?>" size="15" maxlength="15" readonly="true"></td>
                              </tr>
                              <tr bgcolor="#E8E8E8">
                                <td width="18%" align="left" valign="middle" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Nombre(s)</td>
                                <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><div align="left">
                                    <input name="txtnombre" type="text" class="textbox" id="txtnombre2" value="<?=$info[nombre];?>" size="60" maxlength="100" readonly="true">
                                </div></td>
                              </tr>
                              <tr bgcolor="#E8E8E8">
                                <td width="18%" align="left" valign="middle" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Apellido(s)</td>
                                <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><div align="left">
                                    <input name="txtapellido" type="text" class="textbox" id="txtapellido2" value="<?=$info[apellido];?>" size="60" maxlength="100" readonly="true">
                                </div></td>
                              </tr>
                              <tr bgcolor="#E8E8E8">
                                <td colspan="2" align="left" valign="middle" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">&nbsp;</td>
                                </tr>
                              <tr bgcolor="#E8E8E8">
                                <td align="left" valign="middle" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Beca en matr&iacute;cula: </td>
                                <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtbi" type="text" class="textbox" id="txtcarnet2" value="<?=$info[beca_matricula];?>" size="15" maxlength="15" readonly="true"> 
                                  <span class="font_red_11">Valor que ser&aacute; descontado del cargo.</span></td>
                              </tr>
                              <tr bgcolor="#E8E8E8">
                                <td align="left" valign="middle" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">Beca en mensualidades: </td>
                                <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtbm" type="text" class="textbox" id="txtcarnet3" value="<?=$info[beca_mensualidad];?>" size="15" maxlength="15" readonly="true">
                                  <span class="font_red_11">Valor que ser&aacute; descontado del cargo.</span></td>
                              </tr>
                              <tr bgcolor="#E8E8E8">
                                <td align="left" valign="middle" background="../images/tema/bg_frm_campos.png" bgcolor="#CFDFEF" class="lbl_campo">A&ntilde;o a aplicar los descuentos: </td>
                                <td background="../images/tema/bg_frm_campos.png" bgcolor="#ECF2F9"><input name="txtyear" type="text" class="lbl_roja" id="txtyear" value="<?=get_ciclo_activo();?>" size="4" maxlength="4">
                                  <span class="font_red_11">Ingrese el a&ntilde;o de los cargos a aplicar el descuento.</span></td>
                              </tr>
                          </table></td>
                        </tr>
                        <tr>
                          <td bgcolor="#FFFFFF"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="33%"><div align="center">
                                <input name="Submit2" type="submit" class="boton_guardar" value="Aplicar Beca a  Alumno">
                                <span class="font_red_11"><strong><strong><span class="lbl_campo"><strong><strong>
                                <input name="tipo_trn" type="hidden" id="idi6" value="<?=$tipo;?>">
                                <strong><strong>
                                <input name="idi" type="hidden" id="idi" value="<?=$idi;?>">
                                </strong></strong> </strong></strong></span></strong></strong></span></div></td>
                              <td width="33%"><div align="center">
                                <input name="Submit4" type="reset" class="boton_deshacer" value="Recargar Informaci&oacute;n">
                              </div></td>
                              <td width="33%"><div align="center"></div></td>
                            </tr>
                          </table></td>
                        </tr>
                      </table>
                    </form>
                      <br>
                      <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CFDFEF">
                        <tr>
                          <td height="32" colspan="5" background="../images/tema/bg_titulo_frm.png" bgcolor="#CFDFEF"><div align="left">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="6%"><img src="../images/tema/ic_historialbca.png" width="35" height="32"></td>
                                <td width="94%" class="titulo_formulario">Historial de beca del alumno </td>
                              </tr>
                            </table>
                          </div></td>
                          </tr>
                        <tr>
                          <td width="5%" bgcolor="#CFDFEF" class="lbl_campo"><div align="center">A&ntilde;o</div></td>
                          <td width="20%" bgcolor="#CFDFEF" class="lbl_campo"><div align="center">Fecha</div></td>
                          <td width="16%" bgcolor="#CFDFEF" class="lbl_campo"><div align="center">Valor</div></td>
                          <td width="36%" bgcolor="#CFDFEF" class="lbl_campo"><div align="center">Tipo de Cargo </div></td>
                          <td width="23%" bgcolor="#CFDFEF" class="lbl_campo"><div align="center">Usuario</div></td>
                        </tr>
                        <?
                        $qinfob=mysql_query("select * from cp_becas where carnet='{$info[carnet]}' order by year desc, fecha, mes asc");
                        if(mysql_num_rows($qinfob)==0){
                        ?>
                        <tr>
                          <td colspan="5" bgcolor="#ECF2F9"><div align="center" class="parrafo"><strong>NO HAY INFORMACI&Oacute;N </strong></div></td>
                        </tr>
                        <?
                        }
                        while($infob=mysql_fetch_array($qinfob)){
                        ?>
                        <tr>
                          <td bgcolor="#ECF2F9"><div align="center"><?=$infob[year];?></div></td>
                          <td bgcolor="#ECF2F9"><div align="center"><?=fechalarga($infob[fecha]);?></div></td>
                          <td bgcolor="#ECF2F9"><div align="center"><?=moneda($infob[valor_descuento]);?></div></td>
                          <td bgcolor="#ECF2F9"><div align="center"><?=get_tipo_cargo($infob[tipo_cargo]);?></div></td>
                          <td bgcolor="#ECF2F9"><div align="center"><?=nombre_usuario($infob[usuario],"Ad");?></div></td>
                        </tr>
                        <?
                        }
                        ?>
                      </table></td>
                  </tr>
                </table>
              </div></td>
              </tr>
          </table></td>
        </tr>
    </table>    </td>
  </tr>
</table>
</body>
</html>
