public function addAction() { //Acl // $access = new App_Model_Access(); // $checkaccess = $access->accessRights('Fee',$this->view->globalvalue[0]['name'],'addAction'); // if (($checkaccess != NULL)) { $form = new Fee_Form_Fee(); $this->view->form = $form; //$appliesTo = new Feecommon_Model_Feecommon(); $subOffice = new Fee_Model_Fee(); $hierarchy_id = $this->view->adm->viewRecord("ourbank_officehierarchy", "id", "DESC"); foreach ($hierarchy_id as $hierarchy_id) { $form->hierarchy_id->addMultiOption($hierarchy_id['id'], $hierarchy_id['type']); } $glcode = $this->view->adm->viewRecord("ourbank_feeamounttypes", "id", "DESC"); foreach ($glcode as $glcode) { $form->amountype_id->addMultiOption($glcode['id'], $glcode['name']); } $glcode = $this->view->adm->viewRecord("ourbank_category", "id", "DESC"); foreach ($glcode as $glcode) { $form->category_id->addMultiOption($glcode['id'], $glcode['name']); } $glcode = $this->view->adm->viewRecord("ourbank_feetype", "id", "DESC"); foreach ($glcode as $glcode) { $form->feetype_id->addMultiOption($glcode['id'], $glcode['name']); } // $this->view->categorydetails=$appliesTo->getcategory(); //$this->view->memberdetails=$appliesTo->getmembertypes(); if ($this->_request->isPost() && $this->_request->getPost('Submit')) { $formData = $this->_request->getPost(); if ($this->_request->isPost()) { if ($form->isValid($formData)) { $maxid = $subOffice->findlastlevel(); foreach ($maxid as $maxid1) { $lastid = $maxid1->lastid; } for ($j = 1; $j <= 1; $j++) { $fetchglcodedetails = $this->view->adm->editRecord('ourbank_glcode', $lastid); $ledgertype_id = $fetchglcodedetails[0]['ledgertype_id']; $glcode = $fetchglcodedetails[0]['glcode']; $header = $fetchglcodedetails[0]['header']; $lastid; $ledger = new Officedefault_Model_officedefault(); $genarateGlsub = $subOffice->genarateGlsubCode1($ledgertype_id, $lastid); $glsubcode = $genarateGlsub->id; if ($glsubcode) { $ini = substr($glsubcode, 0, 1); $last = substr($glsubcode, 1, 5); $last += 1; $last = str_pad($last, 5, 0, STR_PAD_LEFT); $glsubcode = $ini . $last; $glsubcode; } else { $glcode1 = $ledger->fetchGlcode($j); $glcode = $glcode1->glcode; $ini = substr($glcode, 0, 1); $last = substr($glcode, 1, 5); $last += 1; $last = str_pad($last, 5, 0, STR_PAD_LEFT); $glsubcode = $ini . $last; $glsubcode; } $createdate = $this->_request->getParam('createddate'); $headername = "Fee"; $gInsert = $ledger->insertGlsubcode(array('id' => '', 'office_id' => $formData['hierarchy_id'], 'glsubcode' => $glsubcode, 'glcode_id' => $lastid, 'subledger_id' => $ledgertype_id, 'header' => $formData['name'], 'description' => $formData['description'], 'created_by' => $this->view->createdby)); } $glsubcode_id = $subOffice->findmaxlevel(); foreach ($glsubcode_id as $glsubcode_id) { $glsubcode = $glsubcode_id->lastid; } $formdata1 = array('name' => $formData['name'], 'description' => $formData['description'], 'hierarchy_id' => $formData['hierarchy_id'], 'feetype_id' => $formData['feetype_id'], 'glsubcode_id' => $glsubcode, 'category_id' => $formData['category_id'], 'amountype_id' => $formData['amountype_id'], 'created_by' => $this->view->createdby, 'value' => $formData['value']); $id = $this->view->adm->addRecord("ourbank_fee", $formdata1); $this->_redirect("/fee"); } } } // } else { // $this->_redirect('index/error'); // } }
public function officeaddAction() { //language translator $this->view->title = $this->view->translate("New Office"); //session $storage = new Zend_Auth_Storage_Session(); $data = $storage->read(); //redirect if not a session if (!$data) { $this->_redirect('index/login'); } $path = $this->view->baseUrl(); $officeForm = new Officedefault_Form_officedefault($path, $this->view->createdby); $this->view->form = $officeForm; $office = new Officedefault_Model_officedefault(); $this->view->officeDetails = $office->getOffice(); $this->view->officehierarchyselect = $office->officehierarchyselect(); //load hierarchy office dropdown if ($this->view->officehierarchyselect) { $officehierarchyoutid = $office->getOfficehierarchyDetailsout(); foreach ($officehierarchyoutid as $officehierarchyoutids) { $officeForm->officetype_id->addMultiOption($officehierarchyoutids->Hierarchy_level, $officehierarchyoutids->type); } } else { $officehierarchy = new Officedefault_Model_officedefault(); $officehierarchy = $officehierarchy->getOfficehierarchyDetails(); foreach ($officehierarchy as $officehierarchy) { $officeForm->officetype_id->addMultiOption($officehierarchy->id, $officehierarchy->type); } } //validate poster values if ($this->_request->isPost() && $this->_request->getPost('Submit')) { $formData = $this->_request->getPost(); if ($officeForm->isValid($formData)) { //variable for form data $officeid = $this->_request->getParam('officetype_id'); $parentofficeid = $this->_request->getParam('parentoffice_id'); $name = $this->_request->getParam('name'); $shortname = $this->_request->getParam('short_name'); $createdate = $this->_request->getParam('createddate'); if ($parentofficeid) { $lastid = $this->view->adm->addRecord("ourbank_office", array('id' => '', 'name' => $name, 'short_name' => $shortname, 'officetype_id' => $officeid, 'parentoffice_id' => $parentofficeid, 'createddate' => $createdate, 'createdby' => $this->view->createdby)); $maxid = $office->findlastlevel(); foreach ($maxid as $maxid1) { $villagelastid = $maxid1->lastid; } if ($villagelastid == $officeid) { $this->view->adm->addRecord("ourbank_master_villagelist", array('id' => '', 'village_id' => $lastid, 'name' => $name, 'name_regional' => $name, 'panchayath_id' => $this->_request->getParam('panchayath'), 'created_date' => $createdate, 'created_by' => $this->view->createdby)); $this->view->adm->addRecord("ourbank_master_village", array('id' => '', 'village_id' => $lastid, 'taluk_id' => $this->_request->getParam('taluque'), 'panchayath_id' => $this->_request->getParam('panchayath'), 'hobli_id' => $this->_request->getParam('hobli'), 'district_id' => $this->_request->getParam('district'), 'created_date' => $createdate, 'created_by' => $this->view->createdby)); } //insert glsubcode for ($j = 1; $j <= 6; $j++) { $fetchglcodedetails = $this->view->adm->editRecord('ourbank_glcode', $j); $ledgertype_id = $fetchglcodedetails[0]['ledgertype_id']; $glcode = $fetchglcodedetails[0]['glcode']; $header = $fetchglcodedetails[0]['header']; $ledger = new Officedefault_Model_officedefault(); $genarateGlsub = $ledger->genarateGlsubCode1($ledgertype_id, $j); $glsubcode = $genarateGlsub->id; if ($glsubcode) { $ini = substr($glsubcode, 0, 1); $last = substr($glsubcode, 1, 5); $last += 1; $last = str_pad($last, 5, 0, STR_PAD_LEFT); $glsubcode = $ini . $last; $glsubcode; } else { $glcode1 = $ledger->fetchGlcode($j); $glcode = $glcode1->glcode; $ini = substr($glcode, 0, 1); $last = substr($glcode, 1, 5); $last += 1; $last = str_pad($last, 5, 0, STR_PAD_LEFT); $glsubcode = $ini . $last; $glsubcode; } $headername = array('bank', 'cash', 'loans', 'savings', 'interest', 'fee'); $gInsert = $ledger->insertGlsubcode(array('id' => '', 'office_id' => $lastid, 'glsubcode' => $glsubcode, 'glcode_id' => $j, 'subledger_id' => $ledgertype_id, 'header' => $headername[$j - 1] . $lastid, 'description' => $headername[$j - 1] . $lastid, 'created_date' => $createdate, 'created_by' => $this->view->createdby)); } $this->_redirect('/officecommonview/index/commonview/id/' . $lastid); } } } }