#! /usr/bin/perl
# Copyright 2001-2022 Leslie Richardson
# This file is part of Open Admin for Schools.
# Absent strings for matching set in admin.conf; Comparison at line
# 305 in this file.
my $self = 'rptattmonth.pl';
my %lex = ('Monthly Attendance Report' => 'Monthly Attendance Report',
'Missing' => 'Missing',
'Date' => 'Date',
'Main' => 'Main',
'Attendance' => 'Attendance',
'Schooldays' => 'Schooldays',
'Weekdays' => 'Weekdays',
'Hols/Inserv' => 'Hols/Inserv',
'Red = Withdrawn' => 'Red = Withdrawn',
'Grand Totals' => 'Grand Totals',
'Periods Per Day' => 'Periods Per Day',
'Not Defined' => 'Not Defined',
'Name' => 'Name',
'Enrolled' => 'Enrolled',
'Attended' => 'Attended',
'Days' => 'Days',
'Absent' => 'Absent',
'Unexec' => 'Unexec',
'Excuse' => 'Excuse',
'Other' => 'Other',
'Total' => 'Total',
'Late' => 'Late',
'Times' => 'Times',
'Grade' => 'Grade',
'Homeroom' => 'Homeroom',
'Band' => 'Band',
'Total School Days not calculated' => 'Total School Days not calculated',
'Student-Days' => 'Student-Days',
'Pg' => 'Pg',
'Top' => 'Top',
'View Log File' => 'View Log File',
'Error' => 'Error',
'View/Download' => 'View/Download',
'Report Type' => 'Report Type',
'Group by' => 'Group by',
'Continue' => 'Continue',
'End' => 'End',
'Font Size' => 'Font Size',
'Paper Size' => 'Paper Size',
'Letter' => 'Letter',
'Legal' => 'Legal',
'A4' => 'A4',
'Records per Page' => 'Records per Page',
'Month' => 'Month',
'Group' => 'Group',
'Separate with Spaces' => 'Separate with Spaces',
'Enrol' => 'Enrol',
'Active' => 'Active',
'Type' => 'Type',
'Open' => 'Open',
'or' => 'or',
'Blank=All' => 'Blank=All',
'Select' => 'Select',
'Show Withdrawn' => 'Show Withdrawn',
);
use DBI;
use CGI;
use Number::Format qw(:all);
use Cwd;
my $defmaxrecords = 24; # Default maximum records per PDF page.
# Get current dir so know what path for config files.
my $configpath;
my $teachermode;
if ( getcwd() =~ /tcgi/ ){ # we are in tcgi
$teachermode = 1;
$configpath = '..'; # go back one to get to etc.
} else {
$configpath = '../..'; # go back two to get to etc.
}
# only load passwords and users
eval require "$configpath/etc/admin.conf.root";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
eval require "$configpath/lib/libattend.pl";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
# for parseGradesPeriod function
eval require "$configpath/lib/libDate.pl";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
my $dbtype = 'mysql';
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
$dbh->{mysql_enable_utf8} = 1;
# Load Configuration Variables;
my $sth = $dbh->prepare("select id, datavalue from conf_system where filename = 'admin'");
$sth->execute;
if ( $DBI::errstr ) { print $DBI::errstr; die $DBI::errstr; }
while ( my ($id, $datavalue) = $sth->fetchrow ) {
eval $datavalue;
if ( $@ ) {
print "$lex{Error}: $@
\n";
die "$lex{Error}: $@\n";
}
}
my @tim = localtime(time);
my $year = @tim[5] + 1900;
my $month = @tim[4] + 1;
my $day = @tim[3];
if (length($month) == 1){ $month = "0".$month;}
if (length($day) == 1){ $day = "0".$day;}
my $currdate = "$year-$month-$day";
# Teachermode
if ( $teachermode ) { # running on teacher site
$css = $tchcss;
$homepage = $tchpage;
$downloaddir = $tchdownloaddir;
$webdownloaddir = $tchwebdownloaddir;
}
my $q = new CGI;
print $q->header( -charset, $charset );
my %arr = $q->Vars;
# Page Header
my $title = "$lex{'Monthly Attendance Report'} 1";
print qq{$doctype\n