Chore: Major variable renaming from python style underscores to camel case.
Chore: Replace undefined checks with angular.isUndefined
This commit is contained in:
1 parent
358b235d8f
commit
f667481d71
50 files changed
+494
-576
No files matched your search
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<select id="ddlType" class="form-control" ng-model="account.Type"
|
<select id="ddlType" class="form-control" ng-model="account.Type"
|
||||||
ng-options="l.AccountTypeID as l.Name for l in account_types"> </select>
|
ng-options="l.AccountTypeID as l.Name for l in accountTypes"> </select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<select id="ddlCostCenter" class="form-control" ng-model="account.CostCenter.CostCenterID"
|
<select id="ddlCostCenter" class="form-control" ng-model="account.CostCenter.CostCenterID"
|
||||||
ng-options="l.CostCenterID as l.Name for l in cost_centers"> </select>
|
ng-options="l.CostCenterID as l.Name for l in costCenters"> </select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<td>{{item.Department}}</td>
|
<td>{{item.Department}}</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" ng-model="item.AttendanceTypeID"
|
<select class="form-control" ng-model="item.AttendanceTypeID"
|
||||||
ng-options="i.AttendanceTypeID as i.Name for i in attendance_types"></select>
|
ng-options="i.AttendanceTypeID as i.Name for i in attendanceTypes"></select>
|
||||||
</td>
|
</td>
|
||||||
<td class="no-bg">{{item.Prints}}
|
<td class="no-bg">{{item.Prints}}
|
||||||
<span ng-show="item.Hours.length > 0"
|
<span ng-show="item.Hours.length > 0"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<label for="txtName" class="col-md-2 control-label">Name</label>
|
<label for="txtName" class="col-md-2 control-label">Name</label>
|
||||||
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input type="text" id="txtName" class="form-control" ng-model="cost_center.Name"/>
|
<input type="text" id="txtName" class="form-control" ng-model="costCenter.Name"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
<td>{{item.Date}}</td>
|
<td>{{item.Date}}</td>
|
||||||
<td>
|
<td>
|
||||||
<select name="box" class="form-control" ng-model="item.AttendanceTypeID"
|
<select name="box" class="form-control" ng-model="item.AttendanceTypeID"
|
||||||
ng-options="i.AttendanceTypeID as i.Name for i in attendance_types"> </select>
|
ng-options="i.AttendanceTypeID as i.Name for i in attendanceTypes"> </select>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td class="no-bg">{{item.Prints}} <span ng-show="item.Hours.length > 0"
|
<td class="no-bg">{{item.Prints}} <span ng-show="item.Hours.length > 0"
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<select id="ddlCostCenter" class="form-control" ng-model="employee.CostCenter.CostCenterID"
|
<select id="ddlCostCenter" class="form-control" ng-model="employee.CostCenter.CostCenterID"
|
||||||
ng-options="l.CostCenterID as l.Name for l in cost_centers"> </select>
|
ng-options="l.CostCenterID as l.Name for l in costCenters"> </select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -30,12 +30,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-3" ng-repeat="journal in voucher.Journals | journalDebit:-1">
|
<div class="col-md-3" ng-repeat="journal in voucher.Journals | journalDebit:-1">
|
||||||
<select id="ddlSourceCostCenter" class="form-control" ng-model="journal.CostCenter.CostCenterID"
|
<select id="ddlSourceCostCenter" class="form-control" ng-model="journal.CostCenter.CostCenterID"
|
||||||
ng-options="l.CostCenterID as l.Name for l in cost_centers"> </select>
|
ng-options="l.CostCenterID as l.Name for l in costCenters"> </select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5" ng-repeat="journal in voucher.Journals | journalDebit:1">
|
<div class="col-md-5" ng-repeat="journal in voucher.Journals | journalDebit:1">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<select id="ddlDestinationCostCenter" class="form-control" ng-model="journal.CostCenter.CostCenterID"
|
<select id="ddlDestinationCostCenter" class="form-control" ng-model="journal.CostCenter.CostCenterID"
|
||||||
ng-options="l.CostCenterID as l.Name for l in cost_centers"> </select>
|
ng-options="l.CostCenterID as l.Name for l in costCenters"> </select>
|
||||||
<span class="input-group-addon">₹</span>
|
<span class="input-group-addon">₹</span>
|
||||||
<input type="text" class="form-control" placeholder="Amount" value="{{journal.Amount | number:2}}"/>
|
<input type="text" class="form-control" placeholder="Amount" value="{{journal.Amount | number:2}}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<select id="ddlType" class="form-control" ng-model="product.ProductGroup.ProductGroupID"
|
<select id="ddlType" class="form-control" ng-model="product.ProductGroup.ProductGroupID"
|
||||||
ng-options="l.ProductGroupID as l.Name for l in product_groups"> </select>
|
ng-options="l.ProductGroupID as l.Name for l in productGroups"> </select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<label for="txtName" class="col-md-2 control-label">Name</label>
|
<label for="txtName" class="col-md-2 control-label">Name</label>
|
||||||
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input type="text" id="txtName" class="form-control" ng-model="product_group.Name"/>
|
<input type="text" id="txtName" class="form-control" ng-model="productGroup.Name"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<th class="text-right">Code</th>
|
<th class="text-right">Code</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th class="text-right">Price</th>
|
<th class="text-right">Price</th>
|
||||||
<th ng-if="show_extended" class="text-right">Yield</th>
|
<th ng-if="showExtended" class="text-right">Yield</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Is Active?</th>
|
<th>Is Active?</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="item in products">
|
<tr ng-repeat="item in products">
|
||||||
<td class="text-right">{{item.Code}}</td>
|
<td class="text-right">{{item.Code}}</td>
|
||||||
<td><a href="{{item.Url}}">{{item.Name}} ({{show_extended ? item.Fraction + ' ' + item.FractionUnits + ' = 1 ' : ''}}{{item.Units}})</a></td>
|
<td><a href="{{item.Url}}">{{item.Name}} ({{showExtended ? item.Fraction + ' ' + item.FractionUnits + ' = 1 ' : ''}}{{item.Units}})</a></td>
|
||||||
<td class="text-right">{{item.Price | currency}}</td>
|
<td class="text-right">{{item.Price | currency}}</td>
|
||||||
<td ng-if="show_extended" class="text-right">{{item.ProductYield * 100 | number:2}}%</td>
|
<td ng-if="showExtended" class="text-right">{{item.ProductYield * 100 | number:2}}%</td>
|
||||||
<td>{{item.ProductGroup}}</td>
|
<td>{{item.ProductGroup}}</td>
|
||||||
<td>{{item.IsActive}}</td>
|
<td>{{item.IsActive}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<p class="form-control-static">{{cost_price | currency}} / {{cost_price * 100 / recipe.SalePrice | number:2 }}%</p>
|
<p class="form-control-static">{{costPrice | currency}} / {{costPrice * 100 / recipe.SalePrice | number:2 }}%</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4" ng-hide="recipe.IsSemi">
|
<div class="col-md-4" ng-hide="recipe.IsSemi">
|
||||||
<select id="ddlType" class="form-control" ng-model="recipe.ProductGroup.ProductGroupID"
|
<select id="ddlType" class="form-control" ng-model="recipe.ProductGroup.ProductGroupID"
|
||||||
ng-options="l.ProductGroupID as l.Name for l in product_groups"> </select>
|
ng-options="l.ProductGroupID as l.Name for l in productGroups"> </select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -13,20 +13,20 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
<div class="col-md-offset-2 col-md-2">
|
<div class="col-md-offset-2 col-md-2">
|
||||||
<select class="form-control" ng-model="product_type_selected">
|
<select class="form-control" ng-model="productTypeSelected">
|
||||||
<option value="semi">Semi Products</option>
|
<option value="semi">Semi Products</option>
|
||||||
<option value="menu">Menu Items</option>
|
<option value="menu">Menu Items</option>
|
||||||
<option value="all">All</option>
|
<option value="all">All</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<select class="form-control" ng-model="show_latest">
|
<select class="form-control" ng-model="showLatest">
|
||||||
<option value="latest">Only Latest Recipes</option>
|
<option value="latest">Only Latest Recipes</option>
|
||||||
<option value="all">All Recipes</option>
|
<option value="all">All Recipes</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<select class="form-control" ng-model="show_summary">
|
<select class="form-control" ng-model="showSummary">
|
||||||
<option value="no">Brief</option>
|
<option value="no">Brief</option>
|
||||||
<option value="yes">With Recipes</option>
|
<option value="yes">With Recipes</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -36,25 +36,25 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th ng-if="show_summary === 'no'">Date</th>
|
<th ng-if="showSummary === 'no'">Date</th>
|
||||||
<th class="text-right">Sale Price</th>
|
<th class="text-right">Sale Price</th>
|
||||||
<th class="text-right">Original Cost</th>
|
<th class="text-right">Original Cost</th>
|
||||||
<th class="text-right" ng-if="show_summary === 'no'">Current Cost</th>
|
<th class="text-right" ng-if="showSummary === 'no'">Current Cost</th>
|
||||||
<th class="text-right">Original Costing</th>
|
<th class="text-right">Original Costing</th>
|
||||||
<th class="text-right" ng-if="show_summary === 'no'">Current Costing</th>
|
<th class="text-right" ng-if="showSummary === 'no'">Current Costing</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat-start="item in display">
|
<tr ng-repeat-start="item in display">
|
||||||
<td><a ng-if="item.IsLatest" href="{{item.Url}}">{{item.Name}} ({{item.Units}})</a></td>
|
<td><a ng-if="item.IsLatest" href="{{item.Url}}">{{item.Name}} ({{item.Units}})</a></td>
|
||||||
<td ng-if="show_summary === 'no'">{{item.Date}}</td>
|
<td ng-if="showSummary === 'no'">{{item.Date}}</td>
|
||||||
<td class="text-right">{{item.IsSemi ? '' : (item.SalePrice | currency)}}</td>
|
<td class="text-right">{{item.IsSemi ? '' : (item.SalePrice | currency)}}</td>
|
||||||
<td class="text-right">{{item.CostPrice | currency}}</td>
|
<td class="text-right">{{item.CostPrice | currency}}</td>
|
||||||
<td class="text-right" ng-if="show_summary === 'no'">{{item.CurrentCostPrice | currency}}</td>
|
<td class="text-right" ng-if="showSummary === 'no'">{{item.CurrentCostPrice | currency}}</td>
|
||||||
<td class="text-right">{{item.IsSemi ? '' : (item.Costing | percent)}}</td>
|
<td class="text-right">{{item.IsSemi ? '' : (item.Costing | percent)}}</td>
|
||||||
<td class="text-right" ng-if="show_summary === 'no'">{{item.IsSemi ? '' : (item.CurrentCosting | percent)}}</td>
|
<td class="text-right" ng-if="showSummary === 'no'">{{item.IsSemi ? '' : (item.CurrentCosting | percent)}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-repeat-end ng-if="show_summary === 'yes'">
|
<tr ng-repeat-end ng-if="showSummary === 'yes'">
|
||||||
<td colspan="7">
|
<td colspan="7">
|
||||||
<table class="table table-condensed table-striped">
|
<table class="table table-condensed table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ var AccountListCtrl = ['$scope', '$location', '$routeParams', 'Tokenizer', 'acco
|
|||||||
|
|
||||||
$scope.searchInfo = {
|
$scope.searchInfo = {
|
||||||
comparator: {
|
comparator: {
|
||||||
'def': 'n',
|
|
||||||
'n': {'Col': 'Name', 'Comparator': 'text'},
|
'n': {'Col': 'Name', 'Comparator': 'text'},
|
||||||
't': {'Col': 'Type', 'Comparator': 'text'},
|
't': {'Col': 'Type', 'Comparator': 'text'},
|
||||||
'a': {'Col': 'IsActive', 'Comparator': 'boolean'},
|
'a': {'Col': 'IsActive', 'Comparator': 'boolean'},
|
||||||
'r': {'Col': 'IsReconcilable', 'Comparator': 'boolean'},
|
'r': {'Col': 'IsReconcilable', 'Comparator': 'boolean'},
|
||||||
'c': {'Col': 'CostCenter', 'Comparator': 'text'}
|
'c': {'Col': 'CostCenter', 'Comparator': 'text'}
|
||||||
},
|
},
|
||||||
|
def: 'n',
|
||||||
sorter: {
|
sorter: {
|
||||||
'n': 'Name',
|
'n': 'Name',
|
||||||
't': 'Type',
|
't': 'Type',
|
||||||
@@ -51,11 +51,11 @@ AccountListCtrl.resolve = {
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
var AccountCtrl = ['$scope', '$location', '$modal', 'account', 'account_types', 'cost_centers', function ($scope, $location, $modal, account, account_types, cost_centers) {
|
var AccountCtrl = ['$scope', '$location', '$modal', 'account', 'accountTypes', 'costCenters', function ($scope, $location, $modal, account, accountTypes, costCenters) {
|
||||||
$scope.account = account;
|
$scope.account = account;
|
||||||
|
|
||||||
$scope.account_types = account_types;
|
$scope.accountTypes = accountTypes;
|
||||||
$scope.cost_centers = cost_centers;
|
$scope.costCenters = costCenters;
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
$scope.account.$save(function (u, putResponseHeaders) {
|
$scope.account.$save(function (u, putResponseHeaders) {
|
||||||
@@ -103,10 +103,10 @@ AccountCtrl.resolve = {
|
|||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
return Account.get({id: id}).$promise;
|
return Account.get({id: id}).$promise;
|
||||||
}],
|
}],
|
||||||
account_types: ['AccountType', function (AccountType) {
|
accountTypes: ['AccountType', function (AccountType) {
|
||||||
return AccountType.query({}).$promise;
|
return AccountType.query({}).$promise;
|
||||||
}],
|
}],
|
||||||
cost_centers: ['CostCenter', function (CostCenter) {
|
costCenters: ['CostCenter', function (CostCenter) {
|
||||||
return CostCenter.query({}).$promise;
|
return CostCenter.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
+1
-1
@@ -94,7 +94,7 @@ overlord_directive.directive('chosen', ['$parse', function ($parse) {
|
|||||||
createFunction = attrs['createFunction'],
|
createFunction = attrs['createFunction'],
|
||||||
options = {};
|
options = {};
|
||||||
|
|
||||||
if (typeof createFunction !== 'undefined') {
|
if (angular.isUndefined(createFunction)) {
|
||||||
options['create_option'] = function (data) {
|
options['create_option'] = function (data) {
|
||||||
var fn = $parse(attrs['createFunction'] + '("' + data + '")');
|
var fn = $parse(attrs['createFunction'] + '("' + data + '")');
|
||||||
scope.$apply(function () {
|
scope.$apply(function () {
|
||||||
|
|||||||
+8
-2
@@ -35,7 +35,7 @@ overlord_filter.filter('save_button', function () {
|
|||||||
overlord_filter.filter('journalDebit', function () {
|
overlord_filter.filter('journalDebit', function () {
|
||||||
return function (input, debit) {
|
return function (input, debit) {
|
||||||
var list = [];
|
var list = [];
|
||||||
if (typeof input !== 'undefined') {
|
if (angular.isUndefined(input)) {
|
||||||
for (var i = 0, l = input.length; i < l; i++) {
|
for (var i = 0, l = input.length; i < l; i++) {
|
||||||
if (input[i].Debit === debit) {
|
if (input[i].Debit === debit) {
|
||||||
list.push(input[i]);
|
list.push(input[i]);
|
||||||
@@ -83,7 +83,7 @@ overlord_filter.filter('localTime', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return function (input) {
|
return function (input) {
|
||||||
if (typeof input === 'undefined') {
|
if (angular.isUndefined(input)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
var d = input.match(/(\w+)/g);
|
var d = input.match(/(\w+)/g);
|
||||||
@@ -106,6 +106,12 @@ overlord_filter.filter('percent', ['numberFilter', function (numberFilter) {
|
|||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
overlord_filter.filter('asDate', ['dateFilter', function (dateFilter) {
|
||||||
|
return function (input) {
|
||||||
|
return angular.isDate(input) ? dateFilter(input, 'dd-MMM-yyyy') : input
|
||||||
|
};
|
||||||
|
}]);
|
||||||
|
|
||||||
overlord_filter.filter('clr', function () {
|
overlord_filter.filter('clr', function () {
|
||||||
return function (input) {
|
return function (input) {
|
||||||
if (input === '\u20B9\u00A00.00' || input === '0.00') {
|
if (input === '\u20B9\u00A00.00' || input === '0.00') {
|
||||||
|
|||||||
+101
-37
@@ -252,35 +252,77 @@ overlord_service.service('EventSource', function () {
|
|||||||
}, false);
|
}, false);
|
||||||
};
|
};
|
||||||
this.source.addEventListener('error', function (e) {
|
this.source.addEventListener('error', function (e) {
|
||||||
if (e.readyState == EventSource.CLOSED) {
|
if (e.readyState === EventSource.CLOSED) {
|
||||||
this.status = 'Error';
|
this.status = 'Error';
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
this.ErrorCallback = function (callback) {
|
this.ErrorCallback = function (callback) {
|
||||||
this.source.addEventListener('error', callback, false);
|
this.source.addEventListener('error', callback, false);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.EventCallback = function (event, callback) {
|
this.EventCallback = function (event, callback) {
|
||||||
this.source.addEventListener(event, callback, false);
|
this.source.addEventListener(event, callback, false);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.Close = function () {
|
this.Close = function () {
|
||||||
if (this.status === 'Open') {
|
if (this.status === 'Open') {
|
||||||
this.source.close();
|
this.source.close();
|
||||||
this.status = 'Closed'
|
this.status = 'Closed';
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
overlord_service.factory('Tokenizer', ['$filter', function ($filter) {
|
overlord_service.factory('Tokenizer', ['$filter', function ($filter) {
|
||||||
var parseFilterString = function (q, searchInfo) {
|
var parseFilterString = function (q, searchInfo) {
|
||||||
var re = /((([^ ]+):\s*('[^':]+'|"[^":]+"|[^ ]+))|[^ ]+[^: '"]*)/g,
|
// '[^']+'|"[^"]+"|[^ ]+ == Match a space delimited string or quoted string. ms for short
|
||||||
comparator = searchInfo.comparator,
|
// ((ms\s*:\s*ms)|ms) == Match string : Match string OR Match string
|
||||||
sorter = searchInfo.sorter,
|
var re = /((('[^']+'|"[^"]+"|[^\s]+)\s*:\s*('[^']+'|"[^"]+"|[^\s]+))|('[^']+'|"[^"]+"|[^\s]+))/g,
|
||||||
defaultKey = comparator[comparator.def],
|
comparator = searchInfo.comparator || {},
|
||||||
|
sorter = searchInfo.sorter || {},
|
||||||
|
flagger = searchInfo.flags || {},
|
||||||
|
defaultKey = searchInfo.def,
|
||||||
matches = [],
|
matches = [],
|
||||||
sorting = [],
|
sorting = [],
|
||||||
flags = {};
|
flags = {},
|
||||||
|
operators = {
|
||||||
|
'<': function (a, b) {
|
||||||
|
return a < b;
|
||||||
|
},
|
||||||
|
'>': function (a, b) {
|
||||||
|
return a > b;
|
||||||
|
},
|
||||||
|
'<=': function (a, b) {
|
||||||
|
return a <= b;
|
||||||
|
},
|
||||||
|
'>=': function (a, b) {
|
||||||
|
return a >= b;
|
||||||
|
},
|
||||||
|
'==': function (a, b) {
|
||||||
|
return a == b;
|
||||||
|
},
|
||||||
|
'!=': function (a, b) {
|
||||||
|
return a != b;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
comparators = {
|
||||||
|
'text': function (obj, text) {
|
||||||
|
return obj.toLowerCase().indexOf(text) > -1;
|
||||||
|
},
|
||||||
|
'boolean': function (obj, text) {
|
||||||
|
return obj === isTrue(text);
|
||||||
|
},
|
||||||
|
'numeric': function (obj, text) {
|
||||||
|
var op = opLength(text);
|
||||||
|
if (op) {
|
||||||
|
return operators[text.substr(0, op)](obj, Number(text.substr(op).trim()));
|
||||||
|
} else {
|
||||||
|
return obj.toString().indexOf(text) > -1;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'true': function (obj, text) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function isTrue(value) {
|
function isTrue(value) {
|
||||||
@@ -289,39 +331,61 @@ overlord_service.factory('Tokenizer', ['$filter', function ($filter) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is(ch, chars) {
|
||||||
|
return chars.indexOf(ch) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
function pushObject(comparator, value) {
|
function pushObject(comparator, value) {
|
||||||
return {'Col': comparator.Col, 'Comparator': comparators[comparator.Comparator], 'Value': value};
|
return {'Col': comparator.Col, 'Comparator': comparators[comparator.Comparator], 'Value': value};
|
||||||
}
|
}
|
||||||
|
|
||||||
var comparators = {
|
function toArray(matches) {
|
||||||
'text': function (obj, text) {
|
return _.reduce(matches, function (accumulator, item) {
|
||||||
return obj.toLowerCase().indexOf(text) > -1;
|
var key,
|
||||||
},
|
value;
|
||||||
'boolean': function (obj, text) {
|
if (item.indexOf(':') === -1) {
|
||||||
return obj === isTrue(text);
|
key = '';
|
||||||
},
|
value = item;
|
||||||
'true': function (obj, text) {
|
} else {
|
||||||
return true;
|
key = item.substr(0, item.indexOf(':')).trim();
|
||||||
}
|
value = item.substr(item.indexOf(':') + 1, item.length).trim();
|
||||||
};
|
}
|
||||||
var m = q.match(re);
|
if (key.indexOf("'") !== -1 || key.indexOf('"') !== -1) {
|
||||||
_.forEach(m, function (item) {
|
key = key.substring(1, key.length - 1).trim();
|
||||||
item = item.trim();
|
|
||||||
if (item.indexOf(':') === -1) {
|
|
||||||
if ((item.length > 1) && (item.charAt(0) === '+' || item.charAt(0) === '-') && (item.substr(1) in sorter)) {
|
|
||||||
sorting.push(item.charAt(0) + sorter[item.substr(1).toLowerCase()]);
|
|
||||||
} else if (item.length >= 1 && item.charAt(0) !== '+' && item.charAt(0) !== '-') {
|
|
||||||
matches.push(pushObject(defaultKey, item));
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
var key = item.substr(0, item.indexOf(':')).toLowerCase();
|
|
||||||
var value = item.substr(item.indexOf(':') + 1, item.length).trim().toLowerCase();
|
|
||||||
if (value.indexOf("'") !== -1 || value.indexOf('"') !== -1) {
|
if (value.indexOf("'") !== -1 || value.indexOf('"') !== -1) {
|
||||||
value = value.substring(1, value.length - 1).trim();
|
value = key.substring(1, value.length - 1).trim();
|
||||||
}
|
}
|
||||||
if (key !== '' && value !== '' && key in comparator) {
|
if (value !== '') {
|
||||||
|
accumulator.push({Key: key, Value: value});
|
||||||
|
}
|
||||||
|
return accumulator;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
function opLength(operator) {
|
||||||
|
var i,
|
||||||
|
ops = ['<=', '<', '>=', '>', '==', '!='];
|
||||||
|
for (i = 0; i < ops.length; i++) {
|
||||||
|
if (operator.indexOf(ops[i]) == 0) {
|
||||||
|
return ops[i].length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_(q.match(re))
|
||||||
|
_.forEach(toArray(q.match(re)), function (item) {
|
||||||
|
var key = item.Key,
|
||||||
|
value = item.Value;
|
||||||
|
|
||||||
|
if (key === '' && value.length > 1 && is(value.charAt(0), '+-') && value.substr(1) in sorter) {
|
||||||
|
sorting.push(value.charAt(0) + sorter[value.substr(1).toLowerCase()]);
|
||||||
|
} else {
|
||||||
|
key = key || defaultKey;
|
||||||
|
if (key in comparator) {
|
||||||
matches.push(pushObject(comparator[key], value));
|
matches.push(pushObject(comparator[key], value));
|
||||||
} else if (key !== '' && !angular.isUndefined(searchInfo.flags) && key in searchInfo.flags) {
|
} else if (key in flagger) {
|
||||||
flags[key] = value;
|
flags[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,7 +405,7 @@ overlord_service.factory('Tokenizer', ['$filter', function ($filter) {
|
|||||||
return arrayCopy;
|
return arrayCopy;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {parseFilterString: parseFilterString, doFilter: doFilter };
|
return {parseFilterString: parseFilterString, doFilter: doFilter};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
overlord_service.factory("ReaderPromise", ["$q", function ($q) {
|
overlord_service.factory("ReaderPromise", ["$q", function ($q) {
|
||||||
@@ -389,7 +453,7 @@ overlord_service.factory("ReaderPromise", ["$q", function ($q) {
|
|||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
overlord_service.factory("UploadedImageResizer", ["$q", "ReaderPromise", function ($q, ReaderPromise) {
|
overlord_service.factory("uploadedImageResizer", ["$q", "ReaderPromise", function ($q, ReaderPromise) {
|
||||||
function ResizeImage(file, MAX_WIDTH, MAX_HEIGHT) {
|
function ResizeImage(file, MAX_WIDTH, MAX_HEIGHT) {
|
||||||
var image = file,
|
var image = file,
|
||||||
canvas = document.createElement('canvas'),
|
canvas = document.createElement('canvas'),
|
||||||
|
|||||||
@@ -1,18 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var AttendanceCtrl = ['$scope', '$location', 'dateFilter', 'Attendance', 'attendance_types', 'info', function ($scope, $location, dateFilter, Attendance, attendance_types, info) {
|
var AttendanceCtrl = ['$scope', '$location', 'asDateFilter', 'Attendance', 'attendanceTypes', 'info', function ($scope, $location, asDate, Attendance, attendanceTypes, info) {
|
||||||
$scope.attendance_types = attendance_types;
|
$scope.attendanceTypes = attendanceTypes;
|
||||||
$scope.info = info;
|
$scope.info = info;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.Date)) {
|
$scope.info.Date = asDate($scope.info.Date);
|
||||||
$scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/Attendance/' + $scope.info.Date);
|
$location.path('/Attendance/' + $scope.info.Date);
|
||||||
};
|
};
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.info.Date)) {
|
$scope.info.Date = asDate($scope.info.Date);
|
||||||
$scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
return $scope.info.$save(function (u, putResponseHeaders) {
|
return $scope.info.$save(function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: u.Code});
|
$scope.toasts.push({Type: 'Success', Message: u.Code});
|
||||||
}, function (data, status) {
|
}, function (data, status) {
|
||||||
@@ -50,13 +46,13 @@ var AttendanceSubCtrl = ['$scope', function ($scope) {
|
|||||||
AttendanceCtrl.resolve = {
|
AttendanceCtrl.resolve = {
|
||||||
info: ['$route', 'Attendance', function ($route, Attendance) {
|
info: ['$route', 'Attendance', function ($route, Attendance) {
|
||||||
var date = $route.current.params.date;
|
var date = $route.current.params.date;
|
||||||
if (typeof date === 'undefined') {
|
if (angular.isUndefined(date)) {
|
||||||
return Attendance.get({}).$promise;
|
return Attendance.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Attendance.get({date: date}).$promise;
|
return Attendance.get({date: date}).$promise;
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
attendance_types: ['AttendanceTypes', function (AttendanceTypes) {
|
attendanceTypes: ['AttendanceTypes', function (AttendanceTypes) {
|
||||||
return AttendanceTypes.query({}).$promise;
|
return AttendanceTypes.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var BalanceSheetCtrl = ['$scope', '$location', 'dateFilter', 'info', function ($scope, $location, dateFilter, info) {
|
var BalanceSheetCtrl = ['$scope', '$location', 'asDateFilter', 'info', function ($scope, $location, asDate, info) {
|
||||||
$scope.info = info;
|
$scope.info = info;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.Date)) {
|
var date = asDate($scope.info.Date);
|
||||||
$scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy');
|
$location.path('/BalanceSheet/' + date);
|
||||||
}
|
|
||||||
$location.path('/BalanceSheet/' + $scope.info.Date);
|
|
||||||
};
|
};
|
||||||
$('#txtStartDate').focus();
|
$('#txtStartDate').focus();
|
||||||
}];
|
}];
|
||||||
@@ -15,10 +13,10 @@ BalanceSheetCtrl.resolve = {
|
|||||||
info: ['$route', 'BalanceSheet', function ($route, BalanceSheet) {
|
info: ['$route', 'BalanceSheet', function ($route, BalanceSheet) {
|
||||||
var date = $route.current.params.date;
|
var date = $route.current.params.date;
|
||||||
|
|
||||||
if (typeof date === 'undefined') {
|
if (angular.isUndefined(date)) {
|
||||||
return BalanceSheet.get({}).$promise;
|
return BalanceSheet.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return BalanceSheet.get({date:date}).$promise;
|
return BalanceSheet.get({date: date}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,30 +1,26 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var CashFlowCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'cash_flow', function ($scope, $routeParams, $location, dateFilter, cash_flow) {
|
var CashFlowCtrl = ['$scope', '$routeParams', '$location', 'asDateFilter', 'cashFlow', function ($scope, $routeParams, $location, asDate, cashFlow) {
|
||||||
$scope.info = cash_flow;
|
$scope.info = cashFlow;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate),
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
$location.path('/CashFlow').search({StartDate: startDate, FinishDate: finishDate});
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/CashFlow').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate});
|
|
||||||
};
|
};
|
||||||
$('#txtStartDate').focus();
|
$('#txtStartDate').focus();
|
||||||
}];
|
}];
|
||||||
CashFlowCtrl.resolve = {
|
CashFlowCtrl.resolve = {
|
||||||
cash_flow:['$route', 'CashFlow', function ($route, CashFlow) {
|
cashFlow: ['$route', 'CashFlow', function ($route, CashFlow) {
|
||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
start_date = $route.current.params.StartDate,
|
startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
|
||||||
return CashFlow.get({}).$promise;
|
return CashFlow.get({}).$promise;
|
||||||
} else if (typeof id === 'undefined') {
|
} else if (angular.isUndefined(id)) {
|
||||||
return CashFlow.get({StartDate:start_date, FinishDate:finish_date}).$promise;
|
return CashFlow.get({StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return CashFlow.get({id:id, StartDate:start_date, FinishDate:finish_date}).$promise;
|
return CashFlow.get({id: id, StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,24 +1,22 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ClosingStockCtrl = ['$scope', '$location', 'dateFilter', 'info', function ($scope, $location, dateFilter, info) {
|
var ClosingStockCtrl = ['$scope', '$location', 'asDateFilter', 'info', function ($scope, $location, asDate, info) {
|
||||||
$scope.info = info;
|
$scope.info = info;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.Date)) {
|
var date = asDate($scope.info.Date);
|
||||||
$scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy');
|
$location.path('/ClosingStock/' + date);
|
||||||
}
|
|
||||||
$location.path('/ClosingStock/' + $scope.info.Date);
|
|
||||||
};
|
};
|
||||||
$('#txtDate').focus();
|
$('#txtDate').focus();
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ClosingStockCtrl.resolve = {
|
ClosingStockCtrl.resolve = {
|
||||||
info:['$route', 'ClosingStock', function ($route, ClosingStock) {
|
info: ['$route', 'ClosingStock', function ($route, ClosingStock) {
|
||||||
var date = $route.current.params.date;
|
var date = $route.current.params.date;
|
||||||
|
|
||||||
if (typeof date === 'undefined') {
|
if (angular.isUndefined(date)) {
|
||||||
return ClosingStock.get({}).$promise;
|
return ClosingStock.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return ClosingStock.get({date:date}).$promise;
|
return ClosingStock.get({date: date}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var CostCenterListCtrl = ['$scope', 'cost_centers', function ($scope, cost_centers) {
|
var CostCenterListCtrl = ['$scope', 'costCenters', function ($scope, costCenters) {
|
||||||
$scope.info = cost_centers;
|
$scope.info = costCenters;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
CostCenterListCtrl.resolve = {
|
CostCenterListCtrl.resolve = {
|
||||||
cost_centers: ['CostCenter', function (CostCenter) {
|
costCenters: ['CostCenter', function (CostCenter) {
|
||||||
return CostCenter.query({}).$promise;
|
return CostCenter.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
var CostCenterCtrl = ['$scope', '$routeParams', '$location', 'cost_center', function ($scope, $routeParams, $location, cost_center) {
|
var CostCenterCtrl = ['$scope', '$routeParams', '$location', 'costCenter', function ($scope, $routeParams, $location, costCenter) {
|
||||||
$scope.cost_center = cost_center;
|
$scope.costCenter = costCenter;
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
$scope.cost_center.$save(function (u, putResponseHeaders) {
|
$scope.costCenter.$save(function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/CostCenters')
|
$location.path('/CostCenters')
|
||||||
}, function (data, status) {
|
}, function (data, status) {
|
||||||
@@ -23,7 +23,7 @@ var CostCenterCtrl = ['$scope', '$routeParams', '$location', 'cost_center', func
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.delete = function () {
|
$scope.delete = function () {
|
||||||
$scope.cost_center.$delete(function (u, putResponseHeaders) {
|
$scope.costCenter.$delete(function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/CostCenters')
|
$location.path('/CostCenters')
|
||||||
}, function (data, status) {
|
}, function (data, status) {
|
||||||
@@ -34,9 +34,8 @@ var CostCenterCtrl = ['$scope', '$routeParams', '$location', 'cost_center', func
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
CostCenterCtrl.resolve = {
|
CostCenterCtrl.resolve = {
|
||||||
cost_center: ['$route', 'CostCenter', function ($route, CostCenter) {
|
costCenter: ['$route', 'CostCenter', function ($route, CostCenter) {
|
||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
|
|
||||||
return CostCenter.get({id: id}).$promise;
|
return CostCenter.get({id: id}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,27 +1,23 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var DaybookCtrl = ['$scope', '$location', 'dateFilter', 'info', function ($scope, $location, dateFilter, info) {
|
var DaybookCtrl = ['$scope', '$location', 'asDateFilter', 'info', function ($scope, $location, asDate, info) {
|
||||||
$scope.info = info;
|
$scope.info = info;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate),
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
$location.path('/Daybook').search({StartDate: startDate, FinishDate: finishDate});
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/Daybook').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate});
|
|
||||||
};
|
};
|
||||||
$('#txtStartDate').focus();
|
$('#txtStartDate').focus();
|
||||||
}];
|
}];
|
||||||
DaybookCtrl.resolve = {
|
DaybookCtrl.resolve = {
|
||||||
info:['$route', 'Daybook', function ($route, Daybook) {
|
info: ['$route', 'Daybook', function ($route, Daybook) {
|
||||||
var start_date = $route.current.params.StartDate,
|
var startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
|
||||||
return Daybook.get({}).$promise;
|
return Daybook.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Daybook.get({StartDate:start_date, FinishDate:finish_date}).$promise;
|
return Daybook.get({StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,25 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var EmployeeAttendanceCtrl = ['$scope', '$location', '$routeParams', 'dateFilter', 'EmployeeAttendance', 'attendance_types', 'info', 'Employee', function ($scope, $location, $routeParams, dateFilter, EmployeeAttendance, attendance_types, info, Employee) {
|
var EmployeeAttendanceCtrl = ['$scope', '$location', '$routeParams', 'asDateFilter', 'EmployeeAttendance', 'attendanceTypes', 'info', 'Employee', function ($scope, $location, $routeParams, asDate, EmployeeAttendance, attendanceTypes, info, Employee) {
|
||||||
$scope.attendance_types = attendance_types;
|
$scope.attendanceTypes = attendanceTypes;
|
||||||
$scope.info = info;
|
$scope.info = info;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
var id = $scope.info.Employee.LedgerID;
|
var id = $scope.info.Employee.LedgerID;
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate);
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
var finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
if (id === $routeParams.id && startDate === $routeParams.StartDate && finishDate === $routeParams.FinishDate) {
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
EmployeeAttendance.get({id: id, StartDate: startDate, FinishDate: finishDate}, function (data) {
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
var start_date = $scope.info.StartDate;
|
|
||||||
var finish_date = $scope.info.FinishDate;
|
|
||||||
if (id == $routeParams.id && start_date == $routeParams.StartDate && finish_date == $routeParams.FinishDate) {
|
|
||||||
EmployeeAttendance.get({id: id, StartDate: start_date, FinishDate: finish_date}, function (data) {
|
|
||||||
$scope.info = data;
|
$scope.info = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$location.path('/EmployeeAttendance/' + $scope.info.Employee.LedgerID).search({StartDate: $scope.info.StartDate, FinishDate: $scope.info.FinishDate});
|
$location.path('/EmployeeAttendance/' + id).search({StartDate: startDate, FinishDate: finishDate});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,16 +58,16 @@ var EmployeeAttendanceSubCtrl = ['$scope', function ($scope) {
|
|||||||
EmployeeAttendanceCtrl.resolve = {
|
EmployeeAttendanceCtrl.resolve = {
|
||||||
info: ['$route', 'EmployeeAttendance', function ($route, EmployeeAttendance) {
|
info: ['$route', 'EmployeeAttendance', function ($route, EmployeeAttendance) {
|
||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
start_date = $route.current.params.StartDate,
|
startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
return EmployeeAttendance.get({}).$promise;
|
return EmployeeAttendance.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return EmployeeAttendance.get({id: id, StartDate: start_date, FinishDate: finish_date}).$promise;
|
return EmployeeAttendance.get({id: id, StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
attendance_types: ['AttendanceTypes', function (AttendanceTypes) {
|
attendanceTypes: ['AttendanceTypes', function (AttendanceTypes) {
|
||||||
return AttendanceTypes.query({}).$promise;
|
return AttendanceTypes.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var EmployeeFunctionsCtrl = ['$scope', '$http', 'dateFilter', function ($scope, $http, dateFilter) {
|
var EmployeeFunctionsCtrl = ['$scope', '$http', 'asDateFilter', function ($scope, $http, asDate) {
|
||||||
$scope.record = {};
|
$scope.record = {};
|
||||||
$scope.creditSalary = function () {
|
$scope.creditSalary = function () {
|
||||||
if (!angular.isDate($scope.salaryMonth)) {
|
if (!angular.isDate($scope.salaryMonth)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var salary_month = dateFilter($scope.salaryMonth, 'dd-MMM-yyyy');
|
var SalaryMonth = asDate($scope.salaryMonth);
|
||||||
return $http.
|
return $http.
|
||||||
post('/api/CreditSalary', {Month: salary_month}).
|
post('/api/CreditSalary', {Month: SalaryMonth}).
|
||||||
success(function (data) {
|
success(function (data) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: data.message});
|
$scope.toasts.push({Type: 'Success', Message: data.message});
|
||||||
}).
|
}).
|
||||||
@@ -21,10 +21,10 @@ var EmployeeFunctionsCtrl = ['$scope', '$http', 'dateFilter', function ($scope,
|
|||||||
if (!$scope.record.StartDate || !$scope.record.FinishDate) {
|
if (!$scope.record.StartDate || !$scope.record.FinishDate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var start_date = angular.isDate($scope.record.StartDate) ? dateFilter($scope.record.StartDate, 'dd-MMM-yyyy') : $scope.record.StartDate;
|
var startDate = asDate($scope.record.StartDate);
|
||||||
var finish_date = angular.isDate($scope.record.FinishDate) ? dateFilter($scope.record.FinishDate, 'dd-MMM-yyyy') : $scope.record.FinishDate;
|
var finishDate = asDate($scope.record.FinishDate);
|
||||||
|
|
||||||
var url = '/AttendanceReport?StartDate=' + start_date + "&FinishDate=" + finish_date;
|
var url = '/AttendanceReport?StartDate=' + startDate + "&FinishDate=" + finishDate;
|
||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
$scope.setFile = function (element) {
|
$scope.setFile = function (element) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var EmployeeListCtrl = ['$scope', '$location', '$routeParams', 'employees', function ($scope, $location, $routeParams, employees) {
|
var EmployeeListCtrl = ['$scope', '$location', '$routeParams', 'Tokenizer', 'employees', function ($scope, $location, $routeParams, Tokenizer, employees) {
|
||||||
$scope.search = $routeParams.q || '';
|
$scope.search = $routeParams.q || '';
|
||||||
$scope.info = employees;
|
$scope.info = employees;
|
||||||
var re = /((([^ ]+):\s*('[^':]+'|"[^":]+"|[^ ]+))|[^ ]+[^: '"]*)/g;
|
var re = /((([^ ]+):\s*('[^':]+'|"[^":]+"|[^ ]+))|[^ ]+[^: '"]*)/g;
|
||||||
@@ -16,6 +16,29 @@ var EmployeeListCtrl = ['$scope', '$location', '$routeParams', 'employees', func
|
|||||||
$scope.filterEmployees(newValue);
|
$scope.filterEmployees(newValue);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
$scope.$on('$destroy', function () {
|
||||||
|
Tokenizer.doFilter.cache = {};
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.searchInfo = {
|
||||||
|
comparator: {
|
||||||
|
'n': {'Col': 'Name', 'Comparator': 'text'},
|
||||||
|
'c': {'Col': 'Code', 'Comparator': 'numeric'},
|
||||||
|
's': {'Col': 'Salary', 'Comparator': 'numeric'},
|
||||||
|
'a': {'Col': 'IsActive', 'Comparator': 'boolean'},
|
||||||
|
'des': {'Col': 'Designation', 'Comparator': 'text'},
|
||||||
|
'dep': {'Col': 'CostCenter', 'Comparator': 'text'}
|
||||||
|
},
|
||||||
|
def: 'n',
|
||||||
|
sorter: {
|
||||||
|
'n': 'Name',
|
||||||
|
'c': 'Code',
|
||||||
|
's': 'Salary',
|
||||||
|
'a': 'IsActive',
|
||||||
|
'des': 'Designation',
|
||||||
|
'dep': 'CostCenter'
|
||||||
|
}
|
||||||
|
};
|
||||||
$scope.filterEmployees = _.debounce(function (q) {
|
$scope.filterEmployees = _.debounce(function (q) {
|
||||||
if (q !== $scope._search) {
|
if (q !== $scope._search) {
|
||||||
$scope._search = q;
|
$scope._search = q;
|
||||||
@@ -25,62 +48,12 @@ var EmployeeListCtrl = ['$scope', '$location', '$routeParams', 'employees', func
|
|||||||
$location.path('/Employees').search({'q': q}).replace();
|
$location.path('/Employees').search({'q': q}).replace();
|
||||||
}
|
}
|
||||||
$scope.$apply(function () {
|
$scope.$apply(function () {
|
||||||
$scope.employees = $scope.doFilter(q);
|
var matches = Tokenizer.parseFilterString(q, $scope.searchInfo);
|
||||||
|
$scope.employees = Tokenizer.doFilter(q, $scope.info, matches);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 350);
|
}, 350);
|
||||||
$scope.doFilter = _.memoize(function (q) {
|
|
||||||
var matches = [], i, len;
|
|
||||||
if (angular.isUndefined(q) || q === '') {
|
|
||||||
return $scope.info;
|
|
||||||
}
|
|
||||||
var m = q.match(re);
|
|
||||||
_.forEach(m, function (item) {
|
|
||||||
item = item.toLowerCase();
|
|
||||||
if (item.indexOf(':') === -1) {
|
|
||||||
matches.push({'key': 'n', 'value': item});
|
|
||||||
} else {
|
|
||||||
var key = item.substr(0, item.indexOf(':')).toLowerCase();
|
|
||||||
var value = item.substr(item.indexOf(':') + 1, item.length).trim().toLowerCase();
|
|
||||||
if (value.indexOf("'") === 0 || value.indexOf('"') === 0) {
|
|
||||||
value = value.substring(1, value.length - 2);
|
|
||||||
}
|
|
||||||
if (key !== '' && value !== '' && _.any(['w', 'dep', 'des', 'c'], function (item) {
|
|
||||||
return item === key;
|
|
||||||
})) {
|
|
||||||
matches.push({'key': key, 'value': value});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return _.filter($scope.info, function (item) {
|
|
||||||
len = matches.length;
|
|
||||||
for (i = 0; i < len; i++) {
|
|
||||||
var match = matches[i];
|
|
||||||
if (match.key === 'n') {
|
|
||||||
if (item.Name.toLowerCase().indexOf(match.value) === -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (match.key === 'w') {
|
|
||||||
if (item.IsActive !== $scope.isTrue(match.value)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (match.key === 'dep') {
|
|
||||||
if (item.CostCenter.toLowerCase().indexOf(match.value) === -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (match.key === 'des') {
|
|
||||||
if (item.Designation.toLowerCase().indexOf(match.value) === -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (match.key === 'c') {
|
|
||||||
if (item.Code.toString().indexOf(match.value) === -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
EmployeeListCtrl.resolve = {
|
EmployeeListCtrl.resolve = {
|
||||||
@@ -89,18 +62,14 @@ EmployeeListCtrl.resolve = {
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
var EmployeeCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal', 'employee', 'cost_centers', function ($scope, $routeParams, $location, dateFilter, $modal, employee, cost_centers) {
|
var EmployeeCtrl = ['$scope', '$routeParams', '$location', 'asDateFilter', '$modal', 'employee', 'costCenters', function ($scope, $routeParams, $location, asDate, $modal, employee, costCenters) {
|
||||||
$scope.employee = employee;
|
$scope.employee = employee;
|
||||||
|
|
||||||
$scope.cost_centers = cost_centers;
|
$scope.costCenters = costCenters;
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.employee.JoiningDate)) {
|
$scope.employee.JoiningDate = asDate($scope.employee.JoiningDate);
|
||||||
$scope.employee.JoiningDate = dateFilter($scope.employee.JoiningDate, 'dd-MMM-yyyy');
|
$scope.employee.LeavingDate = asDate($scope.employee.LeavingDate);
|
||||||
}
|
|
||||||
if (angular.isDate($scope.employee.LeavingDate)) {
|
|
||||||
$scope.employee.LeavingDate = dateFilter($scope.employee.LeavingDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$scope.employee.$save(function (u, putResponseHeaders) {
|
$scope.employee.$save(function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: u.Code});
|
$scope.toasts.push({Type: 'Success', Message: u.Code});
|
||||||
$location.path('/Employees');
|
$location.path('/Employees');
|
||||||
@@ -145,10 +114,9 @@ var EmployeeCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal
|
|||||||
EmployeeCtrl.resolve = {
|
EmployeeCtrl.resolve = {
|
||||||
employee: ['$route', 'Employee', function ($route, Employee) {
|
employee: ['$route', 'Employee', function ($route, Employee) {
|
||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
|
|
||||||
return Employee.get({id: id}).$promise;
|
return Employee.get({id: id}).$promise;
|
||||||
}],
|
}],
|
||||||
cost_centers: ['CostCenter', function (CostCenter) {
|
costCenters: ['CostCenter', function (CostCenter) {
|
||||||
return CostCenter.query({}).$promise;
|
return CostCenter.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var HomeCtrl = ['$scope', '$location', '$http', 'dateFilter', 'messages', 'dashboard', 'Message', function ($scope, $location, $http, dateFilter, messages, dashboard, Message) {
|
var HomeCtrl = ['$scope', '$location', '$http', 'asDateFilter', 'messages', 'dashboard', 'Message', function ($scope, $location, $http, asDate, messages, dashboard, Message) {
|
||||||
$scope.chosen = messages.Type;
|
$scope.chosen = messages.Type;
|
||||||
$scope.dashboard = dashboard;
|
$scope.dashboard = dashboard;
|
||||||
$scope.info = messages.Threads;
|
$scope.info = messages.Threads;
|
||||||
@@ -20,9 +20,9 @@ var HomeCtrl = ['$scope', '$location', '$http', 'dateFilter', 'messages', 'dashb
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.getDashboard = function () {
|
$scope.getDashboard = function () {
|
||||||
var start_date = angular.isDate($scope.dashboard.StartDate) ? dateFilter($scope.dashboard.StartDate, 'dd-MMM-yyyy') : $scope.dashboard.StartDate;
|
var startDate = asDate($scope.dashboard.StartDate),
|
||||||
var finish_date = angular.isDate($scope.dashboard.FinishDate) ? dateFilter($scope.dashboard.FinishDate, 'dd-MMM-yyyy') : $scope.dashboard.FinishDate;
|
finishDate = asDate($scope.dashboard.FinishDate);
|
||||||
return $http({ method: 'GET', url: '/api/Dashboard', params: {s: start_date, f: finish_date}}).then(function (data, status, headers, config) {
|
return $http({ method: 'GET', url: '/api/Dashboard', params: {s: startDate, f: finishDate}}).then(function (data, status, headers, config) {
|
||||||
$scope.dashboard = data.data;
|
$scope.dashboard = data.data;
|
||||||
formatData();
|
formatData();
|
||||||
});
|
});
|
||||||
@@ -102,6 +102,7 @@ var HomeCtrl = ['$scope', '$location', '$http', 'dateFilter', 'messages', 'dashb
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
formatData();
|
formatData();
|
||||||
}];
|
}];
|
||||||
HomeCtrl.resolve = {
|
HomeCtrl.resolve = {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher', 'cost_centers', 'issue_grid', 'IssueGrid', 'Voucher', '$modal', 'Batch', function ($scope, $routeParams, $location, dateFilter, voucher, cost_centers, issue_grid, IssueGrid, Voucher, $modal, Batch) {
|
var IssueCtrl = ['$scope', '$routeParams', '$location', 'asDateFilter', 'voucher', 'costCenters', 'smallGrid', 'IssueGrid', 'Voucher', '$modal', 'Batch', function ($scope, $routeParams, $location, asDate, voucher, costCenters, smallGrid, IssueGrid, Voucher, $modal, Batch) {
|
||||||
$scope.voucher = voucher;
|
$scope.voucher = voucher;
|
||||||
$scope.cost_centers = cost_centers;
|
$scope.costCenters = costCenters;
|
||||||
$scope.smallGrid = issue_grid;
|
$scope.smallGrid = smallGrid;
|
||||||
|
|
||||||
if (typeof $routeParams.Source === 'undefined' && typeof $routeParams.Destination === 'undefined' && typeof $routeParams.id === 'undefined') {
|
if (angular.isUndefined($routeParams.Source) && angular.isUndefined($routeParams.Destination) && angular.isUndefined($routeParams.id)) {
|
||||||
var date = $scope.voucher.Date;
|
var date = $scope.voucher.Date;
|
||||||
var source = getDebitCredit($scope.voucher.Journals, -1);
|
var source = getDebitCredit($scope.voucher.Journals, -1);
|
||||||
var destination = getDebitCredit($scope.voucher.Journals, 1);
|
var destination = getDebitCredit($scope.voucher.Journals, 1);
|
||||||
@@ -27,7 +27,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof oldInventory !== 'undefined' &&
|
if (!angular.isUndefined(oldInventory) &&
|
||||||
oldInventory.Batch.BatchID === $scope.batch.BatchID &&
|
oldInventory.Batch.BatchID === $scope.batch.BatchID &&
|
||||||
(!consumption || oldInventory.Quantity + quantity <= $scope.batch.QuantityRemaining)) {
|
(!consumption || oldInventory.Quantity + quantity <= $scope.batch.QuantityRemaining)) {
|
||||||
oldInventory.Quantity += quantity;
|
oldInventory.Quantity += quantity;
|
||||||
@@ -36,7 +36,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
$('#txtBatch').focus();
|
$('#txtBatch').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof oldInventory === 'undefined' && (!consumption || quantity <= $scope.batch.QuantityRemaining)) {
|
if (angular.isUndefined(oldInventory) && (!consumption || quantity <= $scope.batch.QuantityRemaining)) {
|
||||||
this.voucher.Inventories.push(
|
this.voucher.Inventories.push(
|
||||||
{
|
{
|
||||||
Product: $scope.batch.Product,
|
Product: $scope.batch.Product,
|
||||||
@@ -58,12 +58,12 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.$watch('voucher.Date', function (newDate, oldDate) {
|
$scope.$watch('voucher.Date', function (newDate, oldDate) {
|
||||||
var nDate = angular.isDate(newDate) ? dateFilter(newDate, 'dd-MMM-yyyy') : newDate,
|
var nDate = asDate(newDate),
|
||||||
oDate = angular.isDate(oldDate) ? dateFilter(oldDate, 'dd-MMM-yyyy') : oldDate;
|
oDate = asDate(oldDate);
|
||||||
|
|
||||||
|
|
||||||
if (nDate !== oDate && typeof nDate !== 'undefined') {
|
if (nDate !== oDate && !angular.isUndefined(nDate)) {
|
||||||
if (typeof $routeParams.Source !== 'undefined' && typeof $routeParams.Destination !== 'undefined' && typeof $routeParams.id !== 'undefined') {
|
if (!angular.isUndefined($routeParams.Source) && !angular.isUndefined($routeParams.Destination) && !angular.isUndefined($routeParams.id)) {
|
||||||
$location.path('/Issue/' + nDate).search({Source: $routeParams.Source, Destination: $routeParams.Destination});
|
$location.path('/Issue/' + nDate).search({Source: $routeParams.Source, Destination: $routeParams.Destination});
|
||||||
} else {
|
} else {
|
||||||
$scope.smallGrid = IssueGrid.query({date: nDate, Source: $routeParams.Source, Destination: $routeParams.Destination});
|
$scope.smallGrid = IssueGrid.query({date: nDate, Source: $routeParams.Source, Destination: $routeParams.Destination});
|
||||||
@@ -80,16 +80,16 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.$watch('voucher.Journals', function (newJournals, oldJournals) {
|
$scope.$watch('voucher.Journals', function (newJournals, oldJournals) {
|
||||||
if (typeof newJournals === 'undefined' || angular.equals(newJournals, oldJournals)) {
|
if (angular.isUndefined(newJournals) || angular.equals(newJournals, oldJournals)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof oldJournals !== 'undefined') {
|
if (!angular.isUndefined(oldJournals)) {
|
||||||
if (getDebitCredit(oldJournals, -1) === getDebitCredit(newJournals, -1) && getDebitCredit(oldJournals, 1) === getDebitCredit(newJournals, 1)) {
|
if (getDebitCredit(oldJournals, -1) === getDebitCredit(newJournals, -1) && getDebitCredit(oldJournals, 1) === getDebitCredit(newJournals, 1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof $routeParams.Source !== 'undefined' && typeof $routeParams.Destination !== 'undefined' && typeof $routeParams.id !== 'undefined') {
|
if (!angular.isUndefined($routeParams.Source) && !angular.isUndefined($routeParams.Destination) && !angular.isUndefined($routeParams.id)) {
|
||||||
$location.path('/Issue/' + $scope.voucher.Date).search({Source: getDebitCredit(newJournals, -1), Destination: getDebitCredit(newJournals, 1)});
|
$location.path('/Issue/' + $scope.voucher.Date).search({Source: getDebitCredit(newJournals, -1), Destination: getDebitCredit(newJournals, 1)});
|
||||||
} else {
|
} else {
|
||||||
$scope.smallGrid = IssueGrid.query({date: $scope.voucher.Date, Source: getDebitCredit(newJournals, -1), Destination: getDebitCredit(newJournals, 1)});
|
$scope.smallGrid = IssueGrid.query({date: $scope.voucher.Date, Source: getDebitCredit(newJournals, -1), Destination: getDebitCredit(newJournals, 1)});
|
||||||
@@ -97,7 +97,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
$scope.$watch('voucher.Inventories', function (newInventories, oldInventories) {
|
$scope.$watch('voucher.Inventories', function (newInventories, oldInventories) {
|
||||||
if (typeof newInventories === 'undefined' || typeof oldInventories === 'undefined') {
|
if (angular.isUndefined(newInventories) || angular.isUndefined(oldInventories)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var amount = 0;
|
var amount = 0;
|
||||||
@@ -117,7 +117,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.preventAlteration = function (voucher) {
|
$scope.preventAlteration = function (voucher) {
|
||||||
if (typeof voucher.VoucherID === 'undefined') {
|
if (angular.isUndefined(voucher.VoucherID)) {
|
||||||
return !$scope.perms['Issue'];
|
return !$scope.perms['Issue'];
|
||||||
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
||||||
return true;
|
return true;
|
||||||
@@ -137,9 +137,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
$scope.voucher.Date = asDate($scope.voucher.Date);
|
||||||
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$scope.voucher.$save({type: 'Issue'}, function (u, putResponseHeaders) {
|
$scope.voucher.$save({type: 'Issue'}, function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$scope.redirectOnSave(u);
|
$scope.redirectOnSave(u);
|
||||||
@@ -160,7 +158,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.redirectOnSave = function (voucher) {
|
$scope.redirectOnSave = function (voucher) {
|
||||||
if (typeof $routeParams.Source !== 'undefined' && typeof $routeParams.Destination !== 'undefined' && typeof $routeParams.id !== 'undefined') {
|
if (!angular.isUndefined($routeParams.Source) && !angular.isUndefined($routeParams.Destination) && !angular.isUndefined($routeParams.id)) {
|
||||||
Voucher.get({type: 'Issue', Date: $routeParams.id, Source: $routeParams.Source, Destination: $routeParams.Destination}, function (u, putResponseHeaders) {
|
Voucher.get({type: 'Issue', Date: $routeParams.id, Source: $routeParams.Source, Destination: $routeParams.Destination}, function (u, putResponseHeaders) {
|
||||||
$scope.voucher = u;
|
$scope.voucher = u;
|
||||||
});
|
});
|
||||||
@@ -188,7 +186,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
modalInstance.result.then(function (updated) {
|
modalInstance.result.then(function (updated) {
|
||||||
if (updated.Product.ProductID !== $scope.selectedInventory.Batch.Product.ProductID) {
|
if (updated.Product.ProductID !== $scope.selectedInventory.Batch.Product.ProductID) {
|
||||||
var oldInventory = getOld(updated.Batch.Product.ProductID, $scope.voucher.Inventories);
|
var oldInventory = getOld(updated.Batch.Product.ProductID, $scope.voucher.Inventories);
|
||||||
if (typeof oldInventory !== 'undefined') {
|
if (!angular.isUndefined(oldInventory)) {
|
||||||
delete $scope.selectedInventory;
|
delete $scope.selectedInventory;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -223,12 +221,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.batches = function ($viewValue) {
|
$scope.batches = function ($viewValue) {
|
||||||
var params = {term: $viewValue, count: 20};
|
var params = {term: $viewValue, count: 20, date: asDate($scope.voucher.Date)};
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
|
||||||
params.date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
} else {
|
|
||||||
params.date = $scope.voucher.Date;
|
|
||||||
}
|
|
||||||
return Batch.autocomplete(params).$promise;
|
return Batch.autocomplete(params).$promise;
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
@@ -239,28 +232,28 @@ IssueCtrl.resolve = {
|
|||||||
source = $route.current.params.Source,
|
source = $route.current.params.Source,
|
||||||
destination = $route.current.params.Destination;
|
destination = $route.current.params.Destination;
|
||||||
|
|
||||||
if (typeof source !== 'undefined' && typeof destination !== 'undefined' && typeof id !== 'undefined') {
|
if (!angular.isUndefined(source) && !angular.isUndefined(destination) && !angular.isUndefined(id)) {
|
||||||
return Voucher.get({type: 'Issue', Date: id, Source: source, Destination: destination}).$promise;
|
return Voucher.get({type: 'Issue', Date: id, Source: source, Destination: destination}).$promise;
|
||||||
} else if (typeof source === 'undefined' && typeof destination === 'undefined' && typeof id !== 'undefined') {
|
} else if (angular.isUndefined(source) && angular.isUndefined(destination) && !angular.isUndefined(id)) {
|
||||||
return Voucher.get({id: id}).$promise;
|
return Voucher.get({id: id}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Voucher.get({type: 'Issue'}).$promise;
|
return Voucher.get({type: 'Issue'}).$promise;
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
issue_grid: ['$route', 'IssueGrid', function ($route, IssueGrid) {
|
smallGrid: ['$route', 'IssueGrid', function ($route, IssueGrid) {
|
||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
source = $route.current.params.Source,
|
source = $route.current.params.Source,
|
||||||
destination = $route.current.params.Destination;
|
destination = $route.current.params.Destination;
|
||||||
|
|
||||||
if (typeof source !== 'undefined' && typeof destination !== 'undefined' && typeof id !== 'undefined') {
|
if (!angular.isUndefined(source) && !angular.isUndefined(destination) && !angular.isUndefined(id)) {
|
||||||
return IssueGrid.query({date: id, Source: source, Destination: destination}).$promise;
|
return IssueGrid.query({date: id, Source: source, Destination: destination}).$promise;
|
||||||
} else if (typeof source === 'undefined' && typeof destination === 'undefined' && typeof id !== 'undefined') {
|
} else if (angular.isUndefined(source) && angular.isUndefined(destination) && !angular.isUndefined(id)) {
|
||||||
return IssueGrid.query({date: id}).$promise;
|
return IssueGrid.query({date: id}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
cost_centers: ['CostCenter', function (CostCenter) {
|
costCenters: ['CostCenter', function (CostCenter) {
|
||||||
return CostCenter.query({}).$promise;
|
return CostCenter.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImageResizer', 'voucher', 'Account', function ($scope, $location, dateFilter, $modal, UploadedImageResizer, voucher, Account) {
|
var JournalCtrl = ['$scope', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'Account', function ($scope, $location, asDate, $modal, uploadedImageResizer, voucher, Account) {
|
||||||
$('#txtAccount').focus();
|
$('#txtAccount').focus();
|
||||||
|
|
||||||
$scope.voucher = voucher;
|
$scope.voucher = voucher;
|
||||||
@@ -12,7 +12,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.$on("fileSelected", function (event, args) {
|
$scope.$on("fileSelected", function (event, args) {
|
||||||
UploadedImageResizer(args, $scope.voucher.Files);
|
uploadedImageResizer(args, $scope.voucher.Files);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var oldJournal = getOld($scope.account.LedgerID, this.voucher.Journals);
|
var oldJournal = getOld($scope.account.LedgerID, this.voucher.Journals);
|
||||||
if (typeof oldJournal !== 'undefined') {
|
if (!angular.isUndefined(oldJournal)) {
|
||||||
var amount = (oldJournal.Debit * oldJournal.Amount) + (parseInt($scope.debit) * Number($scope.amount));
|
var amount = (oldJournal.Debit * oldJournal.Amount) + (parseInt($scope.debit) * Number($scope.amount));
|
||||||
if (amount < 0) {
|
if (amount < 0) {
|
||||||
oldJournal.Debit = -1;
|
oldJournal.Debit = -1;
|
||||||
@@ -61,7 +61,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
this.voucher.Journals.splice(index, 1);
|
this.voucher.Journals.splice(index, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$watch('voucher.Journals', function (journals, oldValue) {
|
$scope.$watch('voucher.Journals', function (journals) {
|
||||||
if (!angular.isArray(journals)) {
|
if (!angular.isArray(journals)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -72,9 +72,9 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
$scope.preventAlteration = function (voucher) {
|
$scope.preventAlteration = function (voucher) {
|
||||||
if (typeof $scope.perms === 'undefined') {
|
if (angular.isUndefined($scope.perms)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (typeof voucher.VoucherID === 'undefined') {
|
} else if (angular.isUndefined(voucher.VoucherID)) {
|
||||||
return !$scope.perms['Journal'];
|
return !$scope.perms['Journal'];
|
||||||
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
||||||
return true;
|
return true;
|
||||||
@@ -85,18 +85,8 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.get = function (voucherid) {
|
|
||||||
$scope.voucher = Voucher.get({VoucherID: voucherid}, function (u, putResponseHeaders) {
|
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
|
||||||
}, function (data, status) {
|
|
||||||
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
$scope.voucher.Date = asDate($scope.voucher.Date);
|
||||||
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
return $scope.voucher.$save({type: 'Journal'}, function (u, putResponseHeaders) {
|
return $scope.voucher.$save({type: 'Journal'}, function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/Journal/' + u.VoucherID);
|
$location.path('/Journal/' + u.VoucherID);
|
||||||
@@ -137,7 +127,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
modalInstance.result.then(function (updated) {
|
modalInstance.result.then(function (updated) {
|
||||||
if (updated.Ledger.LedgerID !== $scope.selectedJournal.Ledger.LedgerID) {
|
if (updated.Ledger.LedgerID !== $scope.selectedJournal.Ledger.LedgerID) {
|
||||||
var oldJournal = getOld(updated.Ledger.LedgerID, $scope.voucher.Journals);
|
var oldJournal = getOld(updated.Ledger.LedgerID, $scope.voucher.Journals);
|
||||||
if (typeof oldJournal !== 'undefined') {
|
if (!angular.isUndefined(oldJournal)) {
|
||||||
delete $scope.selectedJournal;
|
delete $scope.selectedJournal;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -179,7 +169,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
JournalCtrl.resolve = {
|
JournalCtrl.resolve = {
|
||||||
voucher: ['$route', 'Voucher', function ($route, Voucher) {
|
voucher: ['$route', 'Voucher', function ($route, Voucher) {
|
||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
return Voucher.get({type: 'Journal'}).$promise;
|
return Voucher.get({type: 'Journal'}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Voucher.get({id: id}).$promise;
|
return Voucher.get({id: id}).$promise;
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var LedgerCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'ledger', 'Ledger', 'Account', function ($scope, $routeParams, $location, dateFilter, ledger, Ledger, Account) {
|
var LedgerCtrl = ['$scope', '$routeParams', '$location', 'asDateFilter', 'ledger', 'Ledger', 'Account', function ($scope, $routeParams, $location, asDate, ledger, Ledger, Account) {
|
||||||
$scope.info = ledger;
|
$scope.info = ledger;
|
||||||
$scope.hidden = [];
|
$scope.hidden = [];
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
var id = $scope.info.Ledger.LedgerID;
|
var id = $scope.info.Ledger.LedgerID,
|
||||||
var start_date = angular.isDate($scope.info.StartDate) ? dateFilter($scope.info.StartDate, 'dd-MMM-yyyy') : $scope.info.StartDate;
|
startDate = asDate($scope.info.StartDate),
|
||||||
var finish_date = angular.isDate($scope.info.FinishDate) ? dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy') : $scope.info.FinishDate;
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
if (id === $routeParams.id && start_date === $routeParams.StartDate && finish_date === $routeParams.FinishDate) {
|
if (id === $routeParams.id && startDate === $routeParams.StartDate && finishDate === $routeParams.FinishDate) {
|
||||||
Ledger.get({id: id, StartDate: start_date, FinishDate: finish_date}, function (data) {
|
Ledger.get({id: id, StartDate: startDate, FinishDate: finishDate}, function (data) {
|
||||||
|
$scope.doFilter.cache = {};
|
||||||
$scope.info = data;
|
$scope.info = data;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$location.path('/Ledger/' + id).search('StartDate', start_date).search('FinishDate', finish_date);
|
$location.path('/Ledger/' + id).search('StartDate', startDate).search('FinishDate', finishDate);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,10 +36,10 @@ var LedgerCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'ledger',
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.$watch('hidden', function () {
|
$scope.$watch('hidden', function () {
|
||||||
$scope.display = doFilter($scope.info, $scope.hidden);
|
$scope.display = $scope.doFilter($scope.info, $scope.hidden);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
var doFilter = function (input, hidden) {
|
$scope.doFilter = _.memoize(function (input, hidden) {
|
||||||
var ledger = angular.copy(input),
|
var ledger = angular.copy(input),
|
||||||
data = ledger.Body,
|
data = ledger.Body,
|
||||||
footer = ledger.Footer,
|
footer = ledger.Footer,
|
||||||
@@ -68,7 +69,9 @@ var LedgerCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'ledger',
|
|||||||
footer.Credit = credit;
|
footer.Credit = credit;
|
||||||
footer.Running = running;
|
footer.Running = running;
|
||||||
return {Body: data, Footer: footer};
|
return {Body: data, Footer: footer};
|
||||||
};
|
}, function (input, hidden) {
|
||||||
|
return hidden.sort().join(' ');
|
||||||
|
});
|
||||||
|
|
||||||
$scope.shortcuts = {
|
$scope.shortcuts = {
|
||||||
'up': function (e) {
|
'up': function (e) {
|
||||||
@@ -81,7 +84,7 @@ var LedgerCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'ledger',
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'down': function (e) {
|
'down': function (e) {
|
||||||
if ($scope.selected < $scope.info.Body.length - 1) {
|
if ($scope.selected < $scope.display.Body.length - 1) {
|
||||||
$scope.$apply(function () {
|
$scope.$apply(function () {
|
||||||
$scope.selected = $scope.selected += 1;
|
$scope.selected = $scope.selected += 1;
|
||||||
});
|
});
|
||||||
@@ -125,13 +128,13 @@ var LedgerCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'ledger',
|
|||||||
LedgerCtrl.resolve = {
|
LedgerCtrl.resolve = {
|
||||||
ledger: ['$route', 'Ledger', function ($route, Ledger) {
|
ledger: ['$route', 'Ledger', function ($route, Ledger) {
|
||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
start_date = $route.current.params.StartDate,
|
startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
return Ledger.get({}).$promise;
|
return Ledger.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Ledger.get({id: id, StartDate: start_date, FinishDate: finish_date}).$promise;
|
return Ledger.get({id: id, StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
var LoginCtrl = ['$scope', '$http', '$location', '$routeParams', '$cookieStore', function ($scope, $http, $location, $routeParams, $cookieStore) {
|
var LoginCtrl = ['$scope', '$http', '$location', '$routeParams', '$cookieStore', function ($scope, $http, $location, $routeParams, $cookieStore) {
|
||||||
$scope.showOTP = false;
|
$scope.showOTP = false;
|
||||||
$scope.submit = function () {
|
$scope.submit = function () {
|
||||||
|
var data;
|
||||||
if ($scope.showOTP) {
|
if ($scope.showOTP) {
|
||||||
var data = {username: $scope.username, password: $scope.password, otp: $scope.otp, ClientName: $scope.name};
|
data = {username: $scope.username, password: $scope.password, otp: $scope.otp, ClientName: $scope.name};
|
||||||
} else {
|
} else {
|
||||||
var data = {username: $scope.username, password: $scope.password};
|
data = {username: $scope.username, password: $scope.password};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ var LoginCtrl = ['$scope', '$http', '$location', '$routeParams', '$cookieStore',
|
|||||||
post('/api/login', data).
|
post('/api/login', data).
|
||||||
success(function () {
|
success(function () {
|
||||||
var came_from = $routeParams.came_from;
|
var came_from = $routeParams.came_from;
|
||||||
if (typeof came_from === 'undefined' || came_from === "" || came_from === "/login" || came_from === "/logout") {
|
if (angular.isUndefined(came_from) || came_from === "" || came_from === "/login" || came_from === "/logout") {
|
||||||
came_from = "/";
|
came_from = "/";
|
||||||
}
|
}
|
||||||
$location.path(came_from).search({});
|
$location.path(came_from).search({});
|
||||||
@@ -36,7 +37,7 @@ var LogoutCtrl = ['$scope', '$http', '$location', function ($scope, $http, $loca
|
|||||||
post('/logout').
|
post('/logout').
|
||||||
success(function () {
|
success(function () {
|
||||||
$scope.toasts.push({Type: 'Success', Message: 'Logged out'});
|
$scope.toasts.push({Type: 'Success', Message: 'Logged out'});
|
||||||
$location.path('/')
|
$location.path('/');
|
||||||
}).
|
}).
|
||||||
error(function (errorMessage) {
|
error(function (errorMessage) {
|
||||||
$scope.toasts.push({Type: 'Danger', Message: errorMessage});
|
$scope.toasts.push({Type: 'Danger', Message: errorMessage});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var MessageCtrl = ['$scope', '$location', 'dateFilter', 'message', 'tags', 'users', 'priorities', function ($scope, $location, dateFilter, message, tags, users, priorities) {
|
var MessageCtrl = ['$scope', '$location', 'asDateFilter', 'message', 'tags', 'users', 'priorities', function ($scope, $location, asDate, message, tags, users, priorities) {
|
||||||
$scope.message = message;
|
$scope.message = message;
|
||||||
$scope.priorities = priorities
|
$scope.priorities = priorities
|
||||||
$scope.tags = tags;
|
$scope.tags = tags;
|
||||||
@@ -23,9 +23,7 @@ var MessageCtrl = ['$scope', '$location', 'dateFilter', 'message', 'tags', 'user
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (var i = 0, l = $scope.message.Posts.length; i < l; i++) {
|
for (var i = 0, l = $scope.message.Posts.length; i < l; i++) {
|
||||||
if (angular.isDate($scope.message.Posts[i].Date)) {
|
$scope.message.Posts[i].Date = asDate($scope.message.Posts[i].Date);
|
||||||
$scope.message.Posts[i].Date = dateFilter($scope.message.Posts[i].Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.message.$save(function (u, putResponseHeaders) {
|
$scope.message.$save(function (u, putResponseHeaders) {
|
||||||
|
|||||||
@@ -1,28 +1,24 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var NetTransactionsCtrl = ['$scope', '$location', 'dateFilter', 'net_transactions', function ($scope, $location, dateFilter, net_transactions) {
|
var NetTransactionsCtrl = ['$scope', '$location', 'asDateFilter', 'net_transactions', function ($scope, $location, asDate, net_transactions) {
|
||||||
$scope.info = net_transactions;
|
$scope.info = net_transactions;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate),
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
$location.path('/NetTransactions').search({StartDate: startDate, FinishDate: finishDate});
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/NetTransactions').search({StartDate: $scope.info.StartDate, FinishDate: $scope.info.FinishDate});
|
|
||||||
};
|
};
|
||||||
$('#txtStartDate').focus();
|
$('#txtStartDate').focus();
|
||||||
}];
|
}];
|
||||||
|
|
||||||
NetTransactionsCtrl.resolve = {
|
NetTransactionsCtrl.resolve = {
|
||||||
net_transactions: ['$route', 'NetTransactions', function ($route, NetTransactions) {
|
net_transactions: ['$route', 'NetTransactions', function ($route, NetTransactions) {
|
||||||
var start_date = $route.current.params.StartDate,
|
var startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
|
||||||
return NetTransactions.get({}).$promise;
|
return NetTransactions.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return NetTransactions.get({StartDate: start_date, FinishDate: finish_date}).$promise;
|
return NetTransactions.get({StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -140,7 +140,7 @@ overlord.controller('BaseCtrl', ['$rootScope', '$scope', 'Auth', '$location', '$
|
|||||||
$location.path('/');
|
$location.path('/');
|
||||||
} else {
|
} else {
|
||||||
var came_from = $routeParams.came_from;
|
var came_from = $routeParams.came_from;
|
||||||
if (typeof came_from === 'undefined' && $location.path() !== '/login') {
|
if (angular.isUndefined(came_from) && $location.path() !== '/login') {
|
||||||
came_from = $location.path();
|
came_from = $location.path();
|
||||||
}
|
}
|
||||||
$location.path('/login').search({came_from: came_from});
|
$location.path('/login').search({came_from: came_from});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImageResizer', 'voucher', 'ledgers', 'Account', function ($scope, $location, dateFilter, $modal, UploadedImageResizer, voucher, ledgers, Account) {
|
var PaymentCtrl = ['$scope', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'ledgers', 'Account', function ($scope, $location, asDate, $modal, uploadedImageResizer, voucher, ledgers, Account) {
|
||||||
$('#txtAccount').focus();
|
$('#txtAccount').focus();
|
||||||
|
|
||||||
$scope.voucher = voucher;
|
$scope.voucher = voucher;
|
||||||
@@ -12,7 +12,7 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.$on("fileSelected", function (event, args) {
|
$scope.$on("fileSelected", function (event, args) {
|
||||||
UploadedImageResizer(args, $scope.voucher.Files);
|
uploadedImageResizer(args, $scope.voucher.Files);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var oldJournal = getOld($scope.account.LedgerID, this.voucher.Journals);
|
var oldJournal = getOld($scope.account.LedgerID, this.voucher.Journals);
|
||||||
if (typeof oldJournal === 'undefined') {
|
if (angular.isUndefined(oldJournal)) {
|
||||||
this.voucher.Journals.push({Debit: 1, Amount: Number($scope.amount), Ledger: $scope.account});
|
this.voucher.Journals.push({Debit: 1, Amount: Number($scope.amount), Ledger: $scope.account});
|
||||||
} else {
|
} else {
|
||||||
if (oldJournal.Debit === 1) {
|
if (oldJournal.Debit === 1) {
|
||||||
@@ -62,10 +62,10 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
var amount = _.chain(journals)
|
var amount = _.chain(journals)
|
||||||
.where({'Debit': 1})
|
.where({'Debit': 1})
|
||||||
.reduce(function (sum, item) {
|
.reduce(function (sum, item) {
|
||||||
return item.Amount + sum;
|
return item.Amount + sum;
|
||||||
}, 0).value();
|
}, 0).value();
|
||||||
|
|
||||||
var j = _.find(journals,{'Debit': -1});
|
var j = _.find(journals, {'Debit': -1});
|
||||||
j.Amount = amount;
|
j.Amount = amount;
|
||||||
if (_.find(oldValue, {'Debit': -1}).Ledger.LedgerID !== j.Ledger.LedgerID) {
|
if (_.find(oldValue, {'Debit': -1}).Ledger.LedgerID !== j.Ledger.LedgerID) {
|
||||||
$location.search({a: j.Ledger.LedgerID}).replace();
|
$location.search({a: j.Ledger.LedgerID}).replace();
|
||||||
@@ -73,9 +73,9 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
$scope.preventAlteration = function (voucher) {
|
$scope.preventAlteration = function (voucher) {
|
||||||
if (typeof $scope.perms === 'undefined') {
|
if (angular.isUndefined($scope.perms)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (typeof voucher.VoucherID === 'undefined') {
|
} else if (angular.isUndefined(voucher.VoucherID)) {
|
||||||
return !$scope.perms['Payment'];
|
return !$scope.perms['Payment'];
|
||||||
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
||||||
return true;
|
return true;
|
||||||
@@ -86,18 +86,8 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.get = function (voucherid) {
|
|
||||||
$scope.voucher = Voucher.get({VoucherID: voucherid}, function (u, putResponseHeaders) {
|
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
|
||||||
}, function (data, status) {
|
|
||||||
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
$scope.voucher.Date = asDate($scope.voucher.Date);
|
||||||
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
return $scope.voucher.$save({type: 'Payment'}, function (u, putResponseHeaders) {
|
return $scope.voucher.$save({type: 'Payment'}, function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/Payment/' + u.VoucherID);
|
$location.path('/Payment/' + u.VoucherID);
|
||||||
@@ -138,7 +128,7 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImage
|
|||||||
modalInstance.result.then(function (updated) {
|
modalInstance.result.then(function (updated) {
|
||||||
if (updated.Ledger.LedgerID !== $scope.selectedJournal.Ledger.LedgerID) {
|
if (updated.Ledger.LedgerID !== $scope.selectedJournal.Ledger.LedgerID) {
|
||||||
var oldJournal = getOld(updated.Ledger.LedgerID, $scope.voucher.Journals);
|
var oldJournal = getOld(updated.Ledger.LedgerID, $scope.voucher.Journals);
|
||||||
if (typeof oldJournal !== 'undefined') {
|
if (!angular.isUndefined(oldJournal)) {
|
||||||
delete $scope.selectedJournal;
|
delete $scope.selectedJournal;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -181,7 +171,7 @@ PaymentCtrl.resolve = {
|
|||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
account = $route.current.params.a;
|
account = $route.current.params.a;
|
||||||
|
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
var options = {type: 'Payment'};
|
var options = {type: 'Payment'};
|
||||||
if (!angular.isUndefined(account)) {
|
if (!angular.isUndefined(account)) {
|
||||||
options.a = account;
|
options.a = account;
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ProductGroupListCtrl = ['$scope', 'product_groups', function ($scope, product_groups) {
|
var ProductGroupListCtrl = ['$scope', 'productGroups', function ($scope, productGroups) {
|
||||||
$scope.info = product_groups;
|
$scope.info = productGroups;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ProductGroupListCtrl.resolve = {
|
ProductGroupListCtrl.resolve = {
|
||||||
product_groups: ['ProductGroup', function (ProductGroup) {
|
productGroups: ['ProductGroup', function (ProductGroup) {
|
||||||
return ProductGroup.query({}).$promise;
|
return ProductGroup.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
var ProductGroupCtrl = ['$scope', '$location', 'product_group', function ($scope, $location, product_group) {
|
var ProductGroupCtrl = ['$scope', '$location', 'productGroup', function ($scope, $location, productGroup) {
|
||||||
$scope.product_group = product_group;
|
$scope.productGroup = productGroup;
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
$scope.product_group.$save(function (u, putResponseHeaders) {
|
$scope.productGroup.$save(function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/ProductGroups')
|
$location.path('/ProductGroups')
|
||||||
}, function (data, status) {
|
}, function (data, status) {
|
||||||
@@ -23,7 +23,7 @@ var ProductGroupCtrl = ['$scope', '$location', 'product_group', function ($scope
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.delete = function () {
|
$scope.delete = function () {
|
||||||
$scope.product_group.$delete(function (u, putResponseHeaders) {
|
$scope.productGroup.$delete(function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/ProductGroups')
|
$location.path('/ProductGroups')
|
||||||
}, function (data, status) {
|
}, function (data, status) {
|
||||||
@@ -34,7 +34,7 @@ var ProductGroupCtrl = ['$scope', '$location', 'product_group', function ($scope
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
ProductGroupCtrl.resolve = {
|
ProductGroupCtrl.resolve = {
|
||||||
product_group: ['$route', 'ProductGroup', function ($route, ProductGroup) {
|
productGroup: ['$route', 'ProductGroup', function ($route, ProductGroup) {
|
||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
return ProductGroup.get({id: id}).$promise;
|
return ProductGroup.get({id: id}).$promise;
|
||||||
}]
|
}]
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ProductLedgerCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'product_ledger', 'ProductLedger', 'Product', function ($scope, $routeParams, $location, dateFilter, product_ledger, ProductLedger, Product) {
|
var ProductLedgerCtrl = ['$scope', '$routeParams', '$location', 'asDateFilter', 'product_ledger', 'ProductLedger', 'Product', function ($scope, $routeParams, $location, asDate, product_ledger, ProductLedger, Product) {
|
||||||
$scope.info = product_ledger;
|
$scope.info = product_ledger;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
var id = $scope.info.Product.ProductID;
|
var id = $scope.info.Product.ProductID,
|
||||||
var start_date = angular.isDate($scope.info.StartDate) ? dateFilter($scope.info.StartDate, 'dd-MMM-yyyy') : $scope.info.StartDate;
|
startDate = asDate($scope.info.StartDate),
|
||||||
var finish_date = angular.isDate($scope.info.FinishDate) ? dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy') : $scope.info.FinishDate;
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
|
if (id === $routeParams.id && startDate === $routeParams.StartDate && finishDate === $routeParams.FinishDate) {
|
||||||
if (id === $routeParams.id && start_date === $routeParams.StartDate && finish_date === $routeParams.FinishDate) {
|
ProductLedger.get({id: id, StartDate: startDate, FinishDate: finishDate}, function (data) {
|
||||||
ProductLedger.get({id: id, StartDate: start_date, FinishDate: finish_date}, function (data) {
|
|
||||||
$scope.info = data;
|
$scope.info = data;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$location.path('/ProductLedger/' + $scope.info.Product.ProductID).search('StartDate', start_date).search('FinishDate', finish_date);
|
$location.path('/ProductLedger/' + $scope.info.Product.ProductID).search('StartDate', startDate).search('FinishDate', finishDate);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.downloadTable = function () {
|
$scope.downloadTable = function () {
|
||||||
@@ -31,13 +30,13 @@ var ProductLedgerCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'p
|
|||||||
ProductLedgerCtrl.resolve = {
|
ProductLedgerCtrl.resolve = {
|
||||||
product_ledger: ['$route', 'ProductLedger', function ($route, ProductLedger) {
|
product_ledger: ['$route', 'ProductLedger', function ($route, ProductLedger) {
|
||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
start_date = $route.current.params.StartDate,
|
startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
return ProductLedger.get({}).$promise;
|
return ProductLedger.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return ProductLedger.get({id: id, StartDate: start_date, FinishDate: finish_date}).$promise;
|
return ProductLedger.get({id: id, StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
var ProductListCtrl = ['$scope', '$location', '$routeParams', 'Tokenizer', 'products', function ($scope, $location, $routeParams, Tokenizer, products) {
|
var ProductListCtrl = ['$scope', '$location', '$routeParams', 'Tokenizer', 'products', function ($scope, $location, $routeParams, Tokenizer, products) {
|
||||||
$scope.search = $routeParams.q || '';
|
$scope.search = $routeParams.q || '';
|
||||||
$scope.show_extended = false;
|
$scope.showExtended = false;
|
||||||
$scope.info = products;
|
$scope.info = products;
|
||||||
|
|
||||||
$scope.$watch('search', function (newValue, oldValue) {
|
$scope.$watch('search', function (newValue, oldValue) {
|
||||||
@@ -15,12 +15,12 @@ var ProductListCtrl = ['$scope', '$location', '$routeParams', 'Tokenizer', 'prod
|
|||||||
|
|
||||||
$scope.searchInfo = {
|
$scope.searchInfo = {
|
||||||
comparator: {
|
comparator: {
|
||||||
'def': 'n',
|
|
||||||
'n': {'Col': 'Name', 'Comparator': 'text'},
|
'n': {'Col': 'Name', 'Comparator': 'text'},
|
||||||
'a': {'Col': 'IsActive', 'Comparator': 'boolean'},
|
'a': {'Col': 'IsActive', 'Comparator': 'boolean'},
|
||||||
'u': {'Col': 'Units', 'Comparator': 'text'},
|
'u': {'Col': 'Units', 'Comparator': 'text'},
|
||||||
't': {'Col': 'ProductGroup', 'Comparator': 'text'}
|
't': {'Col': 'ProductGroup', 'Comparator': 'text'}
|
||||||
},
|
},
|
||||||
|
def: 'n',
|
||||||
sorter: {
|
sorter: {
|
||||||
'c': 'Code',
|
'c': 'Code',
|
||||||
'n': 'Name',
|
'n': 'Name',
|
||||||
@@ -47,7 +47,7 @@ var ProductListCtrl = ['$scope', '$location', '$routeParams', 'Tokenizer', 'prod
|
|||||||
}
|
}
|
||||||
$scope.$apply(function () {
|
$scope.$apply(function () {
|
||||||
var matches = Tokenizer.parseFilterString(q, $scope.searchInfo);
|
var matches = Tokenizer.parseFilterString(q, $scope.searchInfo);
|
||||||
$scope.show_extended = 'e' in matches.f;
|
$scope.showExtended = 'e' in matches.f;
|
||||||
$scope.products = Tokenizer.doFilter(q, $scope.info, matches);
|
$scope.products = Tokenizer.doFilter(q, $scope.info, matches);
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -61,9 +61,9 @@ ProductListCtrl.resolve = {
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
var ProductCtrl = ['$scope', '$location', '$window', '$modal', 'product', 'product_groups', function ($scope, $location, $window, $modal, product, product_groups) {
|
var ProductCtrl = ['$scope', '$location', '$window', '$modal', 'product', 'product_groups', function ($scope, $location, $window, $modal, product, productGroups) {
|
||||||
$scope.product = product;
|
$scope.product = product;
|
||||||
$scope.product_groups = product_groups;
|
$scope.productGroups = productGroups;
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
$scope.product.$save(function (u, putResponseHeaders) {
|
$scope.product.$save(function (u, putResponseHeaders) {
|
||||||
@@ -113,7 +113,7 @@ ProductCtrl.resolve = {
|
|||||||
|
|
||||||
return Product.get({id: id}).$promise;
|
return Product.get({id: id}).$promise;
|
||||||
}],
|
}],
|
||||||
product_groups: ['ProductGroup', function (ProductGroup) {
|
productGroups: ['ProductGroup', function (ProductGroup) {
|
||||||
return ProductGroup.query({}).$promise;
|
return ProductGroup.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,28 +1,24 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ProfitLossCtrl = ['$scope', '$location', 'dateFilter', 'profit_loss', function ($scope, $location, dateFilter, profit_loss) {
|
var ProfitLossCtrl = ['$scope', '$location', 'asDateFilter', 'profit_loss', function ($scope, $location, asDate, profit_loss) {
|
||||||
$scope.info = profit_loss;
|
$scope.info = profit_loss;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate),
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
$location.path('/ProfitLoss').search({StartDate: startDate, FinishDate: finishDate});
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/ProfitLoss').search({StartDate: $scope.info.StartDate, FinishDate: $scope.info.FinishDate});
|
|
||||||
};
|
};
|
||||||
$('#txtStartDate').focus();
|
$('#txtStartDate').focus();
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ProfitLossCtrl.resolve = {
|
ProfitLossCtrl.resolve = {
|
||||||
profit_loss: ['$route', 'ProfitLoss', function ($route, ProfitLoss) {
|
profit_loss: ['$route', 'ProfitLoss', function ($route, ProfitLoss) {
|
||||||
var start_date = $route.current.params.StartDate,
|
var startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
|
||||||
return ProfitLoss.get({}).$promise;
|
return ProfitLoss.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return ProfitLoss.get({StartDate: start_date, FinishDate: finish_date}).$promise;
|
return ProfitLoss.get({StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,29 +1,25 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var PurchaseEntriesCtrl = ['$scope', '$location', 'dateFilter', 'purchase_entries', function ($scope, $location, dateFilter, purchase_entries) {
|
var PurchaseEntriesCtrl = ['$scope', '$location', 'asDateFilter', 'purchaseEntries', function ($scope, $location, asDate, purchaseEntries) {
|
||||||
$scope.info = purchase_entries;
|
$scope.info = purchaseEntries;
|
||||||
|
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate),
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
$location.path('/PurchaseEntries').search({StartDate: startDate, FinishDate: finishDate});
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/PurchaseEntries').search({StartDate: $scope.info.StartDate, FinishDate: $scope.info.FinishDate});
|
|
||||||
};
|
};
|
||||||
$('#txtStartDate').focus();
|
$('#txtStartDate').focus();
|
||||||
}];
|
}];
|
||||||
|
|
||||||
PurchaseEntriesCtrl.resolve = {
|
PurchaseEntriesCtrl.resolve = {
|
||||||
purchase_entries: ['$route', 'PurchaseEntries', function ($route, PurchaseEntries) {
|
purchaseEntries: ['$route', 'PurchaseEntries', function ($route, PurchaseEntries) {
|
||||||
var start_date = $route.current.params.StartDate,
|
var startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
|
||||||
return PurchaseEntries.get({}).$promise;
|
return PurchaseEntries.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return PurchaseEntries.get({StartDate: start_date, FinishDate: finish_date}).$promise;
|
return PurchaseEntries.get({StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImageResizer', 'voucher', 'Account', 'Batch', function ($scope, $location, dateFilter, $modal, UploadedImageResizer, voucher, Account, Batch) {
|
var PurchaseReturnCtrl = ['$scope', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'Account', 'Batch', function ($scope, $location, asDate, $modal, uploadedImageResizer, voucher, Account, Batch) {
|
||||||
$scope.voucher = voucher;
|
$scope.voucher = voucher;
|
||||||
$scope.rate = 0;
|
$scope.rate = 0;
|
||||||
function getOld(productID, inventories) {
|
function getOld(productID, inventories) {
|
||||||
@@ -10,7 +10,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'Upload
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.$on("fileSelected", function (event, args) {
|
$scope.$on("fileSelected", function (event, args) {
|
||||||
UploadedImageResizer(args, $scope.voucher.Files);
|
uploadedImageResizer(args, $scope.voucher.Files);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'Upload
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof oldInventory === 'undefined' && quantity <= $scope.batch.QuantityRemaining) {
|
if (angular.isUndefined(oldInventory) && quantity <= $scope.batch.QuantityRemaining) {
|
||||||
this.voucher.Inventories.push(
|
this.voucher.Inventories.push(
|
||||||
{
|
{
|
||||||
Product: $scope.batch.Product,
|
Product: $scope.batch.Product,
|
||||||
@@ -64,12 +64,12 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'Upload
|
|||||||
|
|
||||||
$scope.$watch('voucher.Inventories', function (inventories, oldValue) {
|
$scope.$watch('voucher.Inventories', function (inventories, oldValue) {
|
||||||
var amount = 0;
|
var amount = 0;
|
||||||
if (typeof inventories !== 'undefined') {
|
if (!angular.isUndefined(inventories)) {
|
||||||
for (var i = 0, l = inventories.length; i < l; i++) {
|
for (var i = 0, l = inventories.length; i < l; i++) {
|
||||||
amount += Number(inventories[i].Amount);
|
amount += Number(inventories[i].Amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof $scope.voucher.Journals !== 'undefined') {
|
if (!angular.isUndefined($scope.voucher.Journals)) {
|
||||||
for (var i = 0, l = $scope.voucher.Journals.length; i < l; i++) {
|
for (var i = 0, l = $scope.voucher.Journals.length; i < l; i++) {
|
||||||
if ($scope.voucher.Journals[i].Debit === 1) {
|
if ($scope.voucher.Journals[i].Debit === 1) {
|
||||||
$scope.voucher.Journals[i].Amount = amount;
|
$scope.voucher.Journals[i].Amount = amount;
|
||||||
@@ -80,9 +80,9 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'Upload
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
$scope.preventAlteration = function (voucher) {
|
$scope.preventAlteration = function (voucher) {
|
||||||
if (typeof $scope.perms === 'undefined') {
|
if (angular.isUndefined($scope.perms)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (typeof voucher.VoucherID === 'undefined') {
|
} else if (angular.isUndefined(voucher.VoucherID)) {
|
||||||
return !$scope.perms['Purchase Return'];
|
return !$scope.perms['Purchase Return'];
|
||||||
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
||||||
return true;
|
return true;
|
||||||
@@ -93,18 +93,8 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'Upload
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.get = function (voucherid) {
|
|
||||||
$scope.voucher = Voucher.get({VoucherID: voucherid}, function (u, putResponseHeaders) {
|
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
|
||||||
}, function (data, status) {
|
|
||||||
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
$scope.voucher.Date = asDate($scope.voucher.Date);
|
||||||
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
return $scope.voucher.$save({type: 'Purchase Return'}, function (u, putResponseHeaders) {
|
return $scope.voucher.$save({type: 'Purchase Return'}, function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/Return/' + u.VoucherID);
|
$location.path('/Return/' + u.VoucherID);
|
||||||
@@ -145,7 +135,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'Upload
|
|||||||
modalInstance.result.then(function (updated) {
|
modalInstance.result.then(function (updated) {
|
||||||
if (updated.Product.ProductID !== $scope.selectedInventory.Batch.Product.ProductID) {
|
if (updated.Product.ProductID !== $scope.selectedInventory.Batch.Product.ProductID) {
|
||||||
var oldInventory = getOld(updated.Batch.Product.ProductID, $scope.voucher.Inventories);
|
var oldInventory = getOld(updated.Batch.Product.ProductID, $scope.voucher.Inventories);
|
||||||
if (typeof oldInventory !== 'undefined') {
|
if (!angular.isUndefined(oldInventory)) {
|
||||||
delete $scope.selectedInventory;
|
delete $scope.selectedInventory;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -182,13 +172,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'Upload
|
|||||||
return Account.autocomplete({term: $viewValue, count: 20, a: true}).$promise;
|
return Account.autocomplete({term: $viewValue, count: 20, a: true}).$promise;
|
||||||
};
|
};
|
||||||
$scope.batches = function ($viewValue) {
|
$scope.batches = function ($viewValue) {
|
||||||
var params = {term: $viewValue, count: 20};
|
var params = {term: $viewValue, count: 20, date: asDate($scope.voucher.Date)};
|
||||||
|
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
|
||||||
params.date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
} else {
|
|
||||||
params.date = $scope.voucher.Date;
|
|
||||||
}
|
|
||||||
return Batch.autocomplete(params).$promise;
|
return Batch.autocomplete(params).$promise;
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
@@ -196,7 +180,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'Upload
|
|||||||
PurchaseReturnCtrl.resolve = {
|
PurchaseReturnCtrl.resolve = {
|
||||||
voucher: ['$route', 'Voucher', function ($route, Voucher) {
|
voucher: ['$route', 'Voucher', function ($route, Voucher) {
|
||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
return Voucher.get({type: 'Purchase Return'}).$promise;
|
return Voucher.get({type: 'Purchase Return'}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Voucher.get({id: id}).$promise;
|
return Voucher.get({id: id}).$promise;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImageResizer', 'voucher', 'Account', 'Product', function ($scope, $location, dateFilter, $modal, UploadedImageResizer, voucher, Account, Product) {
|
var PurchaseCtrl = ['$scope', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'Account', 'Product', function ($scope, $location, asDate, $modal, uploadedImageResizer, voucher, Account, Product) {
|
||||||
$scope.voucher = voucher;
|
$scope.voucher = voucher;
|
||||||
function getOld(productID, inventories) {
|
function getOld(productID, inventories) {
|
||||||
return _.find(inventories, function (inventory) {
|
return _.find(inventories, function (inventory) {
|
||||||
@@ -9,7 +9,7 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImag
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.$on("fileSelected", function (event, args) {
|
$scope.$on("fileSelected", function (event, args) {
|
||||||
UploadedImageResizer(args, $scope.voucher.Files);
|
uploadedImageResizer(args, $scope.voucher.Files);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImag
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof oldInventory === 'undefined') {
|
if (angular.isUndefined(oldInventory)) {
|
||||||
this.voucher.Inventories.push(
|
this.voucher.Inventories.push(
|
||||||
{
|
{
|
||||||
Product: $scope.product,
|
Product: $scope.product,
|
||||||
@@ -65,14 +65,15 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImag
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.$watch('voucher.Inventories', function (inventories, oldValue) {
|
$scope.$watch('voucher.Inventories', function (inventories, oldValue) {
|
||||||
var amount = 0;
|
var amount = 0,
|
||||||
if (typeof inventories !== 'undefined') {
|
i, l;
|
||||||
for (var i = 0, l = inventories.length; i < l; i++) {
|
if (!angular.isUndefined(inventories)) {
|
||||||
|
for (i = 0, l = inventories.length; i < l; i++) {
|
||||||
amount += Number(inventories[i].Amount);
|
amount += Number(inventories[i].Amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof $scope.voucher.Journals !== 'undefined') {
|
if (!angular.isUndefined($scope.voucher.Journals)) {
|
||||||
for (var i = 0, l = $scope.voucher.Journals.length; i < l; i++) {
|
for (i = 0, l = $scope.voucher.Journals.length; i < l; i++) {
|
||||||
if ($scope.voucher.Journals[i].Debit === -1) {
|
if ($scope.voucher.Journals[i].Debit === -1) {
|
||||||
$scope.voucher.Journals[i].Amount = amount;
|
$scope.voucher.Journals[i].Amount = amount;
|
||||||
break;
|
break;
|
||||||
@@ -82,9 +83,9 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImag
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
$scope.preventAlteration = function (voucher) {
|
$scope.preventAlteration = function (voucher) {
|
||||||
if (typeof $scope.perms === 'undefined') {
|
if (angular.isUndefined($scope.perms)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (typeof voucher.VoucherID === 'undefined') {
|
} else if (angular.isUndefined(voucher.VoucherID)) {
|
||||||
return !$scope.perms['Purchase'];
|
return !$scope.perms['Purchase'];
|
||||||
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
||||||
return true;
|
return true;
|
||||||
@@ -95,18 +96,8 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImag
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.get = function (voucherid) {
|
|
||||||
$scope.voucher = Voucher.get({VoucherID: voucherid}, function (u, putResponseHeaders) {
|
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
|
||||||
}, function (data, status) {
|
|
||||||
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
$scope.voucher.Date = asDate($scope.voucher.Date);
|
||||||
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
return $scope.voucher.$save({type: 'Purchase'}, function (u, putResponseHeaders) {
|
return $scope.voucher.$save({type: 'Purchase'}, function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/Purchase/' + u.VoucherID);
|
$location.path('/Purchase/' + u.VoucherID);
|
||||||
@@ -147,7 +138,7 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'UploadedImag
|
|||||||
modalInstance.result.then(function (updated) {
|
modalInstance.result.then(function (updated) {
|
||||||
if (updated.Product.ProductID !== $scope.selectedInventory.Product.ProductID) {
|
if (updated.Product.ProductID !== $scope.selectedInventory.Product.ProductID) {
|
||||||
var oldInventory = getOld(updated.Product.ProductID, $scope.voucher.Inventories);
|
var oldInventory = getOld(updated.Product.ProductID, $scope.voucher.Inventories);
|
||||||
if (typeof oldInventory !== 'undefined') {
|
if (!angular.isUndefined(oldInventory)) {
|
||||||
delete $scope.selectedInventory;
|
delete $scope.selectedInventory;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -193,7 +184,7 @@ PurchaseCtrl.resolve = {
|
|||||||
voucher: ['$route', 'Voucher', function ($route, Voucher) {
|
voucher: ['$route', 'Voucher', function ($route, Voucher) {
|
||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
|
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
return Voucher.get({type: 'Purchase'}).$promise;
|
return Voucher.get({type: 'Purchase'}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Voucher.get({id: id}).$promise;
|
return Voucher.get({id: id}).$promise;
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var PurchasesCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'purchases', function ($scope, $routeParams, $location, dateFilter, purchases) {
|
var PurchasesCtrl = ['$scope', '$routeParams', '$location', 'asDateFilter', 'purchases', function ($scope, $routeParams, $location, asDate, purchases) {
|
||||||
$scope.info = purchases;
|
$scope.info = purchases;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate),
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
$location.path('/Purchases').search({s: startDate, f: finishDate});
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/Purchases').search({s:$scope.info.StartDate, f:$scope.info.FinishDate});
|
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
PurchasesCtrl.resolve = {
|
PurchasesCtrl.resolve = {
|
||||||
purchases:['$route', 'Purchases', function ($route, Purchases) {
|
purchases: ['$route', 'Purchases', function ($route, Purchases) {
|
||||||
var start_date = $route.current.params.s,
|
var startDate = $route.current.params.s,
|
||||||
finish_date = $route.current.params.f;
|
finishDate = $route.current.params.f;
|
||||||
|
|
||||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
|
||||||
return Purchases.get({}).$promise;
|
return Purchases.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Purchases.get({s:start_date, f:finish_date}).$promise;
|
return Purchases.get({s: startDate, f: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,31 +1,27 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var RawMaterialCostCtrl = ['$scope', '$location', 'dateFilter', 'raw_material_cost', function ($scope, $location, dateFilter, raw_material_cost) {
|
var RawMaterialCostCtrl = ['$scope', '$location', 'asDateFilter', 'rawMaterialCost', function ($scope, $location, asDate, rawMaterialCost) {
|
||||||
$scope.info = raw_material_cost;
|
$scope.info = rawMaterialCost;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate),
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
$location.path('/RawMaterialCost').search({StartDate: startDate, FinishDate: finishDate});
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/RawMaterialCost').search({StartDate: $scope.info.StartDate, FinishDate: $scope.info.FinishDate});
|
|
||||||
};
|
};
|
||||||
$('#txtStartDate').focus();
|
$('#txtStartDate').focus();
|
||||||
}];
|
}];
|
||||||
|
|
||||||
RawMaterialCostCtrl.resolve = {
|
RawMaterialCostCtrl.resolve = {
|
||||||
raw_material_cost: ['$route', 'RawMaterialCost', function ($route, RawMaterialCost) {
|
rawMaterialCost: ['$route', 'RawMaterialCost', function ($route, RawMaterialCost) {
|
||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
start_date = $route.current.params.StartDate,
|
startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
|
||||||
return RawMaterialCost.get({}).$promise;
|
return RawMaterialCost.get({}).$promise;
|
||||||
} else if (typeof id === 'undefined') {
|
} else if (angular.isUndefined(id)) {
|
||||||
return RawMaterialCost.get({StartDate: start_date, FinishDate: finish_date}).$promise;
|
return RawMaterialCost.get({StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return RawMaterialCost.get({id: id, StartDate: start_date, FinishDate: finish_date}).$promise;
|
return RawMaterialCost.get({id: id, StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal', 'UploadedImageResizer', 'voucher', 'ledgers', 'Voucher', 'Account', function ($scope, $routeParams, $location, dateFilter, $modal, UploadedImageResizer, voucher, ledgers, Voucher, Account) {
|
var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'ledgers', 'Voucher', 'Account', function ($scope, $routeParams, $location, asDate, $modal, uploadedImageResizer, voucher, ledgers, Voucher, Account) {
|
||||||
$('#txtAccount').focus();
|
$('#txtAccount').focus();
|
||||||
|
|
||||||
$scope.voucher = voucher;
|
$scope.voucher = voucher;
|
||||||
@@ -12,7 +12,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.$on("fileSelected", function (event, args) {
|
$scope.$on("fileSelected", function (event, args) {
|
||||||
UploadedImageResizer(args, $scope.voucher.Files);
|
uploadedImageResizer(args, $scope.voucher.Files);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var oldJournal = getOld($scope.account.LedgerID, this.voucher.Journals);
|
var oldJournal = getOld($scope.account.LedgerID, this.voucher.Journals);
|
||||||
if (typeof oldJournal === 'undefined') {
|
if (angular.isUndefined(oldJournal)) {
|
||||||
this.voucher.Journals.push({Debit: -1, Amount: Number($scope.amount), Ledger: $scope.account});
|
this.voucher.Journals.push({Debit: -1, Amount: Number($scope.amount), Ledger: $scope.account});
|
||||||
} else {
|
} else {
|
||||||
if (oldJournal.Debit === -1) {
|
if (oldJournal.Debit === -1) {
|
||||||
@@ -73,9 +73,9 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
$scope.preventAlteration = function (voucher) {
|
$scope.preventAlteration = function (voucher) {
|
||||||
if (typeof $scope.perms === 'undefined') {
|
if (angular.isUndefined($scope.perms)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (typeof voucher.VoucherID === 'undefined') {
|
} else if (angular.isUndefined(voucher.VoucherID)) {
|
||||||
return !$scope.perms['Receipt'];
|
return !$scope.perms['Receipt'];
|
||||||
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
||||||
return true;
|
return true;
|
||||||
@@ -86,18 +86,8 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.get = function (voucherid) {
|
|
||||||
$scope.voucher = Voucher.get({VoucherID: voucherid}, function (u, putResponseHeaders) {
|
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
|
||||||
}, function (data, status) {
|
|
||||||
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
$scope.voucher.Date = asDate($scope.voucher.Date);
|
||||||
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
return $scope.voucher.$save({type: 'Receipt'}, function (u, putResponseHeaders) {
|
return $scope.voucher.$save({type: 'Receipt'}, function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/Receipt/' + u.VoucherID);
|
$location.path('/Receipt/' + u.VoucherID);
|
||||||
@@ -138,7 +128,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
|
|||||||
modalInstance.result.then(function (updated) {
|
modalInstance.result.then(function (updated) {
|
||||||
if (updated.Ledger.LedgerID !== $scope.selectedJournal.Ledger.LedgerID) {
|
if (updated.Ledger.LedgerID !== $scope.selectedJournal.Ledger.LedgerID) {
|
||||||
var oldJournal = getOld(updated.Ledger.LedgerID, $scope.voucher.Journals);
|
var oldJournal = getOld(updated.Ledger.LedgerID, $scope.voucher.Journals);
|
||||||
if (typeof oldJournal !== 'undefined') {
|
if (!angular.isUndefined(oldJournal)) {
|
||||||
delete $scope.selectedJournal;
|
delete $scope.selectedJournal;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -181,7 +171,7 @@ ReceiptCtrl.resolve = {
|
|||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
account = $route.current.params.a;
|
account = $route.current.params.a;
|
||||||
|
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
var options = {type: 'Receipt'};
|
var options = {type: 'Receipt'};
|
||||||
if (!angular.isUndefined(account)) {
|
if (!angular.isUndefined(account)) {
|
||||||
options.a = account;
|
options.a = account;
|
||||||
|
|||||||
@@ -3,29 +3,29 @@
|
|||||||
var RecipeListCtrl = ['$scope', 'recipes', function ($scope, recipes) {
|
var RecipeListCtrl = ['$scope', 'recipes', function ($scope, recipes) {
|
||||||
$scope.info = recipes;
|
$scope.info = recipes;
|
||||||
$scope.display = $scope.info;
|
$scope.display = $scope.info;
|
||||||
$scope.product_type_selected = 'all';
|
$scope.productTypeSelected = 'all';
|
||||||
$scope.show_latest = 'latest';
|
$scope.showLatest = 'latest';
|
||||||
$scope.show_summary = 'no';
|
$scope.showSummary = 'no';
|
||||||
|
|
||||||
$scope.$watch('product_type_selected', function (value) {
|
$scope.$watch('productTypeSelected', function (value) {
|
||||||
$scope.display = $scope.doFilter();
|
$scope.display = $scope.doFilter();
|
||||||
}, true);
|
}, true);
|
||||||
$scope.$watch('show_latest', function (value) {
|
$scope.$watch('showLatest', function (value) {
|
||||||
$scope.display = $scope.doFilter();
|
$scope.display = $scope.doFilter();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
$scope.doFilter = function (q) {
|
$scope.doFilter = function (q) {
|
||||||
return _.filter($scope.info, function (item) {
|
return _.filter($scope.info, function (item) {
|
||||||
if ($scope.product_type_selected === 'menu') {
|
if ($scope.productTypeSelected === 'menu') {
|
||||||
if (item.IsSemi) {
|
if (item.IsSemi) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if ($scope.product_type_selected === 'semi') {
|
} else if ($scope.productTypeSelected === 'semi') {
|
||||||
if (!item.IsSemi) {
|
if (!item.IsSemi) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($scope.show_latest === 'latest' && !item.IsLatest) {
|
if ($scope.showLatest === 'latest' && !item.IsLatest) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -39,14 +39,14 @@ RecipeListCtrl.resolve = {
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
var RecipeCtrl = ['$scope', '$location', '$window', '$modal', 'dateFilter', 'Product', 'recipe', 'product_groups', function ($scope, $location, $window, $modal, dateFilter, Product, recipe, product_groups) {
|
var RecipeCtrl = ['$scope', '$location', '$window', '$modal', 'asDateFilter', 'Product', 'recipe', 'productGroups', function ($scope, $location, $window, $modal, asDate, Product, recipe, productGroups) {
|
||||||
$scope.recipe = recipe;
|
$scope.recipe = recipe;
|
||||||
$scope.original = {};
|
$scope.original = {};
|
||||||
angular.copy($scope.recipe, $scope.original);
|
angular.copy($scope.recipe, $scope.original);
|
||||||
$scope.product_groups = product_groups;
|
$scope.productGroups = productGroups;
|
||||||
$scope.cost_price = 0;
|
$scope.costPrice = 0;
|
||||||
function getOld(productID, recipe_items) {
|
function getOld(productID, recipeItems) {
|
||||||
return _.find(recipe_items, function (recipe_item) {
|
return _.find(recipeItems, function (recipe_item) {
|
||||||
return recipe_item.Product.ProductID === productID;
|
return recipe_item.Product.ProductID === productID;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ var RecipeCtrl = ['$scope', '$location', '$window', '$modal', 'dateFilter', 'Pro
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var oldItem = getOld($scope.product.ProductID, this.recipe.RecipeItems);
|
var oldItem = getOld($scope.product.ProductID, this.recipe.RecipeItems);
|
||||||
if (typeof oldItem === 'undefined') {
|
if (angular.isUndefined(oldItem)) {
|
||||||
var quantity = Number($scope.quantity);
|
var quantity = Number($scope.quantity);
|
||||||
var price = Number($scope.product.Price);
|
var price = Number($scope.product.Price);
|
||||||
this.recipe.RecipeItems.push({
|
this.recipe.RecipeItems.push({
|
||||||
@@ -77,20 +77,18 @@ var RecipeCtrl = ['$scope', '$location', '$window', '$modal', 'dateFilter', 'Pro
|
|||||||
this.recipe.RecipeItems.splice(index, 1);
|
this.recipe.RecipeItems.splice(index, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$watch('recipe.RecipeItems', function (recipe_items, oldValue) {
|
$scope.$watch('recipe.RecipeItems', function (recipeItems, oldValue) {
|
||||||
if (!angular.isArray(recipe_items)) {
|
if (!angular.isArray(recipeItems)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.cost_price = recipe_items.reduce(function (sum, item, index, array) {
|
$scope.costPrice = recipeItems.reduce(function (sum, item, index, array) {
|
||||||
var rate = item.Price / (item.Product.Fraction * item.Product.ProductYield)
|
var rate = item.Price / (item.Product.Fraction * item.Product.ProductYield)
|
||||||
return sum + (item.Quantity * rate);
|
return sum + (item.Quantity * rate);
|
||||||
}, 0);
|
}, 0);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.recipe.Date)) {
|
$scope.recipe.Date = asDate($scope.recipe.Date);
|
||||||
$scope.recipe.Date = dateFilter($scope.recipe.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
if (angular.isUndefined($scope.recipe.Date) || $scope.recipe.Date === '') {
|
if (angular.isUndefined($scope.recipe.Date) || $scope.recipe.Date === '') {
|
||||||
$scope.toasts.push({Type: 'Danger', Message: 'Please Choose a date'});
|
$scope.toasts.push({Type: 'Danger', Message: 'Please Choose a date'});
|
||||||
return;
|
return;
|
||||||
@@ -171,7 +169,7 @@ RecipeCtrl.resolve = {
|
|||||||
|
|
||||||
return Recipe.get({id: id}).$promise;
|
return Recipe.get({id: id}).$promise;
|
||||||
}],
|
}],
|
||||||
product_groups: ['ProductGroup', function (ProductGroup) {
|
productGroups: ['ProductGroup', function (ProductGroup) {
|
||||||
return ProductGroup.query({}).$promise;
|
return ProductGroup.query({}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,26 +1,26 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ReconcileCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'reconcile', 'Reconcile', 'Account', function ($scope, $routeParams, $location, dateFilter, reconcile, Reconcile, Account) {
|
var ReconcileCtrl = ['$scope', '$routeParams', '$location', 'asDateFilter', 'reconcile', 'Reconcile', 'Account', function ($scope, $routeParams, $location, asDate, reconcile, Reconcile, Account) {
|
||||||
$scope.info = reconcile;
|
$scope.info = reconcile;
|
||||||
|
$scope.hidden = [];
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
var id = $scope.info.Account.LedgerID;
|
var id = $scope.info.Account.LedgerID,
|
||||||
var start_date = angular.isDate($scope.info.StartDate) ? dateFilter($scope.info.StartDate, 'dd-MMM-yyyy') : $scope.info.StartDate;
|
startDate = asDate($scope.info.StartDate),
|
||||||
var finish_date = angular.isDate($scope.info.FinishDate) ? dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy') : $scope.info.FinishDate;
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
if (id === $routeParams.id && start_date === $routeParams.StartDate && finish_date === $routeParams.FinishDate) {
|
if (id === $routeParams.id && startDate === $routeParams.StartDate && finishDate === $routeParams.FinishDate) {
|
||||||
Reconcile.get({id: id, StartDate: start_date, FinishDate: finish_date}, function (data) {
|
Reconcile.get({id: id, StartDate: startDate, FinishDate: finishDate}, function (data) {
|
||||||
|
$scope.doFilter.cache = {};
|
||||||
$scope.info = data;
|
$scope.info = data;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$location.path('/Reconcile/' + id).search('StartDate', start_date).search('FinishDate', finish_date);
|
$location.path('/Reconcile/' + id).search('StartDate', startDate).search('FinishDate', finishDate);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
var i, l,
|
var i, l,
|
||||||
len = $scope.info.Body.length;
|
len = $scope.info.Body.length;
|
||||||
for (i = 0, l = len; i < l; i++) {
|
for (i = 0, l = len; i < l; i++) {
|
||||||
if (angular.isDate($scope.info.Body[i].ReconcileDate)) {
|
$scope.info.Body[i].ReconcileDate = asDate($scope.info.Body[i].ReconcileDate);
|
||||||
$scope.info.Body[i].ReconcileDate = dateFilter($scope.info.Body[i].ReconcileDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$scope.info.$save({StartDate: $routeParams.StartDate, FinishDate: $routeParams.FinishDate}, function (u, putResponseHeaders) {
|
$scope.info.$save({StartDate: $routeParams.StartDate, FinishDate: $routeParams.FinishDate}, function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
@@ -54,6 +54,8 @@ var ReconcileCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'recon
|
|||||||
$scope.$apply(function () {
|
$scope.$apply(function () {
|
||||||
$scope.selected = $scope.selected -= 1;
|
$scope.selected = $scope.selected -= 1;
|
||||||
});
|
});
|
||||||
|
$("#" + $scope.selected).scrollintoview({duration: 'fast'});
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'down': function () {
|
'down': function () {
|
||||||
@@ -61,37 +63,33 @@ var ReconcileCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'recon
|
|||||||
$scope.$apply(function () {
|
$scope.$apply(function () {
|
||||||
$scope.selected = $scope.selected += 1;
|
$scope.selected = $scope.selected += 1;
|
||||||
});
|
});
|
||||||
|
$("#" + $scope.selected).scrollintoview({duration: 'fast'});
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'alt+r': function () {
|
|
||||||
console.log('alt+r');
|
|
||||||
},
|
|
||||||
'enter': function () {
|
'enter': function () {
|
||||||
var path = $scope.info.Body[$scope.selected].Url.replace(/^(?:\/\/|[^\/]+)*/, "");
|
var path = $scope.info.Body[$scope.selected].Url.replace(/^(?:\/\/|[^\/]+)*/, "");
|
||||||
$scope.$apply(function () {
|
$scope.$apply(function () {
|
||||||
$location.path(path).search('StartDate', null).search('FinishDate', null);
|
$location.path(path).search('StartDate', null).search('FinishDate', null);
|
||||||
});
|
});
|
||||||
},
|
|
||||||
'alt+u': function () {
|
|
||||||
console.log('alt+u');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.accounts = function ($viewValue) {
|
$scope.accounts = function ($viewValue) {
|
||||||
return Account.autocomplete({term: $viewValue, count: 20, r:true}).$promise;
|
return Account.autocomplete({term: $viewValue, count: 20, r: true}).$promise;
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ReconcileCtrl.resolve = {
|
ReconcileCtrl.resolve = {
|
||||||
reconcile: ['$route', 'Reconcile', function ($route, Reconcile) {
|
reconcile: ['$route', 'Reconcile', function ($route, Reconcile) {
|
||||||
var id = $route.current.params.id,
|
var id = $route.current.params.id,
|
||||||
start_date = $route.current.params.StartDate,
|
startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
return Reconcile.get({}).$promise;
|
return Reconcile.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Reconcile.get({id: id, StartDate: start_date, FinishDate: finish_date}).$promise;
|
return Reconcile.get({id: id, StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var SalaryDeductionCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'Employee', function ($scope, $location, dateFilter, $modal, voucher, Employee) {
|
var SalaryDeductionCtrl = ['$scope', '$location', 'asDateFilter', '$modal', 'voucher', 'Employee', function ($scope, $location, asDate, $modal, voucher, Employee) {
|
||||||
$scope.voucher = voucher;
|
$scope.voucher = voucher;
|
||||||
|
|
||||||
function getOldItem(ledgerID, items) {
|
function getOldItem(ledgerID, items) {
|
||||||
@@ -39,19 +39,19 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'vouch
|
|||||||
|
|
||||||
function getEsi(grossSalary, daysWorked, daysInMonth) {
|
function getEsi(grossSalary, daysWorked, daysInMonth) {
|
||||||
var limit = 15000,
|
var limit = 15000,
|
||||||
employee_rate = 0.0175,
|
employeeRate = 0.0175,
|
||||||
employer_rate = 0.0475,
|
employerRate = 0.0475,
|
||||||
employee = (grossSalary > limit) ? 0 : Math.ceil(employee_rate * grossSalary * daysWorked / daysInMonth),
|
employee = (grossSalary > limit) ? 0 : Math.ceil(employeeRate * grossSalary * daysWorked / daysInMonth),
|
||||||
employer = (grossSalary > limit) ? 0 : Math.ceil(employer_rate * grossSalary * daysWorked / daysInMonth);
|
employer = (grossSalary > limit) ? 0 : Math.ceil(employerRate * grossSalary * daysWorked / daysInMonth);
|
||||||
return {ee: employee, er: employer, both: employee + employer};
|
return {ee: employee, er: employer, both: employee + employer};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPf(grossSalary, daysWorked, daysInMonth) {
|
function getPf(grossSalary, daysWorked, daysInMonth) {
|
||||||
var limit = 6500,
|
var limit = 6500,
|
||||||
employee_rate = 0.12,
|
employeeRate = 0.12,
|
||||||
employer_rate = 0.12 + 0.011 + 0.005 + 0.0001,
|
employerRate = 0.12 + 0.011 + 0.005 + 0.0001,
|
||||||
employee = (grossSalary > limit) ? 0 : Math.ceil(employee_rate * grossSalary * daysWorked / daysInMonth),
|
employee = (grossSalary > limit) ? 0 : Math.ceil(employeeRate * grossSalary * daysWorked / daysInMonth),
|
||||||
employer = (grossSalary > limit) ? 0 : Math.ceil(employer_rate * grossSalary * daysWorked / daysInMonth);
|
employer = (grossSalary > limit) ? 0 : Math.ceil(employerRate * grossSalary * daysWorked / daysInMonth);
|
||||||
return {ee: employee, er: employer, both: employee + employer};
|
return {ee: employee, er: employer, both: employee + employer};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'vouch
|
|||||||
esi = getEsi(grossSalary, daysWorked, daysInMonth),
|
esi = getEsi(grossSalary, daysWorked, daysInMonth),
|
||||||
pf = getPf(grossSalary, daysWorked, daysInMonth);
|
pf = getPf(grossSalary, daysWorked, daysInMonth);
|
||||||
|
|
||||||
if (typeof oldJournal !== 'undefined') {
|
if (!angular.isUndefined(oldJournal)) {
|
||||||
$scope.toasts.push({Type: 'Danger', Message: 'Employee has already been added!'});
|
$scope.toasts.push({Type: 'Danger', Message: 'Employee has already been added!'});
|
||||||
} else {
|
} else {
|
||||||
this.voucher.SalaryDeductions.push({
|
this.voucher.SalaryDeductions.push({
|
||||||
@@ -88,9 +88,9 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'vouch
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.preventAlteration = function (voucher) {
|
$scope.preventAlteration = function (voucher) {
|
||||||
if (typeof $scope.perms === 'undefined') {
|
if (angular.isUndefined($scope.perms)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (typeof voucher.VoucherID === 'undefined') {
|
} else if (angular.isUndefined(voucher.VoucherID)) {
|
||||||
return !$scope.perms['Salary Deduction'];
|
return !$scope.perms['Salary Deduction'];
|
||||||
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
} else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) {
|
||||||
return true;
|
return true;
|
||||||
@@ -110,9 +110,7 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'vouch
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if (angular.isDate($scope.voucher.Date)) {
|
$scope.voucher.Date = asDate($scope.voucher.Date);
|
||||||
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$scope.voucher.$save({type: 'Salary Deduction'}, function (u, putResponseHeaders) {
|
$scope.voucher.$save({type: 'Salary Deduction'}, function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||||
$location.path('/SalaryDeduction/' + u.VoucherID);
|
$location.path('/SalaryDeduction/' + u.VoucherID);
|
||||||
@@ -169,7 +167,7 @@ SalaryDeductionCtrl.resolve = {
|
|||||||
voucher: ['$route', 'Voucher', function ($route, Voucher) {
|
voucher: ['$route', 'Voucher', function ($route, Voucher) {
|
||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
|
|
||||||
if (typeof id === 'undefined') {
|
if (angular.isUndefined(id)) {
|
||||||
return Voucher.get({type: 'Salary Deduction'}).$promise;
|
return Voucher.get({type: 'Salary Deduction'}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return Voucher.get({id: id}).$promise;
|
return Voucher.get({id: id}).$promise;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var SettingsCtrl = ['$scope', '$http', 'dateFilter', '$modal', 'lockInfo', 'Product', function ($scope, $http, dateFilter, $modal, lockInfo, Product) {
|
var SettingsCtrl = ['$scope', '$http', 'asDateFilter', '$modal', 'lockInfo', 'Product', function ($scope, $http, asDate, $modal, lockInfo, Product) {
|
||||||
$scope.lockInfo = lockInfo.data;
|
$scope.lockInfo = lockInfo.data;
|
||||||
$scope.rebaseDate = '';
|
$scope.rebaseDate = '';
|
||||||
$scope.setLockDate = function () {
|
$scope.setLockDate = function () {
|
||||||
@@ -8,7 +8,7 @@ var SettingsCtrl = ['$scope', '$http', 'dateFilter', '$modal', 'lockInfo', 'Prod
|
|||||||
if ($scope.lockInfo.Start.Rolling) {
|
if ($scope.lockInfo.Start.Rolling) {
|
||||||
$scope.lockInfo.Start.Days = parseInt($scope.lockInfo.Start.Days, 10);
|
$scope.lockInfo.Start.Days = parseInt($scope.lockInfo.Start.Days, 10);
|
||||||
} else if (angular.isDate($scope.lockInfo.Start.Date)) {
|
} else if (angular.isDate($scope.lockInfo.Start.Date)) {
|
||||||
$scope.lockInfo.Start.Date = dateFilter($scope.lockInfo.Start.Date, 'dd-MMM-yyyy');
|
$scope.lockInfo.Start.Date = asDate($scope.lockInfo.Start.Date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ var SettingsCtrl = ['$scope', '$http', 'dateFilter', '$modal', 'lockInfo', 'Prod
|
|||||||
if ($scope.lockInfo.Finish.Rolling) {
|
if ($scope.lockInfo.Finish.Rolling) {
|
||||||
$scope.lockInfo.Finish.Days = parseInt($scope.lockInfo.Finish.Days, 10);
|
$scope.lockInfo.Finish.Days = parseInt($scope.lockInfo.Finish.Days, 10);
|
||||||
} else if (angular.isDate($scope.lockInfo.Finish.Date)) {
|
} else if (angular.isDate($scope.lockInfo.Finish.Date)) {
|
||||||
$scope.lockInfo.Finish.Date = dateFilter($scope.lockInfo.Finish.Date, 'dd-MMM-yyyy');
|
$scope.lockInfo.Finish.Date = asDate($scope.lockInfo.Finish.Date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $http.post('/api/LockInfo', $scope.lockInfo).
|
return $http.post('/api/LockInfo', $scope.lockInfo).
|
||||||
@@ -64,9 +64,7 @@ var SettingsCtrl = ['$scope', '$http', 'dateFilter', '$modal', 'lockInfo', 'Prod
|
|||||||
if ($scope.rebaseDate === '') {
|
if ($scope.rebaseDate === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (angular.isDate($scope.rebaseDate)) {
|
$scope.rebaseDate = asDate($scope.rebaseDate);
|
||||||
$scope.rebaseDate = dateFilter($scope.rebaseDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$http({method: 'POST', url: '/api/Rebase/' + $scope.rebaseDate}).
|
$http({method: 'POST', url: '/api/Rebase/' + $scope.rebaseDate}).
|
||||||
success(function (data) {
|
success(function (data) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: 'Data rebased!'});
|
$scope.toasts.push({Type: 'Success', Message: 'Data rebased!'});
|
||||||
@@ -109,8 +107,8 @@ var SettingsCtrl = ['$scope', '$http', 'dateFilter', '$modal', 'lockInfo', 'Prod
|
|||||||
if (angular.isUndefined($scope.qty) || $scope.qty === '') {
|
if (angular.isUndefined($scope.qty) || $scope.qty === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var resetDate = angular.isDate($scope.resetDate) ? dateFilter($scope.resetDate, 'dd-MMM-yyyy') : $scope.resetDate;
|
var resetDate = asDate($scope.resetDate);
|
||||||
var stockDate = angular.isDate($scope.stockDate) ? dateFilter($scope.stockDate, 'dd-MMM-yyyy') : $scope.stockDate;
|
var stockDate = asDate($scope.stockDate);
|
||||||
var qty = Number($scope.qty);
|
var qty = Number($scope.qty);
|
||||||
$http({method: 'POST', url: '/api/ResetStock/' + $scope.product.ProductID, params: {StockDate: stockDate, ResetDate: resetDate, Quantity: qty}}).
|
$http({method: 'POST', url: '/api/ResetStock/' + $scope.product.ProductID, params: {StockDate: stockDate, ResetDate: resetDate, Quantity: qty}}).
|
||||||
success(function (data) {
|
success(function (data) {
|
||||||
|
|||||||
@@ -1,28 +1,24 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var StockMovementCtrl = ['$scope', '$location', 'dateFilter', 'stock_movement', function ($scope, $location, dateFilter, stock_movement) {
|
var StockMovementCtrl = ['$scope', '$location', 'asDateFilter', 'stockMovement', function ($scope, $location, asDate, stockMovement) {
|
||||||
$scope.info = stock_movement;
|
$scope.info = stockMovement;
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.StartDate)) {
|
var startDate = asDate($scope.info.StartDate),
|
||||||
$scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy');
|
finishDate = asDate($scope.info.FinishDate);
|
||||||
}
|
$location.path('/StockMovement').search({StartDate: startDate, FinishDate: finishDate});
|
||||||
if (angular.isDate($scope.info.FinishDate)) {
|
|
||||||
$scope.info.FinishDate = dateFilter($scope.info.FinishDate, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/StockMovement').search({StartDate: $scope.info.StartDate, FinishDate: $scope.info.FinishDate});
|
|
||||||
};
|
};
|
||||||
$('#txtStartDate').focus();
|
$('#txtStartDate').focus();
|
||||||
}];
|
}];
|
||||||
|
|
||||||
StockMovementCtrl.resolve = {
|
StockMovementCtrl.resolve = {
|
||||||
stock_movement: ['$route', 'StockMovement', function ($route, StockMovement) {
|
stockMovement: ['$route', 'StockMovement', function ($route, StockMovement) {
|
||||||
var start_date = $route.current.params.StartDate,
|
var startDate = $route.current.params.StartDate,
|
||||||
finish_date = $route.current.params.FinishDate;
|
finishDate = $route.current.params.FinishDate;
|
||||||
|
|
||||||
if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') {
|
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
|
||||||
return StockMovement.get({}).$promise;
|
return StockMovement.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return StockMovement.get({StartDate: start_date, FinishDate: finish_date}).$promise;
|
return StockMovement.get({StartDate: startDate, FinishDate: finishDate}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -1,24 +1,20 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var TrialBalanceCtrl = ['$scope', '$location', 'dateFilter', 'trial_balance', function ($scope, $location, dateFilter, trial_balance) {
|
var TrialBalanceCtrl = ['$scope', '$location', 'asDateFilter', 'trialBalance', function ($scope, $location, asDate, trialBalance) {
|
||||||
$scope.info = trial_balance;
|
$scope.info = trialBalance;
|
||||||
|
|
||||||
$scope.show = function () {
|
$scope.show = function () {
|
||||||
if (angular.isDate($scope.info.Date)) {
|
$location.path('/TrialBalance/' + asDate($scope.info.Date));
|
||||||
$scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy');
|
|
||||||
}
|
|
||||||
$location.path('/TrialBalance/' + $scope.info.Date);
|
|
||||||
};
|
};
|
||||||
$('#txtDate').focus();
|
$('#txtDate').focus();
|
||||||
}];
|
}];
|
||||||
TrialBalanceCtrl.resolve = {
|
TrialBalanceCtrl.resolve = {
|
||||||
trial_balance: ['$route', 'TrialBalance', function ($route, TrialBalance) {
|
trialBalance: ['$route', 'TrialBalance', function ($route, TrialBalance) {
|
||||||
var date = $route.current.params.date;
|
var date = $route.current.params.date;
|
||||||
|
|
||||||
if (typeof date === 'undefined') {
|
if (angular.isUndefined(date)) {
|
||||||
return TrialBalance.get({}).$promise;
|
return TrialBalance.get({}).$promise;
|
||||||
} else {
|
} else {
|
||||||
return TrialBalance.get({date: date}).$promise;
|
return TrialBalance.get({date: date}).$promise;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@@ -36,7 +36,6 @@ var UserCtrl = ['$scope', '$location', 'user', function ($scope, $location, user
|
|||||||
UserCtrl.resolve = {
|
UserCtrl.resolve = {
|
||||||
user: ['$route', 'User', function ($route, User) {
|
user: ['$route', 'User', function ($route, User) {
|
||||||
var id = $route.current.params.id;
|
var id = $route.current.params.id;
|
||||||
|
|
||||||
return User.get({id: id}).$promise;
|
return User.get({id: id}).$promise;
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user