diff --git a/brewman/brewman/__init__.py b/brewman/brewman/__init__.py index 0bfa2597..f4312162 100644 --- a/brewman/brewman/__init__.py +++ b/brewman/brewman/__init__.py @@ -94,9 +94,6 @@ def main(global_config, **settings): config.add_route('issue', '/Issue') config.add_route('issues_grid', '/Issues/Services/{date}') - config.add_route('day_book', '/Reports/DayBook') - config.add_route('unposted', '/Reports/Unposted') - config.add_route('ledger_id', '/Ledger/{id}') config.add_route('ledger', '/Ledger') @@ -109,6 +106,9 @@ def main(global_config, **settings): config.add_route('cash_flow_id', '/CashFlow/{id}') config.add_route('cash_flow', '/CashFlow') + config.add_route('daybook', '/Daybook') + config.add_route('unposted', '/Unposted') + config.add_route('profit_loss', '/Reports/ProfitLoss') config.add_route('group_roles_id', '/Admin/GroupRoles/{id}') diff --git a/brewman/brewman/static/partial/daybook.html b/brewman/brewman/static/partial/daybook.html new file mode 100644 index 00000000..595934f7 --- /dev/null +++ b/brewman/brewman/static/partial/daybook.html @@ -0,0 +1,42 @@ +
+ Daybook +
+ + +
+ + + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
DateTypeNarrationDebitAmountCreditAmount
{{item.Date}}{{item.Type}}{{item.Narration}}{{item.DebitN}}{{item.DebitA}}{{item.CreditN}}{{item.CreditA}}
+
+
+
diff --git a/brewman/brewman/static/partial/unposted.html b/brewman/brewman/static/partial/unposted.html new file mode 100644 index 00000000..a0d95bda --- /dev/null +++ b/brewman/brewman/static/partial/unposted.html @@ -0,0 +1,35 @@ +
+ Unposted Entries +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
SelectDateTypeNarrationDebitAmountCreditAmount
{{item.Date}}{{item.Type}}{{item.Narration}}{{item.DebitN}}{{item.DebitA}}{{item.CreditN}}{{item.CreditA}}
+
+
+
diff --git a/brewman/brewman/static/scripts/angular_service.js b/brewman/brewman/static/scripts/angular_service.js index 6250c96f..c7017cb0 100644 --- a/brewman/brewman/static/scripts/angular_service.js +++ b/brewman/brewman/static/scripts/angular_service.js @@ -92,6 +92,16 @@ overlord_service.factory('CashFlow', ['$resource', function ($resource) { return $resource('/CashFlow/:id'); }]); +// TODO: Replace hardcoded url with route_url +overlord_service.factory('Daybook', ['$resource', function ($resource) { + return $resource('/Daybook'); +}]); + +// TODO: Replace hardcoded url with route_url +overlord_service.factory('Unposted', ['$resource', function ($resource) { + return $resource('/Unposted'); +}]); + // TODO: Replace hardcoded url with route_url overlord_service.factory('LedgerService', ['$resource', function ($resource) { return $resource('/Services/Accounts/:type'); diff --git a/brewman/brewman/static/scripts/daybook.js b/brewman/brewman/static/scripts/daybook.js index eb123fce..28121dad 100644 --- a/brewman/brewman/static/scripts/daybook.js +++ b/brewman/brewman/static/scripts/daybook.js @@ -1,27 +1,15 @@ -function Populate(response) { - if (response != null) { - var stateObj = { 'StartDate': response.start_date, 'FinishDate': response.finish_date }; - history.pushState(stateObj, 'Display', response.url); - var $table = $('#tbodyMain') - $table.html(response.body); +function DaybookCtrl($scope, $routeParams, $location, Daybook) { + if (typeof $routeParams.StartDate === 'undefined') { + $scope.info = Daybook.get({}); + } else if (typeof $routeParams.id === 'undefined') { + $scope.info = Daybook.get({StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate}); } + $scope.show = function () { + $scope.info = Daybook.get({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}, function (u, putResponseHeaders) { + $location.path('/Daybook').search({StartDate:u.StartDate, FinishDate:u.FinishDate}); + }, function (data, status) { + $scope.toasts.push({Type:'Error', Message:data.data}); + }); + }; + $('#txtStartDate').focus(); } - -function Show(startDate, finishDate) { - $.ajax({ - type: "POST", - contentType: "application/json; charset=utf-8", - url: show_url, - data: JSON.stringify({ startDate: startDate, finishDate: finishDate }), - dataType: "json", - success: function(response) { - Populate(response); - }, - error: function(jqXHR, textStatus) { - $("#ctl00_statusDiv").removeClass().addClass("error"); - var msg = $.parseJSON(jqXHR.responseText).Message; - $("#ctl00_statusDiv").html(msg); - } - }); - return false; -} \ No newline at end of file diff --git a/brewman/brewman/static/scripts/overlord.js b/brewman/brewman/static/scripts/overlord.js index 992552b2..e158e795 100644 --- a/brewman/brewman/static/scripts/overlord.js +++ b/brewman/brewman/static/scripts/overlord.js @@ -32,6 +32,9 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte // when('/Ledger', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl, resolve: LedgerCtrl.resolve}). // when('/Ledger/:id', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl, resolve: LedgerCtrl.resolve}). + when('/Daybook', {templateUrl:'/partial/daybook.html', controller:DaybookCtrl}). + when('/Unposted', {templateUrl:'/partial/unposted.html', controller:UnpostedCtrl}). + when('/TrialBalance', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl}). when('/TrialBalance/:date', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl}). diff --git a/brewman/brewman/static/scripts/unposted.js b/brewman/brewman/static/scripts/unposted.js new file mode 100644 index 00000000..2e8a8516 --- /dev/null +++ b/brewman/brewman/static/scripts/unposted.js @@ -0,0 +1,3 @@ +function UnpostedCtrl($scope, Unposted) { + $scope.info = Unposted.query(); +} diff --git a/brewman/brewman/templates/angular_base.mako b/brewman/brewman/templates/angular_base.mako index fbf3b2ca..0fc02b8f 100644 --- a/brewman/brewman/templates/angular_base.mako +++ b/brewman/brewman/templates/angular_base.mako @@ -42,6 +42,8 @@ ${h.ScriptLink(request, 'product-ledger.js')} ${h.ScriptLink(request, 'trial-balance.js')} ${h.ScriptLink(request, 'cash-flow.js')} + ${h.ScriptLink(request, 'daybook.js')} + ${h.ScriptLink(request, 'unposted.js')} ${h.ScriptLink(request, 'account.js')} ${h.ScriptLink(request, 'user.js')} diff --git a/brewman/brewman/templates/nav_bar/report.mako b/brewman/brewman/templates/nav_bar/report.mako index 2d1ea2e6..4bd0ea78 100644 --- a/brewman/brewman/templates/nav_bar/report.mako +++ b/brewman/brewman/templates/nav_bar/report.mako @@ -5,7 +5,7 @@
  • Product Ledger
  • ##
  • Raw Material Cost
  • Cash Flow
  • -
  • Day Book
  • +
  • Day Book
  • Purchases