Split the App js out or autocomplete.js into its own file.

Removed dead routes not in use.
Made the Home view angular.
Product Ledger is not Angular
This commit is contained in:
Tanshu
2012-10-16 15:02:36 +05:30
parent 9efcefe31e
commit 16b2e8dd51
25 changed files with 302 additions and 707 deletions

Binary file not shown.

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Converter.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="Logs/converter.log"/>
<appendToFile value="false"/>
<maximumFileSize value="1000KB"/>
<maxSizeRollBackups value="4"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%5level %date (%file:%line) - %message%newline"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="RollingFile"/>
</root>
</log4net>
<applicationSettings>
<Converter.Properties.Settings>
<setting name="SQLServerAddress" serializeAs="String">
<value />
</setting>
<setting name="DatabasePath" serializeAs="String">
<value />
</setting>
</Converter.Properties.Settings>
</applicationSettings>
</configuration>

View File

@ -44,13 +44,6 @@ def main(global_config, **settings):
config.add_route('login', '/login')
config.add_route('logout', '/logout')
config.add_route('contact', '/contact')
config.add_route('json_test', '/json')
config.add_route('blog_add', '/blog/new')
config.add_route('blog_post', '/post/{id}')
config.add_route('blog', '/blog')
config.add_route('gallery', '/gallery')
config.add_route('upload_picture', '/upload')
config.add_route('home', '/')
config.add_route('cost_center_id', '/CostCenter/{id}')
@ -107,12 +100,12 @@ def main(global_config, **settings):
config.add_route('ledger_id', '/Ledger/{id}')
config.add_route('ledger', '/Ledger')
config.add_route('product_ledger_id', '/ProductLedger/{id}')
config.add_route('product_ledger', '/ProductLedger')
config.add_route('trial_balance_date', '/TrialBalance/{date}')
config.add_route('trial_balance', '/TrialBalance')
config.add_route('product_ledger_id', '/Reports/ProductLedger/{id}')
config.add_route('product_ledger', '/Reports/ProductLedger')
config.add_route('cash_flow_id', '/Reports/CashFlow/{id}')
config.add_route('cash_flow', '/Reports/CashFlow')

View File

@ -0,0 +1,8 @@
<div class="hero-unit">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero
unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p>
</div>

View File

@ -14,7 +14,7 @@
<div class="controls">
<autocomplete id="txtLedger" url="/Services/Accounts" selname="info.Ledger.Name"
selid="info.Ledger.LedgerID"></autocomplete>
<button ng-click="show()">Add</button>
<button ng-click="show()">Show</button>
</div>
</div>
<div class="control-group">
@ -35,24 +35,24 @@
</thead>
<tbody>
<tr ng-repeat="item in info.Body" ng-class="{true:'', false:'unposted'}[item.Posted]">
<th>{{item.Date}}</th>
<th><a href="{{item.Url}}">{{item.Name}}</a></th>
<th>{{item.Type}}</th>
<th>{{item.Narration}}</th>
<th class="right">{{item.Debit}}</th>
<th class="right">{{item.Credit}}</th>
<th class="right">{{item.Running}}</th>
<td>{{item.Date}}</td>
<td><a href="{{item.Url}}">{{item.Name}}</a></td>
<td>{{item.Type}}</td>
<td>{{item.Narration}}</td>
<td class="right">{{item.Debit}}</td>
<td class="right">{{item.Credit}}</td>
<td class="right">{{item.Running}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>{{info.Footer.Date}}</th>
<th>{{info.Footer.Name}}</th>
<th>{{info.Footer.Type}}</th>
<th>{{info.Footer.Narration}}</th>
<th class="right">{{info.Footer.Debit}}</th>
<th class="right">{{info.Footer.Credit}}</th>
<th class="right">{{info.Footer.Running}}</th>
<td>{{info.Footer.Date}}</td>
<td>{{info.Footer.Name}}</td>
<td>{{info.Footer.Type}}</td>
<td>{{info.Footer.Narration}}</td>
<td class="right">{{info.Footer.Debit}}</td>
<td class="right">{{info.Footer.Credit}}</td>
<td class="right">{{info.Footer.Running}}</td>
</tr>
</tfoot>
</table>

View File

@ -0,0 +1,70 @@
<form method="post" autocomplete="off" class="horizontal-form" ng-controller="ProductLedgerCtrl">
<legend>Product Ledger</legend>
<div class="control-group">
<label for="txtStartDate" class="control-label">Date</label>
<div class="controls">
<datepicker id="txtStartDate" model="info" prop="StartDate" ng-model="info.StartDate"></datepicker>
<datepicker id="txtFinishDate" model="info" prop="FinishDate" ng-model="info.FinishDate"></datepicker>
</div>
</div>
<div class="control-group">
<label for="txtProduct" class="control-label">Ledger</label>
<div class="controls">
<autocomplete id="txtProduct" url="/Services/ProductsList" selname="info.Product.Name"
selid="info.Product.ProductID"></autocomplete>
<button ng-click="show()">Show</button>
</div>
</div>
<div class="control-group">
<label for="gvGrid" class="control-label"></label>
<div class="controls">
<table id="gvGrid" class="clean-table">
<thead>
<tr>
<th>Date</th>
<th>Particulars</th>
<th>Type</th>
<th>Narration</th>
<th class="right">Debit Q</th>
<th class="right">Debit A</th>
<th class="right">Credit Q</th>
<th class="right">Credit A</th>
<th class="right">Running Q</th>
<th class="right">Running A</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in info.Body">
<td>{{item.Date}}</td>
<td><a href="{{item.Url}}">{{item.Name}}</a></td>
<td>{{item.Type}}</td>
<td>{{item.Narration}}</td>
<td class="right">{{item.DebitQ}}</td>
<td class="right">{{item.DebitA}}</td>
<td class="right">{{item.CreditQ}}</td>
<td class="right">{{item.CreditA}}</td>
<td class="right">{{item.RunningQ}}</td>
<td class="right">{{item.RunningA}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>{{info.Footer.Date}}</td>
<td>{{info.Footer.Name}}</td>
<td>{{info.Footer.Type}}</td>
<td>{{info.Footer.Narration}}</td>
<td class="right">{{info.Footer.DebitQ}}</td>
<td class="right">{{info.Footer.DebitA}}</td>
<td class="right">{{info.Footer.CreditQ}}</td>
<td class="right">{{info.Footer.CreditA}}</td>
<td class="right">{{info.Footer.RunningQ}}</td>
<td class="right">{{info.Footer.RunningA}}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</form>

View File

@ -1,72 +1,5 @@
var overlord_service = angular.module('overlord.service', ['ngResource']);
overlord_service.factory('get_voucher', ['$http', function ($http) {
return function (scope) {
$http.post('', scope.voucher).
success(function (data, status) {
scope.voucher = data;
scope.toasts.push({Type:'Success', Message:data.Code});
}).
error(function (data, status) {
scope.toasts.push({Type:'Error', Message:data});
});
};
}]);
overlord_service.factory('save_voucher', ['$http', function ($http) {
return function (scope) {
$http.post('', scope.voucher).
success(function (data, status) {
scope.voucher = data;
scope.toasts.push({Type:'Success', Message:data.Code});
}).
error(function (data, status) {
scope.toasts.push({Type:'Error', Message:data});
});
};
}]);
overlord_service.factory('delete_voucher', ['$http', function ($http) {
return function (scope) {
$http.post(delete_url, {}).
success(function (data, status) {
scope.voucher = {};
scope.toasts.push({Type:'Success', Message:data.Code});
}).
error(function (data, status) {
scope.toasts.push({Type:'Error', Message:data});
});
};
}]);
overlord_service.factory('post_voucher', ['$http', function ($http) {
return function (scope) {
$http.post(post_url, {}).
success(function (data, status) {
scope.voucher.Posted = true;
scope.voucher.Poster = data.name;
scope.toasts.push({Type:'Success', Message:data.Code});
}).
error(function (data, status) {
scope.toasts.push({Type:'Error', Message:data});
});
};
}]);
overlord_service.factory('remove_toast', function () {
return function (toast) {
$http.post(post_url, {}).
success(function (data, status) {
scope.voucher.Posted = true;
scope.voucher.Poster = data.name;
scope.toasts.push({Type:'Success', Message:data.Code});
}).
error(function (data, status) {
scope.toasts.push({Type:'Error', Message:data});
});
};
});
// TODO: Replace hardcoded url with route_url
overlord_service.factory('issue_grid', ['$resource', function ($resource) {
return $resource('/Issues/Services/:date');
@ -93,6 +26,11 @@ overlord_service.factory('Ledger', ['$resource', function ($resource) {
return $resource('/Ledger/:id');
}]);
// TODO: Replace hardcoded url with route_url
overlord_service.factory('ProductLedger', ['$resource', function ($resource) {
return $resource('/ProductLedger/:id');
}]);
// TODO: Replace hardcoded url with route_url
overlord_service.factory('Permission', ['$resource', function ($resource) {
return $resource('/Permissions');
@ -144,11 +82,6 @@ overlord_service.factory('CostCenter', ['$resource', function ($resource) {
}]);
// TODO: Replace hardcoded url with route_url
overlord_service.factory('TrialBalance', ['$resource', function ($resource) {
return $resource('/TrialBalance/:date');
}]);
// TODO: Replace hardcoded url with route_url
overlord_service.factory('TrialBalance', ['$resource', function ($resource) {
return $resource('/TrialBalance/:date');

View File

@ -1,50 +1,4 @@
var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filter', 'overlord.service']).
config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider.
when('/Journal', {templateUrl: '/partial/journal.html', controller: JournalCtrl}).
when('/Journal/:id', {templateUrl: '/partial/journal.html', controller: JournalCtrl}).
when('/Payment', {templateUrl: '/partial/payment.html', controller: PaymentCtrl}).
when('/Payment/:id', {templateUrl: '/partial/payment.html', controller: PaymentCtrl}).
when('/Receipt', {templateUrl: '/partial/receipt.html', controller: ReceiptCtrl}).
when('/Receipt/:id', {templateUrl: '/partial/receipt.html', controller: ReceiptCtrl}).
when('/Purchase', {templateUrl: '/partial/purchase.html', controller: PurchaseCtrl}).
when('/Purchase/:id', {templateUrl: '/partial/purchase.html', controller: PurchaseCtrl}).
when('/Issue', {templateUrl: '/partial/issue.html', controller: IssueCtrl}).
when('/Issue/:id', {templateUrl: '/partial/issue.html', controller: IssueCtrl}).
when('/Ledger', {templateUrl: '/partial/ledger.html', controller: LedgerCtrl}).
when('/Ledger/:id', {templateUrl: '/partial/ledger.html', controller: LedgerCtrl}).
when('/TrialBalance', {templateUrl: '/partial/trial-balance.html', controller: TrialBalanceCtrl}).
when('/TrialBalance/:date', {templateUrl: '/partial/trial-balance.html', controller: TrialBalanceCtrl}).
when('/Accounts', {templateUrl: '/partial/account-list.html', controller: AccountListCtrl}).
when('/Account', {templateUrl: '/partial/account-detail.html', controller: AccountCtrl}).
when('/Account/:id', {templateUrl: '/partial/account-detail.html', controller: AccountCtrl}).
when('/CostCenters', {templateUrl: '/partial/cost-center-list.html', controller: CostCenterListCtrl}).
when('/CostCenter', {templateUrl: '/partial/cost-center-detail.html', controller: CostCenterCtrl}).
when('/CostCenter/:id', {templateUrl: '/partial/cost-center-detail.html', controller: CostCenterCtrl}).
when('/Products', {templateUrl: '/partial/product-list.html', controller: ProductListCtrl}).
when('/Product', {templateUrl: '/partial/product-detail.html', controller: ProductCtrl}).
when('/Product/:id', {templateUrl: '/partial/product-detail.html', controller: ProductCtrl}).
when('/ProductGroups', {templateUrl: '/partial/product-group-list.html', controller: ProductGroupListCtrl}).
when('/ProductGroup', {templateUrl: '/partial/product-group-detail.html', controller: ProductGroupCtrl}).
when('/ProductGroup/:id', {templateUrl: '/partial/product-group-detail.html', controller: ProductGroupCtrl}).
when('/Users', {templateUrl: '/partial/user-list.html', controller: UserListCtrl}).
when('/User', {templateUrl: '/partial/user-detail.html', controller: UserCtrl}).
when('/User/:id', {templateUrl: '/partial/user-detail.html', controller: UserCtrl});
// .otherwise({redirectTo: '/phones'});
$locationProvider.html5Mode(true);
}]);
function AutoComplete(matchFieldName, lookupURL) {
function AutoComplete(matchFieldName, lookupURL) {
$(matchFieldName).autocomplete({
source:function (request, response) {
$.ajax({
@ -66,20 +20,3 @@ function AutoComplete(matchFieldName, lookupURL) {
autoFocus:true
});
}
function BaseCtrl($scope, Permission) {
$scope.perms = Permission.get();
$scope.toasts = [];
$scope.clearToast = function(item) {
var idx = $scope.toasts.indexOf(item);
if (idx !== -1) {
//injected into repeater scope by fadey directive
this.destroy(function() {
$scope.toasts.splice(idx, 1);
});
}
};
}

View File

@ -1,5 +1,6 @@
function IssueCtrl($scope, $routeParams, $location, Voucher, CostCenter, issue_grid) {
if (typeof $routeParams.id === 'undefined') {
// $scope.voucher = Voucher.get({type:'Issue', date:$routeParams.Date, source:$routeParams.Source, destination:$routeParams.Destination});
$scope.voucher = Voucher.get({type:'Issue'});
} else {
$scope.voucher = Voucher.get({id:$routeParams.id});
@ -60,7 +61,7 @@
}
var doUpdate = false;
if (typeof oldJournals !== 'undefined' && typeof $scope.source === 'undefined' ) {
if (typeof oldJournals !== 'undefined' && typeof $scope.source === 'undefined') {
for (var i = 0, l = oldJournals.length; i < l; i++) {
if (oldJournals[i].Debit === -1) {
$scope.source = oldJournals[i].CostCenter.CostCenterID;
@ -74,13 +75,13 @@
if (!doUpdate) {
for (var i = 0, l = newJournals.length; i < l; i++) {
if (newJournals[i].Debit === -1) {
if (newJournals[i].CostCenter.CostCenterID != $scope.source){
if (newJournals[i].CostCenter.CostCenterID != $scope.source) {
$scope.source = newJournals[i].CostCenter.CostCenterID;
doUpdate = true;
}
} else {
if (newJournals[i].CostCenter.CostCenterID != $scope.destination){
if (newJournals[i].CostCenter.CostCenterID != $scope.destination) {
$scope.destination = newJournals[i].CostCenter.CostCenterID;
doUpdate = true;
}
@ -106,8 +107,9 @@
}, true);
$scope.resetVoucher = function (voucherid) {
// $location.path('/Issue').search({Date:voucher.Date, Source:'', Destination:''});
$scope.voucher = Voucher.get({id:voucherid, type:'Issue'}, function (u, putResponseHeaders) {
$location.path('/Issue')
$location.path('/Issue');
}, function (data, status) {
$scope.toasts.push({Type:'Error', Message:data.data});
});
@ -115,7 +117,7 @@
$scope.get = function (voucherid) {
$scope.voucher = Voucher.get({id:voucherid}, function (u, putResponseHeaders) {
$location.path('/Issue/' + u.VoucherID)
$location.path('/Issue/' + u.VoucherID);
}, function (data, status) {
$scope.toasts.push({Type:'Error', Message:data.data});
});
@ -123,7 +125,7 @@
$scope.save = function () {
$scope.voucher.$save(function (u, putResponseHeaders) {
$location.path('/Issue/' + u.VoucherID)
$location.path('/Issue/' + u.VoucherID);
$scope.toasts.push({Type:'Success', Message:u.Code});
$scope.updateGrid();
}, function (data, status) {
@ -133,7 +135,7 @@
$scope.delete = function () {
$scope.voucher.$delete(function (u, putResponseHeaders) {
$location.path('/Issue')
$location.path('/Issue').replace();
$scope.toasts.push({Type:'Success', Message:''});
$scope.updateGrid();
}, function (data, status) {

View File

@ -16,3 +16,15 @@
};
$('#txtLedger').focus();
}
//LedgerCtrl.resolve = {
// ledger_data:function ($route, Ledger) {
// var params = $route.current.params;
// if (typeof params.id === 'undefined') {
// return Ledger.get({});
// } else {
// return Ledger.get({id:params.id, StartDate:params.StartDate, FinishDate:params.FinishDate});
//
// }
// }
//}

View File

@ -0,0 +1,71 @@
'use strict';
var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filter', 'overlord.service']).
config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider.
when('/', {templateUrl:'/partial/home.html'}).
when('/Journal', {templateUrl:'/partial/journal.html', controller:JournalCtrl}).
when('/Journal/:id', {templateUrl:'/partial/journal.html', controller:JournalCtrl}).
when('/Payment', {templateUrl:'/partial/payment.html', controller:PaymentCtrl}).
when('/Payment/:id', {templateUrl:'/partial/payment.html', controller:PaymentCtrl}).
when('/Receipt', {templateUrl:'/partial/receipt.html', controller:ReceiptCtrl}).
when('/Receipt/:id', {templateUrl:'/partial/receipt.html', controller:ReceiptCtrl}).
when('/Purchase', {templateUrl:'/partial/purchase.html', controller:PurchaseCtrl}).
when('/Purchase/:id', {templateUrl:'/partial/purchase.html', controller:PurchaseCtrl}).
when('/Issue', {templateUrl:'/partial/issue.html', controller:IssueCtrl}).
when('/Issue/:id', {templateUrl:'/partial/issue.html', controller:IssueCtrl}).
when('/Ledger', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl}).
when('/Ledger/:id', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl}).
when('/ProductLedger', {templateUrl:'/partial/product-ledger.html', controller:ProductLedgerCtrl}).
when('/ProductLedger/:id', {templateUrl:'/partial/product-ledger.html', controller:ProductLedgerCtrl}).
// when('/Ledger', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl, resolve: LedgerCtrl.resolve}).
// when('/Ledger/:id', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl, resolve: LedgerCtrl.resolve}).
when('/TrialBalance', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl}).
when('/TrialBalance/:date', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl}).
when('/Accounts', {templateUrl:'/partial/account-list.html', controller:AccountListCtrl}).
when('/Account', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl}).
when('/Account/:id', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl}).
when('/CostCenters', {templateUrl:'/partial/cost-center-list.html', controller:CostCenterListCtrl}).
when('/CostCenter', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl}).
when('/CostCenter/:id', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl}).
when('/Products', {templateUrl:'/partial/product-list.html', controller:ProductListCtrl}).
when('/Product', {templateUrl:'/partial/product-detail.html', controller:ProductCtrl}).
when('/Product/:id', {templateUrl:'/partial/product-detail.html', controller:ProductCtrl}).
when('/ProductGroups', {templateUrl:'/partial/product-group-list.html', controller:ProductGroupListCtrl}).
when('/ProductGroup', {templateUrl:'/partial/product-group-detail.html', controller:ProductGroupCtrl}).
when('/ProductGroup/:id', {templateUrl:'/partial/product-group-detail.html', controller:ProductGroupCtrl}).
when('/Users', {templateUrl:'/partial/user-list.html', controller:UserListCtrl}).
when('/User', {templateUrl:'/partial/user-detail.html', controller:UserCtrl}).
when('/User/:id', {templateUrl:'/partial/user-detail.html', controller:UserCtrl});
// .otherwise({redirectTo: '/phones'});
$locationProvider.html5Mode(true);
}]);
function BaseCtrl($scope, Permission) {
$scope.perms = Permission.get();
$scope.toasts = [];
$scope.clearToast = function (item) {
var idx = $scope.toasts.indexOf(item);
if (idx !== -1) {
//injected into repeater scope by fadey directive
this.destroy(function () {
$scope.toasts.splice(idx, 1);
});
}
};
}

View File

@ -0,0 +1,18 @@
function ProductLedgerCtrl($scope, $routeParams, $location, ProductLedger) {
if (typeof $routeParams.id === 'undefined') {
$scope.info = ProductLedger.get({});
} else {
$scope.info = ProductLedger.get({id:$routeParams.id, StartDate:$routeParams.StartDate, FinishDate:$routeParams.FinishDate});
}
$scope.show = function () {
$scope.info = ProductLedger.get({id:$scope.info.Product.ProductID, StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}, function (u, putResponseHeaders) {
$location.path('/ProductLedger/' + u.Product.ProductID);
$location.search('StartDate', u.StartDate);
$location.search('FinishDate', u.FinishDate);
}, function (data, status) {
$scope.toasts.push({Type:'Error', Message:data.data});
});
};
$('#txtProduct').focus();
}

View File

@ -1,28 +0,0 @@
function Populate(vouchers, editUrl) {
if (vouchers != null) {
var stateObj = { 'LedgerID':vouchers.id, 'Name':vouchers.name, 'StartDate':vouchers.start_date, 'FinishDate':vouchers.finish_date };
history.pushState(stateObj, 'Display', vouchers.url);
$('#txtProduct').val(vouchers.name);
$('#tbodyMain').html(vouchers.body);
$('#tfootMain').html(vouchers.footer);
}
}
function Show(productString, productID, startDate, finishDate) {
$.ajax({
type:"POST",
contentType:"application/json; charset=utf-8",
url:show_url,
data:JSON.stringify({ productString:productString, productID: productID, 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;
}

View File

@ -26,12 +26,7 @@
${h.JsLink(request, 'angular-1.0.1.js')}
${h.JsLink(request, 'angular-resource-1.0.1.js')}
<script type="text/javascript">
roles_url = '${request.route_url('is_user_in_roles')}';
role_url = '${request.route_url('is_user_in_role', id = '')}';
</script>
${h.ScriptLink(request, 'autocomplete.js')}
${h.ScriptLink(request, 'overlord.js')}
${h.ScriptLink(request, 'angular_directive.js')}
${h.ScriptLink(request, 'angular_filter.js')}
${h.ScriptLink(request, 'angular_service.js')}
@ -44,6 +39,7 @@
${h.ScriptLink(request, 'issue.js')}
${h.ScriptLink(request, 'ledger.js')}
${h.ScriptLink(request, 'product-ledger.js')}
${h.ScriptLink(request, 'trial_balance.js')}
${h.ScriptLink(request, 'account.js')}

View File

@ -31,26 +31,8 @@
</script>
${h.ScriptLink(request, 'autocomplete.js')}
${h.ScriptLink(request, 'angular_directive.js')}
${h.ScriptLink(request, 'angular_filter.js')}
${h.ScriptLink(request, 'angular_service.js')}
${h.ScriptLink(request, 'session.js')}
${h.ScriptLink(request, 'journal.js')}
${h.ScriptLink(request, 'payment.js')}
${h.ScriptLink(request, 'receipt.js')}
${h.ScriptLink(request, 'purchase.js')}
${h.ScriptLink(request, 'issue.js')}
${h.ScriptLink(request, 'ledger.js')}
${h.ScriptLink(request, 'trial_balance.js')}
${h.ScriptLink(request, 'account.js')}
${h.ScriptLink(request, 'user.js')}
${h.ScriptLink(request, 'cost-center.js')}
${h.ScriptLink(request, 'product.js')}
${h.ScriptLink(request, 'product-group.js')}
<%block name="header" />
<!-- Le fav and touch icons -->

View File

@ -1,9 +0,0 @@
# -*- coding: utf-8 -*-
<%inherit file="base.mako"/>
<%block name="content">
<div class="hero-unit">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p>
</div>
</%block>

View File

@ -1,83 +0,0 @@
# -*- coding: utf-8 -*-
<%inherit file="../base.mako"/>
<%block name="header">
${h.ScriptLink(request, 'productledger.js')}
<script type="text/javascript">
$(document).ready(function () {
AutoComplete('#txtProduct', '${request.route_url('services_product_list')}');
$('#txtStartDate').datepicker({ dateFormat:'dd-M-yy' });
${startDate}
$('#txtFinishDate').datepicker({ dateFormat:'dd-M-yy'});
${finishDate}
${product}
$('#txtProduct').focus()
show_url = '${request.route_url('product_ledger')}';
$("#btnSubmit").click(function () {
return Show($('#txtProduct').val(), '', $('#txtStartDate').val(), $('#txtFinishDate').val());
});
window.onpopstate = function (event) {
var state = event.state;
if (state != null) {
var productID = event.state.ProductID;
$('#txtStartDate').val(state.StartDate);
$('#txtFinishDate').val(state.FinishDate);
$('#txtProduct').val(state.Name);
Show('', ProductID, $('#txtStartDate').val(), $('#txtFinishDate').val());
}
};
});
</script>
</%block>
<%block name="content">
<h2 class="ribbon-header">Product Ledger</h2>
<form method="post" autocomplete="off">
${h.CsrfToken(request.session)}
<p>
${h.Label('Start Date:', 'txtStartDate')}
${h.TextInput('txtStartDate', css_class = 'non-search-box', autocomplete='off')}
</p>
<p>
${h.Label('Finish Date:', 'txtFinishDate')}
${h.TextInput('txtFinishDate', css_class = 'non-search-box', autocomplete='off')}
</p>
<p>
${h.Label('Product:', 'txtProduct')}
${h.TextInput('txtProduct', css_class = 'search-box', autocomplete='off', placeholder='Product')}
${h.SubmitButton('btnSubmit', 'Submit')}
</p>
<p>
<table id="gvGrid" class="clean-table">
<thead>
<tr>
<th class="Date">Date</th>
<th class="Name">Particulars</th>
<th class="VoucherType">Type</th>
<th class="Narration">Narration</th>
<th class="DebitQuantity right">Debit</th>
<th class="DebitAmount right">Debit</th>
<th class="CreditQuantity right">Credit</th>
<th class="CreditAmount right">Credit</th>
<th class="RunningQuantity right">Running</th>
<th class="RunningAmount right">Running</th>
</tr>
</thead>
<tbody id="tbodyMain">
${body}
</tbody>
<tfoot id="tfootMain">
${footer}
</tfoot>
</table>
</p>
</form>
</%block>

View File

@ -1,6 +1,13 @@
from decimal import Decimal
import json
import uuid
from pyramid.view import view_config
@view_config(route_name='home', renderer='brewman:templates/angular_base.mako')
def home(request):
return {}
class DecimalAsFloatHack(float):
def __init__(self, d):

View File

@ -1,48 +0,0 @@
from brewman.models import DBSession, BeerType, Brew
def list_beer_types(request):
dbsession = DBSession()
list = dbsession.query(BeerType).all()
return {'list':list, 'project':'brewman'}
def show_beer_type(request):
id = request.matchdict['id']
dbsession = DBSession()
item = dbsession.query(BeerType).filter(BeerType.id==id).one()
return {'item':item, 'title':item.name, 'project':'brewman', 'top_block': page_title_and_breadcrumb(request)}
def add_beer_type(request):
# id = request.matchdict['id']
# dbsession = DBSession()
# item = dbsession.query(BeerType).filter_by(id==id).one()
return {'title':'Add Beer Style', 'pageclass': "class page-contacts page-sidebar-right", 'top_block': page_title_and_breadcrumb(request)}
def edit_beer_type(request):
id = request.matchdict['id']
dbsession = DBSession()
item = dbsession.query(BeerType).filter_by(id==id).one()
return {'item':item, 'project':'brewman'}
def list_brews(request):
dbsession = DBSession()
list = dbsession.query(Brew).all()
return {'list':list, 'project':'brewman'}
def show_brew(request):
id = request.matchdict['id']
dbsession = DBSession()
item = dbsession.query(Brew).filter_by(id==id).one()
return {'item':item, 'project':'brewman'}
def add_brew(request):
id = request.matchdict['id']
dbsession = DBSession()
item = dbsession.query(Brew).filter_by(id==id).one()
return {'item':item, 'project':'brewman'}
def edit_brew(request):
id = request.matchdict['id']
dbsession = DBSession()
item = dbsession.query(Brew).filter_by(id==id).one()
return {'item':item, 'project':'brewman'}

View File

@ -6,43 +6,8 @@ from pyramid.security import remember, forget
from pyramid.view import view_config
from brewman.models.auth import User
from brewman.views.widgets import footer, contact_widget, recent_posts, categories, archive
@view_config(route_name='home', renderer='brewman:templates/home.mako')
def home(request):
return {'title': 'Hops n Grains - Welcome'}
@view_config(route_name='contact', renderer='brewman:templates/contact.pt')
def contact(request):
return {'title': 'Hops n Grains - Contact Us',
'pageclass': "page-contacts page-sidebar-right skin-5",
'pagecontentclass': "page-content grid_8",
'top_block': breadcrumb(request, "Contacts", "Feel free to contact us any time."),
'widget1': recent_posts(request),
'wid1': "grid_6",
'widget2': categories(request),
'wid2': "grid_3",
'widget3': archive(request),
'wid3': "grid_3",
'footer': footer(request)}
@view_config(route_name='gallery', renderer='brewman:templates/gallery.pt')
def gallery(request):
return {'title': 'Hops n Grains - Gallery',
'pageclass': "page-gallery",
'pagecontentclass': "page-content",
'top_block': breadcrumb(request, "Gallery", "Nice and clean gallery grid."),
'widget1': tweets(request),
'wid1': "grid_4",
'widget2': categories(request),
'wid2': "grid_4",
'widget3': contact_widget(request),
'wid3': "grid_4",
'footer': footer(request),
'widget_comments': comments(request)}
@view_config(context=HTTPNotFound, renderer='brewman:templates/404.mako')

View File

@ -1,148 +0,0 @@
import os
import random
import transaction
from pyramid.httpexceptions import HTTPNotFound, HTTPFound
from pyramid.response import Response
from pyramid.security import authenticated_userid, remember, forget
from pyramid.view import view_config
from brewman.models import DBSession, UploadedImage, User
from brewman.views.top_parts import slidernivo, breadcrumb, slider3d, slideraccordion, slidercarousel, sliderstatic, randomslider
from brewman.views.widgets import footer, widget_gallery, tweets, contact_widget, archive, categories, recent_posts, comments, blog_roll, events
@view_config(request_method='POST', route_name='upload_picture', renderer='brewman:templates/upload_picture.pt')
def upload_picture_submit(request):
filename = request.POST['picture'].filename
input_file = request.POST['picture'].file
comment = request.POST['comment']
size = request.POST['size']
file_path = os.getcwd() + '\\brewman\\static\\pictures\\' + filename
output_file = open(file_path, 'wb')
input_file.seek(0)
while 1:
data = input_file.read(2<<16)
if not data:
break
output_file.write(data)
output_file.close()
session = DBSession()
pinf = UploadedImage(location='brewman:static/pictures/' + filename, comment=comment, size=size)
session.add(pinf)
session.flush()
transaction.commit()
return Response(pinf.comment)
@view_config(request_method='GET', route_name='upload_picture', renderer='brewman:templates/upload_picture.pt')
def upload_picture(request):
return {'title':'Hops n Grains - Upload a picture',
'pageclass': "page-frontpage skin-4",
'pagecontentclass': "page-content",
'top_block': randomslider(request),
'widget1': widget_gallery(request),
'wid1': "grid_4",
'widget2': tweets(request),
'wid2': "grid_4",
'widget3': contact_widget(request),
'wid3': "grid_4",
'footer': footer(request)}
@view_config(route_name='home', renderer='brewman:templates/home.pt')
def home(request):
return {'title':'Hops n Grains - Welcome',
'pageclass': "page-frontpage skin-2",
'pagecontentclass': "page-content",
'top_block': randomslider(request),
'widget1': widget_gallery(request),
'wid1': "grid_4",
'widget2': tweets(request),
'wid2': "grid_4",
'widget3': contact_widget(request),
'wid3': "grid_4",
'footer': footer(request)}
@view_config(route_name='contact', renderer='brewman:templates/contact.pt')
def contact(request):
return {'title':'Hops n Grains - Contact Us',
'pageclass': "page-contacts page-sidebar-right skin-5",
'pagecontentclass': "page-content grid_8",
'top_block': breadcrumb(request, "Contacts", "Feel free to contact us any time."),
'widget1': recent_posts(request),
'wid1': "grid_6",
'widget2': categories(request),
'wid2': "grid_3",
'widget3': archive(request),
'wid3': "grid_3",
'footer': footer(request)}
@view_config(route_name='gallery', renderer='brewman:templates/gallery.pt')
def gallery(request):
return {'title':'Hops n Grains - Gallery',
'pageclass': "page-gallery",
'pagecontentclass': "page-content",
'top_block': breadcrumb(request, "Gallery", "Nice and clean gallery grid."),
'widget1': tweets(request),
'wid1': "grid_4",
'widget2': categories(request),
'wid2': "grid_4",
'widget3': contact_widget(request),
'wid3': "grid_4",
'footer': footer(request),
'widget_comments': comments(request)}
@view_config(context=HTTPNotFound, renderer='brewman:templates/404.pt')
def not_found(request):
return {'title':'Hops n Grains - 404',
'pageclass': "page-404 skin-9",
'pagecontentclass': "page-content",
'top_block': "",
'widget1': tweets(request),
'wid1': "grid_4",
'widget2': recent_posts(request),
'wid2': "grid_4",
'widget3': contact_widget(request),
'wid3': "grid_4",
'footer': footer(request)}
@view_config(request_method='POST', route_name='login', renderer='brewman:templates/login.pt')
def login_submit(request):
username = request.POST['username']
password = request.POST['password']
found, user = User.check_password(username, password)
if found == True:
headers = remember(request, user.id)
request.session.flash(u'Logged in successfully.')
return HTTPFound(location=request.route_url('home'), headers=headers)
else:
return Response('Login Failure')
@view_config(request_method='GET', route_name='login', renderer='brewman:templates/login.pt')
def login(request):
return {'title':'Hops n Grains - Login',
'pageclass': "page-gallery skin-7",
'pagecontentclass': "page-content",
'top_block': breadcrumb(request, "Login", "This is the place to login."),
'widget1': tweets(request),
'wid1': "grid_4",
'widget2': recent_posts(request),
'wid2': "grid_4",
'widget3': contact_widget(request),
'wid3': "grid_4",
'footer': footer(request)}
@view_config(route_name='logout')
def logout(request):
request.session.invalidate()
request.session.flash(u'Logged out successfully.')
headers = forget(request)
return HTTPFound(location=request.route_url('home'), headers=headers)
@view_config(request_method='POST', route_name='json_test', renderer='json', http_cache=0, xhr=True)
def json_test(request):
rand = random.randrange(1, 400, 1)
return {'myid': rand}

View File

@ -114,7 +114,6 @@ def opening_balance(ledgerID, start_date):
creditShow = ""
runningTotal = opening
running = "\u20B9 {0:,.2f}".format(abs(runningTotal)) + (' Dr' if runningTotal >= 0 else ' Cr')
voucher_type = VoucherType.by_name('Opening Balance')
return debit, credit, runningTotal, {'Date': start_date, 'Name': voucher_type.name, 'Type': voucher_type.name,
return debit, credit, runningTotal, {'Date': start_date, 'Name': 'Opening Balance', 'Type': 'Opening Balance',
'Narration': '', 'Debit': debitShow, 'Credit': creditShow,
'Running': running, 'Posted': True}

View File

@ -10,31 +10,28 @@ from brewman.models import DBSession
from brewman.models.master import Product, CostCenter
from brewman.models.voucher import Voucher, Journal, VoucherType, Inventory
from brewman.views.services.session import services_session_period_start, services_session_period_finish
from brewman.views.transactions import get_edit_url
@view_config(request_method='GET', route_name='product_ledger_id',
renderer='brewman:templates/reports/product_ledger.mako')
@view_config(request_method='GET', route_name='product_ledger', renderer='brewman:templates/reports/product_ledger.mako')
@view_config(request_method='GET', route_name='product_ledger_id', renderer='brewman:templates/angular_base.mako',
xhr=False)
@view_config(request_method='GET', route_name='product_ledger', renderer='brewman:templates/angular_base.mako',
xhr=False)
def ledger_display_get(request):
return {}
def product_ledger_get(request):
product_id = request.matchdict.get('id', None)
if product_id is None:
body = ""
footer = ""
product = ""
startDate = Literal(
"StartDate('#txtStartDate', '{0}');".format(request.route_url('services_session_period_start')))
finishDate = Literal(
"FinishDate('#txtFinishDate', '{0}');".format(request.route_url('services_session_period_finish')))
else:
product = Product.by_id(uuid.UUID(product_id))
startDate = request.GET.get('startDate', None)
finishDate = request.GET.get('finishDate', None)
report = build_report(request, product, startDate, finishDate)
body = Literal(report['body'])
footer = Literal(report['footer'])
startDate = Literal("$('#txtStartDate').val('{0}');".format(startDate))
finishDate = Literal("$('#txtFinishDate').val('{0}');".format(finishDate))
product = Literal("$('#txtProduct').val('{0}');".format(product.full_name))
product = Product.by_id(uuid.UUID(product_id))
startDate = request.GET.get('startDate', None)
finishDate = request.GET.get('finishDate', None)
report = build_report(request, product, startDate, finishDate)
body = Literal(report['body'])
footer = Literal(report['footer'])
startDate = Literal("$('#txtStartDate').val('{0}');".format(startDate))
finishDate = Literal("$('#txtFinishDate').val('{0}');".format(finishDate))
product = Literal("$('#txtProduct').val('{0}');".format(product.full_name))
return {'title': 'Display Ledger - Hops n Grains',
'pageclass': "page-blogpost page-sidebar-right",
@ -47,6 +44,24 @@ def product_ledger_get(request):
'product': product}
@view_config(request_method='GET', route_name='product_ledger_id', renderer='json', xhr=True)
@view_config(request_method='GET', route_name='product_ledger', renderer='json', xhr=True)
def ledger_display_post(request):
id = request.matchdict.get('id', None)
if id is None:
return {'StartDate': services_session_period_start(request),
'FinishDate': services_session_period_finish(request), 'Product': {}, 'Body': [], 'Footer': {}}
else:
product = Product.by_id(uuid.UUID(id))
start_date = request.GET.get('StartDate', services_session_period_start(request))
finish_date = request.GET.get('FinishDate', services_session_period_finish(request))
info = {'StartDate': start_date, 'FinishDate': finish_date,
'Product': {'ProductID': product.id, 'Name': product.name},
'Body': [], 'Footer': {}}
build_report(request, info)
return info
@view_config(request_method='POST', route_name='product_ledger', renderer='json', xhr=True)
def product_ledger_post(request):
productID = request.json_body['productID']
@ -61,113 +76,81 @@ def product_ledger_post(request):
return build_report(request, product, startDate, finishDate)
def build_report(request, product, startDate, finishDate):
body = ''
totalDebitQuantity, totalDebitAmount, totalCreditQuantity, totalCreditAmount, runningTotalQuantity, runningTotalAmount, opening = opening_balance(
product.id, startDate)
body += opening
def build_report(request, info):
product_id = info['Product']['ProductID']
start_date = info['StartDate']
finish_date = info['FinishDate']
runningTotalQ, runningTotalA, opening = opening_balance(product_id, start_date)
totalDebitQ = runningTotalQ
totalDebitA = runningTotalA
totalCreditQ = 0
totalCreditA = 0
info['Body'].append(opening)
query = DBSession.query(Voucher, Inventory, Journal).options(
joinedload(Journal.ledger, innerjoin=True),
joinedload(Journal.costcenter, innerjoin=True))\
.filter(Voucher.id == Inventory.voucher_id)\
.filter(Voucher.id == Journal.voucher_id)\
.filter(Inventory.product_id == product.id)\
.filter(Inventory.product_id == product_id)\
.filter(Journal.cost_center_id != CostCenter.cost_center_purchase())\
.filter(Voucher.date >= datetime.datetime.strptime(startDate, '%d-%b-%Y'))\
.filter(Voucher.date <= datetime.datetime.strptime(finishDate, '%d-%b-%Y'))\
.filter(Voucher.date >= datetime.datetime.strptime(start_date, '%d-%b-%Y'))\
.filter(Voucher.date <= datetime.datetime.strptime(finish_date, '%d-%b-%Y'))\
.order_by(Voucher.date).order_by(Voucher.last_edit_date).all()
for row in query:
journalDebit = row.Journal.debit * -1
name = row.Journal.costcenter.name if row.Voucher.type == VoucherType.by_name(
'Issue').id else row.Journal.ledger.name
debitQuantity = "{0:.2f}".format(row.Inventory.quantity) if journalDebit == 1 else ""
debitAmount = "\u20B9 {0:.2f}".format(row.Inventory.amount) if journalDebit == 1 else ""
creditQuantity = "{0:.2f}".format(row.Inventory.quantity) if journalDebit != 1 else ""
creditAmount = "\u20B9 {0:.2f}".format(row.Inventory.amount) if journalDebit != 1 else ""
debitQ = "{0:.2f}".format(row.Inventory.quantity) if journalDebit == 1 else ""
debitA = "\u20B9 {0:.2f}".format(row.Inventory.amount) if journalDebit == 1 else ""
creditQ = "{0:.2f}".format(row.Inventory.quantity) if journalDebit != 1 else ""
creditA = "\u20B9 {0:.2f}".format(row.Inventory.amount) if journalDebit != 1 else ""
runningTotalQuantity += (row.Inventory.quantity * journalDebit)
runningTotalAmount += (row.Inventory.amount * journalDebit)
runningTotalQ += (row.Inventory.quantity * journalDebit)
runningTotalA += (row.Inventory.amount * journalDebit)
if journalDebit == 1:
totalDebitQuantity += row.Inventory.quantity
totalDebitAmount += row.Inventory.amount
totalDebitQ += row.Inventory.quantity
totalDebitA += row.Inventory.amount
else:
totalCreditQuantity += row.Inventory.quantity
totalCreditAmount += row.Inventory.amount
totalCreditQ += row.Inventory.quantity
totalCreditA += row.Inventory.amount
name = '<a href="' + get_edit_url(request, row.Voucher) + '">' + name + '</a>'
body += '<tr class="Voucher" id="{0}"><td class="Date">{1}</td><td class="Name">{2}</td>'\
'<td class="VoucherType">{3}</td><td class="Narration">{4}</td><td class="DebitQuantity">{5}</td>'\
'<td class="DebitAmount">{6}</td><td class="CreditQuantity">{7}</td><td class="CreditAmount">{8}</td>'\
'<td class="RunningQuantity">{9:.2f}</td><td class="RunningAmount">\u20B9 {10:.2f}</td></tr>'\
.format(str(row.Voucher.id), row.Voucher.date.strftime('%d-%b-%Y'), name,
VoucherType.by_id(row.Voucher.type).name, row.Voucher.narration, debitQuantity, debitAmount,
creditQuantity, creditAmount, runningTotalQuantity, runningTotalAmount)
info['Body'].append(
{'Date': row.Voucher.date.strftime('%d-%b-%Y'), 'Name': name, 'Url': get_edit_url(request, row.Voucher),
'Type': VoucherType.by_id(row.Voucher.type).name, 'Narration': row.Voucher.narration, 'DebitQ': debitQ,
'DebitA': debitA,
'CreditQ': creditQ, 'CreditA': creditA, 'RunningQ': "{0:.2f}".format(runningTotalQ),
'RunningA': "\u20B9 {0:.2f}".format(runningTotalA)})
voucher_type = VoucherType.by_name('Closing Balance')
footer = '<tr class="Voucher"><td class="Date">{0}</td><td class="Name">{1}</td>'\
'<td class="VoucherType">{1}</td><td class="Narration"></td><td class="DebitQuantity">{2:.2f}</td>'\
'<td class="DebitAmount">\u20B9 {3:.2f}</td><td class="CreditQuantity">{4:.2f}</td>'\
'<td class="CreditAmount">\u20B9 {5:.2f}</td><td class="RunningQuantity">{6:.2f}</td>'\
'<td class="RunningAmount">\u20B9 {7:.2f}</td></tr>'\
.format(finishDate, voucher_type.name, totalDebitQuantity, totalDebitAmount,
totalCreditQuantity, totalCreditAmount, runningTotalQuantity, runningTotalAmount)
return {'body': body, 'footer': footer, 'start_date': startDate, 'finish_date': finishDate, 'id': str(product.id),
'name': product.full_name, 'url': request.route_url('product_ledger_id', id=str(product.id),
_query={'startDate': startDate, 'finishDate': finishDate})}
info['Footer'] = {'Date': finish_date, 'Name': 'Closing Balance', 'Type': 'Closing Balance', 'Narration': '',
'DebitQ': "{0:,.2f}".format(totalDebitQ), 'DebitA': "\u20B9 {0:,.2f}".format(totalDebitA),
'CreditQ': "{0:,.2f}".format(totalCreditQ), 'CreditA': "\u20B9 {0:,.2f}".format(totalCreditA),
'RunningQ': "{0:,.2f}".format(runningTotalQ), 'RunningA': "\u20B9 {0:,.2f}".format(runningTotalA)}
def opening_balance(productID, startDate):
runningTotalQuantity = 0
runningTotalAmount = 0
totalDebitQuantity = 0
totalDebitAmount = 0
totalCreditQuantity = 0
totalCreditAmount = 0
def opening_balance(product_id, start_date):
quantity, amount = DBSession.query(func.sum(Inventory.quantity * Journal.debit),
func.sum(Inventory.amount * Journal.debit))\
.join(Voucher)\
.filter(Voucher.id == Inventory.voucher_id)\
.filter(Voucher.id == Journal.voucher_id)\
.filter(Inventory.product_id == productID)\
.filter(Inventory.product_id == product_id)\
.filter(Journal.cost_center_id == CostCenter.cost_center_purchase())\
.filter(Voucher.date < datetime.datetime.strptime(startDate, '%d-%b-%Y'))\
.filter(Voucher.date < datetime.datetime.strptime(start_date, '%d-%b-%Y'))\
.one()
if quantity is None or quantity == 0:
debitQuantity = ""
debitAmount = ""
creditQuantity = ""
creditAmount = ""
else:
debitQuantity = "{0:.2f}".format(quantity) if quantity > 0 else ""
debitAmount = "\u20B9 {0:.2f}".format(amount) if quantity > 0 else ""
creditQuantity = "{0:.2f}".format(quantity) if quantity < 0 else ""
creditAmount = "\u20B9 {0:.2f}".format(amount) if quantity < 0 else ""
if quantity and quantity > 0:
debitQuantity = "{0:.2f}".format(quantity)
debitAmount = "\u20B9 {0:.2f}".format(amount)
if quantity is None:
quantity = 0
amount = 0
runningTotalQuantity = quantity
runningTotalAmount = amount
if quantity < 0:
totalCreditQuantity = quantity * -1
totalCreditAmount = amount * -1
else:
totalDebitQuantity = quantity
totalDebitAmount = amount
voucher_type = VoucherType.by_name('Opening Balance')
return totalDebitQuantity, totalDebitAmount, totalCreditQuantity, totalCreditAmount, runningTotalQuantity,\
runningTotalAmount,\
'<tr class="Voucher"><td class="Date">{0}</td><td class="Name">{1}</td>'\
'<td class="VoucherType">{1}</td><td class="Narration"></td><td class="DebitQuantity">{2}</td>'\
'<td class="DebitAmount">{3}</td><td class="CreditQuantity">{4}</td>'\
'<td class="CreditAmount">{5}</td><td class="RunningQuantity">{6:.2f}</td>'\
'<td class="RunningAmount">\u20B9 {7:.2f}</td></tr>'\
.format(startDate, voucher_type.name, debitQuantity, debitAmount,
creditQuantity, creditAmount, runningTotalQuantity, runningTotalAmount)
return quantity, amount, {'Date': start_date, 'Name': 'Opening Balance', 'Type': 'Opening Balance', 'Narration': '',
'DebitQ': debitQuantity, 'DebitA': debitAmount, 'RunningQ': quantity, 'RunningA': amount}

View File

@ -1,31 +0,0 @@
from pyramid.renderers import render
def footer(request):
return render('brewman:templates/widgets/footer.pt', {'request': request})
def widget_gallery(request):
return render('brewman:templates/widgets/gallery.pt', {'request': request})
def tweets(request):
return render('brewman:templates/widgets/tweets.pt', {'request': request})
def contact_widget(request):
return render('brewman:templates/widgets/contact.pt', {'request': request})
def archive(request):
return render('brewman:templates/widgets/archive.pt', {'request': request})
def categories(request):
return render('brewman:templates/widgets/categories.pt', {'request': request})
def recent_posts(request):
return render('brewman:templates/widgets/recent_posts.pt', {'request': request})
def comments(request):
return render('brewman:templates/widgets/comments.pt', {'request': request})
def blog_roll(request):
return render('brewman:templates/widgets/blog_roll.pt', {'request': request})
def events(request):
return render('brewman:templates/widgets/events.pt', {'request': request})