diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 3779fad4..190c084f 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -306,6 +306,12 @@ $route['addNonOperational'] = 'DayBook_Controller/addNonOperational'; $route['updateNonOperationalDetails'] = 'DayBook_Controller/updateNonOperationalDetails'; +$route['getExpenseType'] = 'DayBook_Controller/getExpenseType'; + + +$route['getDayBookfilterDetails'] = 'DayBook_Controller/getDayBookfilterDetails'; + + /** This is for CRONE JOB*/ $route['sendStudentNotification'] = 'Fees_Status_Controller/sendStudentNotification'; diff --git a/Apollo/api/application/controllers/DayBook_Controller.php b/Apollo/api/application/controllers/DayBook_Controller.php index 6ee190a6..30e652bd 100755 --- a/Apollo/api/application/controllers/DayBook_Controller.php +++ b/Apollo/api/application/controllers/DayBook_Controller.php @@ -199,6 +199,40 @@ class DayBook_Controller extends REST_Controller { } } + + + +public function getDayBookfilterDetails_post() +{ + + + $reqData = $this->post('data'); + $reqDataBy = $this->post('localReqDetails'); + $filter['exptype'] = $this->post('exptype'); + $filter['modeofpayment'] = $this->post('modeofpayment'); + $filter['fdate'] = $this->post('fdate'); + $filter['tdate'] = $this->post('tdate'); + + + $getDayBookApprovalDetails = $this->daybook_model->get_Daybook_filterApproval_Details_List($reqData, $reqDataBy,$filter);// Check if the employee exist + if ($getDayBookApprovalDetails) + { + $getDayBookApprovalDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getDayBookApprovalDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } +} + + + public function deleteDayBookDetails_post() { $reqData = $this->post('data'); $reason = $this->post('reason'); @@ -318,6 +352,10 @@ public function updateNonOperationalDetails_post() { + + + + // add details daybook public function adddaybook_post() { @@ -347,6 +385,8 @@ public function updateNonOperationalDetails_post() { $req['VoucherNumber'] = $reqData['voucherNumber']; $date = date('Y-m-d H:i:s'); $req['CreatedOn'] = $date; + + $req['ModeOfPayment'] = 'CASH'; if($reqData['Isdaybook']==true) { @@ -361,7 +401,7 @@ public function updateNonOperationalDetails_post() { $non['Name'] = $reqData['name']; - $non['Type'] = $reqData['type']; + $non['Type'] = $reqData['type']; //$non['Type'] = $typealone->ID; $non['Amount'] = $reqData['amount']; // $d = new DateTime($reqData['date']); @@ -375,6 +415,7 @@ public function updateNonOperationalDetails_post() { $non['VoucherNumber'] = $reqData['voucherNumber']; $date = date('Y-m-d H:i:s'); $non['CreatedOn'] = $date; + $non['ModeOfPayment'] = 'CASH'; $non['Isdaybook'] = 0; @@ -739,5 +780,31 @@ public function updateNonOperationalDetails_post() { } + + + + public function getExpenseType_post() + { + + $branch=$this->post('branch'); + $getexpensetype = $this->daybook_model->getExpenseType($branch); + + if ($getexpensetype) + { + $getexpensetype['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getexpensetype, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } } diff --git a/Apollo/api/application/models/DayBook_model.php b/Apollo/api/application/models/DayBook_model.php index f5fbcd73..5d3258e9 100644 --- a/Apollo/api/application/models/DayBook_model.php +++ b/Apollo/api/application/models/DayBook_model.php @@ -225,6 +225,68 @@ class DayBook_model extends CI_Model return $results; } + + + public function get_Daybook_filterApproval_Details_List($reqData, $reqDataBy,$filter) { + + $ModeOfPayment= $filter['modeofpayment']; + $exptype = $filter['exptype']; + + if($reqData['date'] != '' && $reqData['dateTo'] != '') { + $d = new DateTime($reqData['date']); + $dTo = new DateTime($reqData['dateTo']); + $fromDate = $d->format('Y-m-d'); + $toDate = $dTo->format('Y-m-d'); + $reqpayType = $reqDataBy['localBranchID']; + + // $ModeOfPayment= $filter['modeofpayment']; + + // $exptype = $filter['exptype']; + + $querys = "SELECT t1.ID as ORDER_ID, t1.*, t2.ListName, t3.TypeName , t5.Firstname as Approved_by_name,t7.UniversityName as UniversityName, t6.CourseName as CourseName + FROM ".DAYBOOKMASTER." as t1 + LEFT JOIN ".PICK_LIST_DETAILS." as t2 ON t2.ListCode = t1.Name + LEFT JOIN ".INCOMEOUTCOMEMASTER." as t3 ON t3.ID = t1.Type AND t3.BranchCode = t1.BranchCode + LEFT JOIN ".LOGIN." as t4 ON t4.ID = t1.Approval_By + LEFT JOIN ".STAFF." as t5 ON t5.StaffID = t4.StaffID + LEFT JOIN ".COURSE." as t6 ON t6.CourseID = t1.CourseID AND t6.BranchCode = t1.BranchCode + LEFT JOIN ".UNIVERSITY." as t7 ON t7.UniversityID = t6.UniversityID AND t7.BranchCode = t1.BranchCode + WHERE STR_TO_DATE(t1.Date, '%d-%m-%Y') BETWEEN '$fromDate' + AND '$toDate' AND t1.BranchCode = '$reqpayType' AND t1.Status NOT IN ('Approved', 'Cancel') + + and t1.Type='$exptype' + + AND (t1.ModeOfPayment='$ModeOfPayment' or t1.ModeOfPayment is NULL) + ORDER BY ORDER_ID DESC"; + } + else { $reqpayType = $reqDataBy['localBranchID']; + $querys = "SELECT t1.ID as ORDER_ID, t1.*, t2.ListName, t3.TypeName, t5.Firstname as Approved_by_name,t7.UniversityName as UniversityName, t6.CourseName as CourseName + FROM ".DAYBOOKMASTER." as t1 + LEFT JOIN ".PICK_LIST_DETAILS." as t2 ON t2.ListCode = t1.Name + LEFT JOIN ".INCOMEOUTCOMEMASTER." as t3 ON t3.ID = t1.Type AND t3.BranchCode = t1.BranchCode + LEFT JOIN ".LOGIN." as t4 ON t4.ID = t1.Approval_By + LEFT JOIN ".STAFF." as t5 ON t5.StaffID = t4.StaffID + LEFT JOIN ".COURSE." as t6 ON t6.CourseID = t1.CourseID AND t6.BranchCode = t1.BranchCode + LEFT JOIN ".UNIVERSITY." as t7 ON t7.UniversityID = t6.UniversityID AND t7.BranchCode = t1.BranchCode + WHERE t1.BranchCode = '$reqpayType' AND t1.Status NOT IN ('Approved', 'Cancel') + + and t1.Type='$exptype' + AND (t1.ModeOfPayment='$ModeOfPayment' or t1.ModeOfPayment is NULL) + ORDER BY ORDER_ID DESC"; + } + $dayBookDetails = $this->db->query($querys); + $dayBookDetailsList = $dayBookDetails->result(); + $results['dayBookListStatus'] = true; + $results['dayBookListDetails'] = $dayBookDetailsList; +// print_r($this->db->last_query()); +// die(); + return $results; + } + + + + + // delete the daybook details public function delete_dayBookDetails($id,$reason) { // echo $id;exit(); @@ -1261,4 +1323,37 @@ $subQuery='select Name,ListName,q.Date as dat,month(str_to_date(Date,?)) as mont } return $results; } + + + + + public function getExpenseType($branch) + { + + $expcode='I001'; + $this->db->select('ID,TypeName'); + $this->db->from('T_Income_Outcome_Master'); + $this->db->where('TypeID',$expcode); + $this->db->where('BranchCode',$branch); + $this->db->where('IsActive','1'); + $searchDetails = $this->db->get(); + + if($searchDetails->result()) + { + + $expDetails['status'] = true; + $expDetails['details'] = $searchDetails->result(); + } + + else + { + + $expDetails['status'] = false; + $expDetails['details'] = "No records found!"; + } + + return $expDetails; + + + } } \ No newline at end of file diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index ce6ae1c8..39187bd0 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -603,7 +603,7 @@ $upperresult=strtoupper($getlastansbookstatus); $this->db->select('t3.BatchName, t3.BatchCode,t3.BatchDate'); $this->db->from('' . BATCH . ' as t3'); $this->db->where('t3.UniversityID', $clip->UniversityID); - $this->db->where('t3.IsActive', 1); + // $this->db->where('t3.IsActive', 1); $this->db->where('t3.BranchCode', $branch); $batDetails = $this->db->get(); $batchDetails = $batDetails->result(); diff --git a/Apollo/assets/js/controllers/daybooksuperadminapprovalCtrl.js b/Apollo/assets/js/controllers/daybooksuperadminapprovalCtrl.js index 34502fec..28231778 100755 --- a/Apollo/assets/js/controllers/daybooksuperadminapprovalCtrl.js +++ b/Apollo/assets/js/controllers/daybooksuperadminapprovalCtrl.js @@ -17,6 +17,32 @@ app.controller('daybooksuperadminapprovalCtrl', ["$scope", "$rootScope", "toaste } $scope.viewStudentDetailsPage = false; + + $scope.ExpenseType=''; + + $scope.paymentOptions = [ + { + "paymentOn":"CASH" + }, + { + "paymentOn":"CHEQUE" + }, + { + "paymentOn":"REFERRAL" + }, + { + "paymentOn":"ONLINE TRANSACTION" + }, + { + "paymentOn":"WAIVER" + }, + { + "paymentOn":"Credit/Debit Card" + } + + ]; + + // load when html page load $scope.init = function () { if (localDetail != null) { @@ -164,8 +190,97 @@ app.controller('daybooksuperadminapprovalCtrl', ["$scope", "$rootScope", "toaste } else { } }); + + + + + var getExpenseType = { + method: 'POST', + url: apiPoint.url + 'getExpenseType/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + branch: localDetails.localBranchID, + + } + }; + $http(getExpenseType).then(function (response) { + + if(response.data.status='200') + { + $scope.ExpenseType= response.data.details; + } + + else + { + + } + //console.log(localDetails); + // console.log($scope.searchData.dateTo); + //console.log($scope.searchData.date); + }); + + + + + } + + $scope.searchData = { + "modeofpayment": "", + "exptype": "" + } + + + $scope.getfilterDetails=function(p) + { + // alert() + //console.log(p.expensetype) + // console.log(p.paymentOn.paymentOn) + + if((p.expensetype != undefined)&&(p.paymentOn.paymentOn != undefined)) + { + + var getDayBookfilterDetails = { + method: 'POST', + url: apiPoint.url + 'getDayBookfilterDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.searchData, + localReqDetails: localDetails, + exptype:p.expensetype, + modeofpayment:p.paymentOn.paymentOn, + fdate:$scope.searchData.date, + tdate:$scope.searchData.dateTo + } + }; + $http(getDayBookfilterDetails).then(function (response) { + if (response.data.dayBookListStatus) { + $scope.loadingsearch = false; + + $scope.searchResultDetails = response.data.dayBookListDetails; + $scope.searchResultDetailsCopy = response.data.dayBookListDetails; + } else { + $scope.loadingsearch = false; + } + }); + + } + + else + { + $scope.getDayBookList(); + } + + + } + + + $scope.loadingsearch = false; $scope.noRecordFound = true; $scope.noRecordFoundSearch = false; @@ -355,6 +470,10 @@ app.controller('daybooksuperadminapprovalCtrl', ["$scope", "$rootScope", "toaste // }); } + + + + $scope.statusList = [{ "status_id": 'TS001', "name": "Pending", diff --git a/Apollo/assets/views/daybook/daybooksuperAdminApproval.html b/Apollo/assets/views/daybook/daybooksuperAdminApproval.html index 6e877979..cd3a2389 100755 --- a/Apollo/assets/views/daybook/daybooksuperAdminApproval.html +++ b/Apollo/assets/views/daybook/daybooksuperAdminApproval.html @@ -44,13 +44,16 @@ -