Example #1
0
 public function indexAction()
 {
     $searchForm = new Receiptpayment_Form_Search();
     $this->view->form = $searchForm;
     $this->view->title = "Receipts and payments";
     if ($this->_request->isPost() && $this->_request->getPost('Search')) {
         $formData = $this->_request->getPost();
         $dateconvertor = new App_Model_dateConvertor();
         $fromDate = $dateconvertor->mysqlformat($this->_request->getParam('field1'));
         $toDate = $dateconvertor->mysqlformat($this->_request->getParam('field2'));
         $this->view->field1 = $this->_request->getParam('field1');
         $this->view->field2 = $this->_request->getParam('field2');
         $this->view->pageTitle = "Receipt and Payment";
         $formData = $this->_request->getPost();
         if ($searchForm->isValid($formData)) {
             $this->view->savings = 10;
             $transaction = new Receiptpayment_Model_Receiptpayment();
             //Saving Account Credit and Debit
             $this->view->savingsCredit = $transaction->totalSavingsCredit($fromDate, $toDate);
             $this->view->savingsDebit = $transaction->totalSavingsDebit($fromDate, $toDate);
             //Opening and Closing Balace Calculation
             //Opening Balance Saving Account Credit and Debit
             $this->view->openingsavingsCredit = $transaction->openingBalance($fromDate, $toDate);
             $this->view->openingsavingsDebit = $transaction->closingBalance($fromDate, $toDate);
             $this->view->field1 = $this->_request->getParam('field1');
             $this->view->field2 = $this->_request->getParam('field2');
         }
     }
 }
Example #2
0
 public function searchRoles($post)
 {
     $convertdate = new App_Model_dateConvertor();
     if ($post['granteddate']) {
         $searchdate = $convertdate->mysqlformat($post['granteddate']);
     } else {
         $searchdate = $post['granteddate'];
     }
     $select = $this->select()->setIntegrityCheck(false)->from('ourbank_grant')->where('name like "%" ? "%" ', $post['grantname'])->where('created_date  like "%" ? "%" ', $searchdate);
     $result = $this->fetchAll($select);
     return $result->toArray();
     // return searched grant details
 }
Example #3
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();
 }
Example #4
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;
 }
 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();
     }
 }
Example #6
0
 function indexAction()
 {
     $path = $this->view->baseUrl();
     $this->view->form = $searchForm = new Ledgerbalancebook_Form_Search($path);
     $dateconvertor = new App_Model_dateConvertor();
     $GeneralList = new Ledgerbalancebook_Model_Ledgerbookbalance();
     $officename = $GeneralList->getHier();
     foreach ($officename as $officename) {
         $searchForm->hierarchy->addMultiOption($officename['id'], $officename['type']);
     }
     if ($this->_request->isPost() && $this->_request->getPost('Search')) {
         $formData = $this->_request->getPost();
         if ($searchForm->isValid($formData)) {
             $this->view->date1 = $this->_request->getParam('date1');
             $fromDate = $dateconvertor->mysqlformat($this->view->date1);
             $hierarchy = $this->_request->getParam('hierarchy');
             $branch = $this->_request->getParam('branch');
             $this->view->ledegerList = $GeneralList->generalLedger($fromDate, $hierarchy, $branch);
             $this->view->ledegerListAssets = $GeneralList->generalLedgerAssets($fromDate, $hierarchy, $branch);
         }
     }
 }
Example #7
0
 public function editassetAction()
 {
     $this->view->title = $this->view->translate('Edit Livingasset details');
     //Base line data
     $familycommon = new Familycommonview_Model_familycommonview();
     $this->view->memberid = $this->_getParam('id');
     $this->view->membername = $familycommon->getfamily($this->_getParam('id'));
     // // // //         $revvillageid = $this->view->membername[0]['rev_village_id'];
     // // // //         if ($revvillageid) {
     // // // //             $revvillagename = $this->view->adm->editRecord("ourbank_master_villagelist",$revvillageid);
     // // // //             $this->view->revvillagename=$revvillagename[0]['name'];
     // // // //         }
     //getting module id and submodule id
     $module = $familycommon->getmodule('Family');
     foreach ($module as $module_id) {
     }
     $this->view->mod_id = $module_id['parent'];
     $this->view->sub_id = $module_id['module_id'];
     $this->view->insurance = $familycommon->getinsurance($this->_getParam('id'));
     //edit assets
     $this->view->memberid = $member_id = $this->_getParam('id');
     //load form for living assets
     $this->view->submoduleid = $this->_getParam('subId');
     //dynamically change the path name
     //get all type of living assets
     $this->view->liveasset_details = $this->view->adm->viewRecord("ourbank_master_liveassets", "id", "DESC");
     //update contact details
     if ($this->_request->isPost() && $this->_request->getPost('Submit')) {
         $id = $this->_getParam('id');
         $submoduleid = $this->_getParam('subid');
         $asset_db = new Livingassets_Model_livingassets();
         $editAsset = $asset_db->getAssetdetails($id);
         for ($j = 0; $j < count($editAsset); $j++) {
             $this->view->adm->addRecord("ourbank_liveassetdetails_log", $editAsset[$j]);
         }
         $asset_db->deleteasset($id);
         $number = $this->_getParam('number');
         $value = $this->_getParam('value');
         $date = $this->_getParam('date');
         $dateconvert = new App_Model_dateConvertor();
         $i = 0;
         foreach ($this->_getParam('assettype') as $val) {
             if ($date[$i]) {
                 if ($date[$i] == "00/00/0000" or $date[$i] == NULL) {
                     $dates = date("y/m/d H:i:s");
                 } else {
                     $dates = $dateconvert->mysqlformat($date[$i]);
                 }
             } else {
                 $dates = date("y/m/d H:i:s");
             }
             if ($value[$i]) {
                 $values = $value[$i];
             } else {
                 $values = 0;
             }
             $assettype = array('submodule_id' => $submoduleid, 'family_id' => $id, 'liveasset_id' => $val, 'number' => $number[$i], 'date_of_value' => $dates, 'value' => $values);
             $i++;
             $this->view->adm->addRecord("ourbank_liveassetdetails", $assettype);
         }
         $this->_redirect('/familycommonview/index/commonview/id/' . $id);
     } else {
         //set the contact details in the contact form...
         $sub_id = $this->_getParam('subId');
         $id = $this->_getParam('id');
         $individualcommon = new Familycommonview_Model_familycommonview();
         $this->view->editAsset = $individualcommon->getlivingassetsdetails($id);
         //$form->populate($editContact[0]);
     }
 }
Example #8
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
         }
     }
 }
Example #9
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);
             }
         }
     }
 }
Example #10
0
 public function pdftransactionAction()
 {
     //rupees right alignment
     function position($amt, $posValue)
     {
         $len = strlen($amt);
         $pos = $posValue - 35 - $len * 4;
         return $pos;
     }
     $fromDate = $this->_request->getParam('date');
     $branchid = $this->_request->getParam('office');
     $this->view->field1 = $fromDate;
     $this->view->branchid = $branchid;
     //         $fromDate = $this->_request->getParam('field1');
     //         $this->view->field1 = $fromDate;
     //date format instance
     $dateconvertor = new App_Model_dateConvertor();
     $cfromDate = $dateconvertor->mysqlformat($fromDate);
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     //Path
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9);
     $page->drawText("Cash Scroll", 270, 780);
     $page->drawText("Cash Scroll", 270, 780);
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $y1 = 745;
     $page->drawText("Credit", 50, $y1);
     $page->drawText("Debit", 310, $y1);
     $y1 = 745;
     $y2 = 740;
     $page->drawText("As of From " . $fromDate, 465, $y1);
     //For Top Header
     $text = array("", "SL No.", "Particulars", "Amount", "Total", "Particulars", "Opening Cash", "Closing Cash");
     $this->view->savings = 10;
     $page->drawText("Date : " . date('d-m-Y'), 500, 800);
     //date('Y-m-d')
     //         $page->drawText("Date : ".date('d-m-Y'),500, 800);
     $page->drawText($text[0], 240, 780);
     $page->drawText($text[0], 240, 780);
     $x1 = 60;
     $x2 = 120;
     $x3 = 310;
     $x4 = 315;
     $x5 = 390;
     $x6 = 570;
     $page->drawLine(50, 740, 550, 740);
     $page->drawLine(50, 720, 550, 720);
     $page->drawText($text[1], $x1, 725);
     $page->drawText($text[2], $x2, 725);
     $page->drawText($text[3], 250, 725);
     $page->drawText($text[1], $x4, 725);
     $page->drawText($text[5], $x5, 725);
     $page->drawText($text[3], 510, 725);
     $y1 = 710;
     $y2 = 710;
     $transaction = new Cashscroll_Model_Cashscroll();
     $this->view->savings = 10;
     $this->view->savingsCredit = $transaction->totalSavingsCredit($cfromDate, $branchid);
     $this->view->savingsDebit = $transaction->totalSavingsDebit($cfromDate, $branchid);
     //Credit and Debit
     $savingsCredit = $transaction->totalSavingsCredit($cfromDate, $branchid);
     $savingsDebit = $transaction->totalSavingsDebit($cfromDate, $branchid);
     // Opening Cash
     $openingBalance = 0;
     $osc = $transaction->openingBalance($cfromDate, $branchid);
     foreach ($osc as $osc1) {
         $openingBalance = $osc1->openingBalance;
     }
     $this->view->openingBalance = $openingBalance;
     $amountCredit = "0";
     $amountDebit = "0";
     $i = 0;
     $j = 0;
     foreach ($savingsCredit as $savingsCredit) {
         $i++;
         $page->drawText($i, $x1, $y1);
         $page->drawText($savingsCredit->account_number, $x2, $y1);
         //             $page->drawText($savingsCredit->amount_to_bank,$x3, $y1);
         $pos = position(sprintf("%4.2f", $savingsCredit->amount_to_bank), $x3);
         $page->drawText(sprintf("%4.2f", $savingsCredit->amount_to_bank), $pos + 2, $y1);
         $amountCredit = $amountCredit + $savingsCredit->amount_to_bank;
         $y1 = $y1 - 15;
     }
     foreach ($savingsDebit as $savingsDebit) {
         $j++;
         $page->drawText($j, $x4, $y2);
         $page->drawText($savingsDebit->account_number, $x5, $y2);
         //             $page->drawText($savingsDebit->amount_from_bank,$x6, $y2);
         $pos = position(sprintf("%4.2f", $savingsDebit->amount_from_bank), $x6);
         $page->drawText(sprintf("%4.2f", $savingsDebit->amount_from_bank), $pos + 2, $y2);
         $amountDebit = $amountDebit + $savingsDebit->amount_from_bank;
         $y2 = $y2 - 15;
     }
     $page->drawLine(50, $y1, 550, $y1);
     //opening balnce
     $page->drawText($text[6], $x1, $y1 - 10);
     //         $page->drawText(sprintf("%4.2f", $openingBalance), $x3, $y1 -10);
     $pos = position(sprintf("%4.2f", $openingBalance), $x3);
     $page->drawText(sprintf("%4.2f", $openingBalance), $pos + 2, $y1 - 10);
     //closing Balance
     $page->drawText($text[7], $x4, $y1 - 10);
     //         $page->drawText(sprintf("%4.2f", ( $sum = ($amountCredit + $openingBalance) - $amountDebit)), $x6, $y1 -10);
     $pos = position(sprintf("%4.2f", $sum = $amountCredit + $openingBalance - $amountDebit), $x6);
     $page->drawText(sprintf("%4.2f", $sum = $amountCredit + $openingBalance - $amountDebit), $pos + 2, $y1 - 10);
     $page->drawLine(50, $y1 = $y1 - 20, 550, $y1);
     $page->drawLine(50, $y1 - 20, 550, $y1 - 20);
     $page->drawText($text[4], $x1, $y1 - 15);
     $page->drawText($text[4], $x1, $y1 - 15);
     $pos = position(sprintf("%4.2f", $amountCredit + $openingBalance), $x3);
     $page->drawText(sprintf("%4.2f", $amountCredit + $openingBalance), $pos + 2, $y1 - 15);
     //         $page->drawText(sprintf("%4.2f", ($amountCredit + $openingBalance)), $x3, $y1 -15);
     //         $page->drawText(sprintf("%4.2f", ($amountCredit + $openingBalance)), $x3, $y1 -15);
     $page->drawText($text[4], $x4, $y1 - 15);
     $page->drawText($text[4], $x4, $y1 - 15);
     //         $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $x6, $y1 -15);
     //         $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $x6, $y1 -15);
     $pos = position(sprintf("%4.2f", $amountDebit + $sum), $x6);
     $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $pos + 2, $y1 - 15);
     // Virtual table
     $page->setLineWidth(1)->drawLine(50, $y1 - 20, 50, 740);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(300, $y1 - 20, 300, 740);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(550, $y1 - 20, 550, 740);
     //table rigth vertical
     //$page->drawText("ಭಾವನಾ. ಕೆ. ಎಸ್ ",$x6 + 30, $y1 -15, 'UTF-8');
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/cashscroll.pdf');
     $path = '/var/www/' . $projname . '/reports/cashscroll.pdf';
     chmod($path, 0777);
 }
Example #11
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);
 }
Example #12
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');
     // 		}
 }
Example #13
0
 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');
     }
 }
Example #14
0
 public function pdftransactionAction()
 {
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     $Date = $this->_request->getParam('field1');
     $branch = $this->_request->getParam('field2');
     $officer = $this->_request->getParam('field3');
     $resulttitle = $this->_request->getParam('result');
     $branchname = new Overduelist_Model_Overduelist();
     $dateconvertor = new App_Model_dateConvertor();
     $this->view->date1 = $dateconvertor->normalformat($Date);
     $this->view->field1 = $Date;
     $result = $branchname->getbanknames($branch);
     $this->view->val = 10;
     $bankname = $branchname->getbanknames($branch);
     foreach ($bankname as $bankname1) {
         $this->view->bankname = $bankname1['name'];
     }
     $officename = $branchname->getofficername($officer);
     foreach ($officename as $officename1) {
         $this->view->officername = $officename1['name'];
     }
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array("Over due list", "Account Number", "Number of overdue", "Age(in days)", "OverDue Amount", "Total", "Outstanding Balance", "From Date:", "To Date:", "There is not Outstanding Balance in between two dates");
     $x1 = 80;
     $x2 = 250;
     $x3 = 220;
     $x4 = 320;
     $x6 = 450;
     $y1 = 700;
     $page->drawLine(50, 740, 550, 740);
     $page->drawLine(50, 720, 550, 720);
     $page->drawText($text[0], $x2, 770);
     $page->drawText($text[1], $x1, 725);
     $page->drawText($text[2], $x3, 725);
     $page->drawText($text[3], $x4, 725);
     if ($this->view->officername) {
         $page->drawText("Loan officer: " . $this->view->officername, $x6, 745);
     }
     if ($this->view->bankname) {
         $page->drawText("Bank: " . $this->view->bankname, $x6, 755);
     }
     $page->drawText("As of " . $this->view->date1, $x6, 765);
     $page->drawText("Amount in Rs", $x1, 745);
     $page->drawText($text[4], $x6, 725);
     $arrayLoan = $branchname->search($Date, $branch, $officer);
     $this->view->loanView = $arrayLoan;
     $outstanding_amount = "0";
     foreach ($arrayLoan as $loanduelist) {
         $outstanding_amount += $loanduelist['overdue'];
         $page->drawText($loanduelist['account_number'], $x1, $y1);
         $pos = $dateconvertor->position($loanduelist['totalinstallments'], $x4 - 20);
         $page->drawText($loanduelist['totalinstallments'], $pos + 2, $y1);
         $pos = $dateconvertor->position($dateconvertor->dateDiff($loanduelist['installment_date'], $Date), $x6 - 70);
         $page->drawText($dateconvertor->dateDiff($loanduelist['installment_date'], $Date), $pos + 2, $y1);
         $pos = $dateconvertor->position(sprintf("%4.2f", $loanduelist['overdue']), 540);
         $page->drawText(sprintf("%4.2f", $loanduelist['overdue']), $pos + 2, $y1);
         //$page->drawText($loanduelist['overdue'],$x6, $y1);
         $y1 -= 15;
     }
     $page->drawLine(50, $y1, 550, $y1);
     $y2 = $y1 - 10;
     $page->drawText($text[5], $x1, $y2);
     $pos = $dateconvertor->position(sprintf("%4.2f", $outstanding_amount), 540);
     $page->drawText(sprintf("%4.2f", $outstanding_amount), $pos + 2, $y1 - 10);
     //        $page->drawText($outstanding_amount, $x6, $y2);
     $y3 = $y2 - 5;
     $page->drawLine(50, $y3, 550, $y3);
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/overduelist.pdf');
     $path = '/var/www/' . $projname . '/reports/overduelist.pdf';
     chmod($path, 0777);
     //$this->_redirect('/reports/loandue');
 }
Example #15
0
 function pdftransactionAction()
 {
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $Dispdate = $this->_request->getParam('field1');
     $this->view->field1 = $Dispdate;
     $dateconvertor = new App_Model_dateConvertor();
     $Date = $dateconvertor->mysqlformat($Dispdate);
     $title1 = $this->view->translate('Loan Supplementary');
     $this->view->pageTitle = $title1;
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 20, 780, 120, 830);
     $page->setLineWidth(1)->drawLine(20, 20, 580, 20);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(20, 20, 20, 830);
     //left vertical
     $page->setLineWidth(1)->drawLine(580, 25, 580, 830);
     //right vertical
     $page->setLineWidth(1)->drawLine(20, 830, 580, 830);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array($this->view->translate('Loan Supplementary'), $this->view->translate('Sl'), $this->view->translate('Particulars'), $this->view->translate('A/C No.'), $this->view->translate('Cash'), $this->view->translate('Transfer'), $this->view->translate('Total'));
     $criteria = $this->view->translate('As of') . $Dispdate;
     $currency = "* " . $this->view->translate('Amount in Rs');
     $this->view->savings = 10;
     //         $page->drawText("Date : ".date('d/m/Y'),500, 800); //date('Y-m-d')
     //         $page->drawText("Date : ".date('d/m/Y'),500, 800);
     $page->drawText($text[0], 200, 780);
     $page->drawText($text[0], 200, 780);
     $page->drawText($criteria, 500, 780);
     //Search criteria
     $page->drawText($criteria, 500, 780);
     $page->drawText($currency, 500, 770);
     //Currency
     $page->drawText($currency, 500, 770);
     $my = 735;
     $x1 = 33;
     $x2 = 45;
     $x3 = 135;
     $x4 = 170;
     $x5 = 210;
     $x6 = 260;
     $x7 = 300;
     $x8 = 312;
     $x9 = 402;
     $x10 = 437;
     $x11 = 477;
     $x12 = 530;
     $page->drawLine(30, 750, 570, 750);
     $page->drawLine(30, 730, 570, 730);
     $page->drawText($text[1], $x1, $my);
     $page->drawText($text[2], $x2, $my);
     $page->drawText($text[3], $x3, $my);
     $page->drawText($text[4], $x4, $my);
     $page->drawText($text[5], $x5, $my);
     $page->drawText($text[6], $x6, $my);
     $page->drawText($text[1], $x7, $my);
     $page->drawText($text[2], $x8, $my);
     $page->drawText($text[3], $x9, $my);
     $page->drawText($text[4], $x10, $my);
     $page->drawText($text[5], $x11, $my);
     $page->drawText($text[6], $x12, $my);
     $y1 = 710;
     $y2 = 710;
     $this->view->loan = 10;
     $transaction = new Loansupplementary_Model_Loansupplementary();
     //                 //Loan Account Credit and Debit
     $loanCredit = $transaction->totalloanCredit($Date);
     $this->view->loanCredit = $loanCredit;
     $loanDebit = $transaction->totalloanDebit($Date);
     $this->view->loanDedit = $loanDebit;
     $totalCredit = "0";
     $totalTransferCredit = "0";
     $totalDebit = "0";
     $totalTransferDebit = "0";
     $i = 0;
     $columntotal1 = 0;
     $columntotal = 0;
     $columntotald = 0;
     $columntotald1 = 0;
     foreach ($loanCredit as $loansCredit) {
         $i++;
         $columntotal = 0;
         if ($loansCredit->paymenttype_id == 1 or $loansCredit->paymenttype_id == 5) {
             $page->drawText($i, $x1, $y1);
             $productname = "To " . $loansCredit->account_number;
             $page->drawText($productname, $x2, $y1);
             $page->drawText($loansCredit->account_id, $x3, $y1);
             if ($loansCredit->paymenttype_id == 1) {
                 $page->drawText($loansCredit->amount_to_bank, $x4, $y1);
                 $totalCredit = $totalCredit + $loansCredit->amount_to_bank;
                 $columntotal += $loansCredit->amount_to_bank;
             } elseif ($loansCredit->paymenttype_id == 5) {
                 $page->drawText($loansCredit->amount_to_bank, $x5, $y1);
                 $totalTransferCredit = $totalTransferCredit + $loansCredit->amount_to_bank;
                 $columntotal += $loansCredit->amount_to_bank;
             }
             $page->drawText(sprintf("%4.2f", $columntotal), $x6, $y1);
             $page->drawText(sprintf("%4.2f", $columntotal), $x6, $y1);
             $columntotal1 += $columntotal;
             $y1 = $y1 - 15;
         }
     }
     $i = 0;
     foreach ($loanDebit as $loansDebit) {
         $i++;
         $columntotald = 0;
         if ($loansDebit->paymenttype_id == 1 or $loansDebit->paymenttype_id == 5) {
             $page->drawText($i, $x7, $y2);
             $productnamed = "By " . $loansDebit->account_number;
             $page->drawText($productnamed, $x8, $y2);
             $page->drawText($loansDebit->account_id, $x9, $y2);
             if ($loansDebit->paymenttype_id == 1) {
                 $page->drawText($loansDebit->amount_from_bank, $x10, $y2);
                 $totalDebit = $totalCredit + $loansDebit->amount_from_bank;
                 $columntotald += $loansDebit->amount_from_bank;
             } elseif ($loansDebit->paymenttype_id == 5) {
                 $page->drawText($loansDebit->amount_from_bank, $x11, $y2);
                 $totalTransferDebit = $totalTransferDebit + $loansDebit->amount_from_bank;
                 $columntotald += $loansDebit->amount_from_bank;
             }
             $page->drawText(sprintf("%4.2f", $columntotald), $x12, $y2);
             $page->drawText(sprintf("%4.2f", $columntotald), $x12, $y2);
             $columntotald1 += $columntotald;
             $y2 = $y2 - 15;
         }
     }
     $page->drawLine(30, $y1, 570, $y1);
     $page->drawLine(30, $y1 - 20, 570, $y1 - 20);
     $page->drawText($text[6], $x1, $y1 - 15);
     $page->drawText($text[6], $x1, $y1 - 15);
     if ($totalCredit != "0") {
         $page->drawText(sprintf("%4.2f", $totalCredit), $x4, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalCredit), $x4, $y1 - 15);
     } else {
         $page->drawText("----", $x4, $y1 - 15);
         $page->drawText("----", $x4, $y1 - 15);
     }
     if ($totalTransferCredit != "0") {
         $page->drawText(sprintf("%4.2f", $totalTransferCredit), $x5, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalTransferCredit), $x5, $y1 - 15);
     } else {
         $page->drawText("----", $x5, $y1 - 15);
         $page->drawText("----", $x5, $y1 - 15);
     }
     if ($columntotal1 != "0") {
         $page->drawText(sprintf("%4.2f", $columntotal1), $x6, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $columntotal1), $x6, $y1 - 15);
     } else {
         $page->drawText("----", $x6, $y1 - 15);
         $page->drawText("----", $x6, $y1 - 15);
     }
     if ($totalDebit != "0") {
         $page->drawText(sprintf("%4.2f", $totalDebit), $x10, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalDebit), $x10, $y1 - 15);
     } else {
         $page->drawText("----", $x10, $y1 - 15);
         $page->drawText("----", $x10, $y1 - 15);
     }
     if ($totalTransferDebit != "0") {
         $page->drawText(sprintf("%4.2f", $totalTransferDebit), $x11, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalTransferDebit), $x11, $y1 - 15);
     } else {
         $page->drawText("----", $x11, $y1 - 15);
         $page->drawText("----", $x11, $y1 - 15);
     }
     if ($columntotald1 != "0") {
         $page->drawText(sprintf("%4.2f", $columntotald1), $x12, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $columntotald1), $x12, $y1 - 15);
     } else {
         $page->drawText("----", $x12, $y1 - 15);
         $page->drawText("----", $x12, $y1 - 15);
     }
     // Virtual table
     $page->setLineWidth(1)->drawLine(30, $y1 - 20, 30, 750);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(298, $y1 - 20, 298, 750);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(570, $y1 - 20, 570, 750);
     //table rigth vertical
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/loansupplementary.pdf');
     $path = '/var/www/' . $projname . '/reports/loansupplementary.pdf';
     chmod($path, 0777);
 }
Example #16
0
 public function editcropAction()
 {
     $this->view->title = $this->view->translate('Edit Contact');
     $this->view->title = $this->view->translate('Add Crop');
     //Base line data
     $familycommon = new Familycommonview_Model_familycommonview();
     $this->view->memberid = $this->_getParam('id');
     $this->view->membername = $familycommon->getfamily($this->_getParam('id'));
     //agriculture view
     $this->view->agriculture = $edit_agriculture = $familycommon->getagriculturedetails($this->_getParam('id'));
     $this->view->acretotal = $familycommon->getacretotal($this->_getParam('id'));
     $this->view->guntatotal = $familycommon->getguntatotal($this->_getParam('id'));
     $revvillageid = $this->view->membername[0]['rev_village_id'];
     if ($revvillageid) {
         $revvillagename = $this->view->adm->editRecord("ourbank_master_villagelist", $revvillageid);
     }
     //getting module id and submodule id
     $module = $familycommon->getmodule('Family');
     foreach ($module as $module_id) {
     }
     $this->view->mod_id = $module_id['parent'];
     $this->view->sub_id = $module_id['module_id'];
     $this->view->insurance = $familycommon->getinsurance($this->_getParam('id'));
     //load crop details form with two arguments ...
     $form = new Crop_Form_Crop($this->_getParam('id'), $this->_getParam('subId'));
     $this->view->form = $form;
     $this->view->id = $this->_getParam('id');
     $this->view->submitform = new Crop_Form_Submit();
     //dynamically change the path name
     $addressmodel = new Address_Model_addressInformation();
     $module_name = $addressmodel->getmodule($this->view->subId);
     foreach ($module_name as $module_view) {
         $path1 = $module_view['module_description'] . 'commonview';
     }
     $path1 = $this->view->path1 = strtolower($path1);
     $crop = new Crop_Model_Crop();
     $this->view->cropdetails = $crop->getCrop();
     $this->view->seasondetails = $crop->getSeason();
     $this->view->units = $crop->getUnits();
     //update contact details
     if ($this->_request->getPost('submit')) {
         $formdata = $this->_request->getPost();
         //             echo '<pre>'; print_r($formdata);
         //   if($formdata['enteredacre']>=$formdata['availableacre']){
         //   $this->view->errormsg="<p style='color:red;'>The Entered acres should be less than or equal to ".$formdata['availableacre'];
         //   } else {
         $id = $this->_getParam('id');
         $crop = new Crop_Model_Crop();
         $editCrop = $crop->getCropdetails($id);
         for ($j = 0; $j < count($editCrop); $j++) {
             $this->view->adm->addRecord("ourbank_cropdetails_log", $editCrop[$j]);
         }
         $crop->deletecrop($id);
         $tenant = $this->_getParam('tenant');
         $acer = $this->_getParam('acre');
         $gunta = $this->_getParam('gunta');
         $season = $this->_getParam('season');
         $unit = $this->_getParam('unit');
         $quantity = $this->_getParam('quantity');
         $marketed = $this->_getParam('marketed');
         $price = $this->_getParam('price');
         $realised = $this->_getParam('realised');
         $soldDate = $this->_getParam('date');
         $dateconvert = new App_Model_dateConvertor();
         $i = 0;
         foreach ($this->_getParam('crop_id') as $val) {
             if ($soldDate[$i]) {
                 if ($soldDate[$i] == "00/00/0000" or $soldDate[$i] == NULL) {
                     $date = date("y/m/d H:i:s");
                 } else {
                     $date = $dateconvert->mysqlformat($soldDate[$i]);
                 }
             } else {
                 echo $date = date("y/m/d H:i:s");
             }
             $crop = array('family_id' => $id, 'crop_id' => $val, 'land_id' => $tenant[$i], 'season_id' => $season[$i], 'acre' => $acer[$i], 'gunta' => $gunta[$i], 'unit' => $unit[$i], 'quantity' => $quantity[$i], 'marketed' => $marketed[$i], 'price' => $price[$i], 'realised' => $realised[$i], 'sold_date' => $date);
             $i++;
             $this->view->adm->addRecord("ourbank_cropdetails", $crop);
         }
         $this->_redirect('/familycommonview/index/commonview/id/' . $id);
         //   }
     } else {
         //set the contact details in the contact form...
         $sub_id = $this->_getParam('subId');
         $id = $this->_getParam('id');
         $individualcommon = new Familycommonview_Model_familycommonview();
         $this->view->editCrop = $individualcommon->getcrop($this->_getParam('id'));
     }
 }
Example #17
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
 }
Example #18
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');
     // 		}
 }
Example #19
0
 function pdfgenerationAction()
 {
     $declarationform = new Declaration_Form_Account();
     $this->view->form = $declarationform;
     $this->view->membercode = $memcode = $this->_request->getParam('membercode');
     if (substr($memcode, 4, 1) == 2 or substr($memcode, 4, 1) == 3) {
         $this->view->groupresult = $result = $this->view->dbobj->getmembers($memcode);
         //
         if ($result) {
             $declarationform->populate($result[0]);
             $this->view->groupcode = $groupcode = $result[0]['groupcode'];
             $this->view->relation = $result = $this->view->dbobj->getrelations($groupcode);
         }
     } else {
         $this->view->result = $result = $this->view->dbobj->getmember($memcode);
         //
         if ($result) {
             $declarationform->populate($result[0]);
             $this->view->membercode1 = $familyid = $result[0]['family_id'];
             $this->view->relation = $result = $this->view->dbobj->getrelation($familyid);
             $dbobj = new Declaration_Model_Dec();
             $app = $this->view->baseUrl();
             $word = explode('/', $app);
             $projname = $word[1];
             $title1 = "declaration";
             $this->view->pageTitle = $title1;
             $pdf = new Zend_Pdf();
             $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
             $pdf->pages[] = $page;
             // Image
             $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
             $image = Zend_Pdf_Image::imageWithPath($image_name);
             //$page->drawImage($image, 25, 770, 570, 820);
             $page->drawImage($image, 30, 770, 130, 820);
             $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
             //bottom horizontal
             $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
             //left vertical
             $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
             //right vertical
             $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
             //top horizonta
             // define font resource
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
             // Image
             $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
             $image = Zend_Pdf_Image::imageWithPath($image_name);
             $Declaration = new Declaration_Model_Dec();
             $memcode = $this->_request->getParam('membercode');
             $familyid = $this->_request->getParam('membercode1');
             $showgetmember = $Declaration->getmember($memcode);
             $showgetrelation = $Declaration->getrelation($familyid);
             $dateconvert = new App_Model_dateConvertor();
             foreach ($this->view->result as $result) {
             }
             // write text to page
             $page->setFont($font, 12)->drawText('DECLARATION', 240, 720);
             //                 $page->setLineWidth(1)->drawLine(0, 800, 820, 250);
             $page->setFont($font, 10)->drawText('(TO BE SUBMITTED BY THE BORROWER UNDER SBI JOINT LIABILITY GROUP)', 72, 700);
             $page->setFont($font, 9)->drawText('I,' . $result['name'] . ' (Name of the borrower), Son of ' . $this->view->relation[0]['fathername'] . '', 72, 670);
             $page->setFont($font, 9)->drawText('Aged around ' . $result['age'] . ' years,presently residing at ' . $result['street'] . ' do here by', 72, 655);
             $page->setFont($font, 9)->drawText('Solemnly affirm and sincerely state on Oath as follows:', 72, 625);
             $page->setFont($font, 9)->drawText('i)  I propose to avail a crop loan under SBI JLG scheme against hypothecation of the crop which the loan is to be sanctioned.', 72, 605);
             $page->setFont($font, 9)->drawText('ii) In this connection, I confirm that and declare that I am land less labourer / share cropper /tenant farmer /oral lessee', 72, 585);
             $page->setFont($font, 9)->drawText('( Stricke out which ever not applicable ).', 80, 575);
             $page->setFont($font, 9)->drawText('iii) I hereby declare and confirm furture that the properties mentioned in the schedule to the affidavit is the property which', 72, 555);
             $page->setFont($font, 9)->drawText('is the subject matter of lease (Oral /written) in my favour for year to year or for period of  ' . $dateconvert->normalformat($result['created_date']) . '', 80, 545);
             $page->setFont($font, 9)->drawText('year as mentioned in the document and the lease is presently in force and Sri ' . $result['landowner_name'] . ' is the lesser and ', 80, 535);
             $page->setFont($font, 9)->drawText('the owner of the property (a copy of the lease deed is enclosed).', 80, 525);
             $page->setFont($font, 9)->drawText('iv)I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and', 72, 505);
             $page->setFont($font, 9)->drawText('have not committed any breach of the terms and conditions of the lease.Moreover,I declare further  that there are no', 80, 495);
             $page->setFont($font, 9)->drawText('arrears of any lease amount.', 80, 485);
             $page->setFont($font, 9)->drawText('v) I have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank', 72, 465);
             $page->setFont($font, 9)->drawText('finance.The crop to be raised is free from the charge/encumbrances.', 80, 455);
             // add page to document
             $pdf->pages[] = $page;
             $pdfData = $pdf->render();
             $pdfData = $pdf->render();
             $pdf->save('/var/www/' . $projname . '/reports/declaration.pdf');
             $path = '/var/www/' . $projname . '/reports/declaration.pdf';
             chmod($path, 0777);
             //                 $this->_redirect('/declaration/index');
         }
     }
 }
Example #20
0
 public function holidayeditAction()
 {
     //calling the holiday form
     $holidayForm = new Holiday_Form_Holiday();
     $this->view->form = $holidayForm;
     //getting id
     $id = $this->_getParam('id');
     $this->view->id = $id;
     // calling holiday model
     $holiday = new Holiday_Model_Holiday();
     //listing office names
     $officename = $this->view->adm->viewRecord("ourbank_officehierarchy", "id", "DESC");
     foreach ($officename as $officename) {
         $holidayForm->office_id->addMultiOption($officename['id'], $officename['type']);
     }
     //displaying the values to edit
     $result = $holiday->getHoliday($id);
     $dateconvert = new App_Model_dateConvertor();
     foreach ($result as $holidaydetails) {
         $this->view->form->name->setValue($holidaydetails['name']);
         $this->view->form->office_id->setValue($holidaydetails['office_id']);
         $this->view->form->holiday_from->setValue($dateconvert->normalformat($holidaydetails['holiday_from']));
         $this->view->form->holiday_upto->setValue($dateconvert->normalformat($holidaydetails['holiday_upto']));
         $this->view->form->repayment_date->setValue($dateconvert->normalformat($holidaydetails['repayment_date']));
     }
     //update action
     if ($this->_request->isPost() && $this->_request->getPost('Update')) {
         if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
             if ($holidayForm->isValid($formData)) {
                 //update and edit
                 $formdata1 = array('name' => $formData['name'], 'office_id' => $formData['office_id'], 'holiday_from' => $dateconvert->mysqlformat($formData['holiday_from']), 'holiday_upto' => $dateconvert->mysqlformat($formData['holiday_upto']), 'repayment_date' => $dateconvert->mysqlformat($formData['repayment_date']), 'created_by' => $this->view->createdby);
                 $previousdata = $this->view->adm->editRecord("ourbank_holiday", $id);
                 $this->view->adm->updateLog("ourbank_holiday_log", $previousdata[0], $this->view->createdby);
                 //update
                 $this->view->adm->updateRecord("ourbank_holiday", $id, $formdata1);
                 $this->_redirect("/holiday");
             }
         }
     }
 }
Example #21
0
 function pdftransactionAction()
 {
     $fromdate = $this->_request->getParam('fdate');
     $dateconvertor = new App_Model_dateConvertor();
     $Date = $dateconvertor->mysqlformat($fromdate);
     $this->view->fdate = $Date;
     $asofDate = $dateconvertor->normalformat($fromdate);
     $this->view->asofdate = $asofDate;
     $incomeexpenditure = new Incomeexpenditure_Model_Incomeexpenditure();
     $this->view->income = $income = $incomeexpenditure->incomedetails($Date);
     $this->view->expenditure = $expenditure = $incomeexpenditure->expendituredetails($Date);
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 20, 780, 120, 830);
     $page->setLineWidth(1)->drawLine(20, 20, 580, 20);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(20, 20, 20, 830);
     //left vertical
     $page->setLineWidth(1)->drawLine(580, 25, 580, 830);
     //right vertical
     $page->setLineWidth(1)->drawLine(20, 830, 580, 830);
     //top horizontal
     $x1 = 45;
     $x2 = 250;
     $x3 = 330;
     $x4 = 500;
     $my = 735;
     $y1 = 710;
     $y2 = 710;
     $totalincome = 0;
     $totalexpe = 0;
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array($this->view->translate('Income and Expenditure'), $this->view->translate('Income'), $this->view->translate('Amount'), $this->view->translate('Expenditure'), $this->view->translate('Amount'), $this->view->translate('Grand total'));
     $criteria = $this->view->translate('As of') . " " . $asofDate;
     $currency = "* " . $this->view->translate('Amount in Rs');
     // // // file:///var/www/IDF/application/modules/incomeexpenditure/controllers/IndexController.php
     /*$page->drawText("Date : ".date('d/m/Y'),500, 800); //date('Y-m-d')
       $page->drawText("Date : ".date('d/m/Y'),500, 800);*/
     $page->drawText($text[0], 185, 780);
     $page->drawText($text[0], 185, 780);
     $page->drawText($criteria, 500, 780);
     //Search criteria
     $page->drawText($criteria, 500, 780);
     $page->drawText($currency, 500, 770);
     //Currency
     $page->drawText($currency, 500, 770);
     $page->drawText($text[1], $x1, $my);
     $page->drawText($text[2], $x2, $my);
     $page->drawText($text[3], $x3, $my);
     $page->drawText($text[4], $x4, $my);
     $page->drawLine(30, 750, 570, 750);
     $page->drawLine(30, 730, 570, 730);
     foreach ($income as $income) {
         $page->drawText($income['header'], $x1, $y1);
         $page->drawText($income['credit'], $x2, $y1);
         $totalincome += $income['credit'];
         $y1 = $y1 - 15;
     }
     foreach ($expenditure as $expe) {
         $page->drawText($expe['header'], $x3, $y2);
         $page->drawText($expe['credit'], $x4, $y2);
         $totalexpe += $expe['credit'];
         $y2 = $y2 - 15;
     }
     $page->drawLine(30, $y1, 570, $y1);
     $page->drawLine(30, $y1 - 20, 570, $y1 - 20);
     $page->drawText($text[5], $x1, $y1 - 15);
     $page->drawText(sprintf("%4.2f", $totalincome), $x2, $y1 - 15);
     $page->drawText($text[5], $x3, $y1 - 15);
     $page->drawText(sprintf("%4.2f", $totalexpe), $x4, $y1 - 15);
     // Virtual table
     $page->setLineWidth(1)->drawLine(30, $y1 - 20, 30, 750);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(300, $y1 - 20, 300, 750);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(570, $y1 - 20, 570, 750);
     //table rigth vertical
     $pdfData = $pdf->render();
     $account_number = $Date;
     // 		$pdf->save('/var/www/ourbank/reports/incomeexpenditure.pdf');
     //$path = '/var/www/ourbank/reports/incomeexpenditure.pdf';
     $pdf->save('/var/www/' . $projname . '/reports/' . $account_number . 'incomeexpenditure.pdf');
     $path = '/var/www/' . $projname . '/reports/' . $account_number . 'incomeexpenditure.pdf';
     chmod($path, 0777);
 }
Example #22
0
 public function mainSearch($input, $fieldname, $table, $condition)
 {
     $dateconvert = new App_Model_dateConvertor();
     function checkingDate($value)
     {
         return preg_match('`^\\d{1,2}/\\d{1,2}/\\d{4}$`', $value);
     }
     $keyvalue = array_filter($input);
     $searchcounter = count($keyvalue);
     if ($searchcounter > 0) {
         for ($i = 1; $i <= count($fieldname); $i++) {
             $inputA = $fieldname['input' . $i];
             $inputB = $input['s' . $i];
             $checkdate = checkingDate($inputB);
             if ($checkdate == 1) {
                 $inputB = $dateconvert->mysqlformat($inputB);
                 $where[] = "a." . $inputA . " like '%" . $inputB . "%'";
             } else {
                 $where[] = "a." . $inputA . " like '%" . $inputB . "%'";
             }
         }
         $condwhere = implode(" AND ", $where);
         if ($condition) {
             $wherecond = 'AND (' . $condition . ')';
         } else {
             $wherecond = '';
         }
         $this->db = Zend_Db_Table::getDefaultAdapter();
         $sql = "SELECT * FROM " . $table . " as a WHERE " . $condwhere . " {$wherecond} ORDER BY a.DateofEntry Desc";
         $result = $this->db->fetchAll($sql);
         //         echo $sql;
         return $result;
     } else {
         if ($condition) {
             $select = $this->select()->setIntegrityCheck(false)->join(array('a' => $table), array('id'))->order(array('a.id DESC'))->where($condition);
             $result = $this->fetchAll($select);
         } else {
             $select = $this->select()->setIntegrityCheck(false)->join(array('a' => $table), array('id'))->order(array('a.id DESC'));
             $result = $this->fetchAll($select);
         }
         return $result->toArray();
     }
 }