function getTotalPayableAmount($admin, $user_level) { if ($this->getData(TRANS_TRANSACTION_STATUS) == TRANS_STATUS_PAYMENT && $user_level != TRANS_LEVEL_PAYMENT_OFFICER && $user_level != TRANS_LEVEL_ADMIN_OFFICER && $user_level != TRANS_LEVEL_ROOT_OFFICER) { $this->debug("addCashPayment Failed, user level {$user_level} of {$admin} is not allowed."); $this->setError(-1, "addCashPayment mode failed, user level {$user_level} not allowed."); return -1; } $clsTPS = new EBPLSTransactionPaymentSchedule($this->m_dbLink); $amount_paid = $clsTPS->getTotalAmountPaid($this->getData(TRANS_ID)); $amount_due = $clsTPS->getTotalAmountDue($this->getData(TRANS_ID)); return floatval($amount_due) - floatval($amount_paid); }