forked from science-ation/science-ation
- Move registration fee computation into the include file
- Add the required registration fee to the received forms checkoff, so the amount of the cheque can ben checked too.
This commit is contained in:
parent
1e2608d5b5
commit
57ff84c563
@ -117,6 +117,8 @@ echo mysql_Error();
|
||||
$studnum++;
|
||||
}
|
||||
|
||||
list($regfee,$regfeedata) = computeRegistrationFee($reg_id);
|
||||
echo "<tr><td><b>".i18n("Registration Fee")."</b></td><td>".sprintf("$%.02f", $regfee)."</td></tr>";
|
||||
echo "</table>\n";
|
||||
echo "<br />";
|
||||
|
||||
|
@ -327,4 +327,52 @@ function generateProjectNumber($registration_id)
|
||||
return $projectnumber;
|
||||
}
|
||||
|
||||
function computeRegistrationFee($regid)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$ret = array();
|
||||
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
|
||||
$n_students = mysql_num_rows($q);
|
||||
$n_tshirts = 0;
|
||||
while($s = mysql_fetch_object($q)) {
|
||||
if($s->tshirt != 'none') $n_tshirts++;
|
||||
}
|
||||
|
||||
if($config['regfee_per'] == 'student') {
|
||||
$f = $config['regfee'] * $n_students;
|
||||
$ret[] = array( 'id' => 'regfee',
|
||||
'text' => "Fair Registration (per student)",
|
||||
'base' => $config['regfee'],
|
||||
'num' => $n_students,
|
||||
'ext' => $f );
|
||||
$regfee += $f;
|
||||
} else {
|
||||
$ret[] = array( 'id' => 'regfee',
|
||||
'text' => "Fair Registration (per project)",
|
||||
'base' => $config['regfee'],
|
||||
'num' => 1,
|
||||
'ext' => $config['regfee'] );
|
||||
$regfee += $config['regfee'];
|
||||
}
|
||||
|
||||
if($config['participant_student_tshirt'] == 'yes') {
|
||||
$tsc = floatval($config['participant_student_tshirt_cost']);
|
||||
if($tsc != 0.0) {
|
||||
$f = $n_tshirts * $tsc;
|
||||
$regfee += $f;
|
||||
if($n_tshirts != 0) {
|
||||
$ret[] = array( 'id' => 'tshirt',
|
||||
'text' => "T-Shirts",
|
||||
'base' => $tsc,
|
||||
'num' => $n_tshirts,
|
||||
'ext' => $f);
|
||||
}
|
||||
}
|
||||
}
|
||||
return array($regfee, $ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
@ -320,42 +320,21 @@ echo "<table><tr><td>";
|
||||
echo "<td><font size=-1>".i18n($extra)."</font></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
if($config['regfee_show_info'] == 'yes')
|
||||
{
|
||||
echo "<h3>".i18n("Registration Fee Information")."</h3>";
|
||||
|
||||
$regfee = 0;
|
||||
|
||||
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||
$n_students = mysql_num_rows($q);
|
||||
$n_tshirts = 0;
|
||||
while($s = mysql_fetch_object($q)) {
|
||||
if($s->tshirt != 'none') $n_tshirts++;
|
||||
}
|
||||
|
||||
echo "<table>";
|
||||
if($config['regfee_per'] == 'student') {
|
||||
$f = $config['regfee'] * $n_students;
|
||||
regfee_line("Fair Registration (per student)", $config['regfee'], $n_students, $f, '');
|
||||
$regfee += $f;
|
||||
} else {
|
||||
regfee_line("Fair Registration (per project)", $config['regfee'], 1, $config['regfee'], '');
|
||||
$regfee += $config['regfee'];
|
||||
}
|
||||
list($regfee, $rfeedata) = computeRegistrationFee($_SESSION['registration_id']);
|
||||
|
||||
$extra_after = "";
|
||||
if($config['participant_student_tshirt'] == 'yes') {
|
||||
$tsc = floatval($config['participant_student_tshirt_cost']);
|
||||
if($tsc != 0.0) {
|
||||
$f = $n_tshirts * $tsc;
|
||||
$regfee += $f;
|
||||
|
||||
if($n_tshirts != 0) {
|
||||
$ex = "*";
|
||||
$extra_after = "* If you do not wish to order a T-Shirt, please select your T-Shirt size as 'None' on the Student Information Page";
|
||||
regfee_line("T-Shirts", $tsc, $n_tshirts, $f, $ex);
|
||||
}
|
||||
echo "<table>";
|
||||
foreach($rfeedata as $rf) {
|
||||
if($rf['id'] == "tshirt") {
|
||||
$ex = "*";
|
||||
$extra_after = "* If you do not wish to order a T-Shirt, please select your T-Shirt size as 'None' on the Student Information Page";
|
||||
}
|
||||
regfee_line($rf['text'],$rf['base'],$rf['num'],$rf['ext'],$ex);
|
||||
}
|
||||
echo "<tr><td align=right colspan=3>".i18n("Total (including all taxes)")."</td><td><b>$".sprintf("%.02f", $regfee)."</b></td><td></td></tr>";
|
||||
echo "</table><br />";
|
||||
|
Loading…
Reference in New Issue
Block a user