#!\perl\bin
require 'paginar.pl';
require 'connectDB.pl';
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use CGI qw(param uploadInfo);
use CGI;
use CGI qw(:standard);
use CGI::Session;
use Date::Simple ( 'date', 'today' );
use Date::Calc qw(:all);
my $dt = today();
my @doc = "";
my @doc1 = "";
my $count = 0;
my $countn = 0;
my $con = "";
my $mes = "";
my $num = "";
my $cicloctrl = "";
# grupo de variables para paging
my $init = param('init');
my $next = $init + 10;
my $prev = $init - 10;
my $i = $init + 1;
my $ult = 0;
my $rem = 0;
my $prog1 = "gralxbirth.pl";
my $prog2 = "reportesinscs.pl";
my $pagina = 0;
my $de = 0;
my $ent = 0;
my $school = "";
my @params = "";
my $countn = 0;
my $nivel = param('nivel');
my $par = "";
my $cgi = new CGI;
my $CGISESSID = $cgi->param('CGISESSID');
my $session
= CGI::Session->load( "driver:File", $CGISESSID,
{ 'Directory' => '/temp/' } )
or die CGI::Session->errstr;
print "Content-type: text/html\n\n";
print start_html(
-title => 'Reporte de Cumpleaños general',
-bgcolor => '#cccccc'
);
print "<HEAD>";
print "<META http-equiv='Cache-control' content='no-cache'>";
print "</HEAD>";
print
"<p align='center'><img src='logo1.gif' border='0' name='banner' ></ a> <br> < /p>";
my $aut = $session->param('Aut01');
if ( $aut eq '1' ) {
# Configurar el acceso a la DB
$con = connectDB::Conn($m)
or die "No puedo conectarme a la database\n";
my $sth1 = $con->prepare("SELECT ciclo, nombre_esc FROM control ");
$sth1->execute() or die "No puedo leer Control....$!";
my @doc1 = $sth1->fetchrow_array;
{
$cicloctrl = $doc1[0];
$school = $doc1[1];
}
$pagina = ( $init / $paginar::entries ) + 1;
# obtengo paginas y encabezados
my $sth1
= $con->prepare(
qq(SELECT count(*) FROM alumnos where status = 'Activo' and ciclo='$cicloctrl' )
);
$sth1->execute() or die "Error en Alumnos...";
@doc1 = $sth1->fetchrow_array;
$countn = $doc1[0];
$de = ( $countn % $paginar::entries );
$ent = $countn - $de;
$de = ( $ent / $paginar::entries ) + 1;
print basefont ( { -face => 'Arial' } );
print "<H2 align='center'><B>$school </H2></B>";
print "<H2 align='center'><B>Inscripciones y Alumnos</H2></B>";
print font ( { -size => '4', -color => 'Red' },
"Cumpleaños de Alumnos" );
print "<BR>";
# llamo al modulo paginar
@params = (
$prog1, $CGISESSID, $prev, $next, $ult, $prog2,
$countn, $init, $nivel, $dt, $de
);
$par = \@params;
do paginar::Paginacion($par);
print "<B>--------- Pagina: $pagina de $de</B>";
print "<TABLE align='center' border='3' >\n";
print
"<TR><TH>Cont.</TH><th>Codigo</th><th>Nombre</th><th>Ap.Paterno</th><th>Ap.Materno</th><th>Sexo</th><th>Nivel</th><th>Grado</th><th>Grupo</th><th>Mes</th><th>Dia</th></TR>\n";
my $sth
= $con->prepare(
qq(SELECT codigo,nombre,paterno,materno,sexo,grado, grupo, month (nacimiento), day (nacimiento), nivel FROM alumnos where status = 'Activo' and ciclo='$cicloctrl' order by month(nacimiento),day(nacimiento) limit $init, $paginar::entries)
);
$sth->execute() or die "Error en Alumnos..";
while ( @doc = $sth->fetchrow_array ) {
if ( $doc[7] eq '1' ) { $mes = 'Ene'; }
if ( $doc[7] eq '2' ) { $mes = 'Feb'; }
if ( $doc[7] eq '3' ) { $mes = 'Mar'; }
if ( $doc[7] eq '4' ) { $mes = 'Abr'; }
if ( $doc[7] eq '5' ) { $mes = 'May'; }
if ( $doc[7] eq '6' ) { $mes = 'Jun'; }
if ( $doc[7] eq '7' ) { $mes = 'Jul'; }
if ( $doc[7] eq '8' ) { $mes = 'Ago'; }
if ( $doc[7] eq '9' ) { $mes = 'Sep'; }
if ( $doc[7] eq '10' ) { $mes = 'Oct'; }
if ( $doc[7] eq '11' ) { $mes = 'Nov'; }
if ( $doc[7] eq '12' ) { $mes = 'Dic'; }
$j = $j + 1;
if ( $j eq 1 ) {
$ant = $doc[7];
}
if ( $ant ne $doc[7] ) {
print "<tr>";
print
"<B><th>=======</th><th>=======</th><th>=======</th><th>=======</th><th>======</th><th>========</th><th>========</th><th>========</th><th>========</th><th>========</th><th>========</th></B>";
print "</tr\n";
$ant = $doc[7];
}
print "<tr>";
print
"<B><TD>$i</TD><td>$doc[0]</td><td>$doc[1]</td><td>$doc[2]</td><td>$doc[3]</td><td>$doc[4]</td><td>$doc[9]</td><td>$doc[5]</td><td>$doc[6]</td><td>$mes</td><td>$doc[8]</td></B>";
print "</tr\n";
$i++;
$init;
}
print "</TABLE>\n";
}
else {
print font (
{ -size => '5', -color => 'Red' },
'No tienes autorizacion para esta opcion'
);
print "<BR>";
print button(
-name => 'back',
-value => 'Atras',
-onClick => 'history.go(-1)'
);
}
$con->disconnect;
print "</html>\n";
exit;