. */ include("./include/include.php"); include_once("./include/Fee.php"); admin_header(); if( !in_array("application_editfee", $_SESSION['sess_functions']) ) { echoln("You are not authorized to see this page."); }else { echoln("

Register fee payments

"); if( ($_SERVER['REQUEST_METHOD']=="POST" || isset($_GET['undo'])) && isset($_REQUEST['PersonID']) ) { // Handle input if( preg_match("/^([0-9]+-)?([0-9]+)$/", $_REQUEST['PersonID'], $matches) ) { $PersonID = $matches[2]; $query = "SELECT `PersonID`, `FirstName`, `LastName`, `BodyCode`, `BodyName`, `Accepted`, `Fee`, `FeePaid`, `ParticipantType` FROM `persons` LEFT JOIN `ab_bodies` USING (`BodyCode`) WHERE `PersonID`=".addslashes($PersonID); if( @mysql_num_rows($res=doquery($query))==1 ) { $row = mysql_fetch_array($res); $fee = new Fee(); $topay=$fee->get_fee($row['BodyCode'], $row['ParticipantType'], $row['Fee']); if( $row['Accepted']=="yes" OR $row['Accepted']=="pending" OR $row['Accepted']=="confirmed" ) { // accepted status ok if( get_money('feepaid')!=0 ) { $query = "UPDATE `persons` SET `FeePaid`=GREATEST(0, `FeePaid`)+".addslashes(get_money('feepaid')).", `Log`=CONCAT(`Log`,'\n".date("Y-m-d H:i:s").": added € ".addslashes(number_format(get_money('feepaid'), 2, ",", "."))." to fee paid (now totalling € ',`FeePaid`,') by ".addslashes($_SESSION['sess_name'])."')"; if( $topay!==false AND isset($_REQUEST['confirmonfeeok']) AND max(0, $row['FeePaid'])+get_money('feepaid')>=$topay ) { $query .= ", `Accepted`='confirmed', `Log`=CONCAT(`Log`,'\n".date("Y-m-d H:i:s").": set accepted status to confirmed (fee paid) by ".addslashes($_SESSION['sess_name'])."')"; } $query .= " WHERE `PersonID`=".addslashes($PersonID); if( doquery($query) ) { echoln("Fee updated successfully to € ".number_format(max(0, $row['FeePaid'])+get_money('feepaid'), 2, ",", ".")."."); $row['FeePaid'] = max(0, $row['FeePaid'])+get_money('feepaid'); if( $topay!==false AND isset($_REQUEST['confirmonfeeok']) AND max(0, $row['FeePaid'])+get_money('feepaid')>=$topay ) { echoln("
Set accepted status to confirmed."); } }else { echoln("Failed updating fee."); } }else { echoln("You didn't specify a valid fee, or a fee of € 0,00."); } }else { // accepted status not ok echoln("This person is not accepted or confirmed. This person does not have to pay a fee, setting the fee not possible."); } echoln(""); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln("
Person ID:".$EVENTNUMID."-".$row['PersonID']."
Name:".$row['FirstName']." ".$row['LastName']."
Body name:".$row['BodyName']."
Accepted (old):".$row['Accepted']."
Fee (to be paid):".($topay===false ? "-- unknown --" : "€ ".$topay.",--")."
Fee already paid:".($row['FeePaid']>=0 ? "€ ".number_format($row['FeePaid'], 2, ",", ".") : "-- nothing --")."
"); }else { echoln("Cannot find person."); } }else { echoln("Cannot find valid Person ID."); } echoln("

"); } echoln("

"); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln("
Person ID:
Fee paid:
"); echoln("

"); echoln("
"); echoln(""); echoln("

Please note: you can only register fees for accepted and confirmed people. Paid fees will be added to the amount already paid in the past.

"); } admin_footer(); ?>