<?
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" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function validar(){
  var formulario = document.form1;
  var objeto;
  
  objeto = formulario.txtmes;
  if(objeto.value=="SV"){
    alert("Seleccione un mes...");
    objeto.focus();
    return (false);
  }
  objeto = formulario.txtyear;
  if(objeto.value==""){
    alert("Ingrese el año a consultar");
    objeto.focus();
    return (false);
  }
  objeto = formulario.txtyear;
  if(isNaN(parseFloat(objeto.value))){
    alert("El dato ingresado en el año no es válido");
    objeto.select();
    return (false);
  }
  
  return (true);
}
//-->
</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%"><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><strong><?echo "$unombre $uapellido";?></strong><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 valign="top" bgcolor="#FFFFFF">&nbsp;            <div align="right"></div>
          <table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">
              <tr align="center" valign="middle" bgcolor="#FFFFCC">
                <td width="75%" height="20" bgcolor="#FFFFCC"><div align="left"><span class="titulo_pagina">REPORTES<img src="../images/flecha_3.jpg" width="9" height="9"> Alumnos pendientes de pago </span></div>
                  <div align="center" class="titulo_pagina"></div></td>
                <td width="25%" bgcolor="#FFFFCC" class="parrafo"><div align="right"><a href="frm_reportes.php" class="link_parrafo">Regresar al men&uacute; de reportes<img src="../images/ic_home.png" width="21" height="21" border="0"></a> </div></td>
              </tr>
              <tr>
                <td colspan="2" align="left" valign="top" bgcolor="#FFFFCC"><div align="left" class="parrafo">
                  <table width="99%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
                    <tr>
                      <td bgcolor="#CFDFEF"><form name="form1" method="post" action="<?=$PHP_SELF;?>" onsubmit="return validar();">
                          <table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#CFDFEF">
                            <tr bgcolor="#6699CC">
                              <td colspan="3" class="titulo_formulario">Ingreso de informaci&oacute;n
                                <input name="busqueda" type="hidden" id="busqueda" value="ok"></td>
                            </tr>
                            <tr>
                              <td width="24%" bgcolor="#CFDFEF" class="lbl_campo">Seleccione un mes a consultar </td>
                              <td width="60%" bgcolor="#ECF2F9">
                              <select name="txtmes" class="textbox" id="txtmes">
                                <option value="SV" selected>Seleccione uno...</option>
                              <?
                              for($i=1;$i<=12;$i++){
                               echo "<option value='$i'>".mes_letras($i)."</option>";
                              }
                              ?>
                              </select>
                              <strong>A&ntilde;o:</strong>                              <input name="txtyear" type="text" class="textbox" id="txtyear" value="<?=date("Y");?>" size="4" maxlength="4">
                              </td>
                              <td width="16%" bgcolor="#ECF2F9"><div align="center">
                                <input name="Submit" type="submit" class="boton_guardar" value="Continuar...">
                              </div></td>
                            </tr>
                            <tr bgcolor="#CFDFEF">
                              <td colspan="3" class="lbl_campo">
                                <?if(!$busqueda){exit();}?></td>
                            </tr>
                          </table>
                      </form></td>
                    </tr>
                  </table>
                </div></td>
              </tr>
            </table>
         <br>
         <?
         $qalm=mysql_query("select alumnos.carnet, nombre, apellido, sum(cp_cargos.saldo) as ttsaldo, 
                            alumnos.grado_estudio, alumnos.nivel_estudio, alumnos.jornada
                            from alumnos inner join cp_cargos ON cp_cargos.carnet = alumnos.carnet
                            where cp_cargos.mes <= $txtmes
                            and alumnos.year_estudio = '$df_year_actual'
                            and year(cp_cargos.fecha_cargo)=$txtyear
                            group by carnet, nombre, apellido
                            having ttsaldo > 0
                            order by apellido, nombre, jornada, nivel_estudio, grado_estudio");
         $total_general=0.00;
         while($ialumno=mysql_fetch_array($qalm)){
         ?>
          <table width="748"  border="0" cellspacing="0" cellpadding="0">
            <tr class="parrafo">
              <td width="59" bgcolor="#FFFFFF">&nbsp;</td>
              <td width="689" bgcolor="#FFFFFF"><strong class="titulo_pagina"><?=$ialumno[carnet]." ".$ialumno[apellido].", ".$ialumno[nombre];?> / <?=ggrado(enc($ialumno[grado_estudio]));?> | <?=gnivel(enc($ialumno[nivel_estudio]));?> | <?=gjornada(enc($ialumno[jornada]));?> </strong></td>
            </tr>
            <tr class="parrafo">
              <td bgcolor="#FFFFFF">&nbsp;</td>
              <td bgcolor="#FFFFFF"><table width="689"  border="0" align="right" cellpadding="0" cellspacing="0">
                <tr class="parrafo">
                  <td width="53" bgcolor="#CFDFEF">&nbsp;</td>
                  <td width="97" bgcolor="#CFDFEF"><strong>TIPO</strong></td>
                  <td width="307" bgcolor="#CFDFEF"><strong>DESCRIPCION</strong></td>
                  <td width="79" bgcolor="#CFDFEF"><div align="right"><strong>SALDO</strong></div></td>
                  <td width="153" bgcolor="#CFDFEF"><div align="center"><strong>FECHA CARGO</strong></div></td>
                </tr>
                <?
            $total_alumno=0.00;
            $cnt_cuotaspend=0;
            $qcargos=mysql_query("select * from cp_cargos where mes <= $txtmes and year(fecha_cargo)<= $txtyear and carnet = '{$ialumno[carnet]}' and saldo > 0 order by mes, fecha_cargo");
            $i=0;
            while($icargos=mysql_fetch_array($qcargos)){
            $i++;
            $total_alumno+=$icargos[saldo];
            $cnt_cuotaspend++;
            ?>
                <tr class="parrafo" bgcolor="<?=color_fila($i);?>">
                  <td>&nbsp;</td>
                  <td><?=$icargos[tipo];?></td>
                  <td><?=$icargos[descripcion];?></td>
                  <td><div align="right"><?=moneda($icargos[saldo],"Q");?></div></td>
                  <td><div align="center"><?=fecha($icargos[fecha_cargo]);?></div></td>
                </tr>
                <?
            }
            $total_general+=$total_alumno;
            ?>
                <tr class="parrafo">
                  <td bgcolor="#CFDFEF">&nbsp;</td>
                  <td bgcolor="#CFDFEF"><b>TOTALES</b></td>
                  <td bgcolor="#CFDFEF"><strong><?=$cnt_cuotaspend;?> cargo(s) pendientes de pago</strong></td>
                  <td bgcolor="#CFDFEF"><div align="right"><strong><?=moneda($total_alumno,"Q");?></strong></div></td>
                  <td bgcolor="#CFDFEF">&nbsp;</td>
                </tr>
              </table></td>
            </tr>
          </table>
          <hr>
          <?
           }
           ?>
           <table width="748"  border="0" cellspacing="0" cellpadding="0">
             <tr bgcolor="#CFDFEF" class="titulo_seccion">
               <td width="516">TOTAL GENERAL </td>
               <td width="79"><div align="right"><?=moneda($total_general,"Q");?></div></td>
               <td width="153">&nbsp;</td>
             </tr>
          </table>          </td>
        </tr>
    </table>    </td>
  </tr>
</table>
</body>
</html>
