science-ation/admin/reports_checkin.php
james 0e10fcda45 factor out PDF code into a separate PDF class
implement new PDF class in reports_checkin
2005-01-13 22:00:34 +00:00

149 lines
3.9 KiB
PHP

<?
require("../common.inc.php");
require("../lpdf.php");
$pdf=new lpdf(i18n($config['fairname']),i18n("Checkin List"));
//lets split this up by age category, then sort each one by division... so first, just get the age categories
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
while($catr=mysql_fetch_object($catq))
{
$q=mysql_query("SELECT registrations.id AS reg_id,
registrations.num AS reg_num,
registrations.status,
projects.title,
projects.projectdivisions_id
FROM
registrations
left outer join projects on projects.registrations_id=registrations.id
WHERE
registrations.year='".$config['FAIRYEAR']."'
AND ( registrations.status='complete' OR registrations.status='paymentpending' )
AND projects.projectcategories_id='$catr->id'
ORDER BY
registrations.status DESC,
projects.title
");
echo mysql_error();
$table=array();
$table['header']=array(i18n("Paid?"),i18n("Proj #"),i18n("Project Title"),i18n("Student(s)"),i18n("Div"));
$table['widths']=array(0.5, 0.6, 3.5, 2.4, 0.5);
$table['dataalign']=array("center","left","left","left","center");
while($r=mysql_fetch_object($q))
{
switch($r->status)
{
case "paymentpending": $status_text="No"; break;
case "complete": $status_text=""; break;
}
$status_text=i18n($status_text);
$divq=mysql_query("SELECT division FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'");
$divr=mysql_fetch_object($divq);
$sq=mysql_query("SELECT students.firstname,
students.lastname,
schools.school
FROM
students,schools
WHERE
students.registrations_id='$r->reg_id'
AND
students.schools_id=schools.id
");
echo mysql_error();
$schools="";
$students="";
while($studentinfo=mysql_fetch_object($sq))
{
$students.="$studentinfo->firstname $studentinfo->lastname\n";
$schools.="$studentinfo->school\n";
}
$table['data'][]=array($status_text,$r->proj_num,$r->title,$students,i18n($divr->division_short));
}
$pdf->addTable($table);
$pdf->newPage();
}
/*
echo "<table class=\"summarytable\">";
echo "<tr>";
echo "<th>".i18n("Status")."</th>";
echo "<th>".i18n("Reg Num")."</th>";
echo "<th>".i18n("Project Title")."</th>";
echo "<th>".i18n("Age Category")."</th>";
echo "<th>".i18n("Division")."</th>";
echo "<th>".i18n("School(s)")."</th>";
echo "<th>".i18n("Student(s)")."</th>";
echo "</tr>";
$stats_totalprojects=0;
$stats_totalstudents=0;
$stats_divisions=array();
$stats_categories=array();
while($r=mysql_fetch_object($q))
{
$stats_totalprojects++;
$stats_divisions[$r->projectdivisions_id]++;
$stats_categories[$r->projectcategories_id]++;
echo "<tr>";
echo "<td>$status_text</td>";
echo "<td>$r->reg_num</td>";
echo "<td>$r->title</td>";
//now get thh category and division
$catq=mysql_query("SELECT category FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectcategories_id."'");
$catr=mysql_fetch_object($catq);
$divq=mysql_query("SELECT division FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'");
$divr=mysql_fetch_object($divq);
echo "<td>".i18n("$catr->category")."</td>";
echo "<td>".i18n("$divr->division")."</td>";
$sq=mysql_query("SELECT students.firstname,
students.lastname,
schools.school
FROM
students,schools
WHERE
students.registrations_id='$r->reg_id'
AND
students.schools_id=schools.id
");
echo mysql_error();
$studnum=1;
$schools="";
$students="";
while($studentinfo=mysql_fetch_object($sq))
{
$students.="$studentinfo->firstname $studentinfo->lastname <br />";
$schools.="$studentinfo->school <br />";
$stats_totalstudents++;
}
echo "<td>$schools</td>";
echo "<td>$students</td>";
echo "</tr>";
}
echo "</table>\n";
*/
$pdf->output();
?>