diff --git a/.gitignore b/.gitignore index 2cb88a62..4d09397e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ env */__pycache__/ */.idea/ .idea/ -*/*.egg-info/ \ No newline at end of file +*.egg-info/ \ No newline at end of file diff --git a/brewman/__init__.py b/brewman/__init__.py index 08ccc082..7d8691b9 100644 --- a/brewman/__init__.py +++ b/brewman/__init__.py @@ -125,6 +125,9 @@ def main(global_config, **settings): config.add_route('api_profit_loss', '/api/ProfitLoss') config.add_route('profit_loss', '/ProfitLoss') + config.add_route('api_stock_movement', '/api/StockMovement') + config.add_route('stock_movement', '/StockMovement') + add_route(config, 'balance_sheet', '/BalanceSheet', has_list=False, variable='date') config.add_route('api_purchase_entries', '/api/PurchaseEntries') diff --git a/brewman/static/partial/stock-movement.html b/brewman/static/partial/stock-movement.html new file mode 100644 index 00000000..548c4e81 --- /dev/null +++ b/brewman/static/partial/stock-movement.html @@ -0,0 +1,52 @@ +
diff --git a/brewman/static/scripts/angular_service.js b/brewman/static/scripts/angular_service.js index 035abba0..2e4241af 100644 --- a/brewman/static/scripts/angular_service.js +++ b/brewman/static/scripts/angular_service.js @@ -126,6 +126,10 @@ overlord_service.factory('ProfitLoss', ['$resource', function ($resource) { return $resource('/api/ProfitLoss'); }]); +overlord_service.factory('StockMovement', ['$resource', function ($resource) { + return $resource('/api/StockMovement'); +}]); + overlord_service.factory('BalanceSheet', ['$resource', function ($resource) { return $resource('/api/BalanceSheet/:date'); }]); diff --git a/brewman/static/scripts/overlord.js b/brewman/static/scripts/overlord.js index a30249c4..4c20acae 100644 --- a/brewman/static/scripts/overlord.js +++ b/brewman/static/scripts/overlord.js @@ -52,6 +52,7 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte when('/Daybook', {templateUrl: '/partial/daybook.html', controller: DaybookCtrl, resolve: DaybookCtrl.resolve}). when('/Unposted', {templateUrl: '/partial/unposted.html', controller: UnpostedCtrl, resolve: UnpostedCtrl.resolve}). when('/ProfitLoss', {templateUrl: '/partial/profit-loss.html', controller: ProfitLossCtrl, resolve: ProfitLossCtrl.resolve}). + when('/StockMovement', {templateUrl: '/partial/stock-movement.html', controller: StockMovementCtrl, resolve: StockMovementCtrl.resolve}). when('/NetTransactions', {templateUrl: '/partial/net-transactions.html', controller: NetTransactionsCtrl, resolve: NetTransactionsCtrl.resolve}). when('/PurchaseEntries', {templateUrl: '/partial/purchase-entries.html', controller: PurchaseEntriesCtrl, resolve: PurchaseEntriesCtrl.resolve}). when('/EmployeeFunctions', {templateUrl: '/partial/employee-functions.html', controller: EmployeeFunctionsCtrl}). diff --git a/brewman/static/scripts/stock-movement.js b/brewman/static/scripts/stock-movement.js new file mode 100644 index 00000000..af4af566 --- /dev/null +++ b/brewman/static/scripts/stock-movement.js @@ -0,0 +1,35 @@ +'use strict'; + +var StockMovementCtrl = ['$scope', '$location', 'dateFilter', 'stock_movement', function ($scope, $location, dateFilter, stock_movement) { + $scope.info = stock_movement; + $scope.show = function () { + if (angular.isDate($scope.info.StartDate)) { + $scope.info.StartDate = dateFilter($scope.info.StartDate, 'dd-MMM-yyyy'); + } + 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(); +}]; + +StockMovementCtrl.resolve = { + stock_movement: ['$q', '$route', 'StockMovement', function ($q, $route, StockMovement) { + var deferred = $q.defer(); + + var start_date = $route.current.params.StartDate; + var finish_date = $route.current.params.FinishDate; + + var successCb = function (result) { + deferred.resolve(result); + }; + + if (typeof start_date === 'undefined' || typeof finish_date === 'undefined') { + StockMovement.get({}, successCb); + } else { + StockMovement.get({StartDate: start_date, FinishDate: finish_date}, successCb); + } + return deferred.promise; + }] +}; \ No newline at end of file diff --git a/brewman/static/scripts/voucher_service.js b/brewman/static/scripts/voucher_service.js deleted file mode 100644 index e168dc62..00000000 --- a/brewman/static/scripts/voucher_service.js +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Created by tanshu on 27/9/13. - */ diff --git a/brewman/templates/angular_base.mako b/brewman/templates/angular_base.mako index 83b7e89c..c1c19b0d 100644 --- a/brewman/templates/angular_base.mako +++ b/brewman/templates/angular_base.mako @@ -77,6 +77,7 @@ + @@ -144,6 +145,7 @@