-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implement the rumer report Note: This PR requires the execution of updates in the migrate file closes #5395
- Loading branch information
Showing
14 changed files
with
414 additions
and
4 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
83 changes: 83 additions & 0 deletions
83
client/src/modules/reports/generate/rumer_report/rumer_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,83 @@ | ||
angular.module('bhima.controllers') | ||
.controller('rumer_reportController', rumerReportController); | ||
|
||
rumerReportController.$inject = [ | ||
'$sce', 'NotifyService', 'BaseReportService', 'AppCache', 'reportData', '$state', | ||
'LanguageService', | ||
]; | ||
|
||
function rumerReportController($sce, Notify, SavedReports, AppCache, reportData, $state, Languages) { | ||
const vm = this; | ||
const cache = new AppCache('rumer_report'); | ||
const reportUrl = 'reports/stock/rumer_report'; | ||
|
||
// default values | ||
vm.reportDetails = { | ||
includePurchaseEntry : 1, | ||
}; | ||
vm.previewGenerated = false; | ||
|
||
// check cached configuration | ||
checkCachedConfiguration(); | ||
|
||
vm.onSelectDepot = depot => { | ||
vm.reportDetails.depotUuid = depot.uuid; | ||
vm.reportDetails.depot_text = depot.text; | ||
}; | ||
|
||
vm.onSelectFiscalYear = (fiscalYear) => { | ||
vm.reportDetails.fiscal_id = fiscalYear.id; | ||
vm.reportDetails.fiscalYearStart = fiscalYear.start_date; | ||
}; | ||
|
||
vm.onSelectPeriod = (period) => { | ||
vm.reportDetails.period_id = period.id; | ||
vm.reportDetails.end_date = period.end_date; | ||
vm.reportDetails.start_date = period.start_date; | ||
}; | ||
|
||
vm.clear = key => { | ||
delete vm[key]; | ||
}; | ||
|
||
vm.clearPreview = () => { | ||
vm.previewGenerated = false; | ||
vm.previewResult = null; | ||
}; | ||
|
||
vm.preview = form => { | ||
if (form.$invalid) { | ||
return 0; | ||
} | ||
|
||
// update cached configuration | ||
cache.reportDetails = angular.copy(vm.reportDetails); | ||
angular.extend(vm.reportDetails, { lang : Languages.key }); | ||
|
||
return SavedReports.requestPreview(reportUrl, reportData.id, angular.copy(vm.reportDetails)) | ||
.then((result) => { | ||
vm.previewGenerated = true; | ||
vm.previewResult = $sce.trustAsHtml(result); | ||
}) | ||
.catch(Notify.handleError); | ||
}; | ||
|
||
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() { | ||
vm.reportDetails = angular.copy(cache.reportDetails || {}); | ||
} | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
client/src/modules/reports/generate/rumer_report/rumer_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,63 @@ | ||
<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 translate>REPORT.RUMER.TITLE</h3> | ||
<p class="text-info" translate>REPORT.RUMER.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 autocomplete="off"> | ||
|
||
<!-- select depot --> | ||
<bh-depot-select | ||
depot-uuid="ReportConfigCtrl.reportDetails.depotUuid" | ||
on-select-callback="ReportConfigCtrl.onSelectDepot(depot)" | ||
required="true"> | ||
</bh-depot-select> | ||
|
||
<bh-fiscal-year-select | ||
fiscal-id="ReportConfigCtrl.reportDetails.fiscal_id" | ||
on-select-fiscal-callback="ReportConfigCtrl.onSelectFiscalYear(fiscalYear)"> | ||
</bh-fiscal-year-select> | ||
|
||
<bh-period-selection | ||
fiscal-year-id="ReportConfigCtrl.reportDetails.fiscal_id" | ||
period-id="ReportConfigCtrl.reportDetails.period_id" | ||
on-select-callback="ReportConfigCtrl.onSelectPeriod(period)"> | ||
</bh-period-selection> | ||
|
||
<!-- <hr> | ||
<bh-yes-no-radios | ||
label="REPORT.RUMER.INCLUDE_OUT_STOCK_ITEMS" | ||
value="ReportConfigCtrl.includeEmptyLot" | ||
name="includeEmptyLot" | ||
help-text="STOCK.INCLUDE_ARTICLES_NOT_IN_STOCK_HELP" | ||
on-change-callback="ReportConfigCtrl.onSelectIncludeEmptyLot(value)"> | ||
</bh-yes-no-radios> --> | ||
|
||
<!-- preview --> | ||
<bh-loading-button loading-state="ConfigForm.$loading"> | ||
<span translate>REPORT.UTIL.PREVIEW</span> | ||
</bh-loading-button> | ||
</form> | ||
</div> | ||
</div> | ||
</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
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,54 @@ | ||
{{> head title="REPORT.MONTHLY_CONSUMPTION.TITLE" }} | ||
|
||
<body class="container-fluid"> | ||
{{> header}} | ||
|
||
<!-- body --> | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<!-- page title --> | ||
<h2 class="text-center text-uppercase"> | ||
{{translate 'REPORT.RUMER.TITLE'}} | ||
</h2> | ||
|
||
<h5 class="text-center">{{translate 'REPORT.RUMER.DESCRIPTION'}}</h5> | ||
|
||
<h3 class="text-center">{{params.depot_text}}</h3> | ||
<p class="text-center">{{date params.start_date}} - {{date params.end_date}}</p> | ||
|
||
<table class="table table-striped table-condensed table-report table-bordered"> | ||
<thead> | ||
<tr style="background-color:#ddd;"> | ||
<th style="min-width:100px;">{{translate 'FORM.LABELS.INVENTORY'}}</th> | ||
<th class="text-center"> {{translate 'REPORT.RUMER.STOCK_BEGINNING'}} </th> | ||
<th class="text-center"> {{translate 'REPORT.RUMER.TOTAL_ENTRIES'}} </th> | ||
{{#each header as | key |}} | ||
<th style="min-width:20px;" class="text-center">{{key}}</th> | ||
{{/each}} | ||
<th style="width: 7.5%;" class="text-center">{{translate 'FORM.LABELS.TOTAL'}} </th> | ||
<th style="width: 7.5%;" class="text-center">{{translate 'REPORT.RUMER.STOCK_END'}}</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
{{#each configurationData}} | ||
<tr> | ||
<td> {{ inventoryText }} </td> | ||
<td><strong> {{ quantityOpening }} </strong></td> | ||
<td> {{ quantityTotalEntry }} </td> | ||
{{#each dailyConsumption }} | ||
<td class="text-right"> | ||
{{#if value}} | ||
{{ value }} | ||
{{/if}} | ||
</td> | ||
{{/each}} | ||
<td><strong> {{ quantityTotalExit }} </strong></td> | ||
<td><strong> {{ quantityEnding }} </strong></td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</body> |
Oops, something went wrong.