diff --git a/Apollo/api/application/config/constants.php b/Apollo/api/application/config/constants.php index 2da53d20..d31a68d9 100755 --- a/Apollo/api/application/config/constants.php +++ b/Apollo/api/application/config/constants.php @@ -135,6 +135,8 @@ defined('SESSIONDETAILS') OR define('SESSIONDETAILS','T_SessionDetails'); defined('COURSESUBJECT') OR define('COURSESUBJECT','T_CourseSubject_Details'); defined('SESSIONSCHEDULE') OR define('SESSIONSCHEDULE','T_SessionSchedule_Master'); defined('SESSIONSCHEDULEDETAILS') OR define('SESSIONSCHEDULEDETAILS','T_SessionSchedule_Details'); +defined('STUDENTDOCUMENTDETAILS') OR define('STUDENTDOCUMENTDETAILS','T_StudentDocumentsDetails'); +defined('STUDENTDOCUMENTTRACKDETAILS') OR define('STUDENTDOCUMENTTRACKDETAILS','T_Student_DocumentTrack_Details'); diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 638afed2..2e6d85fe 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -203,6 +203,7 @@ $route['addDayBook'] = 'DayBook_Controller/adddaybook'; $route['updateDayBookStatusAdmin'] = 'DayBook_Controller/updateDayBookStatusAdmin'; $route['getDayBookDetailsSuperAdmin'] = 'DayBook_Controller/getDayBookDetailsSuperAdmin'; $route['empDayBookModuleAccessChk'] = 'DayBook_Controller/empDayBookModuleAccessChk'; +$route['deleteDayBookFeePayableDetails'] = 'DayBook_Controller/deleteDayBookFeePayableDetails'; /* * day book master * */ $route['getDayBookMasterDetails'] = 'DayBookMaster_Controller/getDayBookMasterDetails'; diff --git a/Apollo/api/application/controllers/DayBook_Controller.php b/Apollo/api/application/controllers/DayBook_Controller.php index 7bc10d3c..95a59e58 100755 --- a/Apollo/api/application/controllers/DayBook_Controller.php +++ b/Apollo/api/application/controllers/DayBook_Controller.php @@ -118,6 +118,28 @@ class DayBook_Controller extends REST_Controller { } } + public function deleteDayBookFeePayableDetails_post() { + $reqData = $this->post('data'); + $reqbyData = $this->post('requestDetails'); + + // print_r($reqbyData);exit(); + $deletedayBookFeePayableDetails = $this->daybook_model->delete_dayBookFeePayableDetails($reqData);// Check if the employee exist + if ($deletedayBookFeePayableDetails) + { + $deletedayBookFeePayableDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($deletedayBookFeePayableDetails, 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 updateDayBookDetails_post() { $reqData = $this->post('data'); $reqbyData = $this->post('localReqDetails'); diff --git a/Apollo/api/application/models/DayBook_model.php b/Apollo/api/application/models/DayBook_model.php index 6c58ec93..3e55e198 100755 --- a/Apollo/api/application/models/DayBook_model.php +++ b/Apollo/api/application/models/DayBook_model.php @@ -36,6 +36,7 @@ class DayBook_model extends CI_Model return $results; } + public function emp_day_book_AccessChk($arr) { $id = $arr['localUserID']; $sql1 = "SELECT t1.FinanceModuleAccess FROM ".STAFF." as t1 LEFT JOIN ".LOGIN." as t2 ON t2.StaffID = t1.StaffID WHERE t2.id = $id"; @@ -48,6 +49,7 @@ class DayBook_model extends CI_Model return $result; } + // get the daybook details list public function get_Daybook_Details_List($reqData, $reqDataBy) { if($reqData['date'] != '' && $reqData['dateTo'] != '') { @@ -95,6 +97,7 @@ class DayBook_model extends CI_Model return $results; } + // delete the daybook details public function delete_dayBookDetails($id) { $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE ID ='$id'"; @@ -109,6 +112,65 @@ class DayBook_model extends CI_Model return $result; } + // delete the daybook fees entry details + public function delete_dayBookFeePayableDetails($id) { +// echo $id;exit(); + $this->db->select('FeesPaymentID'); + $this->db->from(DAYBOOKMASTER); + $this->db->where('ID', $id); + $typeDetails = $this->db->get(); + $typeStateDetails = $typeDetails->result(); + // print_r($typeStateDetails);exit(); + $getID = $typeStateDetails[0]->FeesPaymentID; + // if($getID != '' || $getID != null ) { + // $sql1 = " DELETE FROM T_Students_Fees_PaidDetails WHERE ID ='$getID'"; + // // update branch to staff_branch table + // if ($this->db->query($sql1) == '1') { + // $sql2 = " DELETE FROM ".DAYBOOKMASTER." WHERE ID ='$id'"; + // if ($this->db->query($sql2) == '1') { + // $result['deletedStatus'] = true; + // $result['message'] = "Entry is Deleted"; + // }else{ + // $result['deletedStatus'] = false; + // $result['message'] = "Something went wrong.please try again"; + // } + // } else { + // $result['deletedStatus'] = false; + // $result['message'] = "Something went wrong.please try again"; + // } + // return $result; + // } else { + // $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE ID ='$id'"; + // // update branch to staff_branch table + // if ($this->db->query($sql1) == '1') { + // $result['deletedStatus'] = true; + // $result['message'] = "Entry is Deleted"; + // } else { + // $result['deletedStatus'] = false; + // $result['message'] = "Something went wrong.please try again"; + // } + // return $result; + // } + try { + $sql1 = " DELETE FROM ".STUDENTS_FEES_PAID." WHERE ID ='$getID'"; + $this->db->query($sql1); + } catch(Exception $e) { + echo 'error'; + } finally { + $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE ID ='$id'"; + // update branch to staff_branch table + if ($this->db->query($sql1) == '1') { + $result['deletedStatus'] = true; + $result['message'] = "Entry is Deleted"; + } else { + $result['deletedStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + return $result; + } + + // update existing daybook details public function update_dayBookDetails($Arr, $upFor) { $this->db->where('ID', $upFor); $this->db->update(DAYBOOKMASTER, $Arr); @@ -137,6 +199,7 @@ class DayBook_model extends CI_Model return $result; } + // approve/reject status updation for the daybook expense details public function update_status_admin($arr) { $Approval_By = $arr[0]['Approval_By']; @@ -167,6 +230,7 @@ class DayBook_model extends CI_Model return $result; } + // daybook full details for super admin view public function get_Daybook_Details_List_superAdmin($reqData, $reqDataBy){ if($reqData['date'] != '' && $reqData['dateTo'] != '') { diff --git a/Apollo/api/application/models/Student_model.php b/Apollo/api/application/models/Student_model.php index 4dab02d7..19f7e2ca 100755 --- a/Apollo/api/application/models/Student_model.php +++ b/Apollo/api/application/models/Student_model.php @@ -880,7 +880,7 @@ class Student_model extends CI_Model { $this->db->select('*'); $this->db->order_by('CreatedOn', 'DESC'); - $this->db->from('T_StudentDocumentsDetails'); + $this->db->from(STUDENTDOCUMENTDETAILS); $this->db->where('StudentID', $stuId); $getDocDetails = $this->db->get(); $documentDetails = $getDocDetails->result(); @@ -892,18 +892,17 @@ class Student_model extends CI_Model $results['docListStatus'] = false; $results['message'] = 'No record found'; } - return $results; } public function deleteStu_doc_details($stuId, $docId) { - $sql1 = "SELECT * FROM T_StudentDocumentsDetails WHERE StudentID = '" . $stuId . "' AND ID = '" . $docId . "'"; + $sql1 = "SELECT * FROM ".STUDENTDOCUMENTDETAILS." WHERE StudentID = '" . $stuId . "' AND ID = '" . $docId . "'"; $resultSql1 = $this->db->query($sql1)->result(); if(count($resultSql1) > 0){ // print_r($resultSql1); // echo $resultSql1[0]->DocumentStorePath;exit(); - $sql = "DELETE FROM T_StudentDocumentsDetails WHERE StudentID = '" . $stuId . "' AND ID = '" . $docId . "'"; + $sql = "DELETE FROM ".STUDENTDOCUMENTDETAILS." WHERE StudentID = '" . $stuId . "' AND ID = '" . $docId . "'"; if ($this->db->query($sql)) { try{ if(!file_exists('../images/' . $resultSql1[0]->DocumentStorePath)) { @@ -954,7 +953,7 @@ class Student_model extends CI_Model // echo $docCreatadOn;exit(); // ".STAFF_BRANCH." - $sql1 = "INSERT INTO T_StudentDocumentsDetails (StudentID, DocumentName, Status, DocumentStorePath, Comments, CreatedBy, CreatedOn) + $sql1 = "INSERT INTO ".STUDENTDOCUMENTDETAILS." (StudentID, DocumentName, Status, DocumentStorePath, Comments, CreatedBy, CreatedOn) VALUES ('$stuId', '$docTypeName', '$docStatus', '$strPath', '$docComments', '$docCreatedBy', '$docCreatadOn')"; // update branch to staff_branch table @@ -999,7 +998,7 @@ class Student_model extends CI_Model public function getStudent_PendingDoc_Details($stuID) { $this->db->select('*'); $this->db->order_by('CreatedOn', 'DESC'); - $this->db->from('T_Student_DocumentTrack_Details'); + $this->db->from(STUDENTDOCUMENTTRACKDETAILS); $this->db->where('StudentID', $stuID); $getPendDocDetails = $this->db->get(); $documentPendingDetails = $getPendDocDetails->result(); @@ -1018,7 +1017,7 @@ class Student_model extends CI_Model public function addStu_PendingDoc_Details($reqData) { // echo "model"; // print_r($reqData);exit(); - $this->db->insert('T_Student_DocumentTrack_Details', $reqData); + $this->db->insert(STUDENTDOCUMENTTRACKDETAILS, $reqData); if ($this->db->affected_rows() > 0) { $results['AddStuPendingDocStatus'] = true; $results['message'] = "Added Successfully."; diff --git a/Apollo/assets/js/controllers/daybookCtrl.js b/Apollo/assets/js/controllers/daybookCtrl.js index 3818c2f3..192113f9 100755 --- a/Apollo/assets/js/controllers/daybookCtrl.js +++ b/Apollo/assets/js/controllers/daybookCtrl.js @@ -3,7 +3,7 @@ * daybook details capturing * */ -app.controller('daybookCtrl', ["$scope", "$rootScope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", 'ipCookie', '$window', function ($scope, $rootScope, toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state, ipCookie, $window) { +app.controller('daybookCtrl', ["$scope", "$rootScope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", 'ipCookie', '$window','SweetAlert', function ($scope, $rootScope, toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state, ipCookie, $window, SweetAlert) { // get local client details var localDetail = JSON.parse(localStorage.getItem('localObj')); @@ -30,8 +30,6 @@ app.controller('daybookCtrl', ["$scope", "$rootScope", "toaster", "$filter", "ng $window.localStorage.clear(); $state.go('login.signin'); } - - } $scope.dayBookApprovalAccess = ''; @@ -215,6 +213,45 @@ $scope.dayBookApprovalAccess = ''; } } + + //delete the income entry From the fees payable + $scope.deleteFeePayableEntry = function (id) { + // alert(id); + SweetAlert.swal({ + title: "Warning!", + text: "Do you want to Delete this Entry ?", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#007aff", + confirmButtonText: "Yes!" + }, function (res) { + if (res === true) { + // alert(id); + // alert(stuId); + var deleteFeePayableDetails = { + method: 'POST', + url: apiPoint.url + 'deleteDayBookFeePayableDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: id, + requestDetails: localDetails + } + }; + $http(deleteFeePayableDetails).then(function (response) { + if (response.data.deletedStatus) { + swal(" ", "Deleted Successfully.", "success"); + $scope.getDayBookList(); + } else { + swal(" ", response.data.message, "error"); + } + }); + } + }); + } + + // delete the income/expense list row $scope.deleEditEntry = function (id) { swal({ diff --git a/Apollo/assets/views/daybook/daybook.html b/Apollo/assets/views/daybook/daybook.html index 7ea915be..b5c46286 100755 --- a/Apollo/assets/views/daybook/daybook.html +++ b/Apollo/assets/views/daybook/daybook.html @@ -133,7 +133,9 @@