<?
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;
}
//-->
</script>
</head>

<body>
<table width="640" 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="#FFFFCC">
        <tr>
          <td valign="top" bgcolor="#FFFFFF">&nbsp;
            <table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">
              <tr align="center" valign="middle" bgcolor="#FFFFCC">
                <td width="75%" height="20" bgcolor="#FFFFFF"><div align="left"><span class="titulo_pagina"><?=$nombre_colegio;?><br>
                  Alumnos pendientes de pago a <?=mes_letras($txtmes)." ".$txtyear;?></span></div>
                  <div align="center" class="titulo_pagina"></div></td>
                <td width="25%" bgcolor="#FFFFFF" class="parrafo"><div align="right"><a href="frm_reportes.php" class="link_parrafo"></a> <a href="#" target="_self" class="link_parrafo" onClick="print();"><img src="../images/printButton.png" width="16" height="16" border="0"> Imprimir </a></div></td>
              </tr>
              <tr>
                <td colspan="2" align="left" valign="top" bgcolor="#FFFFFF"><div align="left" class="parrafo"></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 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="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];?> / <?=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="100%"  border="0" align="right" cellpadding="0" cellspacing="0">
                <tr class="parrafo">
                  <td width="8%" bgcolor="#CFDFEF">&nbsp;</td>
                  <td width="14%" bgcolor="#CFDFEF"><strong>TIPO</strong></td>
                  <td width="45%" bgcolor="#CFDFEF"><strong>DESCRIPCION</strong></td>
                  <td width="11%" bgcolor="#CFDFEF"><div align="right"><strong>SALDO</strong></div></td>
                  <td width="22%" 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="100%"  border="0" cellspacing="0" cellpadding="0">
             <tr bgcolor="#CFDFEF" class="titulo_seccion">
               <td width="69%">TOTAL GENERAL </td>
               <td width="11%"><div align="right"><?=moneda($total_general,"Q");?></div></td>
               <td width="20%">&nbsp;</td>
             </tr>
          </table>          </td>
        </tr>
    </table>    </td>
  </tr>
</table>
</body>
</html>
