Exemplo n.º 1
0
 public function deposit($acc, $amount, $date, $type, $transactionMode, $description, $paymenttype_details, $createdby)
 {
     $cl = new App_Model_dateConvertor();
     $db = Zend_Db_Table::getDefaultAdapter();
     $db->setFetchMode(Zend_Db::FETCH_OBJ);
     $accData = $this->search($acc);
     foreach ($accData as $accData) {
         $accId = $accData->accId;
         $gl = $accData->gl;
         $officeid = $accData->officeid;
     }
     // Transaction entry
     $input = array('account_id' => $accId, 'glsubcode_id_to' => $gl, 'transaction_date' => $cl->phpmysqlformat($date), 'amount_from_bank' => $amount, 'transactiontype_id' => 2, 'recordstatus_id' => 3, 'paymenttype_id' => $transactionMode, 'paymenttype_details' => $paymenttype_details, 'transaction_description' => $description, 'balance' => $amount, 'confirmation_flag' => 0, 'created_by' => $createdby);
     $db->insert("ourbank_transaction", $input);
     $tranId = $db->lastInsertId('ourbank_transaction');
     // Saving transaction entry
     $saving = array('transaction_id' => $tranId, 'account_id' => $accId, 'transaction_date' => $cl->phpmysqlformat($date), 'transactiontype_id' => 2, 'glsubcode_id_to' => $gl, 'amount_from_bank' => $amount, 'paymenttype_id' => $transactionMode, 'paymenttype_details' => $paymenttype_details, 'transaction_description' => $description, 'transaction_by' => $createdby);
     $db->insert('ourbank_savings_transaction', $saving);
     if ((substr($acc, 4, 1) == 2 || substr($acc, 4, 1) == 3) && $type == 2) {
         $group = $this->getMember($acc);
         $count = count($group);
         foreach ($group as $group) {
             $Accid = $this->getAccountid($group->id);
             $groupsaving = array('transaction_id' => $tranId, 'account_id' => $Accid, 'member_id' => $group->id, 'transaction_date' => $cl->phpmysqlformat($date), 'transaction_type' => 2, 'transaction_amount' => $amount / $count, 'transacted_by' => $createdby);
             $db->insert('ourbank_group_savingstransaction', $groupsaving);
         }
     }
     // Insertion into Liabilities
     $liabilities = array('office_id' => $officeid, 'glsubcode_id_from' => '', 'glsubcode_id_to' => $gl, 'transaction_id' => $tranId, 'debit' => $amount, 'record_status' => 3);
     $db->insert('ourbank_Liabilities', $liabilities);
     $glresult = $this->getGlcode($officeid);
     if ($glresult) {
         foreach ($glresult as $glresult) {
             $cashglsubocde = $glresult->id;
         }
     } else {
         $cashglsubocde = 0;
     }
     // Insertion into Assets ourbank_Assets
     $assets = array('office_id' => $officeid, 'glsubcode_id_from' => '', 'glsubcode_id_to' => $cashglsubocde, 'transaction_id' => $tranId, 'debit' => $amount, 'record_status' => 3);
     $db->insert('ourbank_Assets', $assets);
     return $tranId;
 }
Exemplo n.º 2
0
 public function SearchAttendance($post)
 {
     $convertdate = new App_Model_dateConvertor();
     if ($post['search_meeting_date']) {
         $search_meeting_date = $convertdate->phpmysqlformat($post['search_meeting_date']);
     } else {
         $search_meeting_date = $post['search_meeting_date'];
     }
     $select = $this->select()->setIntegrityCheck(false)->join(array('a' => 'ourbank_attendance'), array('a.id'), array('a.id as attid', 'a.meeting_date', 'week_no'))->where('a.meeting_id like "%" ? "%"', $post['search_meeting_name_att'])->where('a.meeting_date like "%" ? "%"', $search_meeting_date)->group('a.id')->join(array('b' => 'ourbank_meeting'), 'a.meeting_id = b.id');
     //die($select->__toString($select));
     $result = $this->fetchAll($select);
     return $result->toArray();
 }
Exemplo n.º 3
0
 public function SearchAttendance($post)
 {
     $keyvalue = array_filter($post);
     $searchcounter = count($keyvalue);
     if ($searchcounter > 0) {
         $convertdate = new App_Model_dateConvertor();
         if ($post['s2']) {
             $search_meeting_date = $convertdate->phpmysqlformat($post['s2']);
         } else {
             $search_meeting_date = $post['s2'];
         }
         $select = $this->select()->setIntegrityCheck(false)->join(array('a' => 'ourbank_attendance'), array('id'), array('a.id as attid', 'a.meeting_date', 'a.week_no', 'a.transaction_id'))->where('a.meeting_id like "%" ? "%"', $post['s1'])->where('a.meeting_date like "%" ? "%"', $search_meeting_date)->group('a.id')->join(array('b' => 'ourbank_group'), 'a.meeting_id = b.id');
         $result = $this->fetchAll($select);
         return $result->toArray();
     } else {
         $select = $this->select()->setIntegrityCheck(false)->join(array('a' => 'ourbank_attendance'), array('id'), array('a.id as attid', 'a.meeting_date', 'a.week_no', 'a.transaction_id'))->group('a.id')->join(array('b' => 'ourbank_group'), 'a.meeting_id = b.id');
         $result = $this->fetchAll($select);
         return $result->toArray();
     }
 }
Exemplo n.º 4
0
 public function editgroupAction()
 {
     // check group head , and members are correct
     if ($this->_request->getParam('error')) {
         // display error message for wrong head selection
         $error = $this->_request->getParam('error');
         if ($error == 1) {
             $this->view->error = "Improper Group head selection ! ";
         }
         if ($error == 2) {
             $this->view->error = "Chose single member in a family ! ";
         }
         if ($error == 3) {
             $this->view->error = "Improper Group representatives selection ! ";
         }
         if ($error == 4) {
             $this->view->error = "Maximum 3 members can be a representative in a single group !  ";
         }
         if ($error == 5) {
             $this->view->error = "Chose Bank branch name";
         }
     }
     $app = $this->view->baseUrl();
     $group_id = $this->_getParam('id');
     $this->view->groupid = $group_id;
     $this->view->title = "Edit Group Details";
     // create instance for form page with baseurl
     $addForm = new Groupmdefault_Form_groupdefault($app);
     $days = $this->view->adm->viewRecord("ourbank_master_weekdays", "id", "ASC");
     foreach ($days as $day) {
         $addForm->day->addMultiOption($day['id'], $day['name']);
     }
     $bank = $this->view->adm->viewRecord("ourbank_master_bank", "id", "ASC");
     /* foreach($bank as $banks) {
            $addForm->bank->addMultiOption($banks['id'],$banks['name']);
        }*/
     $branch = $this->view->adm->viewRecord("ourbank_master_branch", "id", "ASC");
     foreach ($branch as $branch) {
         $addForm->branch->addMultiOption($branch['id'], $branch['name']);
     }
     $addForm->Submit->setLabel('Update');
     $this->view->form = $addForm;
     $dbobject = new Groupmdefault_Model_Groupdefault();
     $hierarchy = $dbobject->getofficehierarchy();
     foreach ($hierarchy as $hiearchyids) {
         $hiearchyid = $hiearchyids['hierarchyid'];
     }
     // load office id
     $officedetails = $this->view->adm->getRecord('ourbank_office', 'officetype_id', $hiearchyid);
     foreach ($officedetails as $officeiddetails) {
         $addForm->office->addMultiOption($officeiddetails['id'], $officeiddetails['name']);
     }
     $dbobj = new Groupcommonview_Model_groupcommon();
     $result = $dbobj->getgroup($group_id);
     $convertdate = new App_Model_dateConvertor();
     // assign values with respective form fields
     foreach ($result as $group) {
         $this->view->grouptype = $grouptype = substr($group['groupcode'], 4, 1);
         $this->view->officeid = $group['officeid'];
         $addForm->offedit->setValue($group['officename']);
         $addForm->offeditv->setValue($group['officeid']);
         $addForm->groupname->setValue($group['groupname']);
         $addForm->bank->setValue($group['bank_id']);
         $addForm->branch->setValue($group['branch_id']);
         $addForm->savingamt->setValue($group['saving_perweek']);
         $addForm->penaltylate->setValue($group['penalty_latecoming']);
         $addForm->penaltyabsence->setValue($group['penalty_notcoming']);
         $addForm->interest->setValue($group['rateinterest']);
         $addForm->place->setValue($group['place']);
         $addForm->times->setValue($group['time']);
         $addForm->day->setValue($group['days']);
         $addForm->Created_Date->setValue($convertdate->phpnormalformat($group['group_created_date']));
     }
     $dbobj = new Groupmdefault_Model_Groupdefault();
     $officeid = $group['officeid'];
     $banks = $dbobj->Getbank($officeid);
     //  load applicable to values
     foreach ($banks as $banks) {
         $addForm->bank->addMultiOption($banks['id'], $banks['name']);
     }
     // enable javascript function to load groupmembers
     echo "<script>getMember('" . $group['officeid'] . "','" . $app . "','" . $group['groupid'] . "','" . $grouptype . "');</script>";
     $gacc = array();
     $gmembersacc = array();
     if ($this->_request->isPost() && $this->_request->getPost('Submit')) {
         $mem = $this->_request->getPost('member_id');
         // get selected members
         $groupmembersid = $this->view->adm->getRecord('ourbank_groupmembers', 'group_id', $this->view->groupid);
         // Fetch group members
         foreach ($groupmembersid as $groupmembers) {
             $macc = $dbobject->Getaccdetails($groupmembers['member_id']);
             // Get account id from accounts table
             foreach ($macc as $memberaccount) {
                 $acc = $memberaccount['id'];
                 // get account id
                 $gacc[] = $acc;
                 $savingdetails = $dbobject->getsavings($acc);
                 // get savings details
                 foreach ($savingdetails as $saving) {
                     if ($saving['Amount'] > 0) {
                         $gmembersacc[] = $groupmembers['member_id'];
                     }
                 }
             }
         }
         if ($gmembersacc) {
             foreach ($gmembersacc as $gmacc) {
                 $meminfor = $this->view->adm->getRecord('ourbank_familymember', 'id', $gmacc);
                 foreach ($meminfor as $membersinfo) {
                     echo "<font color = 'green' ><b>" . $membersinfo['name'] . "</b> <br> </font>";
                 }
             }
             echo "<font color ='red'> <b>These group members are having valid accounts. you cannot edit the group members.. </b></font>";
         } else {
             $group_head = $_POST['memberhead'];
             // get group head
             $representative_id = $_POST['representatives'];
             $countreps = count($representative_id);
             $result = "";
             $memberids = array();
             $famid = array();
             $memid = array();
             $countvalues = array();
             foreach ($mem as $memberid) {
                 $memberids[] = explode('_', $memberid);
             }
             foreach ($memberids as $Memberids) {
                 $famid[] = $Memberids[0];
                 $memid[] = $Memberids[1];
             }
             $result = array_diff($representative_id, $memid);
             $error = 0;
             if (in_array($group_head, $memid)) {
                 $results = "ok";
                 if ($result) {
                     $results = "not ok";
                     $error = "3";
                 }
                 if ($countreps > 3) {
                     $results = "not ok";
                     $error = "4";
                 }
                 if (!$branch) {
                     $error = "5";
                     $results = "not ok";
                 } else {
                     $countvalues[] = array_count_values($famid);
                     foreach ($countvalues[0] as $key => $value) {
                         if ($value > 1) {
                             $results = "not ok";
                             $error = "2";
                         }
                     }
                 }
             } else {
                 $error = "1";
             }
             if ($results == "ok" && $error == 0) {
                 // if ok then get all input values
                 $office_id = $this->_request->getParam('offeditv');
                 $groupname = $this->_request->getParam('groupname');
                 $bank = $this->_request->getParam('bank');
                 $branch = $this->_request->getParam('branch');
                 $createddate = $this->_request->getParam('Created_Date');
                 //                     $latitude = $this->_request->getParam('latitude');
                 //                     $longitude = $this->_request->getParam('longitude');
                 $savingamt = $this->_request->getParam('savingamt');
                 $penaltyabsence = $this->_request->getParam('penaltyabsence');
                 $penaltylate = $this->_request->getParam('penaltylate');
                 $interest = $this->_request->getParam('interest');
                 $place = $this->_request->getParam('place');
                 $times = $this->_request->getParam('times');
                 $day = $this->_request->getParam('day');
                 $convertdate = new App_Model_dateConvertor();
                 $createddate = $convertdate->phpmysqlformat($createddate);
                 $date = date("y/m/d H:i:s");
                 // updation and insertion in Accounts table
                 foreach ($gacc as $gaccountid) {
                 }
                 //get the account id
                 $tagacc = $this->view->adm->getsingleRecord('ourbank_accounts', 'tag_account', 'id', $gaccountid);
                 $data = array('tag_account' => 0, 'status_id' => 0);
                 foreach ($gacc as $gaccountid) {
                     //get the account id
                     $where = array('id = ' . $gaccountid, 'membertype_id = 1');
                     $dbobject->updateaccount('ourbank_accounts', $data, $where);
                     // make tag account and status id as zero
                 }
                 $individualtypeid = $this->view->adm->getsingleRecord('ourbank_master_membertypes', 'id', 'type', 'Individual');
                 // get individual type id
                 $productid = $dbobject->getProductid();
                 $productcode = $productid . 'S';
                 // // insert accounts value for group members
                 foreach ($memid as $Memid) {
                     $account_ids = $this->view->adm->addRecord("ourbank_accounts", array('id' => '', 'membertype_id' => $individualtypeid, 'begin_date' => $date, 'tag_account' => $tagacc, 'accountcreated_date' => $date, 'created_date' => $createddate, 'created_by' => $this->view->createdby, 'status_id' => 1));
                     // insert some value to accounts table
                     //                 // create account number <!--(3)office id--(2)individualtype--(3)productoffer with saving code(6)accountid!>
                     $accountNumber = str_pad($office_id, 3, "0", STR_PAD_LEFT) . str_pad($individualtypeid, 2, "0", STR_PAD_LEFT) . str_pad($productcode, 3, "0", STR_PAD_LEFT) . str_pad($account_ids, 6, "0", STR_PAD_LEFT);
                     $this->view->adm->updateRecord("ourbank_accounts", $account_ids, array('account_number' => $accountNumber, 'member_id' => $Memid, 'product_id' => $productid));
                 }
                 $groupdetails = $dbobject->getgroupdetails($group_id);
                 // get group details for particular id
                 $this->view->adm->addRecord("ourbank_group_log", $groupdetails[0]);
                 // add group details to log table
                 $glidforabsense = $this->view->adm->getsingleRecord('ourbank_glsubcode', 'id', 'header', 'Absense');
                 $glidforlate = $this->view->adm->getsingleRecord('ourbank_glsubcode', 'id', 'header', 'Late');
                 $this->view->adm->updateRecord("ourbank_group", $group_id, array('village_id' => $office_id, 'bank_id' => $bank, 'branch_id' => $branch, 'name' => $groupname, 'saving_perweek' => $savingamt, 'penalty_notcoming' => $penaltyabsence, 'penalty_latecoming' => $penaltylate, 'late_subglcode' => $glidforlate, 'absent_subglcode' => $glidforabsense, 'rateinterest' => $interest, 'place' => $place, 'time' => $times, 'days' => $day, 'head' => $group_head, 'group_created_date' => $date, 'created_by' => $this->view->createdby, 'created_date' => $createddate));
                 // update group details
                 $groupmemberdetails = $this->view->adm->getRecord('ourbank_groupmembers', 'group_id', $group_id);
                 // get groupmembers details for particular id
                 foreach ($groupmemberdetails as $groupmemberDetails) {
                     $this->view->adm->addRecord("ourbank_groupmembers_log", array('record_id' => '', 'id' => $groupmemberDetails['id'], 'group_id' => $groupmemberDetails['group_id'], 'member_id' => $groupmemberDetails['member_id'], 'groupmember_status' => $groupmemberDetails['groupmember_status']));
                 }
                 // add group members details to log table
                 $dbobject->UpdateGroupdetails($group_id);
                 // insert group members
                 foreach ($memid as $memberid) {
                     $this->view->adm->addRecord("ourbank_groupmembers", array('id' => '', 'group_id' => $group_id, 'member_id' => $memberid, 'groupmember_status' => 3));
                 }
                 $grouprepdetails = $this->view->adm->getRecord('ourbank_group_representatives', 'group_id', $group_id);
                 // get groupmembers details for particular id
                 foreach ($grouprepdetails as $grouprepmemDetails) {
                     $this->view->adm->addRecord("ourbank_group_representatives_log", array('record_id' => '', 'id' => $grouprepmemDetails['id'], 'group_id' => $grouprepmemDetails['group_id'], 'representative_id' => $grouprepmemDetails['representative_id']));
                 }
                 // add group Representative members details to log table
                 $dbobject->UpdateGroupreps($group_id);
                 foreach ($representative_id as $representatives) {
                     $this->view->adm->addRecord("ourbank_group_representatives", array('id' => '', 'group_id' => $group_id, 'representative_id' => $representatives));
                     ////add representatives with its group id ->($groupid)
                 }
                 $this->_redirect('groupcommonview/index/commonview/id/' . $group_id);
             } else {
                 // display error message for wrong group head selection
                 $this->_redirect('groupmdefault/index/editgroup/id/' . $group_id . '/error/' . $error);
             }
         }
     }
 }
Exemplo n.º 5
0
 public function withdrawalAction()
 {
     $accNum = $this->view->accNum = base64_decode($this->_request->getParam('accNum'));
     $fixedSavings = new Fixedtransaction_Model_fixedSavings();
     $validaccno = $fixedSavings->savingsAccountsSearch($accNum);
     $MinBalance = $this->view->savingsModel->getminimumbal($accNum);
     $Balance = $this->view->savingsModel->getbalance($accNum);
     foreach ($Balance as $balances) {
         $this->view->balance = $balance = $balances['Balance'];
     }
     foreach ($MinBalance as $MinBalan) {
         $minimumbalance = $MinBalan['minmumdeposit'];
     }
     $this->view->limitamount = $balance - $minimumbalance;
     $this->view->details = $this->view->savingsModel->search($accNum);
     $this->view->tran = $this->view->savingsModel->transaction($accNum);
     $form = new Savingswithdrawal_Form_Withdrawal($this->view->accNum, $balance, $minimumbalance);
     $this->view->form = $form;
     $mode = $this->view->adm->viewRecord("ourbank_master_paymenttypes", "id", "DESC");
     foreach ($mode as $mode) {
         $form->transactionMode->addMultiOption($mode['id'], $mode['name']);
         $form->transactionMode1->addMultiOption($mode['id'], $mode['name']);
     }
     //if group members
     if (substr($accNum, 4, 1) == 2 || substr($accNum, 4, 1) == 3) {
         $this->view->group = $this->view->savingsModel->getMember($accNum);
     }
     if ($this->_request->isPost() && $this->_request->getPost('Submit')) {
         if ($this->_request->getParam('date1')) {
             $form->transactionMode->setRequired(false);
             //                 $form->amount->setRequired(false);
             $form->description->setRequired(false);
             $form->date->setRequired(false);
             $givendate = $this->_request->getParam('date1');
             $transactionMode = $this->_request->getParam('transactionMode1');
             if ($transactionMode == 1) {
                 $this->view->form->othertext->setRequired(false);
                 $this->view->form->othertext1->setRequired(false);
             }
             if ($transactionMode != 1) {
                 $this->view->form->othertext->setRequired(false);
                 $chequeno = $this->_request->getParam('othertext1');
                 $paymenttype_details = $chequeno;
             } else {
                 $paymenttype_details = 0;
             }
         } else {
             $form->transactionMode1->setRequired(false);
             $form->description1->setRequired(false);
             $form->date1->setRequired(false);
             $givendate = $this->_request->getParam('date');
             $transactionMode = $this->_request->getParam('transactionMode');
             if ($transactionMode == 1) {
                 $this->view->form->othertext->setRequired(false);
                 $this->view->form->othertext1->setRequired(false);
             }
             if ($transactionMode != 1) {
                 $this->view->form->othertext1->setRequired(false);
                 $chequeno = $this->_request->getParam('othertext');
                 $paymenttype_details = $chequeno;
             } else {
                 $paymenttype_details = 0;
             }
         }
         $flag = false;
         $formData = $this->_request->getPost();
         if ($givendate) {
             $gdate = $this->view->dc->phpmysqlformat($givendate);
             /*  if ( $gdate != date('Y-m-d') ) {
                                     $this->view->maxdate= "Date should be current date" ;
                 } 
                 else { */
             //date validation
             if ($form->isValid($formData)) {
                 $fixedSavings = new Fixedtransaction_Model_fixedSavings();
                 if ($transactionMode == '5') {
                     $savingsAccountsSearch = $fixedSavings->savingsAccountsSearch($chequeno);
                     $validaccno = $fixedSavings->savingsAccountsSearchwithid($chequeno);
                     if (!$validaccno) {
                         $this->view->noaccount = "Enter valid saving account number";
                         $flag = true;
                     }
                     if (!$savingsAccountsSearch) {
                         $form->othertext->setValue('');
                         $form->othertext1->setValue('');
                         $flag = true;
                         $this->view->noaccount = "This account number does not exist";
                     }
                 }
                 if ($flag == false) {
                     $description = $this->_request->getParam('description');
                     if ($this->_request->getParam('date1')) {
                         $cl = new App_Model_dateConvertor();
                         $type = 1;
                         $amount = $this->_request->getParam('amount1');
                         $date = $this->_request->getParam('date1');
                         $accNum = base64_decode($this->_request->getParam('accNum'));
                         $tranId = $this->view->savingsModel->deposit($this->view->accNum, $amount, $date, $type, $transactionMode, $description, $paymenttype_details, $this->view->createdby);
                         $group = $this->view->savingsModel->getMember($accNum);
                         foreach ($this->view->details as $details) {
                             $accID = $details->accId;
                         }
                         foreach ($group as $Group) {
                             $Accid = $this->view->savingsModel->getAccountid($Group->id);
                             if ($this->_request->getParam($Group->id) != 0) {
                                 $trandata = array('transaction_id' => $tranId, 'account_id' => $Accid, 'transaction_date' => $cl->phpmysqlformat($date), 'transaction_type' => 2, 'transaction_amount' => $this->_request->getParam($Group->id), 'member_id' => $Group->id, 'transacted_by' => 1);
                                 $this->view->savingsModel->groupWithdrawal($trandata);
                             }
                         }
                     } else {
                         $type = 2;
                         $amount = $this->_request->getParam('amount');
                         $date = $this->_request->getParam('date');
                         $accNum = base64_decode($this->_request->getParam('accNum'));
                         $tranId = $this->view->savingsModel->deposit($this->view->accNum, $amount, $date, $type, $transactionMode, $description, $paymenttype_details, $this->view->createdby);
                     }
                     $this->_redirect("/savingswithdrawal/index/message/amt/" . base64_encode($amount) . "/accNum/" . base64_encode($this->view->accNum));
                 }
             }
             // }                       //date validation
         }
     }
 }
Exemplo n.º 6
0
 public function insertTran($data, $int, $totalAmt, $intType, $currentinstallment)
 {
     $db = Zend_Db_Table::getDefaultAdapter();
     $acc = $this->searchaccounts($data["accNum"]);
     foreach ($acc as $acc) {
         $accId = $acc->accId;
         $gl = $acc->gl;
         $officeid = $acc->officeid;
         $interest = $acc->interest;
         $intGl = $acc->intGl;
     }
     $cl = new App_Model_dateConvertor();
     $tranData = array('account_id' => $accId, 'glsubcode_id_to' => $gl, 'transaction_date' => $cl->phpmysqlformat($data["date"]), 'amount_to_bank' => $data["amount"], 'paymenttype_details' => $data["paymenttype_details"], 'paymenttype_id' => $data["paymentMode"], 'recordstatus_id' => 3, 'transactiontype_id' => 1, 'transaction_description' => "(Repayment) " . $data["description"], 'created_by' => 1);
     $db->insert("ourbank_transaction", $tranData);
     $tranId = $db->lastInsertId('id');
     // Installment update
     $sql = "select installment_id from ourbank_installmentdetails where account_id='" . $accId . "' AND installment_status = 4 limit 1";
     $idData = $db->fetchAll($sql);
     foreach ($idData as $idData) {
         $pram = $idData->installment_id;
     }
     //insert into loan repayment
     if ($intType == 3) {
         $currentinstallid = $currentinstallment;
     } else {
         $currentinstallid = $pram - 1;
     }
     $repayData = array('account_id' => $accId, 'transaction_id' => $tranId, 'paid_date' => $cl->phpmysqlformat($data["date"]), 'paid_amount' => $data["amount"], 'paid_principal' => $data["amount"] - $int, 'paid_interest' => $int, 'balanceamount' => $totalAmt - $data["amount"], 'installment_id' => $currentinstallid, 'recordstatus_id' => 3);
     $db->insert("ourbank_loan_repayment", $repayData);
     // Insertion into Assets ourbank_Assets Cash Cr entry
     $glbank = $this->getGlcode($officeid, 'cash' . $officeid);
     // Insertion into Assets ourbank_Assets cash Cr entry
     if ($intType != 3) {
         $assetamount = $data["amount"] - $interest;
     } else {
         $assetamount = $data["amount"];
     }
     $assets = array('office_id' => $officeid, 'glsubcode_id_from' => $glbank[0]['id'], 'glsubcode_id_to' => '', 'transaction_id' => $tranId, 'credit' => $assetamount, 'record_status' => 3);
     $db->insert('ourbank_Assets', $assets);
     // Insertion into Assets ourbank_Assets productgl Cr entry
     //         $glassets =  array('office_id' => $officeid,
     //                     'glsubcode_id_from' => $gl,
     //                     'glsubcode_id_to' => '',
     //                     'transaction_id' => $tranId,
     //                     'credit' => $assetamount,
     //                     'record_status' => 3);
     //         $db->insert('ourbank_Assets',$glassets);
     if ($intType != 3) {
         // Insertion into Assets ourbank_Income interest Cr entry
         $interestledger = $this->getGlcode($officeid, 'interest' . $officeid);
         $interest = array('office_id' => $officeid, 'glsubcode_id_from' => $interestledger[0]['id'], 'glsubcode_id_to' => '', 'transaction_id' => $tranId, 'credit' => $interest, 'recordstatus_id' => 3);
         $db->insert('ourbank_Income', $interest);
     }
     $monthinterest = $this->findmonthinterest($accId);
     if ($monthinterest) {
         $interestledger = $this->getGlcode($officeid, 'interest' . $officeid);
         $interest = array('office_id' => $officeid, 'glsubcode_id_from' => $interestledger[0]['id'], 'glsubcode_id_to' => '', 'transaction_id' => $tranId, 'credit' => $monthinterest[0]['monthinterest'], 'recordstatus_id' => 3);
         $db->insert('ourbank_Income', $interest);
         $input = array('monthend_tag' => 1);
         $this->accUpdate('ourbank_loan_repayment', 2, $accId, $input, 'monthend_tag');
     }
     //Retuns some variables
     return array('transaction_id' => $tranId, 'account_id' => $accId, 'paymentMode' => $data["paymentMode"], 'installment_id' => $accId);
 }
Exemplo n.º 7
0
 public function recurringsavingsAction()
 {
     // disable the layout to load new action page in common page
     $this->_helper->layout->disableLayout();
     $savingsForm = new Savings_Form_Savings();
     $this->view->form = $savingsForm;
     $convertdate = new App_Model_dateConvertor();
     $savings = new Savings_Model_Savings();
     // load applicable to values
     $applicableto = $savings->fetchAllMemberType();
     foreach ($applicableto as $applicableto) {
         $savingsForm->applicableto->addMultiOption($applicableto['id'], $applicableto['type']);
     }
     // load glsubcode ids
     // // // 		$glsubcode = $savings->fetchAllglsubcode('Liabilities');
     // // // 		foreach($glsubcode as $glsubcode) {
     // // // 			$savingsForm->glsubcode_id->addMultiOption($glsubcode->id,$glsubcode->header." -[".$glsubcode->glsubcode."]");
     // // // 		}
     // load frequency of deposit values
     $freequencyofdeposit = $savings->fetchAllTimeFrequencyType();
     foreach ($freequencyofdeposit as $freequency) {
         $savingsForm->frequency_of_deposit->addMultiOption($freequency['id'], $freequency['name']);
     }
     // // // //                $feeglcode =  $savings->fetchAllglsubcode('Expenditure');
     // // // //                // load feeglcode values
     // // // //                 foreach($feeglcode as $feeglcodes) {
     // // // //                         $savingsForm->feeglcode->addMultiOption($feeglcodes->id,$feeglcodes->header);
     // // // //                 }
     if ($this->_request->isPost() && $this->_request->getPost('Submit')) {
         $formData = $this->_request->getPost();
         if ($this->_request->isPost()) {
             $savingsForm->minmumdeposit->setRequired(false);
             $savingsForm->frequencyofdeposit->setRequired(false);
             $savingsForm->Int_timefrequency_id->setRequired(false);
             $savingsForm->frequencyofinterestupdating->setRequired(false);
             $savingsForm->minimumbalanceforinterest->setRequired(false);
             // receive all given input values
             $closeddate = $this->_request->getParam('closedate');
             $productType = $this->_request->getParam('productType');
             $interestfrom = $this->_request->getParam('interestfrom');
             $interestto = $this->_request->getParam('interestto');
             $interestrate = $this->_request->getParam('interestrate');
             $currentdate = $this->_request->getParam('currentdates');
             $begindate = $this->_request->getParam('begindate');
             $minimumamount = $this->_request->getParam('minimum_deposit_amount');
             $maximumamount = $this->_request->getParam('maximum_deposit_amount');
             $month = 'months';
             $memberCount = $this->_request->getParam('memberCount');
             $headerCon = "L";
             $glsubcode = $savings->genarateGlCode('recurring deposit');
             $glcode = $savings->getGlCodeid('recurring deposit');
             $glcodeexist = $savings->getGlCodeexist('recurring deposit');
             $glco = substr($glcodeexist, 1, 2);
             //                     foreach($genarateGl as $Glsubcode){
             //                         $glsubcode = $Glsubcode['glsubcode'];
             //                     }
             if ($glsubcode) {
                 $first = substr($glsubcode, 0, 3);
                 $existcode = substr($glsubcode, 3, 3);
                 $existcode++;
                 $last = str_pad($existcode, 3, 0, STR_PAD_LEFT);
                 $newglsubcode = $first . $last;
             } else {
                 $glcodeId = $headerCon . $glco . "001";
                 $newglsubcode = $glcodeId;
             }
             $date = date("y/m/d H:i:s");
             $glsubcodeid = $this->view->adm->addRecord('ourbank_glsubcode', array('id' => '', 'glsubcode' => $newglsubcode, 'glcode_id' => $glcode, 'subledger_id' => $glcode, 'header' => $formData['offerproductname'], 'description' => $formData['offerproduct_description'], 'created_date' => $date, 'created_by' => $this->view->createdby));
             $product_id = $this->view->adm->getsingleRecord('ourbank_product', 'id', 'shortname', $productType);
             $this->view->product_id = $product_id;
             // check with maximum and minimum date
             if ($convertdate->phpmysqlformat($closeddate) <= $convertdate->phpmysqlformat($begindate)) {
                 $this->view->closedate = "<B style='color:red'>'closed date must be grater than begin date'.'{$begindate}'</b>";
                 // check with maximum and minimum amount
             } elseif ($minimumamount >= $maximumamount) {
                 $this->view->maximumamount = "<B style='color:red'>'maximum amount must be grater than minimum'.'{$minimumamount}'</b>";
             } else {
                 $result = $savings->addofferproduct($formData, $product_id, $closeddate, $glsubcodeid);
                 //Insert Products offer
                 $offerproductupdate_id = Zend_Db_Table::getDefaultAdapter()->lastInsertId('ourbank_productsoffer', 'id');
                 // Insert fixed product values
                 $result = $savings->addofferproductfixedrecurring($formData, $offerproductupdate_id);
                 // insert interest period values
                 $countinterest = count($interestfrom);
                 for ($i = 0; $i < $countinterest; $i++) {
                     $description = $interestfrom[$i] . -$interestto[$i] . $month;
                     $interestarray = array('id' => '', 'period_ofrange_monthfrom' => $interestfrom[$i], 'period_ofrange_monthto' => $interestto[$i], 'period_ofrange_description' => $description, 'offerproduct_id' => $offerproductupdate_id, 'Interest' => $interestrate[$i], 'intereststatus_id' => 3);
                     $this->view->adm->addRecord('ourbank_interest_periods', $interestarray);
                 }
             }
             $this->_redirect('savings/index');
         }
     }
 }
Exemplo n.º 8
0
 public function addofferproduct($post, $product_id, $closeddate, $glsubcodeid)
 {
     // instance to convert date
     $convertdate = new App_Model_dateConvertor();
     // 		$user_id = $sessionName->primaryuserid;
     if ($closeddate == "") {
         $CLOSEDDATE = "0000-00-00";
     } else {
         $CLOSEDDATE = $convertdate->phpmysqlformat($closeddate);
     }
     //                 if($post['feeglcode'] == "") {
     //                         $feesubcode = '';
     //                 } else {
     //                         $feesubcode = $post['feeglcode'];
     //                 }
     $data = array('id' => '', 'name' => $post['offerproductname'], 'shortname' => $post['offerproductshortname'], 'product_id' => $product_id, 'description' => $post['offerproduct_description'], 'begindate' => $convertdate->phpmysqlformat($post['begindate']), 'closedate' => $CLOSEDDATE, 'applicableto' => $post['applicableto'], 'glsubcode_id' => $glsubcodeid, 'capital_glsubcode_id' => '', 'Interest_glsubcode_id' => '');
     // 					'fee_glsubcode_id'=>$feesubcode);
     $this->insert($data);
     //insert pffer details
 }
Exemplo n.º 9
0
 public function attendanceeditAction()
 {
     //Acl
     // 		$acl = new App_Model_Acl();
     // 		$access = new App_Model_Access();
     // 		$role = $access->getRole($this->view->id);
     //
     // 		$accessid = $access->accessRights('Attendance',$role,"attendanceeditAction");
     // 		$checkaccess = $acl->isAllowed($role,'Attendance',$accessid);
     // 		if(($role) && ($checkaccess != NULL)) {
     //edit
     $path = $this->view->baseUrl();
     $attendanceform = new Attendance_Form_Attendance($path);
     $this->view->attendanceform = $attendanceform;
     $this->view->attendance_id = $attendance_id = $this->_request->getParam('attendance_id');
     $meeting = new Meeting_Model_Meeting();
     $result = $meeting->fetchAllmeetingdetails();
     $convertdate = new App_Model_dateConvertor();
     //Object for date convertor
     $fetchattendance = new Attendance_Model_Attendance();
     //listing discussion dropdown
     $this->view->discussionlist = $fetchattendance->discussionlist();
     $this->view->decissionlist = $fetchattendance->decissionlist();
     //dropdown
     //$this->view->editdiscussion=$this->view->adm->viewRecord("ourbank_discussion",$attendance_id,'asc');
     $this->view->editdiscussion = $fetchattendance->getdiscussion($attendance_id);
     $this->view->editdecision = $fetchattendance->getdecision($attendance_id);
     $memberattendance = $fetchattendance->fetchmemberttendance($attendance_id);
     //print_r($memberattendance);
     if ($memberattendance) {
         $fetchattendance1 = $fetchattendance->fetchattendancedetailsforID($attendance_id);
         //echo '<pre>'; print_r($fetchattendance1);
     } else {
         $fetchattendance1 = $fetchattendance->fetchattendancedetailsforID1($attendance_id);
         //echo '<pre>';
     }
     //foreach($fetchattendance1 as $fetchattendance2) { $getMemberID[]=$fetchattendance2['member_id'];}
     $meeting = $this->view->adm->viewRecord("ourbank_meeting", "id", "DESC");
     //echo '<pre>'; print_r($meeting);
     foreach ($meeting as $meeting1) {
         $attendanceform->meeting_name->addMultiOption($meeting1['id'], $meeting1['name']);
     }
     foreach ($fetchattendance1 as $fetchattendance1) {
         foreach ($result as $result) {
             if ($result['id'] == $fetchattendance1['meeting_id']) {
                 $attendanceform->meeting_name->addMultiOption($result['id'], $result['name']);
             }
         }
         //dropdown weekdays
         //         $days = $this->view->adm->viewRecord("ourbank_master_weekdays","id","ASC");
         //         foreach($days as $days) {
         //             $attendanceform->meeting_day->addMultiOption($days['id'],$days['name']);
         //         }
         //attendance details
         $this->view->attendanceform->resolution->setValue($fetchattendance1['resolution']);
         $this->view->attendanceform->meeting_name->setValue($fetchattendance1['meeting_id']);
         $this->view->attendanceform->meeting_time->setValue($fetchattendance1['attendancetime']);
         //echo $fetchattendance1['day'];
         $this->view->attendanceform->meeting_date->setValue($convertdate->phpnormalformat($fetchattendance1['meeting_date']));
         $this->view->attendanceform->notes->setValue($fetchattendance1['notes']);
     }
     //Fetches all the memberes in that group of particular meeting ID
     echo "<script>getMembers(" . $fetchattendance1['meeting_id'] . ",'" . $path . "'," . $attendance_id . ");</script>";
     echo "<script>getMeeting(" . $fetchattendance1['meeting_id'] . ",'" . $path . "'," . $attendance_id . ");</script>";
     //update
     if ($this->_request->isPost() && $this->_request->getPost('Update')) {
         $attendance_id = $this->_request->getParam('attendance_id');
         $member_id = array();
         $formData = $this->_request->getPost();
         $member_id = $this->_request->getPost('member_id');
         $convertdate = new App_Model_dateConvertor();
         $meeting_date = $convertdate->phpmysqlformat($formData['meeting_date']);
         // for attendance log details
         $attendancelog = $this->view->adm->getRecord('ourbank_attendance', 'id', $attendance_id);
         for ($j = 0; $j < count($attendancelog); $j++) {
             $this->view->adm->addRecord("ourbank_attendance_log", $attendancelog[$j]);
         }
         // for member log details
         $memberlog = $fetchattendance->fetchmemberlog($attendance_id);
         for ($j = 0; $j < count($memberlog); $j++) {
             //echo '<pre>'; print_r($memberlog[$j]);
             $this->view->adm->addRecord("ourbank_memberattendance_log", $memberlog[$j]);
         }
         // for discussion log details
         $discussionlog = $fetchattendance->fetchdiscussionlog($attendance_id);
         for ($j = 0; $j < count($discussionlog); $j++) {
             $this->view->adm->addRecord("ourbank_discussion_log", $discussionlog[$j]);
         }
         // for decision log details
         $decisionlog = $fetchattendance->fetchdecisionlog($attendance_id);
         for ($j = 0; $j < count($decisionlog); $j++) {
             $this->view->adm->addRecord("ourbank_decision_log", $decisionlog[$j]);
         }
         //update record
         $fetchattendance->attendance($attendance_id);
         $updateAttendance = new Attendance_Model_Attendance();
         $member_id = array();
         $formData = $this->_request->getPost();
         $member_id = $this->_request->getPost('member_id');
         //echo '<pre>'; print_r($formData);
         /*      if($member_id) {
                     for($aa=0;$aa<sizeof($member_id);$aa++) {
                         $updateAttendance->insertattendance($formData,$member_id[$aa],$attendance_id,$this->view->createdby);
                     }
                 } else {
                 $updateAttendance->insertattendance($formData,'0',$attendance_id,$this->view->createdby);
                 } */
         $maxid1 = $updateAttendance->fetchmaxid($formData['meeting_name']);
         if ($maxid1[0]['meetingno'] == "") {
             $maxid = '1';
         } else {
             $maxid = $maxid1[0]['meetingno'];
         }
         //insert attendance details
         $attendance_id = $this->view->adm->addRecord("ourbank_attendance", array('id' => '', 'meeting_id' => $formData['meeting_name'], 'week_no' => $maxid, 'meeting_date' => $meeting_date, 'notes' => $formData['notes'], 'time' => $formData['meeting_time'], 'resolution' => $formData['resolution'], 'created_date' => date("y/m/d H:i:s"), 'created_by' => $this->view->createdby));
         $memberid = $this->_request->getPost('member_id');
         if ($memberid) {
             foreach ($memberid as $memberid1) {
                 $this->view->adm->addRecord("ourbank_memberattendance", array('id' => '', 'attendance_id' => $attendance_id, 'member_id' => $memberid1, 'created_date' => date("y/m/d H:i:s")));
             }
         }
         //insert discussion table
         $discussion = $this->_request->getPost('discussionlist');
         if ($discussion) {
             foreach ($discussion as $discussion1) {
                 $this->view->adm->addRecord("ourbank_discussion", array('id' => '', 'attendance_id' => $attendance_id, 'discussion_id' => $discussion1, 'created_date' => date("y/m/d H:i:s")));
             }
         }
         //insert decision table
         $decision = $this->_request->getPost('decisionlist');
         if ($decision) {
             foreach ($decision as $decision1) {
                 $this->view->adm->addRecord("ourbank_decision", array('id' => '', 'attendance_id' => $attendance_id, 'decision_id' => $decision1, 'created_date' => date("y/m/d H:i:s")));
             }
         }
         $this->_redirect('attendanceindex/index');
     }
     // 		} else {
     // 		$this->_redirect('index/index');
     // 		}
 }
Exemplo n.º 10
0
 public function attendanceeditAction()
 {
     function array_search_values($m_needle, $a_haystack, $b_strict = false)
     {
         return array_intersect_key($a_haystack, array_flip(array_keys($a_haystack, $m_needle, $b_strict)));
     }
     //Acl
     // 		$acl = new App_Model_Acl();
     // 		$access = new App_Model_Access();
     // 		$role = $access->getRole($this->view->id);
     //
     // 		$accessid = $access->accessRights('Attendance',$role,"attendanceeditAction");
     // 		$checkaccess = $acl->isAllowed($role,'Attendance',$accessid);
     // 		if(($role) && ($checkaccess != NULL)) {
     //edit
     $path = $this->view->baseUrl();
     $attendanceform = new Meetingbook_Form_Attendance($path);
     $this->view->attendanceform = $attendanceform;
     $this->view->attendance_id = $attendance_id = $this->_request->getParam('attendance_id');
     $meeting = new Meeting_Model_Meeting();
     $result = $meeting->fetchAllmeetingdetails();
     $convertdate = new App_Model_dateConvertor();
     //Object for date convertor
     $fetchattendance = new Meetingbook_Model_Meetingbook();
     //listing discussion dropdown
     $this->view->discussionlist = $fetchattendance->discussionlist();
     $this->view->decissionlist = $fetchattendance->decissionlist();
     $this->view->editdiscussion = $fetchattendance->getdiscussion($attendance_id);
     $this->view->editdecision = $fetchattendance->getdecision($attendance_id);
     $memberattendance = $fetchattendance->fetchmemberttendance($attendance_id);
     if ($memberattendance) {
         $fetchattendance1 = $fetchattendance->fetchattendancedetailsforID($attendance_id);
     } else {
         $fetchattendance1 = $fetchattendance->fetchattendancedetailsforID1($attendance_id);
     }
     // //         Zend_Debug::dump($fetchattendance1);
     $meeting = $this->view->adm->viewRecord("ourbank_group", "id", "DESC");
     foreach ($meeting as $meeting1) {
         $attendanceform->meeting_name->addMultiOption($meeting1['id'], $meeting1['name']);
     }
     foreach ($fetchattendance1 as $fetchattendance1) {
         foreach ($result as $result) {
             if ($result['id'] == $fetchattendance1['meeting_id']) {
                 $attendanceform->meeting_name->addMultiOption($result['id'], $result['name']);
             }
         }
         //attendance details
         $this->view->attendanceform->resolution->setValue($fetchattendance1['resolution']);
         $this->view->groupid = $fetchattendance1['meeting_id'];
         $this->view->attendanceform->meeting_name->setValue($fetchattendance1['meeting_id']);
         $this->view->weekno = $fetchattendance1['meetimg'];
         $this->view->vNo = $vNo = $fetchattendance1['transaction_id'];
         $this->view->attendanceform->meeting_time->setValue($fetchattendance1['attendancetime']);
         $this->view->attendanceform->meeting_date->setValue($convertdate->phpnormalformat($fetchattendance1['meeting_date']));
         $this->view->attendanceform->notes->setValue($fetchattendance1['notes']);
     }
     //Fetches all the memberes in that group of particular meeting ID
     $transId = $this->view->vNo;
     echo "<script>getMembers(" . $fetchattendance1['meeting_id'] . ",'" . $path . "'," . $attendance_id . "," . $transId . ");</script>";
     echo "<script>getMeeting(" . $fetchattendance1['meeting_id'] . ",'" . $path . "'," . $attendance_id . ");</script>";
     //fetch savings details
     //         $this->view->savingsdetails=$this->view->savings->fetchsavingsdetails($vNo);
     // echo '<pre>'; print_r($this->view->savingsdetails);
     //update
     if ($this->_request->isPost() && $this->_request->getPost('Update')) {
         $attendance_id = $this->_request->getParam('attendance_id');
         $member_id = array();
         $formData = $this->_request->getPost();
         $member_id = $this->_request->getPost('member_id');
         $convertdate = new App_Model_dateConvertor();
         $meeting_date = $convertdate->phpmysqlformat($formData['meeting_date']);
         $date = $meeting_date;
         $accNum = $this->_request->getPost('accNum');
         if ($attendanceform->isValid($formData)) {
             if ($accNum) {
                 $insertattendance = new Meetingbook_Model_Meetingbook();
                 $member_id = array();
                 $formData = $this->_request->getPost();
                 $member_id = $this->_request->getPost('member_id');
                 $convertdate = new App_Model_dateConvertor();
                 $meeting_date = $convertdate->phpmysqlformat($formData['meeting_date']);
                 $date = $meeting_date;
                 $amount = $this->_request->getPost('savingspaid');
                 //insert attendance details
                 $maxid1 = $insertattendance->fetchmaxid($formData['meeting_name']);
                 if ($maxid1[0]['meetingno'] == "") {
                     $maxid = '1';
                 } else {
                     $maxid = $maxid1[0]['meetingno'];
                 }
                 //savings details insertion
                 $this->view->details = $this->view->savings->search($this->_request->getParam('accNum'));
                 $totsavings = $this->_request->getPost('totsavingspaid');
                 $description = $this->_request->getPost('notes');
                 $type = 1;
                 $transactionMode = 1;
                 //update existing transaction id as inactive
                 $this->view->savings->updateRecord("ourbank_transaction", $vNo, array('recordstatus_id' => 2));
                 $this->view->savings->updateRecord("ourbank_Assets", $vNo, array('record_status' => 2));
                 $this->view->savings->updateRecord("ourbank_Liabilities", $vNo, array('record_status' => 2));
                 $this->view->savings->updateRecord1("ourbank_Income", $vNo, array('recordstatus_id' => 2));
                 //for getting common transaction id
                 $totsavings = $formData['overallpaid'];
                 $groupaccID = $formData['groupaccID'];
                 $tranId = $this->view->savings->getTransactionID($groupaccID, $totsavings, $date, $type, $transactionMode, $description);
                 $this->view->savings->deposit($accNum, $totsavings, $date, $type, $transactionMode, $description, $tranId);
                 foreach ($this->view->details as $details) {
                     $accID = $details->accId;
                 }
                 $group = $this->view->savings->getMember($accNum);
                 $amount = $this->_request->getPost('savingspaid');
                 //inserting individual members savings
                 $id = 0;
                 foreach ($group as $group) {
                     //echo $group->id;
                     if ($group->id != 0) {
                         $this->_request->getParam($group->id);
                         $this->view->adm->addRecord("ourbank_group_savingstransaction", array('transaction_id' => $tranId, 'account_id' => $accID, 'transaction_date' => $date, 'transaction_type' => 1, 'transaction_amount' => $amount[$id], 'member_id' => $group->id, 'transacted_by' => 1));
                         $id++;
                     }
                 }
                 //end of savings details insertion
                 //start loan repayment
                 $loanaccNum = $this->_request->getParam('loanaccNum');
                 //print_r($accNum[0]);
                 $loanamount = $this->_request->getParam('loanpaid');
                 $this->view->details = $this->view->loanModel->searchaccounts($loanaccNum);
                 $this->view->paid = $this->view->loanModel->paid($loanaccNum);
                 $this->view->unpaid = $this->view->loanModel->unpaid($loanaccNum);
                 $instalments = $this->view->loanModel->loanInstalments($loanaccNum);
                 $increment = 0;
                 foreach ($loanaccNum as $loanaccNum) {
                     if ($loanaccNum) {
                         $data = array('date' => $date, 'amount' => $loanamount[$increment], 'paymentMode' => 1, 'description' => $description, 'accNum' => $loanaccNum, 'transID' => $tranId);
                         $this->view->details = $this->view->loanModel->searchaccounts($loanaccNum);
                         foreach ($this->view->details as $details) {
                             $intType = $details->interesttype;
                             // Intereset type
                         }
                         switch ($intType) {
                             case 1:
                                 $int = $this->view->loanModel->declain($data);
                                 break;
                             case 2:
                                 $int = $this->view->loanModel->emi($data);
                                 break;
                             case 3:
                                 break;
                         }
                         $array = $this->view->loanModel->insertTran($data);
                     }
                     $increment++;
                 }
                 //end of the loan repayment
                 // for attendance log details
                 $attendancelog = $this->view->adm->getRecord('ourbank_attendance', 'id', $attendance_id);
                 for ($j = 0; $j < count($attendancelog); $j++) {
                     $this->view->adm->addRecord("ourbank_attendance_log", $attendancelog[$j]);
                 }
                 // for member log details
                 $memberlog = $fetchattendance->fetchmemberlog($attendance_id);
                 for ($j = 0; $j < count($memberlog); $j++) {
                     $this->view->adm->addRecord("ourbank_memberattendance_log", $memberlog[$j]);
                 }
                 // for discussion log details
                 $discussionlog = $fetchattendance->fetchdiscussionlog($attendance_id);
                 for ($j = 0; $j < count($discussionlog); $j++) {
                     $this->view->adm->addRecord("ourbank_discussion_log", $discussionlog[$j]);
                 }
                 // for decision log details
                 $decisionlog = $fetchattendance->fetchdecisionlog($attendance_id);
                 for ($j = 0; $j < count($decisionlog); $j++) {
                     $this->view->adm->addRecord("ourbank_decision_log", $decisionlog[$j]);
                 }
                 //update record
                 $fetchattendance->attendance($attendance_id);
                 $updateAttendance = new Meetingbook_Model_Meetingbook();
                 $member_id = array();
                 $formData = $this->_request->getPost();
                 $member_id = $this->_request->getPost('member_id');
                 $this->view->adm->updateRecord("ourbank_attendance", $attendance_id, array('id' => $attendance_id, 'transaction_id' => $tranId, 'week_no' => $this->view->weekno, 'meeting_id' => $formData['meeting_name'], 'meeting_date' => $meeting_date, 'notes' => $formData['notes'], 'time' => $formData['meeting_time'], 'resolution' => $formData['resolution'], 'created_date' => date("y/m/d H:i:s"), 'created_by' => $this->view->createdby));
                 $loop = $formData['length'];
                 //-------for absent fee and income  ---------
                 for ($i = 0; $i < $loop; $i++) {
                     if (array_search_values('absent_' . $i, $formData)) {
                         $absentees_id[] = array_search_values('absent_' . $i, $formData);
                     }
                 }
                 for ($i = 0; $i < count($absentees_id); $i++) {
                     foreach ($absentees_id[$i] as $key => $value) {
                         //echo $key."<br>";
                     }
                 }
                 $abs1 = $i * $formData['absentfee'];
                 if ($abs1) {
                     $this->view->adm->addRecord("ourbank_Income", array('Income_id' => '', 'office_id' => $formData['officeid'], 'glsubcode_id_from' => $formData['absentglsubcode'], 'transaction_id' => 1, 'credit' => $abs1, 'recordstatus_id' => 3));
                 }
                 for ($i = 0; $i < count($absentees_id); $i++) {
                     foreach ($absentees_id[$i] as $key => $value) {
                         if ($key) {
                             $this->view->adm->addRecord("ourbank_memberattendance", array('id' => '', 'attendance_id' => $attendance_id, 'member_id' => $key, 'attendance_type' => 1, 'created_date' => date("y/m/d H:i:s")));
                         }
                     }
                 }
                 //-------for late fee and income  ---------
                 for ($j = 0; $j < $loop; $j++) {
                     if (array_search_values('late_' . $j, $formData)) {
                         $latemember_id[] = array_search_values('late_' . $j, $formData);
                     }
                 }
                 for ($j = 0; $j < count($latemember_id); $j++) {
                     foreach ($latemember_id[$j] as $key => $value) {
                         //echo $key."<br>";
                     }
                 }
                 $abs2 = $j * $formData['latefee'];
                 if ($abs2) {
                     $this->view->adm->addRecord("ourbank_Income", array('Income_id' => '', 'office_id' => $formData['officeid'], 'glsubcode_id_from' => $formData['lateglsubcode'], 'transaction_id' => 1, 'credit' => $abs2, 'recordstatus_id' => 3));
                 }
                 for ($j = 0; $j < count($latemember_id); $j++) {
                     foreach ($latemember_id[$j] as $key => $value) {
                         if ($key) {
                             $this->view->adm->addRecord("ourbank_memberattendance", array('id' => '', 'attendance_id' => $attendance_id, 'member_id' => $key, 'attendance_type' => 2, 'created_date' => date("y/m/d H:i:s")));
                         }
                     }
                 }
                 //insert discussion table
                 $discussion = $this->_request->getPost('discussionlist');
                 if ($discussion) {
                     foreach ($discussion as $discussion1) {
                         $this->view->adm->addRecord("ourbank_discussion", array('id' => '', 'attendance_id' => $attendance_id, 'discussion_id' => $discussion1, 'created_date' => date("y/m/d H:i:s")));
                     }
                 }
                 //insert decision table
                 $decision = $this->_request->getPost('decisionlist');
                 if ($decision) {
                     foreach ($decision as $decision1) {
                         $this->view->adm->addRecord("ourbank_decision", array('id' => '', 'attendance_id' => $attendance_id, 'decision_id' => $decision1, 'created_date' => date("y/m/d H:i:s")));
                     }
                 }
                 $this->_redirect('meetingbookindex/index');
             }
         } else {
             $this->view->result = "<p style='color:red'>This Group Savings Account is closed<p>";
         }
     }
     // 		} else {
     // 		$this->_redirect('index/index');
     // 		}
 }