#!\perl\bin
# alumnos x nombre alumxnameBis.pl
require 'paginar.pl';
require 'connectDB.pl';
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use CGI qw(param uploadInfo);
use CGI;
use CGI ':standard';
use CGI::Session;
use Date::Simple ('date', 'today');
use Date::Calc qw(:all);
my $dt = today();
my @doc = "";
my $countn = 0;
my $con = "";
my $cicloctrl = "";
# grupo de variables para paging
my $init = param('init');
my $next = $init + 20;
my $prev = $init - 20;
my $i = $init + 1;
my $ult = 0;
my $entries = 20 ;
my $rem = 0;
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 "<p align='center'><img src='logo1.gif' border='0' name='banner' ></a><br></p>";
print start_html(-title=>'Mapapi', -bgcolor=>'#ffffc6');
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 FROM control ");
$sth1->execute()or die "No puedo leer Control....$!";
my @doc1 = $sth1->fetchrow_array;
{
$cicloctrl = $doc1[0];
}
print basefont ({-face=>'Arial'});
print "<H2 align='center'><B>Inscripciones y Alumnos</H2><h5 align='right'>Fecha:$dt</h5></B>";
print font ({-size=>'4', -color=>'Red'},'Alumnos x Nombre');
print "<BR>";
# llamo al modulo paginar
paginar::Paginacion('$prog','$SESSION','$prev','$next','$ult');
print "<TABLE align='right' 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>Fecha Nacim.</th><th>Sangre</th><th>Situacion</th><th>Grado</th><th>Grupo</th></TR>\n";
my $sth = $con->prepare(qq(SELECT codigo,nombre,paterno,materno,sexo,nacimiento,sangre,situacion,grado, grupo FROM alumnos where status = 'Activo' and ciclo='$cicloctrl' order by nombre,paterno,materno limit $init, $entries));
$sth->execute() or die "Error en Alumnos...";
while (@doc = $sth->fetchrow_array)
{
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[5]</td><td>$doc[6]</td><td>$doc[7]</td><td>$doc[8]</td><td>$doc[9]</td></B>";
print "</tr\n";
$i++;
$init;
}
print "</TABLE>\n";
my $sth1 = $con->prepare(qq(SELECT count(*) as total FROM alumnos where status = 'Activo' and ciclo='$cicloctrl' ));
$sth1->execute() or die "Error en Alumnos...";
@doc = $sth1->fetchrow_array;
print "<B> Total de Alumnos ==> " . $doc[0] . "</B><BR>";
print button(-name=>'back', -value=>'Atras', -onClick=>'history.go(-1)');
}
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;
exit;