Skip to content

Commit

Permalink
feat(General Ledger): link Account Statement
Browse files Browse the repository at this point in the history
This commit links the General Ledger to the Account Statement via the
dropdown menu in the General Ledger.

Closes #2459.
  • Loading branch information
jniles committed Jan 26, 2018
1 parent 085500d commit ae25a1d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 13 deletions.
1 change: 1 addition & 0 deletions client/src/i18n/en/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"SINCE": "Since",
"SIXTY_TO_NINETY_DAYS": "60 to 90 Days",
"THIRTY_TO_SIXTY_DAYS": "30 to 60 Days",
"VIEW_ACCOUNT_STATEMENT": "View in Account Statement",
"VIEW_CREDIT_NOTE": "View Credit Note",
"VIEW_INVOICE": "View Invoices",
"VIEW_PATIENT": "View Patient",
Expand Down
1 change: 1 addition & 0 deletions client/src/i18n/fr/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"SINCE": "Depuis",
"SIXTY_TO_NINETY_DAYS": "60 a 90 jours",
"THIRTY_TO_SIXTY_DAYS": "30 a 60 jours",
"VIEW_ACCOUNT_STATEMENT": "Voir le Rélevé de Compte",
"VIEW_CREDIT_NOTE": "Voir la note de credit",
"VIEW_INVOICE": "Voir les factures",
"VIEW_PATIENT": "Voir le Patient",
Expand Down
2 changes: 1 addition & 1 deletion client/src/i18n/fr/tree.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"TREE": {
"ACCOUNT":"Comptes",
"ACCOUNT_STATEMENT":"Rélevé de compte",
"ACCOUNT_STATEMENT":"Rélevé de Compte",
"ADMIN":"Admin",
"AGED_CREDITORS":"Balance âgée des Créances",
"BALANCE":"Balance",
Expand Down
21 changes: 10 additions & 11 deletions client/src/modules/account_statement/account_statement.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function AccountStatementController(
var cacheKey = 'account-statement';
var state;

var columns;
var sorting;
var filtering;
var columnConfig;
Expand All @@ -38,14 +39,14 @@ function AccountStatementController(
// grid definition ================================================================
vm.gridApi = {};

// FIXME(@jniles) - why does this not have fastWatch?
vm.gridOptions = {
enableColumnMenus : false,
showColumnFooter : true,
appScopeProvider : vm,
fastWatch : true,
flatEntityAccess : true,
enableRowHeaderSelection : true,
onRegisterApi : onRegisterApi,
onRegisterApi : onRegisterApiFn,
};

// Initialise each of the account statement utilities
Expand All @@ -59,7 +60,7 @@ function AccountStatementController(
vm.filtering = filtering;

// columns definition
var columns = [
columns = [
{ field : 'trans_id',
displayName : 'TABLE.COLUMNS.TRANSACTION',
headerCellFilter : 'translate',
Expand Down Expand Up @@ -175,7 +176,6 @@ function AccountStatementController(
displayName : 'FORM.LABELS.COMMENT',
headerCellFilter : 'translate',
visible : true },

{ field : 'display_name',
displayName : 'TABLE.COLUMNS.RESPONSIBLE',
headerCellFilter : 'translate',
Expand All @@ -185,7 +185,7 @@ function AccountStatementController(
vm.gridOptions.columnDefs = columns;

// on register api
function onRegisterApi(api) {
function onRegisterApiFn(api) {
vm.gridApi = api;
}

Expand Down Expand Up @@ -276,6 +276,11 @@ function AccountStatementController(

// runs on startup
function startup() {
var hasStateFilters = $state.params.filters.length > 0;
if (hasStateFilters) {
AccountStatement.filters.replaceFiltersFromState($state.params.filters);
}

load(AccountStatement.filters.formatHTTP(true));
vm.latestViewFilters = AccountStatement.filters.formatView();
}
Expand Down Expand Up @@ -344,12 +349,6 @@ function AccountStatementController(
return aggregates;
}

// catch loading errors
function handleError(err) {
Notify.handleError(err);
vm.hasErrors = true;
}

vm.saveGridState = state.saveGridState;
vm.clearGridState = function clearGridState() {
state.clearGridState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ angular.module('bhima.routes')
url : '/account_statement',
controller : 'AccountStatementController as AccountStateCtrl',
templateUrl : 'modules/account_statement/account_statement.html',
params : {
filters : [],
},
});
}]);
3 changes: 2 additions & 1 deletion client/src/modules/general-ledger/general-ledger.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ function GeneralLedgerController(
};

function handleError(err) {
console.error(err);
vm.hasError = true;
Notify.handleError(err);
}
Expand Down Expand Up @@ -324,6 +323,8 @@ function GeneralLedgerController(
}

function preProcessAccounts(account) {
account.hrlabel = Accounts.label(account);

// remove zero values from the matrix to render as empty cells.
fields.forEach(function (field) {
if (account[field] === 0) {
Expand Down
12 changes: 12 additions & 0 deletions client/src/modules/general-ledger/templates/action.cell.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
</a>

<ul class="dropdown-menu-right" bh-dropdown-menu-auto-dropup uib-dropdown-menu>
<li>
<a data-method="view-account-statement" ui-sref="accountStatement({ filters : [
{ key : 'account_id', value : row.entity.id, displayValue : row.entity.hrlabel },
{ key : 'period', value : 'allTime' },
{ key : 'custom_period_start', value : grid.appScope.year.start_date },
{ key : 'custom_period_end', value : grid.appScope.year.end_date },
{ key : 'limit', value : 1000 },
]})">
<span translate>REPORT.VIEW_ACCOUNT_STATEMENT</span>
</a>
</li>
<li class="divider"></li>
<li>
<a ng-href="/reports/finance/account_report/?{{ grid.appScope.openAccountReport(row.entity.id) }}" download="{{ TREE.REPORT_ACCOUNTS | translate }}">
<span class="fa fa-file-pdf-o"></span> <span translate>TREE.REPORT_ACCOUNTS</span>
Expand Down

0 comments on commit ae25a1d

Please sign in to comment.