From 074b66274c88bfe6ee7a10bb6e80e19cd69bca83 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 8 Dec 2005 16:00:18 +0000 Subject: [PATCH] Add student emergency contact report --- admin/reports.php | 4 ++ admin/reports_emergencycontact.php | 94 ++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 admin/reports_emergencycontact.php diff --git a/admin/reports.php b/admin/reports.php index 2bb13287..bc462f08 100644 --- a/admin/reports.php +++ b/admin/reports.php @@ -43,6 +43,10 @@ while($catr=mysql_fetch_object($catq)) echo ""; echo ""; + echo "
"; + echo i18n("Student Emergency Contact Names/Numbers").": "; + echo "PDF   "; + echo "CSV   "; echo "
"; echo i18n("Project Table Labels").": "; diff --git a/admin/reports_emergencycontact.php b/admin/reports_emergencycontact.php new file mode 100644 index 00000000..5aac0d82 --- /dev/null +++ b/admin/reports_emergencycontact.php @@ -0,0 +1,94 @@ + + Copyright (C) 2005 James Grant + + This program 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, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +?> +newPage(); + $rep->setFontSize(10); + } + else if($type=="csv") + { + $rep=new lcsv(i18n("Emergency Contact")." - ".i18n($catr->category)); + } + $q=mysql_query("SELECT students.firstname, + students.lastname, + emergencycontact.firstname AS emerg_firstname, + emergencycontact.lastname AS emerg_lastname, + emergencycontact.relation, + emergencycontact.phone1, + emergencycontact.phone2, + emergencycontact.phone3, + emergencycontact.phone4, + emergencycontact.email, + registrations.status, + projects.title, + projects.projectnumber + FROM + students + left outer join emergencycontact ON students.id=emergencycontact.students_id + left outer join registrations ON students.registrations_id=registrations.id + left outer join projects ON projects.registrations_id=registrations.id + WHERE + registrations.year='".$config['FAIRYEAR']."' + AND ( registrations.status='complete' OR registrations.status='paymentpending' ) + ORDER BY + students.lastname, + students.firstname + "); + echo mysql_error(); + + $table=array(); + + $table['header']=array(i18n("First Name"),i18n("Last Name"),i18n("Emerg First"),i18n("Emerg Last"), i18n("Relation"), i18n("Emerg Phone")); + $table['widths']=array( 1.25, 1.25, 1.25, 1.25, 1, 1.25); + $table['dataalign']=array("left","left","left","left","left","left"); + + while($r=mysql_fetch_object($q)) + { + $table['data'][]=array($r->firstname,$r->lastname,$r->emerg_firstname,$r->emerg_lastname,$r->relation,$r->phone1); + if($r->phone2) + $table['data'][]=array('','','','','',$r->phone2); + if($r->phone3) + $table['data'][]=array('','','','','',$r->phone3); + if($r->phone4) + $table['data'][]=array('','','','','',$r->phone4); + + } + + $rep->addTable($table); + $rep->output(); +?>