public function indexAction() { $this->view->form = $searchform = new Savingswithdrawal_Form_Search(); $fixedSavings = new Fixedtransaction_Model_fixedSavings(); $dbobj = new Savingsdeposit_Model_Savingsdeposit(); if ($this->_request->isPost() && $this->_request->getPost('Search')) { $formdata = $this->_request->getPost(); $acc = $this->_request->getPost('accNum'); if ($searchform->isValid($formdata)) { $validaccno = $dbobj->savingsAccountsSearch($acc); $tagAcc = $this->view->adm->getsingleRecord('ourbank_accounts', 'tag_account', 'account_number', $acc); $mtype = $this->view->adm->getsingleRecord('ourbank_accounts', 'membertype_id', 'account_number', $acc); if ($tagAcc != 0 && $mtype == 1) { $this->view->error = "Withdrawal not allowed use group account to withdrawal"; } else { if ($validaccno) { $Balance = $this->view->ms->getbalance($acc); foreach ($Balance as $balances) { $balance = $balances['Balance']; } if ($balance > 0) { $this->_redirect("/savingswithdrawal/index/withdrawal/accNum/" . base64_encode($acc)); } else { $this->view->error = "Zero balance withdrawal not allowed."; } } else { $this->view->error = "Account number does not exist"; } } } } }
public function indexAction() { $this->view->form = $searchform = new Savingsdeposit_Form_Search(); $fixedSavings = new Fixedtransaction_Model_fixedSavings(); $dbobj = new Savingsdeposit_Model_Savingsdeposit(); if ($this->_request->isPost() && $this->_request->getPost('Search')) { $formdata = $this->_request->getPost(); $acc = $this->_request->getPost('accNum'); if ($searchform->isValid($formdata)) { $validaccno = $dbobj->savingsAccountsSearch($acc); $tagAcc = $this->view->adm->getsingleRecord('ourbank_accounts', 'tag_account', 'account_number', $acc); $mtype = $this->view->adm->getsingleRecord('ourbank_accounts', 'membertype_id', 'account_number', $acc); if ($tagAcc != 0 && $mtype == 1) { $this->view->error = "Deposit not allowed use group account to deposit"; } else { if ($validaccno) { $this->_redirect("/savingsdeposit/index/deposit/accNum/" . base64_encode($acc)); } else { $this->view->error = "Enter valid saving account number"; } } } } }