Skip to content

Commit

Permalink
Fix account balance report
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcameron committed May 25, 2022
1 parent 850323d commit 322b6dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ function BalanceReportConfigController($sce, Notify, SavedReports, AppCache, rep

vm.onSelectFiscalYear = (fiscalYear) => {
vm.reportDetails.fiscal_id = fiscalYear.id;
delete vm.reportDetails.period_id;
};

vm.onSelectPeriod = (period) => {
vm.reportDetails.period_id = period.id;
vm.reportDetails.period_id = period?.id;
};

vm.clearPreview = function clearPreview() {
Expand All @@ -45,6 +46,10 @@ function BalanceReportConfigController($sce, Notify, SavedReports, AppCache, rep
};

vm.onChangeClosingBalances = bool => {
// If true, the period is the whole FY, so delete the period
if (bool) {
delete vm.reportDetails.period_id;
}
vm.reportDetails.includeClosingBalances = bool;
};

Expand Down Expand Up @@ -99,5 +104,9 @@ function BalanceReportConfigController($sce, Notify, SavedReports, AppCache, rep
if (!angular.isDefined(vm.reportDetails.shouldHideTitleAccounts)) {
vm.reportDetails.shouldHideTitleAccounts = 0;
}
if (angular.isDefined(vm.reportDetails.fiscal_id)
&& angular.isDefined(vm.reportDetails.includeClosingBalances)) {
delete vm.reportDetails.period_id;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ <h3 class="text-capitalize" translate>REPORT.BALANCE_REPORT.TITLE</h3>
fiscal-year-id="ReportConfigCtrl.reportDetails.fiscal_id"
period-id="ReportConfigCtrl.reportDetails.period_id"
on-select-callback="ReportConfigCtrl.onSelectPeriod(period)"
disable="!ReportConfigCtrl.reportDetails.includeClosingBalances"
required="true">
disable="ReportConfigCtrl.reportDetails.includeClosingBalances"
required="!ReportConfigCtrl.reportDetails.includeClosingBalances"
ng-show="!ReportConfigCtrl.reportDetails.includeClosingBalances">
</bh-period-selection>

<bh-yes-no-radios
Expand Down

0 comments on commit 322b6dd

Please sign in to comment.