diff --git a/www/application/controllers/Member.php b/www/application/controllers/Member.php index 5f254582..1510748e 100644 --- a/www/application/controllers/Member.php +++ b/www/application/controllers/Member.php @@ -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'] = "
" . $out['error'] . "
"; + 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'] = "
" . $out['error'] . "
"; + } 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||'
Acc:'||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']); diff --git a/www/application/views/site3/internal/template/view_securehead.php b/www/application/views/site3/internal/template/view_securehead.php index 5c261dd5..63e2d11d 100644 --- a/www/application/views/site3/internal/template/view_securehead.php +++ b/www/application/views/site3/internal/template/view_securehead.php @@ -1,5 +1,9 @@ - + @@ -13,22 +17,26 @@ - + - + - - + + @@ -90,7 +98,7 @@