add reason for daybook

This commit is contained in:
gayathri1990 2018-07-09 17:06:40 +05:30
parent 43b3fb0b52
commit 029f0c4fe8
5 changed files with 61 additions and 36 deletions

View File

@ -121,8 +121,12 @@ class DayBook_Controller extends REST_Controller {
public function deleteDayBookDetails_post() { public function deleteDayBookDetails_post() {
$reqData = $this->post('data'); $reqData = $this->post('data');
$reason = $this->post('reason');
// print_r($reqData);
// print_r($reason);
// exit();
$reqbyData = $this->post('localReqDetails'); $reqbyData = $this->post('localReqDetails');
$deletedayBookDetails = $this->daybook_model->delete_dayBookDetails($reqData);// Check if the employee exist $deletedayBookDetails = $this->daybook_model->delete_dayBookDetails($reqData,$reason);// Check if the employee exist
if ($deletedayBookDetails) if ($deletedayBookDetails)
{ {
$deletedayBookDetails['status'] = REST_Controller::HTTP_OK; $deletedayBookDetails['status'] = REST_Controller::HTTP_OK;
@ -141,10 +145,10 @@ class DayBook_Controller extends REST_Controller {
public function deleteDayBookFeePayableDetails_post() { public function deleteDayBookFeePayableDetails_post() {
$reqData = $this->post('data'); $reqData = $this->post('data');
$reason = $this->post('reason');
$reqbyData = $this->post('requestDetails'); $reqbyData = $this->post('requestDetails');
// print_r($reqbyData);exit(); // print_r($reqbyData);exit();
$deletedayBookFeePayableDetails = $this->daybook_model->delete_dayBookFeePayableDetails($reqData);// Check if the employee exist $deletedayBookFeePayableDetails = $this->daybook_model->delete_dayBookFeePayableDetails($reqData,$reason);// Check if the employee exist
if ($deletedayBookFeePayableDetails) if ($deletedayBookFeePayableDetails)
{ {
$deletedayBookFeePayableDetails['status'] = REST_Controller::HTTP_OK; $deletedayBookFeePayableDetails['status'] = REST_Controller::HTTP_OK;

View File

@ -151,7 +151,7 @@ class DayBook_model extends CI_Model
} }
// delete the daybook details // delete the daybook details
public function delete_dayBookDetails($id) { public function delete_dayBookDetails($id,$reason) {
// echo $id;exit(); // echo $id;exit();
$mysql = "SELECT * FROM ".DAYBOOKMASTER." WHERE ID = '$id'"; $mysql = "SELECT * FROM ".DAYBOOKMASTER." WHERE ID = '$id'";
@ -170,7 +170,7 @@ class DayBook_model extends CI_Model
$currID = $latestUpdateDetails[0]->ID; $currID = $latestUpdateDetails[0]->ID;
// $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE ID ='$id'"; // $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE ID ='$id'";
$sql1 = "UPDATE ".DAYBOOKMASTER." SET Status ='Cancel' WHERE ID ='$id'"; $sql1 = "UPDATE ".DAYBOOKMASTER." SET Status ='Cancel',Reason='$reason' WHERE ID ='$id'";
// update branch to staff_branch table // update branch to staff_branch table
if ($this->db->query($sql1) == '1') { if ($this->db->query($sql1) == '1') {
@ -206,7 +206,7 @@ class DayBook_model extends CI_Model
} }
// delete the daybook fees entry details // delete the daybook fees entry details
public function delete_dayBookFeePayableDetails($id) { public function delete_dayBookFeePayableDetails($id,$reason) {
$this->db->select('FeesPaymentID, BranchCode'); $this->db->select('FeesPaymentID, BranchCode');
$this->db->from(DAYBOOKMASTER); $this->db->from(DAYBOOKMASTER);
$this->db->where('ID', $id); $this->db->where('ID', $id);
@ -241,7 +241,7 @@ class DayBook_model extends CI_Model
// $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE FeesPaymentID ='$getID'"; // $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE FeesPaymentID ='$getID'";
// $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE FeesPaymentID ='$getID'"; // $sql1 = " DELETE FROM ".DAYBOOKMASTER." WHERE FeesPaymentID ='$getID'";
$sql1 = "UPDATE ".DAYBOOKMASTER." SET Status ='Cancel' WHERE FeesPaymentID ='$getID'"; $sql1 = "UPDATE ".DAYBOOKMASTER." SET Status ='Cancel',Reason='$reason' WHERE FeesPaymentID ='$getID'";
// update branch to staff_branch table // update branch to staff_branch table
if ($this->db->query($sql1) == '1') { if ($this->db->query($sql1) == '1') {
@ -271,7 +271,7 @@ class DayBook_model extends CI_Model
$result['message'] = "Something went wrong.please try again"; $result['message'] = "Something went wrong.please try again";
} }
}else{ }else{
$sql1 = "UPDATE ".DAYBOOKMASTER." SET Status ='Cancel' , Balance ='$currBalance' WHERE FeesPaymentID ='$getID'"; $sql1 = "UPDATE ".DAYBOOKMASTER." SET Status ='Cancel' ,Reason='$reason', Balance ='$currBalance' WHERE FeesPaymentID ='$getID'";
// update branch to staff_branch table // update branch to staff_branch table
if ($this->db->query($sql1) == '1') { if ($this->db->query($sql1) == '1') {

View File

@ -149,7 +149,7 @@ $scope.dayBookApprovalAccess = '';
$scope.getDayBookList(); $scope.getDayBookList();
} }
} }
// change to date, update and call search functionality // change to date, update and call search functionality
$scope.changeToDate = function () { $scope.changeToDate = function () {
if($scope.searchData.dateTo !== undefined) { if($scope.searchData.dateTo !== undefined) {
@ -291,10 +291,15 @@ $scope.dayBookApprovalAccess = '';
} }
// alert(JSON.stringify($scope.myModel)); // alert(JSON.stringify($scope.myModel));
} }
$scope.deleted1 = function (id) {
var id=id;
var reason=prompt("Enter for the Delete Reason!","");
$scope.deleteFeePayableEntry(reason,id);
}
//delete the income entry From the fees payable //delete the income entry From the fees payable
$scope.deleteFeePayableEntry = function (id) { $scope.deleteFeePayableEntry = function (reason,id) {
// alert(id); // alert(id);
SweetAlert.swal({ SweetAlert.swal({
title: "Warning!", title: "Warning!",
@ -307,14 +312,14 @@ $scope.dayBookApprovalAccess = '';
if (res === true) { if (res === true) {
// alert(id); // alert(id);
// alert(stuId); // alert(stuId);
var deleteFeePayableDetails = { var deleteFeePayableDetails ={
method: 'POST', method: 'POST',
url: apiPoint.url + 'deleteDayBookFeePayableDetails/', url: apiPoint.url + 'deleteDayBookFeePayableDetails/',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
data: { data: {
data: id, reason:reason,data:id,
requestDetails: localDetails requestDetails: localDetails
} }
}; };
@ -330,10 +335,25 @@ $scope.dayBookApprovalAccess = '';
}); });
} }
$scope.deleted = function (id) {
// swal({
// title: "Enter Reason For Delete",
var id=id;
var a=prompt("Enter for the Delete Reason!","");
$scope.deleEditEntry(a,id);
// html: true,
// text: "Reason:<input type='text' id='reason' value=''>"
// });
}
// delete the income/expense list row // delete the income/expense list row
$scope.deleEditEntry = function (id) { $scope.deleEditEntry = function (a,id) {
swal({ swal({
title: "Are you sure?", title: "Are you sure?",
text: "Your will not be able to recover this record!", text: "Your will not be able to recover this record!",
type: "warning", type: "warning",
@ -343,9 +363,9 @@ $scope.dayBookApprovalAccess = '';
closeOnConfirm: false closeOnConfirm: false
}, },
function () { function () {
$scope.indexDelete2(id); $scope.indexDelete2(a,id);
}); });
$scope.indexDelete2 = function (id) { $scope.indexDelete2 = function (a,id) {
var deleteDetails = { var deleteDetails = {
method: 'POST', method: 'POST',
url: apiPoint.url + 'deleteDayBookDetails/', url: apiPoint.url + 'deleteDayBookDetails/',
@ -353,7 +373,7 @@ $scope.dayBookApprovalAccess = '';
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
data: { data: {
data: id, reason:a,data: id,
requestDetails: localDetails requestDetails: localDetails
} }
}; };

View File

@ -138,7 +138,7 @@
<th>Balance <th>Balance
<!--<span class="glyphicon sort-icon" ng-show="sortKey=='Amount'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>--> <!--<span class="glyphicon sort-icon" ng-show="sortKey=='Amount'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>-->
</th> </th>
<th>Reason</th>
<th class="center" ng-click="sort('Status')">Status <th class="center" ng-click="sort('Status')">Status
<!--<span class="glyphicon sort-icon" ng-show="sortKey=='Status'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>--> <!--<span class="glyphicon sort-icon" ng-show="sortKey=='Status'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>-->
</th> </th>
@ -165,7 +165,7 @@
<td>{{p.ModeOfPayment}}</td> <td>{{p.ModeOfPayment}}</td>
<td>{{p.Amount}}</td> <td>{{p.Amount}}</td>
<td>{{p.Balance}}</td> <td>{{p.Balance}}</td>
<td>{{p.Reason}}</td>
<!--<td class="center" tooltip="{{p.Approval_Comments}}" ng-if="p.ListName == 'Income'"> <!--<td class="center" tooltip="{{p.Approval_Comments}}" ng-if="p.ListName == 'Income'">
- </td>--> - </td>-->
<td class="center" tooltip="{{p.Approval_Comments}}"><span ng-if="p.Status == 'Pending'" style="text-transform: uppercase; text-shadow: 1px 1px #286d5f; color: #55d4bb ">{{p.Status}}</span> <td class="center" tooltip="{{p.Approval_Comments}}"><span ng-if="p.Status == 'Pending'" style="text-transform: uppercase; text-shadow: 1px 1px #286d5f; color: #55d4bb ">{{p.Status}}</span>
@ -177,13 +177,13 @@
<td class="center" ng-if="p.ListName == 'Income' && p.Status != 'Cancel' "> <td class="center" ng-if="p.ListName == 'Income' && p.Status != 'Cancel' ">
<span ng-if=" p.PaymentStatus == 1 "> <i tooltip="EDIT" class="glyphicon glyphicon-pencil" ng-click="setEditId(p.ID)"></i> </span> <span ng-if=" p.PaymentStatus == 1 "> <i tooltip="EDIT" class="glyphicon glyphicon-pencil" ng-click="setEditId(p.ID)"></i> </span>
<span ng-if=" p.PaymentStatus == 0 "> <span ng-if=" p.PaymentStatus == 0 ">
<i tooltip="DELETE" class="glyphicon glyphicon-remove" ng-click="deleteFeePayableEntry(p.ID)"></i> <i tooltip="DELETE" class="glyphicon glyphicon-remove" ng-click="deleted1(p.ID)"></i>
</span> </span>
</td> </td>
<td class="center" ng-if="p.Status == 'Pending' && p.Status != 'Cancel'"> <td class="center" ng-if="p.Status == 'Pending' && p.Status != 'Cancel'">
<span ng-if=" p.PaymentStatus == 1 "> <span ng-if=" p.PaymentStatus == 1 ">
<span> <i tooltip="EDIT" class="glyphicon glyphicon-pencil" ng-click="setEditId(p.ID)"></i> </span> <span> <i tooltip="EDIT" class="glyphicon glyphicon-pencil" ng-click="setEditId(p.ID)"></i> </span>
<span> <i tooltip="DELETE" class="glyphicon glyphicon-remove" ng-click="deleEditEntry(p.ID)"></i> </span> <span> <i tooltip="DELETE" class="glyphicon glyphicon-remove" ng-click="deleted(p.ID)"></i> </span>
</span> </span>
</td> </td>
</tr> </tr>

View File

@ -335,6 +335,20 @@
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-12">
<div class="pull-right">
<button type="submit" ladda="ldloading.zoom_in" tabindex="23" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="saveFees(user,Form,updateModel,'zoom-in')">
Save
</button>
<input type="button" class="btn btn-warning btn-wide" tabindex="24" value="Cancel"
ng-click="cancel();">
</input>
</div>
</div>
</div>
</fieldset> </fieldset>
@ -522,20 +536,7 @@
</div> </div>
<div class="row">
<div class="col-md-12">
<div class="pull-right">
<button type="submit" ladda="ldloading.zoom_in" tabindex="23" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="saveFees(user,Form,updateModel,'zoom-in')">
Save
</button>
<input type="button" class="btn btn-warning btn-wide" tabindex="24" value="Cancel"
ng-click="cancel();">
</input>
</div>
</div>
</div>
</fieldset> </fieldset>
</div> </div>