public function init() { $this->view->pageTitle = 'Fee'; $storage = new Zend_Auth_Storage_Session(); $data = $storage->read(); if (!$data) { $this->_redirect('index/login'); // once session get expired it will redirect to Login page } $sessionName = new Zend_Session_Namespace('ourbank'); $userid = $this->view->createdby = $sessionName->primaryuserid; // get the stored session id $login = new App_Model_Users(); $loginname = $login->username($userid); foreach ($loginname as $loginname) { $this->view->username = $loginname['username']; // get the user name } // if (($this->view->globalvalue[0]['id'] == 0)) { // $this->_redirect('index/logout'); // } $this->view->adm = new App_Model_Adm(); $ledger = new Ledger_Model_Ledger(); $ledger1 = $ledger->fetchAllLedger1(); $flag = 0; $date = date("y/m/d H:i:s"); foreach ($ledger1 as $ledger2) { if ($ledger2->header == 'Fee') { $flag = 1; } } if ($flag == 0) { $glInsert = $ledger->insertGlcode(array('id' => '', 'glcode' => 'I01000', 'ledgertype_id' => 1, 'header' => 'Fee', 'description' => 'Fee in income', 'created_date' => $date, 'created_by' => 1)); } }
public function init() { $this->view->title = "Management"; $date = date("y/m/d H:i:s"); $ledger = new Ledger_Model_Ledger(); $ledger1 = $ledger->fetchAllLedger1(); $flag = 0; if ($ledger1) { $flag = 1; } $defaultledger = array('Bank', 'Cash', 'Loans', 'Savings', 'Interest', 'Fee', 'SrvChrg', 'Penalty', 'IntOnLoan', 'MeetingExpenses', 'OtherExpenses', 'IntOnSavings'); $glcode = array('A01000', 'A02000', 'A03000', 'L01000', 'I01000', 'I02000', 'I03000', 'I04000', 'I05000', 'E01000', 'E02000', 'E03000'); $ledgertype = array(3, 3, 3, 4, 1, 1, 1, 1, 1, 2, 2, 2); $description = array('Bank', 'Cash', 'Loans', 'Savings', 'Interest', 'Fee', 'ServiceCharge', 'Penalty', 'InterestOnLoans', 'MeetingExpenses', 'OtherExpenses', 'InterestOnSavings'); if ($flag == 0) { for ($i = 0; $i <= count($defaultledger); $i++) { $glInsert = $ledger->insertGlcode(array('glcode' => $glcode[$i], 'ledgertype_id' => $ledgertype[$i], 'header' => $defaultledger[$i], 'description' => $description[$i], 'created_by' => 1, 'created_date' => $date)); } } }
public function getglcodeAction() { $this->_helper->layout->disableLayout(); $ledger_id = $this->_request->getParam('ledger_id'); $ledger = new Ledger_Model_Ledger(); $this->view->gldetails = $ledger->fetchGlcodeforledgerid($ledger_id); }
public function addfunderAction() { //Acl // $this->view->title='Add Institution'; // $access = new App_Model_Access(); // $checkaccess = $access->accessRights('Funder',$this->view->globalvalue[0]['name'],'addfunderAction'); // if (($checkaccess != NULL)) { $this->view->title = $this->view->translate("Funder Details"); //create instance of funder $form = new Funderdetails_Form_funderdetails($this->view->id); $this->view->form = $form; //load funder type drop down $fundertype = $this->view->adm->viewRecord("ourbank_master_fundertype", "id", "DESC"); foreach ($fundertype as $fundertype1) { $form->type->addMultiOption($fundertype1['id'], $fundertype1['name']); } // get poster data if ($this->_request->isPost() && $this->_request->getPost('Submit')) { $formData = $this->_request->getPost(); //poster data validation if ($form->isValid($formData)) { $funder = new Funderdetails_Model_funderdetails(); $funders = $funder->getfunder(); $date = date("y/m/d H:i:s"); if (!$funders) { $ledger = new Ledger_Model_Ledger(); $glInsert = $ledger->insertGlcode(array('id' => '', 'glcode' => 'L02000', 'ledgertype_id' => 4, 'header' => $formData['name'], 'description' => $formData['name'], 'created_date' => $date, 'created_by' => $this->view->createdby)); $glcode_id = $funder->findmaxlevel(); foreach ($glcode_id as $glcode_id) { $lastid = $glcode_id->lastid; } $this->view->adm->addRecord("ourbank_funder", array('id' => '', 'code' => 0, 'type' => $formData['type'], 'name' => $formData['name'], 'glcode_id' => $lastid, 'status' => $formData['status'], 'created_by' => $this->view->createdby, 'created_date' => $date)); $this->_redirect('/funder'); } else { $glfunder = $funder->findmaxfunder(); foreach ($glfunder as $glfunder) { $lastfunderid = $glfunder->lastid; } $funder = new Funderdetails_Model_funderdetails(); $funderslast = $funder->getfunderlast($lastfunderid); foreach ($funderslast as $funderslast) { $glid = $funderslast['glcode_id']; } $gllast = $funder->getglcode($glid); foreach ($gllast as $gllast) { $glcode1 = $gllast['glcode']; } $ini = substr($glcode1, 0, 1); $last = substr($glcode1, 1, 5); $last += 1000; $last = str_pad($last, 5, 0, STR_PAD_LEFT); $glcode = $ini . $last; $glcode; $ledger = new Ledger_Model_Ledger(); $glInsert = $ledger->insertGlcode(array('id' => '', 'glcode' => $glcode, 'ledgertype_id' => 4, 'header' => $formData['name'], 'description' => $formData['name'], 'created_date' => $date, 'created_by' => $this->view->createdby)); $glcode_id = $funder->findmaxlevel(); foreach ($glcode_id as $glcode_id) { $lastid = $glcode_id->lastid; } $this->view->adm->addRecord("ourbank_funder", array('id' => '', 'code' => 0, 'type' => $formData['type'], 'name' => $formData['name'], 'glcode_id' => $lastid, 'status' => $formData['status'], 'created_by' => $this->view->createdby, 'created_date' => $date)); $this->_redirect('/funder'); } } } }