public function testIsActive() { $date = new \DateTime(); $date->sub(new \DateInterval('P1D')); $this->entity->setActivation($date); $this->assertTrue($this->entity->isActive()); }
public function getNoteFees($id = null) { if (is_null($id)) { $id = $this->id_note; } $fee = new Fee(); $fees = $fee->fetchAll($id); return $fees; }
public static function process_fee_payment($amount, $payment_mode, $admission_no, $paid_by) { $new_fee_balance = Fee::get_pending_fee_balance($admission_no) - $amount; DB::Table('students_tb')->where('admission_no', $admission_no)->update(array('current_balance' => $new_fee_balance)); $transaction_array = array('date_of_payment' => date('Y-m-d H:i:s'), 'amount' => $amount, 'served_by' => 12, 'paid_by' => $paid_by, 'admission_no' => $admission_no, 'payment_mode' => $payment_mode); DB::Table('fee_transactions')->insert($transaction_array); }
public function budget($id) { $this->view = null; $user = User::find($id); if (!$user) { echo json_encode(array('success' => false)); return; } $ret = array('active' => $user->getActiveBudgets()); if ($user->getId() == Session::uid()) { $ret = array_merge($ret, array('feeSums' => Fee::getSums(), 'totalManaged' => money_format('%i', $user->getTotalManaged()), 'remainingFunds' => money_format('%i', $user->setRemainingFunds()), 'allocated' => money_format('%i', $user->getAllocated()), 'submitted' => money_format('%i', $user->getSubmitted()), 'paid' => money_format('%i', $user->getPaid()), 'transfered' => money_format('%i', $user->getTransfered()), 'transfersDetails' => $user->getBudgetTransfersDetails(), 'available' => $user->getBudget())); } echo json_encode(array('success' => true, 'budget' => $ret)); return; }
public function collect() { $loggedUser = Auth::user(); $fee = Fee::where('status', 'ENABLED')->find(); $specialFees = SpecialFee::where('status', 'ENABLED'); $users = User::where('role', 'USER')->get(); foreach ($users as $user) { $amount = $fee->amount; foreach ($specialFees as $specialFee) { if ($specialFee->user_id == $user->id) { $amount = $specialFee->amount; } } $user->balance = $user->balance - $amount; $user->save(); } }
public function __construct() { parent::__construct(); $this->name = strtolower(preg_replace('/Layout$/', '', get_class($this))); $user_id = Session::uid(); $user = User::find($user_id); $this->currentUser['id'] = $user_id; $this->currentUser['username'] = $user_id ? $user->getUsername() : ''; $this->currentUser['nickname'] = $user_id ? $user->getNickname() : ''; $this->currentUser['is_runner'] = empty($_SESSION['is_runner']) ? false : true; $this->currentUser['runningProjects'] = json_encode($user->getProjectsAsRunner()); $this->currentUser['is_payer'] = empty($_SESSION['is_payer']) ? false : true; $this->currentUser['is_admin'] = !$user->getIs_admin() ? false : true; if ($user_id) { Utils::initUserById($user_id); $user->findUserById($user_id); $this->currentUser['budget'] = array('feeSums' => Fee::getSums(), 'totalManaged' => money_format('$ %i', $user->getTotalManaged()), 'remainingFunds' => money_format('$ %i', $user->setRemainingFunds()), 'allocated' => money_format('$ %i', $user->getAllocated()), 'submitted' => money_format('$ %i', $user->getSubmitted()), 'paid' => money_format('$ %i', $user->getPaid()), 'transfered' => money_format('$ %i', $user->getTransfered()), 'transfersDetails' => $user->getBudgetTransfersDetails(), 'available' => $user->getBudget()); $this->currentUser['can'] = array('addProject' => $user->getIs_admin() || $user->isRunner() || $user->isPaypalVerified()); $this->currentUser['is_internal'] = $user->isInternal(); $this->currentUser['budgetAuthorized'] = strpos(BUDGET_AUTHORIZED_USERS, "," . $user_id . ",") !== false; } }
public function setPaid($id, $paid) { try { $user = User::find(Session::uid()); // Check if we have a payer if (!$user->isPayer()) { throw new Exception('Nothing to see here. Move along!'); } // Get clean data $paid = $paid ? true : false; $notes = trim($_POST['notes']); if (!$notes) { throw new Exception('You must write a note!'); } $fund_id = Fee::getFundId($id); // Exit of this script if (!Fee::markPaidById($id, $user->getId(), $notes, $paid, false, $fund_id)) { throw new Exception('Payment Failed!'); } /* Only send the email when marking as paid. */ if ($paid) { $fee = Fee::getFee($fee_id); $workitem = new WorkItem($fee['worklist_id']); $summary = $workitem->getSummary(); $fee_user = User::find($fee['user_id']); $subject = "Worklist.net paid you " . $fee['amount'] . " for " . $summary; $body = "Your Fee was marked paid.<br/>" . "Job <a href='" . SERVER_URL . $fee['worklist_id'] . "'>#" . $fee['worklist_id'] . ': ' . $summary . '</a><br/>' . "Fee Description : " . nl2br($fee['desc']) . "<br/>" . "Paid Notes : " . nl2br($notes) . "<br/><br/>" . "Contact the job Designer with any questions<br/><br/>Worklist.net<br/>"; if (!Utils::send_email($fee_user->getUsername(), $subject, $body)) { error_log("FeeController::setPaid: Utils::send_email failed"); } } return $this->setOutput(array('success' => true, 'notes' => 'Payment has been saved!')); } catch (Exception $e) { return $this->setOutput(array('success' => false, 'notes' => $e->getMessage())); } }
# You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #************************************************************************** header("Content-Type: text/xml"); error_reporting(1); session_name('CentreSIS'); session_start(); require '../../../config.inc.php'; require '../../../database.inc.php'; 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/Fee.php'; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $feeId = $_REQUEST['FEE_ID']; if (Fee::deleteFee($feeId)) { echo '{"result":[{"success":true}]}'; } else { echo '{"result":[{"success":false}]}'; } } else { echo '{"result":[{"success":false}]}'; }
# along with this program. If not, see <http://www.gnu.org/licenses/>. #************************************************************************** header("Content-Type: text/xml"); error_reporting(1); session_name('CentreSIS'); session_start(); require '../../../config.inc.php'; require '../../../database.inc.php'; 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/Fee.php'; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $feeId = $_REQUEST['FEE_ID']; $username = User('USERNAME'); if (Fee::removeWaiver($feeId)) { echo '{"result":[{"success":true}]}'; } else { echo '{"result":[{"success":false}]}'; } } else { echo '{"result":[{"success":false}]}'; }
require '../../../functions/User.fnc.php'; require '../../../functions/ParseML.fnc.php'; require '../../../functions/ProgramTitle.fnc.php'; require '../classes/Auth.php'; require '../classes/Fee.php'; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $studentIds = $_REQUEST['STUDENT_ID']; $amount = $_REQUEST['AMOUNT']; $title = $_REQUEST['TITLE']; $comment = $_REQUEST['COMMENT']; $module = $_REQUEST['MODULE']; $assMon = $_REQUEST['month_assigned']; $assDay = $_REQUEST['day_assigned']; $assYr = $_REQUEST['year_assigned']; $dueMon = $_REQUEST['month_due']; $dueDay = $_REQUEST['day_due']; $dueYr = $_REQUEST['year_due']; $username = User('USERNAME'); $monthnames = array(1 => 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'); $dueMon = array_search($dueMon, $monthnames); $dueDate = $dueMon . '/' . $dueDay . '/' . $dueYr; $assMon = array_search($assMon, $monthnames); $assignedDate = $assMon . '/' . $assDay . '/' . $assYr; Fee::addMassFee($amount, $title, $studentIds, $dueDate, $assignedDate, $comment, $module, $username); echo '{"result":[{"success":true}]}'; } else { echo '{"result":[{"success":false}]}'; }
$assignedDate = $assMon . '/' . $assDay . '/' . $assYr; Fee::addFee($amount, $title, $studentId, $dueDate, $assignedDate, $comment, $module, $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(_('fee'), _('waive'))) { include 'modules/Billing/classes/Auth.php'; include 'modules/Billing/classes/Fee.php'; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $feeId = $_REQUEST['fee_id']; $username = User('USERNAME'); Fee::waiveFee($feeId, $username); } $displayList = true; } } else { if (isset($_REQUEST['student_id'])) { $displayList = true; } else { $displaySearch = true; } } } } if ($displayList) { $studentId = $_REQUEST['student_id']; $query = "SELECT\r\n fee_id,\r\n amount,\r\n title,\r\n inserted_by,\r\n assigned_date AS assigned_date,\r\n due_date AS due_date,\r\n comment,\r\n waived,\r\n waived_by,\r\n waived_date\r\n FROM\r\n BILLING_FEE\r\n WHERE\r\n student_id = {$studentId}\r\n\r\n ORDER BY fee_id";
if ($fee) { $data = $fee; } else { $data['err'] = "Impossible de récupérer le frais"; } //Le frais est récupéré en AJAX, donc on retourne du JSON exploitable $response = $app->response(); $response['Content-Type'] = 'application/json'; $response->body(json_encode($data)); } })->name('fee'); $app->post('/fee/:id(/:action)', function ($id = null, $action = null) use($app) { $post = $app->request->post(); if (isset($id) && isset($action)) { switch ($action) { case 'edit': $fee = new Fee($post); $fee->id_fee = $id; if ($fee->save()) { $fee = $fee->fetch(); } else { $err = "No"; } $app->redirect('/note/' . $fee->id_note); break; default: # code... break; } } })->name('fee');
/** * Add fee to the current transaction. * * @param array $feeData array fee data hash array * @param object $user user (patron) object * @param string $currency currency * * @return boolean True on success, false otherwise. * @access public */ public function addFee($feeData, $user, $currency) { $fee = new Fee(); $fee->user_id = $user->id; $fee->title = $feeData['title']; $fee->type = $feeData['fine']; $fee->amount = $feeData['amount']; $fee->currency = $currency; if (!$fee->amount) { return false; } if (!$fee->insert()) { return false; } $transaction_fee_obj = new Transaction_fees(); $transaction_fee_obj->transaction_id = $this->id; $transaction_fee_obj->fee_id = $fee->id; if (!$transaction_fee_obj->insert()) { return false; } return true; }
public function addFeesToCompletedJob($include_review = false) { // workitem is DONE, calculate the creator fee based on project roles // and accepted bid if ($this->hasAcceptedBids()) { $reviewer_fee = 0; $reviewer_fee_desc = '/^Code Review - comment/'; $reviewer_fee_added = false; $fees = $this->getFees($this->getId()); foreach ($fees as $fee) { // find the accepted bid amount if ($fee['desc'] == 'Accepted Bid') { $accepted_bid_amount = $fee['amount']; } if (preg_match($reviewer_fee_desc, $fee['desc'])) { $reviewer_fee_added = true; } } if (!$reviewer_fee_added && $include_review) { $project = new Project(); $project_roles = $project->getRoles($this->getProjectId(), "role_title = 'Reviewer'"); if (count($project_roles) != 0) { error_log("[FEES] we have a role for reviewer"); $reviewer_role = $project_roles[0]; if ($reviewer_role['percentage'] !== null && $reviewer_role['min_amount'] !== null) { $reviewer_fee = $reviewer_role['percentage'] / 100 * $accepted_bid_amount; if ((double) $reviewer_fee < $reviewer_role['min_amount']) { $reviewer_fee = $reviewer_role['min_amount']; } // add the fee $reviewer_fee_detail = 'Code Review - comment'; Fee::add($this->getId(), $reviewer_fee, $fee_category, $reviewer_fee_detail, $this->getCReviewerId(), $is_expense, $is_rewarder); // and reduce the runners budget $myRunner = new User(); $myRunner->findUserById($this->getRunnerId()); $myRunner->updateBudget(-$runner_fee, $this->getBudget_id()); } } } } }
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #************************************************************************** //header("Content-Type: text/xml"); error_reporting(1); session_name('CentreSIS'); session_start(); require '../../../config.inc.php'; require '../../../database.inc.php'; 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/Fee.php'; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $studentId = $_REQUEST['STUDENT_ID']; //$studentId = 1; $json = Fee::getFees($studentId); echo '{"result":[{"success":true}],' . $json . '}'; } else { echo '{"result":[{"success":false}]}'; }
public function reports() { if (empty($_SESSION['is_runner']) && empty($_SESSION['is_payer']) && isset($_POST['paid'])) { $this->view = null; Utils::redirect("jobs"); return; } $this->view = new ReportsView(); if (!empty($_REQUEST['payee'])) { $payee = new User(); $payee->findUserByNickname($_REQUEST['payee']); $_REQUEST['user'] = $payee->getId(); } $showTab = 0; if (!empty($_REQUEST['view'])) { if ($_REQUEST['view'] == 'chart') { $showTab = 1; } if ($_REQUEST['view'] == 'payee') { $showTab = 2; } } $this->write('showTab', $showTab); $w2_only = 0; if (!empty($_REQUEST['w2_only'])) { if ($_REQUEST['w2_only'] == 1) { $w2_only = 1; } } $this->write('w2_only', $w2_only); $_REQUEST['name'] = '.reports'; if (isset($_POST['paid']) && !empty($_POST['paidList']) && !empty($_SESSION['is_payer'])) { // we need to decide if we are dealing with a fee or bonus and call appropriate routine $fees_id = explode(',', trim($_POST['paidList'], ',')); foreach ($fees_id as $id) { $query = "SELECT `id`, `bonus` FROM `" . FEES . "` WHERE `id` = {$id} "; $result = mysql_query($query); $row = mysql_fetch_assoc($result); if ($row['bonus']) { Bonus::markPaidById($id, $user_paid = 0, $paid = 1, true, $fund_id = false); } else { Fee::markPaidById($id, $user_paid = 0, $paid_notes = '', $paid = 1, true, $fund_id = false); } } } parent::run(); }
public function updateSandboxUrl($id) { $this->view = null; try { $workitem = new WorkItem($id); $user = User::find(Session::uid()); if ($workitem->getMechanicId() != $user->getId() && !$workitem->getIsRelRunner() || $workitem->getStatus() == 'Done') { throw new Exception('Action not allowed'); } $url = trim($_POST['url']); $notes = trim($_POST['notes']) ? trim($_POST['notes']) : null; $workitem->setSandbox($url); $workitem->save(); if ($notes) { //add review notes $fee_amount = 0.0; $fee_desc = 'Review Notes: ' . $notes; $mechanic_id = $workitem->getMechanicId(); $itemid = $workitem->getId(); $is_expense = 1; $fee_category = ''; Fee::add($itemid, $fee_amount, $fee_category, $fee_desc, $mechanic_id, $is_expense); } $journal_message = '\\#' . $workitem->getId() . ' updated by @' . $user->getNickname() . " Branch URL: {$url}"; Utils::systemNotification($journal_message); echo json_encode(array('success' => false, 'message' => $journal_message)); } catch (Exception $e) { echo json_encode(array('success' => false, 'message' => $e->getMessage())); } }
require '../classes/Auth.php'; require '../classes/Fee.php'; $auth = new Auth(); $staffId = User('STAFF_ID'); $profile = User('PROFILE'); if ($auth->checkAdmin($profile, $staffId)) { $studentId = $_REQUEST['STUDENT_ID']; $amount = $_REQUEST['AMOUNT']; $title = $_REQUEST['TITLE']; $comment = $_REQUEST['COMMENT']; $module = $_REQUEST['MODULE']; $assMon = $_REQUEST['month_assigned']; $assDay = $_REQUEST['day_assigned']; $assYr = $_REQUEST['year_assigned']; $dueMon = $_REQUEST['month_due']; $dueDay = $_REQUEST['day_due']; $dueYr = $_REQUEST['year_due']; $username = User('USERNAME'); $monthnames = array(1 => 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'); $dueMon = array_search($dueMon, $monthnames); $dueDate = $dueMon . '/' . $dueDay . '/' . $dueYr; $assMon = array_search($assMon, $monthnames); $assignedDate = $assMon . '/' . $assDay . '/' . $assYr; if (Fee::addFee($amount, $title, $studentId, $dueDate, $assignedDate, $comment, $module, $username)) { echo '{"result":[{"success":true}]}'; } else { echo '{"result":[{"success":false}]}'; } } else { echo '{"result":[{"success":false}]}'; }
default: # code... break; } } else { $note = new Note(); $note = $note->fetch($id); $app->render('note/single.php', array('note' => $note)); } }); $app->post('/note/:id(/:action)', function ($id, $action = null) use($app) { if (isset($action)) { switch ($action) { case 'add_fee': $post = $app->request->post(); $fee = new Fee($post); $fee->id_note = $id; if (!$fee->save()) { $err = "No"; } $app->redirect('/note/' . $fee->id_note); break; default: # code... break; } } }); $app->get('/notes', function () use($app) { $note = new Note(); $notes = $note->fetchAll($_SESSION['userinfo']->id_user);