forked from IMA-WorldHealth/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.
chore(cashflow): complete by service clientside
This commit completes the cashflow by service clientside report. It only gives the possibility to select a date range. TODOs: 1. Select a particular cashbox.
- Loading branch information
Showing
6 changed files
with
101 additions
and
16 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
47 changes: 47 additions & 0 deletions
47
client/src/partials/reports/modals/cashflowByService.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,47 @@ | ||
angular.module('bhima.controllers') | ||
.controller('cashflowByServiceController', CashflowByServiceConfigController); | ||
|
||
CashflowByServiceConfigController.$inject = [ | ||
'$state', '$http', '$uibModalInstance', 'NotifyService', 'LanguageService', 'reportDetails' | ||
]; | ||
|
||
/** | ||
* CashflowByService | ||
* | ||
* @description | ||
* This controller is responsible of Aged Debtors report, that report include | ||
* all incomes minus all depenses | ||
*/ | ||
function CashflowByServiceConfigController($state, $http, ModalInstance, Notify, Languages, reportDetails) { | ||
var vm = this; | ||
|
||
// expose to the view | ||
vm.generate = requestPDF; | ||
vm.cancel = ModalInstance.dismiss; | ||
vm.report = reportDetails; | ||
|
||
vm.date = new Date(); | ||
|
||
function requestPDF(form) { | ||
if (form.$invalid) { return; } | ||
|
||
var url = 'reports/finance/cashflow/services'; | ||
|
||
var pdfParams = { | ||
reportId : vm.report.id, | ||
label : vm.label, | ||
dateFrom : vm.dateFrom, | ||
dateTo : vm.dateTo, | ||
lang : Languages.key, | ||
renderer : 'pdf', | ||
saveReport : true | ||
}; | ||
|
||
return $http.get(url, { params : pdfParams }) | ||
.then(function (result) { | ||
ModalInstance.dismiss(); | ||
$state.reload(); | ||
}) | ||
.catch(Notify.handleError); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
client/src/partials/reports/modals/cashflowByService.modal.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,36 @@ | ||
<div class="modal-header"> | ||
<ol class="headercrumb"> | ||
<li class="title" translate>{{ ReportConfigCtrl.report.title_key }}</li> | ||
<span class="badge badge-success text-uppercase" translate>FORM.LABELS.CREATE</span> | ||
</ol> | ||
</div> | ||
|
||
<form name="ConfigForm" bh-submit="ReportConfigCtrl.generate(ConfigForm)" bh-form-defaults novalidate> | ||
<div class="modal-body"> | ||
<div class="form-group" | ||
ng-class="{ 'has-error' : ConfigForm.$submitted && ConfigForm.label.$invalid }"> | ||
<label class="control-label" translate>FORM.LABELS.LABEL</label> | ||
<input class="form-control" name="label" ng-model="ReportConfigCtrl.label" required /> | ||
<div class="help-block" ng-messages="ConfigForm.label.$error" ng-show="ConfigForm.$submitted"> | ||
<div ng-messages-include="partials/templates/messages.tmpl.html"></div> | ||
</div> | ||
</div> | ||
|
||
<!-- date interval --> | ||
<bh-date-interval | ||
date-from="ReportConfigCtrl.dateFrom" | ||
date-to="ReportConfigCtrl.dateTo" | ||
required="true"> | ||
</bh-date-interval> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" ng-click="ReportConfigCtrl.cancel()" data-method="cancel"> | ||
<span translate>FORM.BUTTONS.CANCEL</span> | ||
</button> | ||
|
||
<bh-loading-button loading-state="ConfigForm.$loading" ng-disabled="ConfigForm.$invalid"> | ||
<span translate>FORM.BUTTONS.GENERATE</span> | ||
</bh-loading-button> | ||
</div> | ||
</form> |
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