<?php require_once "atc_finance.class.php"; $ATC = new ATC_Finance(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { try { if (!$ATC->user_has_permission(ATC_PERMISSION_FINANCE_EDIT)) { throw new ATCExceptionInsufficientPermissions("Insufficient rights to view this page"); } $ATC->add_payment($_POST['personnel_id'], $_POST['amount'], $_POST['reference'], $_POST['payment_type'], $_POST['term_id']); } catch (ATCExceptionInsufficientPermissions $e) { header("HTTP/1.0 401 Unauthorised"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCExceptionDBError $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCExceptionDBConn $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCException $e) { header("HTTP/1.0 400 Bad Request"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (Exception $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } exit; } $ATC->gui_output_page_header('Finance'); if (!$ATC->user_has_permission(ATC_PERMISSION_FINANCE_VIEW)) { throw new ATCExceptionInsufficientPermissions("Insufficient rights to view this page");