forked from Third-Culture-Software/bhima
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implementation of the budget report, allowing the selection of the fiscal year and the number of previous years for result analysis. - Retrieving the values for the periods, excluding period 0, the closing period 13, as well as hidden and blocked accounts. - Correction of the restriction during the compilation of securities accounts for non-budgeted accounts. closes Third-Culture-Software#7683
- Loading branch information
Showing
16 changed files
with
677 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
client/src/modules/reports/generate/budget_report/budget_report.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
angular.module('bhima.controllers') | ||
.controller('budget_reportController', BudgetReportController); | ||
|
||
BudgetReportController.$inject = [ | ||
'$sce', 'NotifyService', 'BaseReportService', 'AppCache', 'reportData', '$state', 'SessionService', | ||
]; | ||
|
||
function BudgetReportController($sce, Notify, SavedReports, AppCache, reportData, $state, Session) { | ||
const vm = this; | ||
const cache = new AppCache('configure_budget_report'); | ||
const reportUrl = 'reports/finance/budget_report'; | ||
|
||
vm.reportDetails = { | ||
currency_id : Session.enterprise.currency_id, | ||
set_number_year : 1, | ||
filter : 'default', | ||
}; | ||
|
||
vm.previewGenerated = false; | ||
checkCachedConfiguration(); | ||
|
||
vm.onSelectFiscalYear = (fiscalYear) => { | ||
vm.reportDetails.fiscal_id = fiscalYear.id; | ||
}; | ||
|
||
vm.onSelectCurrency = (currency) => { | ||
vm.reportDetails.currency_id = currency.id; | ||
}; | ||
|
||
vm.onSelectCronReport = report => { | ||
vm.reportDetails = angular.copy(report); | ||
}; | ||
|
||
vm.numberYears = [ | ||
{ id : 1 }, { id : 2 }, { id : 3 }, { id : 4 }, { id : 5 }, | ||
]; | ||
|
||
vm.preview = function preview(form) { | ||
if (form.$invalid) { return null; } | ||
|
||
// update cached configuration | ||
cache.reportDetails = angular.copy(vm.reportDetails); | ||
|
||
return SavedReports.requestPreview(reportUrl, reportData.id, angular.copy(vm.reportDetails)) | ||
.then((result) => { | ||
vm.previewGenerated = true; | ||
vm.previewResult = $sce.trustAsHtml(result); | ||
}) | ||
.catch(Notify.handleError); | ||
}; | ||
|
||
vm.clearPreview = function clearPreview() { | ||
vm.previewGenerated = false; | ||
vm.previewResult = null; | ||
}; | ||
|
||
vm.clear = (value) => { | ||
delete vm.reportDetails[value]; | ||
}; | ||
|
||
vm.filterBudget = [ | ||
{ value : 'default', label : 'REPORT.BUDGET_REPORT.DISPLAY_ALL_ACCOUNTS' }, | ||
{ value : 'hide_title', label : 'REPORT.BUDGET_REPORT.HIDE_TITLE_ACCOUNT' }, | ||
{ value : 'show_title', label : 'REPORT.BUDGET_REPORT.SHOW_ONLY_TITLE_ACCOUNT' }, | ||
]; | ||
|
||
vm.requestSaveAs = function requestSaveAs() { | ||
|
||
const options = { | ||
url : reportUrl, | ||
report : reportData, | ||
reportOptions : angular.copy(vm.reportDetails), | ||
}; | ||
|
||
return SavedReports.saveAsModal(options) | ||
.then(() => { | ||
$state.go('reportsBase.reportsArchive', { key : options.report.report_key }); | ||
}) | ||
.catch(Notify.handleError); | ||
}; | ||
|
||
function checkCachedConfiguration() { | ||
if (cache.reportDetails) { | ||
vm.reportDetails = angular.copy(cache.reportDetails); | ||
} | ||
vm.reportDetails.type = 1; | ||
} | ||
} |
96 changes: 96 additions & 0 deletions
96
client/src/modules/reports/generate/budget_report/budget_report.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<bh-report-preview | ||
ng-if="ReportConfigCtrl.previewGenerated" | ||
source-document="ReportConfigCtrl.previewResult" | ||
on-clear-callback="ReportConfigCtrl.clearPreview()" | ||
on-save-callback="ReportConfigCtrl.requestSaveAs()"> | ||
</bh-report-preview> | ||
|
||
<div ng-show="!ReportConfigCtrl.previewGenerated"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h3 class="text-capitalize" translate>REPORT.BUDGET_REPORT.TITLE</h3> | ||
<p class="text-info" translate>REPORT.BUDGET_REPORT.DESCRIPTION</p> | ||
</div> | ||
</div> | ||
|
||
<div class="row" style="margin-top : 10px"> | ||
<div class="col-md-6"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<span translate>REPORT.UTIL.OPTIONS</span> | ||
</div> | ||
|
||
<div class="panel-body"> | ||
<form name="ConfigForm" bh-submit="ReportConfigCtrl.preview(ConfigForm)" novalidate> | ||
<bh-fiscal-year-select | ||
fiscal-id="ReportConfigCtrl.reportDetails.fiscal_id" | ||
on-select-fiscal-callback="ReportConfigCtrl.onSelectFiscalYear(fiscalYear)" | ||
required="true"> | ||
</bh-fiscal-year-select> | ||
|
||
<div class="form-group" ng-class="{'has-error' : ConfigForm.set_number_year.$invalid && ConfigForm.$submitted}"> | ||
<label class="control-label" translate>REPORT.BUDGET_REPORT.SET_NUMBER_YEAR</label> | ||
<bh-clear on-clear="ReportConfigCtrl.clear('id')"></bh-clear> | ||
<ui-select | ||
name="set_number_year" | ||
ng-model="ReportConfigCtrl.reportDetails.set_number_year"> | ||
|
||
<ui-select-match placeholder="{{ 'REPORT.BUDGET_REPORT.MAX_5_YEAR' | translate }}"> | ||
<span>{{$select.selected.id}}</span> | ||
</ui-select-match> | ||
|
||
<ui-select-choices repeat="year.id as year in ReportConfigCtrl.numberYears | filter:{id: $select.search}"> | ||
<strong ng-bind-html="year.id | highlight:$select.search"></strong> | ||
</ui-select-choices> | ||
</ui-select> | ||
<div class="help-block" ng-messages="ConfigForm.id.$error" ng-show="ConfigForm.$submitted"> | ||
<div ng-messages-include="modules/templates/messages.tmpl.html"></div> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group" ng-class="{ 'has-error' : ConfigForm.$submitted && ConfigForm.budgetFilter.$invalid }"> | ||
<div ng-repeat="budgetFilter in ReportConfigCtrl.filterBudget" class="radio"> | ||
<label> | ||
<input | ||
name="filter" | ||
type="radio" | ||
ng-model="ReportConfigCtrl.reportDetails.filter" | ||
ng-value="budgetFilter.value" | ||
data-report-format-option="{{ budgetFilter.value }}" | ||
required> | ||
<span translate>{{budgetFilter.label}}</span> | ||
</label> | ||
</div> | ||
|
||
<div class="help-block" ng-messages="ConfigForm.filter.$error" ng-show="ConfigForm.$submitted"> | ||
<div ng-messages-include="modules/templates/messages.tmpl.html"></div> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="checkbox"> | ||
<label> | ||
<input type="checkbox" ng-model="ReportConfigCtrl.reportDetails.hide_unused" ng-true-value="1" ng-false-value="0"> | ||
<span translate>REPORT.BUDGET_REPORT.HIDE_UNUSED_ACCOUNTS</span> | ||
</label> | ||
</div> | ||
</div> | ||
|
||
<bh-loading-button loading-state="ConfigForm.$loading"> | ||
<span translate>REPORT.UTIL.PREVIEW</span> | ||
</bh-loading-button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-md-6"> | ||
<bh-cron-email-report | ||
report-key="operating" | ||
report-form="ConfigForm" | ||
report-details="ReportConfigCtrl.reportDetails" | ||
on-select-report="ReportConfigCtrl.onSelectCronReport(report)"> | ||
</bh-cron-email-report> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.