science-ation/admin/reports_checkin.php
2005-01-14 20:41:22 +00:00

74 lines
2.1 KiB
PHP

<?
require("../common.inc.php");
require("../lpdf.php");
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$_GET['cat']."'");
if($catr=mysql_fetch_object($catq))
{
$pdf=new lpdf( i18n($config['fairname']),
i18n("Checkin List")." - ".i18n($catr->category),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
);
$pdf->newPage();
$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
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,division_shortform FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'");
$divr=mysql_fetch_object($divq);
$sq=mysql_query("SELECT students.firstname,
students.lastname
FROM
students
WHERE
students.registrations_id='$r->reg_id'
");
$students="";
$studnum=0;
while($studentinfo=mysql_fetch_object($sq))
{
if($studnum>0) $students.=", ";
$students.="$studentinfo->firstname $studentinfo->lastname";
$studnum++;
}
$table['data'][]=array($status_text,$r->proj_num,$r->title,$students,i18n($divr->division_shortform));
}
$pdf->addTable($table);
$pdf->output();
}
?>