. */ include("./include/include.php"); include("./include/g_accepted.php"); include("./include/AjaxResponse.php"); include("./include/Popup.php"); include("./include/Persons.php"); include("./include/PersonsFields/810Fee.php"); include("./include/PersonsFields/820FeePaid.php"); include("./include/PersonsFields/825FeeCheck.php"); define("POPUP_HEIGHT", 275); define("POPUP_WIDTH", 330); if( !in_array("application_editfee", $_SESSION['sess_functions']) ) { $popup = new Popup("Edit fee", "You are not authorized to see this page."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); echo $popup->createPopup(); }else { admin_header(true, true); if( !isset($_POST['fee']) AND !isset($_POST['feepaid']) ) { // Show form with data $query="SELECT `FirstName`, `LastName`, `BodyName`, `ParticipantType`, `ParticipantOrder`, `Fee`, `FeePaid` FROM `ab_bodies`, `persons` WHERE `ab_bodies`.`BodyCode`=`persons`.`BodyCode` AND `persons`.`PersonID`=".addslashes(get_int("id")); if( @mysql_num_rows( $res=doquery($query) )==1 ) { $row = mysql_fetch_array($res); $content = "
"; $content .= ""; $content .= ""; $r = 1; $content .= ""; $content .= ""; $content .= ""; if( $setup['SetupBoardApproval']=="yes" ) { if( $row["ParticipantType"]=="-" ) $content .= ""; else $content .= ""; } $content .= ""; if( $row['FeePaid']<0 ) { $feePaid = "-1"; }elseif( round($row['FeePaid'])==$row['FeePaid'] ) { $feePaid = round($row['FeePaid']); }else { $feePaid = number_format($row['FeePaid'], 2, ",", "."); } $content .= ""; $content .= "
First name:".$row["FirstName"]."
Family name:".$row["LastName"]."
Body:".$row["BodyName"]."
Participant type:-
Participant type:".$row["ParticipantType"]." (".$row["ParticipantOrder"].")
Fee:,--
Enter '-1' for automatically assigned fee
Fee paid:
Enter '-1' for not paid (this is different than paying € 0,--)
"; $content .= "
"; $content .= "

"; $content .= ""; $content .= "\"\"/ Save"; $content .= ""; $content .= "

"; $popup = new Popup("Edit fee", $content); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); echo $popup->createPopup(); }else { $content = "Error: unable to load the data. The person was not found."; $popup = new Popup("Edit fee", $content); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); echo $popup->createPopup(); } }else { // Process data if( preg_match("/^-?[0-9]+$/", $_POST['fee']) && get_int('fee')>=-1 && preg_match("/^-?[0-9]*([\.,][0-9]{1,2})?$/", $_POST['feepaid']) && $_POST['feepaid']>=-1 ) { // valid fee and feepaid entered $query="UPDATE `persons` SET `Fee`=".addslashes(get_int('fee')).", `FeePaid`=".addslashes(get_money('feepaid')).", `Log`=CONCAT(`Log`,'\n".date("Y-m-d H:i:s").": set fee to &euro ".addslashes(get_int('fee')).",-- and fee paid to € ".addslashes(number_format(get_money('feepaid'), 2, ",", "."))." by ".addslashes($_SESSION['sess_name'])."') WHERE `PersonID`=".addslashes(get_int('id')); if( doquery($query) ) { // query successfull $response = new AjaxResponse(true); $feeField = new PersonsFee(); $feePaidField = new PersonsFeePaid(); $feeCheckField = new PersonsFeeCheck(); $query = "SELECT ".$feeField->sql_columnname().", ".$feeCheckField->sql_columnname()." FROM `persons` WHERE `PersonID`=".addslashes(get_int('id')); if( ($res = doquery($query)) && mysql_num_rows($res)==1 ) { $row = mysql_fetch_assoc($res); $newFee = $feeField->display($row['Fee'], get_int('id')); $response->addRefresh("Fee_".get_int('id'), $newFee); $newFeeCheck = $feeCheckField->display($row['FeeCheck']); $response->addRefresh("FeeCheck_".get_int('id'), $newFeeCheck); } $newFeePaid = $feePaidField->display(get_money('feepaid'), get_int('id')); $response->addRefresh("FeePaid_".get_int('id'), $newFeePaid); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }else { // query failed $response = new AjaxResponse(false); $response->addRefresh("popup_content", "Error: update failed"); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); } }else { // Invalid fee or fee paid entered $response = new AjaxResponse(false); $response->addRefresh("popup_content", "Error: invalid fee or fee paid entered"); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); } } admin_footer(true, true); } ?>