daybook
This commit is contained in:
parent
6e46233da8
commit
9c6bff597e
@ -217,6 +217,10 @@ $scope.dayBookApprovalAccess = '';
|
||||
if (response.data.typeNameStatus) {
|
||||
$scope.incomeExpenseName = response.data.typeList;
|
||||
$scope.incomeExpenseType = response.data.typeNameList;
|
||||
|
||||
console.log($scope.incomeExpenseName)
|
||||
|
||||
console.log($scope.incomeExpenseType);
|
||||
} else {
|
||||
}
|
||||
});
|
||||
@ -224,19 +228,41 @@ $scope.dayBookApprovalAccess = '';
|
||||
|
||||
// parse the income and expense type from the list
|
||||
$scope.getType = function (type) {
|
||||
$scope.getIncomeTypes = $scope.incomeExpenseType.filter(function (val) {
|
||||
$scope.getIncomeTypes = $scope.incomeExpenseName.filter(function (val) {
|
||||
return val.TypeID === 'I002' ? 1 : 0;
|
||||
});
|
||||
$scope.getExpenseTypes = $scope.incomeExpenseType.filter(function (val) {
|
||||
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
|
||||
return val.TypeID === 'I001' ? 1 : 0;
|
||||
});
|
||||
|
||||
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
|
||||
return val.TypeID === 'I003' ? 1 : 0;
|
||||
});
|
||||
|
||||
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
|
||||
return val.TypeID === 'I004' ? 1 : 0;
|
||||
});
|
||||
|
||||
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
|
||||
return val.TypeID === 'I005' ? 1 : 0;
|
||||
});
|
||||
|
||||
$scope.getExpenseTypes = $scope.incomeExpenseName.filter(function (val) {
|
||||
return val.TypeID === 'I006' ? 1 : 0;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.myModelAdd.type = '';
|
||||
$scope.getTypes = type === 'I002' ? $scope.getIncomeTypes : $scope.getExpenseTypes;
|
||||
|
||||
console.log($scope.getTypes)
|
||||
};
|
||||
|
||||
$scope.editId = -1;
|
||||
$scope.setEditId = function (P) {
|
||||
// alert(id);
|
||||
//alert(id);
|
||||
$scope.editId = P;
|
||||
}
|
||||
|
||||
@ -274,12 +300,14 @@ $scope.dayBookApprovalAccess = '';
|
||||
}
|
||||
|
||||
$scope.copyModel = function (p) {
|
||||
console.log(p);
|
||||
var inc = $scope.incomeExpenseType.filter((inc)=>inc.ID == p.Type);
|
||||
console.log(inc);
|
||||
$scope.incexp = inc[0];
|
||||
$scope.myModel = {
|
||||
"id": p.ID,
|
||||
"date": p.Date,
|
||||
"incomeExpense": p.Name,
|
||||
"type": p.Type,
|
||||
"type" : $scope.incexp.ID,
|
||||
"amount": p.Amount,
|
||||
"status": p.Status,
|
||||
"description": p.Description,
|
||||
@ -288,6 +316,7 @@ $scope.dayBookApprovalAccess = '';
|
||||
"voucherNumber": p.VoucherNumber,
|
||||
"branch":p.BranchCode,
|
||||
"name": p.Name
|
||||
|
||||
}
|
||||
// alert(JSON.stringify($scope.myModel));
|
||||
}
|
||||
@ -491,8 +520,13 @@ $scope.dayBookApprovalAccess = '';
|
||||
// update a daybook entry details
|
||||
$scope.daybookeditUpdate = {
|
||||
submit: function (form, myModel) {
|
||||
|
||||
console.log(myModel.type);
|
||||
//return false;
|
||||
var firstError = null;
|
||||
if (form.$invalid) {
|
||||
|
||||
alert();
|
||||
var field = null, firstError = null;
|
||||
for (field in form) {
|
||||
if (field[0] != '$') {
|
||||
@ -505,7 +539,7 @@ $scope.dayBookApprovalAccess = '';
|
||||
}
|
||||
}
|
||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
||||
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
||||
swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
||||
} else {
|
||||
// alert(JSON.stringify($scope.myModel));exit();
|
||||
$scope.disableEditButton = true;
|
||||
|
||||
@ -195,7 +195,7 @@
|
||||
<div ng-init="copyModel(p)" class="container" style="background-color: rgb(248, 248, 248);
|
||||
border-radius: 6px;padding: 22px;">
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.editvoucherNumber.$dirty && Form.editvoucherNumber.$invalid, 'has-success':Form.editvoucherNumber.$valid}">
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.editvoucherNumber.$dirty && Form.editvoucherNumber.$invalid, 'has-success':Form.editvoucherNumber.$valid}">
|
||||
<label>
|
||||
Voucher Number
|
||||
</label>
|
||||
@ -242,11 +242,11 @@
|
||||
|
||||
|
||||
|
||||
<select class="form-control" tabindex="1" class="cs-select cs-skin-elastic" name="addType" ng-model="myModelAdd.type" required>
|
||||
<select class="form-control" tabindex="1" class="cs-select cs-skin-elastic" name="addType" ng-model="myModel.type" required>
|
||||
|
||||
|
||||
<optgroup ng-repeat="typeName in incomeExpenseName" label="{{typeName.ListName}}">
|
||||
<option ng-repeat="incexpType in incomeExpenseType" ng-if="typeName.ListCode == incexpType.TypeID" ng-selected="typeItem.ID == p.Type" value="{{typeItem.ID}}" value="{{incexpType.ID}}">{{incexpType.TypeName}}</option>
|
||||
<option ng-repeat="incexpType in incomeExpenseType" ng-if="typeName.ListCode == incexpType.TypeID" value="{{incexpType.ID}}" ng-selected="incexp.ID == incexpType.ID">{{incexpType.TypeName}}</option>
|
||||
|
||||
</optgroup>
|
||||
<!-- <option value="" disabled selected>Select Type</option>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user