<?
include("../fnc.php");
enlinea_a();
if($busqueda){

}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>e-Ducativo - Lista de alumnos con cargos pendientes de cancelar</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;
}
//-->
</script>
</head>

<body>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="518" class="lbl_campo"><span class="titulo_seccion"><?=$nombre_colegio;?>
    </span><br>
      <strong>Reporte de alumnos pendientes de pago</strong> <br>
    Al Mes de <?=mes_letras($txtmes);?> del A&ntilde;o: <?=$txtyear;?> <br><br></td>
    <td width="122" class="lbl_campo"><div align="right"><a href="#" class="link_parrafo" onclick="window.print();"><img src="../images/printButton.png" width="16" height="16" border="0"> Imprimir</a></div></td>
  </tr>
  <tr>
    <td colspan="2"><?
         $qgrado=mysql_query("select distinct grados.id as idg, grados.grado, jornadas.id as idj, jornadas.jornada, niveles.nivel, niveles.id as idn
                                                         from jornadas inner join grados ON grados.jornada = jornadas.id
                                                         inner join niveles ON grados.nivel = niveles.id
                                                         where grados.id = $txtgrado");
         $igrado=mysql_fetch_array($qgrado);
         ?>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
          <td width="98%" bgcolor="#FFFFFF" class="titulo_seccion"><?="Grado: {$igrado[grado]}, Nivel: {$igrado[nivel]}, Sección: $txtseccion, Jornada: {$igrado[jornada]}";?></td>
        </tr>
      </table>
      <?
         $qalm=mysql_query("select alumnos.carnet, nombre, apellido, sum(cp_cargos.saldo) as ttsaldo
                            from alumnos inner join cp_cargos ON cp_cargos.carnet = alumnos.carnet
                            where alumnos.grado_estudio=$txtgrado
                            and alumnos.seccion = '$txtseccion'
                            and alumnos.year_estudio = '$df_year_actual'
                            and cp_cargos.mes <= $txtmes
                            and year(cp_cargos.fecha_cargo)=$txtyear
                            group by carnet, nombre, apellido
                            having ttsaldo > 0");
         $total_general=0.00;
         while($ialumno=mysql_fetch_array($qalm)){
         ?>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr class="parrafo">
          <td width="8%" bgcolor="#FFFFFF">&nbsp;</td>
          <td width="92%" bgcolor="#FFFFFF"><strong class="titulo_pagina">
            <?=$ialumno[carnet]." ".$ialumno[apellido].", ".$ialumno[nombre];?>
          </strong></td>
        </tr>
        <tr class="parrafo">
          <td bgcolor="#FFFFFF">&nbsp;</td>
          <td bgcolor="#FFFFFF"><table width="100%"  border="0" align="right" cellpadding="0" cellspacing="0">
              <tr class="parrafo">
                <td bgcolor="#CFDFEF"><strong>TIPO</strong></td>
                <td width="307" bgcolor="#CFDFEF"><strong>DESCRIPCION</strong></td>
                <td width="79" bgcolor="#CFDFEF"><strong>SALDO</strong></td>
                <td width="153" bgcolor="#CFDFEF"><div align="center"><strong>FECHA PAGO</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");
            $i=0;
            while($icargos=mysql_fetch_array($qcargos)){
            $i++;
            $total_alumno+=$icargos[saldo];
            $total_general+=$icargos[saldo];
            $cnt_cuotaspend++;
            ?>
              <tr class="parrafo" bgcolor="<?=color_fila($i);?>">
                <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>
              <?
            }
            ?>
              <tr class="parrafo">
                <td bgcolor="#CFDFEF">&nbsp;</td>
                <td bgcolor="#CFDFEF"><strong>TOTALES</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>
      <?
           }
           ?>
           <div align="center"><span class="lbl_campo">TOTAL GENERAL: <?=moneda($total_general);?>         </span></div>
           </td>
  </tr>
</table>
</body>
</html>
