$studentId = $_REQUEST['student_id']; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $amount = $_REQUEST['AMOUNT']; $comment = $_REQUEST['COMMENT']; $mon = $_REQUEST['month_date']; $day = $_REQUEST['day_date']; $yr = $_REQUEST['year_date']; $type_ = $_REQUEST['TYPE']; $username = User('USERNAME'); $monthnames = array(1 => 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'); $mon = array_search($mon, $monthnames); $date_ = $mon . '/' . $day . '/' . $yr; Payment::addPayment($amount, $type_, $studentId, $date_, $comment, $username); } echo '<SCRIPT language=javascript>opener.document.location = "Modules.php?modname=' . $_REQUEST['modname'] . "&student_id={$studentId}" . '"; window.close();</script>'; } else { if ($_REQUEST['modfunc'] == 'remove') { if (DeletePrompt(_('payment'), _('refund'))) { include 'modules/Billing/classes/Auth.php'; include 'modules/Billing/classes/Payment.php'; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $Id = $_REQUEST['id']; $username = User('USERNAME'); Payment::refundPayment($Id, $username); }
require '../../../functions/Current.php'; require '../../../functions/PopTable.php'; require '../../../functions/DrawTab.fnc.php'; require '../../../functions/DBGet.fnc.php'; require '../../../functions/User.fnc.php'; require '../../../functions/ParseML.fnc.php'; require '../../../functions/ProgramTitle.fnc.php'; require '../classes/Auth.php'; require '../classes/Payment.php'; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $studentId = $_REQUEST['STUDENT_ID']; $amount = $_REQUEST['AMOUNT']; $comment = $_REQUEST['COMMENT']; $mon = $_REQUEST['month_date']; $day = $_REQUEST['day_date']; $yr = $_REQUEST['year_date']; $type_ = $_REQUEST['TYPE']; $monthnames = array(1 => 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'); $mon = array_search($mon, $monthnames); $date_ = $mon . '/' . $day . '/' . $yr; if (Payment::addPayment($amount, $type_, $studentId, $date_, $comment)) { echo '{"result":[{"success":true}]}'; } else { echo '{"result":[{"success":false}]}'; } } else { echo '{"result":[{"success":false}]}'; }
<?php //Component Payment loadLib('payment'); loadLib('clinic'); //loadJS('payment.js','payment'); //loadCSS('payment.css','payment'); switch (getVar('task')) { case 'add_payment': //check if the user has rights to add a payment if (current_user_can('add_payment')) { Payment::addPayment(getVar('patient_id'), getVar('clinic'), getVar('practitioner_id'), getVar('description'), getVar('amount')); error_log("Adding the payment", 0); setResponse('Payment Registered... !!'); } break; case 'get_clinics': //get the clinics to use in the payment echo $clinics = json_encode(Clinic::getClinics()); break; case 'get_fees': echo $fees = json_encode(Payment::getFees()); break; case 'get_users': echo $users = json_encode(get_users('role=practitioner')); break; } switch (getView()) { case 'list': //get all the payments from the clinics $payments = Payment::getAllPayments();