#! /usr/bin/perl
# Copyright 2001-2021 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.
my %lex = ('Error' => 'Error',
'Main' => 'Main',
'Bus Route' => 'Bus Route',
'Students' => 'Students',
'Route' => 'Route',
'Name' => 'Name',
'Grade' => 'Grade',
'HRm' => 'HRm',
'Address' => 'Address',
'Ph' => 'Ph',
'Parent 1' => 'Parent 1',
'Parent 2' => 'Parent 2',
'View/Download' => 'View/Download',
'View Log File' => 'View Log File',
'Rm' => 'Rm',
'Report' => 'Report',
'Not Found' => 'Not Found',
'Family' => 'Family',
'Sort by' => 'Sort by',
'Continue' => 'Continue',
);
use DBI;
use CGI;
# Basic Constants
my $logfile = "pdflog$$.txt";
my $shortname = "busrpt$$";
my $filename = "$shortname.tex";
my $maxlines = 19;
# Read config variables
eval require "../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. ": $@ \n";
die $lex{Error}. ": $@\n";
}
my $altNameField = $g_FamilyGroupNameField; # provides a family rather than a/b/c forms
eval require "../lib/liblatex.pl";
if ( $@ ) {
print $lex{Error}. " $@ \n";
die $lex{Error}. " $@\n";
}
my $q = new CGI;
my %arr = $q->Vars;
print $q->header( -charset, $charset );
if ($arr{maxstudents}) {
$maxlines = $arr{maxstudents};
}
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
$dbh->{mysql_enable_utf8} = 1;
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";
my $title = "$lex{'Bus Route'} $lex{Report}";
print qq{$doctype\n
\n};
print qq{\n};
#----------------
sub showStartPage {
#----------------
# Display Current Busroute numbers;
my $sth = $dbh->prepare("select distinct busroute, count(busroute) from student
group by busroute order by busroute");
$sth->execute;
if ( $DBI::errstr ) { print $DBI::errstr; die $DBI::errstr; }
my $first = 1;
while ( my ( $busroute, $count ) = $sth->fetchrow ) {
if ( $first ) {
print qq{