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); } } } }
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'); // } }
public function savingseditAction() { $this->view->title = "Edit Savings"; $offerproduct_id = base64_decode($this->_getParam('id')); $this->view->offerid = $offerproduct_id; $systemDate = date('Y-m-d'); $savingsForm = new Savings_Form_Savings(); $this->view->form = $savingsForm; $offerproduct = new Savings_Model_Savings(); $convertdate = new App_Model_dateConvertor(); $this->view->offerproduct_id = $offerproduct_id; $this->view->currentdates = $systemDate; $savingsForm->Submit->setName('Update'); $savingsForm->offerproductname->removeValidator('Db_NoRecordExists'); $offerProductshortname = $offerproduct->offerProductshortname($offerproduct_id); foreach ($offerProductshortname as $shortname) { $offerproduct_shortname = $shortname['shortname']; $this->view->shortname = $offerproduct_shortname; $this->view->productshortname = $offerproduct_shortname; $savingsForm->offerproductname->setValue($shortname['name']); $this->view->FDproductid = $shortname['product_id']; } // load applicable to values $applicableto = $offerproduct->fetchAllMemberType(); foreach ($applicableto as $applicableto) { $savingsForm->applicableto->addMultiOption($applicableto['id'], $applicableto['type']); } // // load glsubcode id values // $glsubcode = $offerproduct->fetchAllglsubcode('Liabilities'); // foreach($glsubcode as $glsubcode) { // $savingsForm->glsubcode_id->addMultiOption($glsubcode->id,$glsubcode->header." -[".$glsubcode->glsubcode."]"); // } // load frequency of deposit values $select = $offerproduct->fetchAllTimeFrequencyType(); foreach ($select as $timefrequencytype) { $savingsForm->frequencyofdeposit->addMultiOption($timefrequencytype['id'], $timefrequencytype['name']); $savingsForm->Int_timefrequency_id->addMultiOption($timefrequencytype['id'], $timefrequencytype['name']); } // set all form field values $result = $offerproduct->viewofferProduct($offerproduct_id, $this->view->shortname); foreach ($result as $saving) { $this->view->form->savingproductname->setValue($saving['productname']); $this->view->form->offerproductname->setValue($saving['pname']); $this->view->form->offerproductshortname->setValue($saving['psname']); $this->view->form->offerproduct_description->setValue($saving['description']); $bdate = $convertdate->phpnormalformat($saving['begindate']); $this->view->form->begindate->setValue($bdate); $cdate = $convertdate->phpnormalformat($saving['closedate']); $this->view->form->closedate->setValue($cdate); $this->view->form->applicableto->setValue($saving['applicableto']); // $this->view->form->glsubcode_id->setValue($saving['glsubcode_id']); } if ($this->view->shortname == 'ps') { $this->view->form->minmumdeposit->setValue($saving['minmumdeposit']); $this->view->form->frequencyofdeposit->setValue($saving['frequencyofdeposit']); $this->view->form->Int_timefrequency_id->setValue($saving['Int_timefrequency_id']); $this->view->form->frequencyofinterestupdating->setValue($saving['frequencyofinterestupdating']); $this->view->form->minimumbalanceforinterest->setValue($saving['minimumbalanceforinterest']); } if ($this->view->shortname == 'fd' || $this->view->shortname == 'rd') { $this->view->form->minimum_deposit_amount->setValue($saving['minimum_deposit_amount']); $this->view->form->maximum_deposit_amount->setValue($saving['maximum_deposit_amount']); $this->view->form->frequency_of_deposit->setValue($saving['frequency_of_deposit']); $this->view->form->penal_Interest->setValue($saving['penal_Interest']); $frequency_of_deposit = $offerproduct->fetchAllTimeFrequencyType(); foreach ($frequency_of_deposit as $frequencyofdeposit) { $savingsForm->frequency_of_deposit->addMultiOption($frequencyofdeposit['id'], $frequencyofdeposit['name']); } } $interestperiods = $offerproduct->viewinterest($this->view->offerproduct_id); $this->view->viewinterest = $interestperiods; if ($this->_request->isPost() && $this->_request->getPost('Update')) { $formData = $this->_request->getPost(); $interestperiods = new Savings_Model_Savings(); // // // // if ($this->_request->isPost()) { $productshortname = $this->_request->getParam('shortname'); $offerproductid = $this->_request->getParam('offerproduct_id'); $Count = $this->_request->getParam('count'); $memberCount = $this->_request->getParam('memberCount'); $month = 'months'; $closeddate = $this->_request->getParam('closedate'); if ($productshortname == 'ps') { //make it as non mandatory fields $savingsForm->closedate->setRequired(false); $savingsForm->minimum_deposit_amount->setRequired(false); $savingsForm->maximum_deposit_amount->setRequired(false); $savingsForm->frequency_of_deposit->setRequired(false); $savingsForm->penal_Interest->setRequired(false); } else { //make it as non mandatory fields $savingsForm->minmumdeposit->setRequired(false); $savingsForm->frequencyofdeposit->setRequired(false); $savingsForm->Int_timefrequency_id->setRequired(false); $savingsForm->frequencyofinterestupdating->setRequired(false); $savingsForm->minimumbalanceforinterest->setRequired(false); } $existintid = array(); $interestForProduct = $this->view->adm->getRecord("ourbank_interest_periods", 'offerproduct_id', $offerproductid); foreach ($interestForProduct as $interestids) { $existintid[] = $interestids['id']; } // // // if ($savingsForm->isValid($this->_request->getPost())) { // // // // // Zend_Debug::dump($formData); $previousdata = $this->view->adm->editRecord("ourbank_productsoffer", $offerproductid); // get products offer details $result = $offerproduct->addofferproduct1($previousdata[0], $offerproductid); // insert into products offer details to log table $glcodes = $this->view->adm->getsingleRecord('ourbank_productsoffer', 'glsubcode_id', 'id', $offerproductid); $offerproduct->updateRecordpoffer($offerproductid, $formData, $this->view->shortname, $glcodes); // //if the record is belongs to personal savings if ($productshortname == 'ps') { $previousdataps = $this->view->adm->getRecord("ourbank_productssaving", 'productsoffer_id', $offerproductid); // get products saving details $result = $offerproduct->addofferproductsavingslog($previousdataps[0], $offerproductid); //Insert Products saving details to log table $offerproduct->updateRecordps($offerproductid, $formData); } else { $previousdatafd = $this->view->adm->getRecord("ourbank_product_fixedrecurring", 'productsoffer_id', $offerproductid); // get products saving details $result = $offerproduct->fixedrecurringlog($previousdatafd[0], $offerproductid); //Insert Products // saving details to log table $offerproduct->updateRecordfd($offerproductid, $formData); } $interestrecord = $offerproduct->getRecord($offerproductid); //get interest details foreach ($interestrecord as $intrecord) { $interestdata = array('record_id' => '', 'id' => $intrecord['id'], 'period_ofrange_monthfrom' => $intrecord['period_ofrange_monthfrom'], 'period_ofrange_monthto' => $intrecord['period_ofrange_monthto'], 'period_ofrange_description' => $intrecord['period_ofrange_description'], 'offerproduct_id' => $intrecord['offerproduct_id'], 'Interest' => $intrecord['Interest'], 'intereststatus_id' => 3); $result = $offerproduct->addinterestlog('ourbank_interest_periods_log', $interestdata); } // // // insert interest values if ($Count != 0) { $i = 0; foreach ($existintid as $existintids) { $i++; if ($i <= $Count) { $From = $this->_request->getParam('ifrom' . $i); $To = $this->_request->getParam('iTo' . $i); $Rate = $this->_request->getParam('iRate' . $i); $month = 'months'; $period_ofrange_description = $From . -$To . $month; $interestvalue = array('period_ofrange_monthfrom' => $From, 'period_ofrange_monthto' => $To, 'period_ofrange_description' => $period_ofrange_description, 'offerproduct_id' => $offerproductid, 'Interest' => $Rate, 'intereststatus_id' => 3); $offerproduct->updateinterest($interestvalue, $existintids); } } } if ($memberCount != 0) { for ($i = 1; $i <= $memberCount; $i++) { $From = $this->_request->getParam('memberName' . $i); $To = $this->_request->getParam('To' . $i); $Rate = $this->_request->getParam('Rate' . $i); $month = 'months'; $period_ofrange_description = $From . -$To . $month; if ($From) { $interestperiod = $this->view->adm->addRecord('ourbank_interest_periods', array('id' => '', 'period_ofrange_monthfrom' => $From, 'period_ofrange_monthto' => $To, 'period_ofrange_description' => $period_ofrange_description, 'offerproduct_id' => $offerproductid, 'Interest' => $Rate, 'intereststatus_id' => 3)); } } } $this->_redirect('savings/index'); } }
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'); // } }