This commit is contained in:
2022-02-19 00:09:18 -05:00
parent 44e2295bb7
commit 961b003078
3 changed files with 120 additions and 133 deletions
+71 -2
View File
@@ -682,10 +682,79 @@ class Member extends Users_Controller {
$this->table->set_heading('Date', 'Amount','Fee','Recipient','Confirmation', 'Status');
$data['sendmoney_table'] = $this->table->generate($query);
$data['sendmoney_table_result'] = $query->result();
$data['page_title'] ="Wallet";
$this->RenderUserPage('users/view_balance', $data);
$data['page_title'] ="Wallet";
$this->RenderUserPage('users/view_balance', $data);
}
public function smoney() {
$data = $this->getSessionArray();
$data['add_error'] = '';
$data['amount'] = 0;
$this->load->model('combo_model');
$data['recipient_account'] = $this->input->post('recipient_account');
$data['recipient_account_combo'] = $this->combo_model->getUserRecipientCombo('recipient_account', $_SESSION['member_id'], $data['recipient_account']);
$data['fee'] = $data['total'] =0;
$data['comment'] = '';
// $data['fee'] = 0;
//$data['escrow_balance'] = 0;
if ($_POST) {
$data['comment'] = $this->input->post('comment');
$data['amount'] = $this->input->post('amount') + 0; // must be number [still in full will be cents to go to backend latter]
if ($data['amount'] == 0 || $data['amount'] < 0 || $data['amount'] == '' || $data['recipient_account'] == '') {
$out['error'] = 'Amount & Recipient Account Required';
$data['add_error'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $out['error'] . "</div></div>";
if ($data['amount'] > 0) {
$outx = $this->transactionFee($data['amount'], $_SESSION['member_id']);
$data['total'] = $outx['total_amount'];
$data['fee'] = $outx['processing_fee'];
}
} else {
$outx = $this->transactionFee($data['amount'], $_SESSION['member_id']);
$data['total'] = $outx['total_amount'];
$data['fee'] = $outx['processing_fee'];
$TotalAmount = $data['total'];
// now let us do initial check if you have enough money
if ($_SESSION['current_balance'] < $TotalAmount) {
$out['error'] = 'You do not have enough balance for this transfer';
$data['add_error'] = "<div class=\"text-left\"><div class=\"alert alert-danger no-border\">" . $out['error'] . "</div></div>";
} else {
$this->session->set_flashdata('pending_sendmoney', $data);
redirect('member/confirmwithdraw');
}
}
}
$this->load->library('table');
$this->table->set_template($this->template);
$mysql = "SELECT m.added::date AS date,m.terminatingamount*0.01 AS amount,m.fee*0.01 as fee, "
. "r.firstname||' '||r.lastname||'<br><b>Acc:</b>'||r.account_no||'-'||b.name AS Recitient,mp.confirmation,"
. "CASE WHEN m.status=1 THEN 'Pending' WHEN m.status=3 THEN 'Cancelled' WHEN m.status=5 THEN 'Completed' ELSE '' END AS Status "
. "FROM money_transfer m "
. "LEFT JOIN sendmoney_recipient r ON r.id = m.recipientid "
. "LEFT JOIN bank_entity_codes b ON b.code = r.bank_code "
. "LEFT JOIN members_payments mp ON mp.what_sendmoney = m.id "
. "WHERE m.member_id =" . $_SESSION['member_id'] . " AND mp.confirmation IS NOT NULL ORDER BY m.id DESC LIMIT 4";
$query = $this->db->query($mysql);
$this->table->set_heading('Date', 'Amount','Fee','Recipient','Confirmation', 'Status');
$data['sendmoney_table'] = $this->table->generate($query);
$data['sendmoney_table_result'] = $query->result();
$data['page_title'] ="Wallet";
$this->RenderUserPage('users/view_smoney', $data);
}
public function fee() {
$amount = $this->input->get('amount') + 0;
$res = $this->transactionFee($amount, $_SESSION['member_id']);