#!/usr/bin/perl
# Copyright 2001-2008 Leslie Richardson
# This file is part of Open Admin for Schools.
# Open Admin for Schools is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# File: rpttransmon.pl
# Monthly report for Enrollment change.
# PDF Output
my %lex = ('Monthly Transfer Report' => 'Monthly Transfer Report',
'Date format Error' => 'Date format Error',
'View/Download' => 'View/Download',
'View Log File' => 'View Log File',
'Main' => 'Main',
'Current Date' => 'Current Date',
'Aging Date' => 'Aging Date',
'Month of' => 'Month of',
'No Enrollment Changes in Current Enrollment' =>
'No Enrollment Changes in Current Enrollment',
'enrol' => 'New Enrollments',
'reenrol' => 'Reenrollments',
're-enrol' => 'Reenrollments',
'withdraw' => 'Withdrawals',
'Student' => 'Student',
'Reason' => 'Reason',
'Go Back' => 'Go Back',
'Date' => 'Date',
'Principal' => 'Principal',
'Grade' => 'Grade',
'Error' => 'Error',
);
# show Principal Signature Line; set to 0 to turn off
my $principalSign = 1;
my $self = 'rpttransmon.pl';
use DBI;
use CGI;
# Used for the category titles
my $shortname = "rpttransfer$$";
my $fileName = "$shortname.tex";
my $q = new CGI;
print $q->header;
my %arr = $q->Vars;
# Read config variables
eval require "../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. " $@ \n";
die $lex{Error}. " $@ \n";
}
eval require "../lib/liblatex.pl";
if ( $@ ) {
print $lex{Error}. " $@ \n";
die $lex{Error}. " $@ \n";
}
# Set Dates
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday,
$iddst) = localtime(time);
$year = $year + 1900;
$mon++;
$wday++;
my $currdate = "$dow[$wday], $month[$mon] $mday, $year";
# Print Page Head.
print "$doctype\n
". $lex{'Monthly Transfer Report'}. "
$chartype\n[ ". $lex{Main}. " ]\n";
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
# No date defined.
my ($yr, $mo, $da);
if ( not $arr{date} ) { # We'll go back 1 month.
if ( $mon > 1 ){ # if not January (ie. 1)
$mo = $mon - 1;
$yr = $year;
} else { # month is 1, go to prev dec.
$mo = 12;
$yr = $year - 1;
}
$da = "01";
} else { # We have been passed a date.
($yr, $mo, $da) = split /-/, $arr{date};
$da = "01";
}
my $agingdate = "$yr-$mo-$da";
if ($yr == 0 or $mo == 0 or $da == 0) {
print '