Skip to content

Commit

Permalink
chore(cashflow): complete by service clientside
Browse files Browse the repository at this point in the history
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
Jonathan Niles authored and sfount committed Feb 1, 2017
1 parent 0c65b81 commit 78620a9
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 16 deletions.
3 changes: 2 additions & 1 deletion client/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,8 @@
},
"CASH_EXPENSE" : "Expenses",
"CASH_INCOME" : "Incomes",
"CASHFLOW" : "Cashflow",
"CASHFLOW_BY_SERVICE" : "Cashflow By Service",
"CHART_OF_ACCOUNTS" : "Chart of Accounts",
"CLOSING_BALANCE" : "Closing Balance",
"CONFIGURATION" : "Report Configuration",
Expand Down Expand Up @@ -1442,7 +1444,6 @@
"BALANCE" : "Balance",
"BILLING_SERVICES" : "Billing Services",
"CASHBOX_MANAGEMENT" : "Cashbox Management",
"CASHFLOW" : "Cashflow",
"CASH_PAYMENT_REGISTRY" : "Cash Payment Registry",
"CASH_WINDOW" : "Cash Window",
"COMPLEX_JOURNAL_VOUCHER" : "Journal Vouchers",
Expand Down
3 changes: 2 additions & 1 deletion client/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,8 @@
},
"CASH_EXPENSE" : "Depenses",
"CASH_INCOME" : "Recettes",
"CASHFLOW" : "Cashflow",
"CASHFLOW_BY_SERVICE" : "Cashflow par Service",
"CHART_OF_ACCOUNTS": "Plan Comptable",
"CLOSING_BALANCE" : "Balance à la cloture",
"CONFIGURATION" : "Configuration rapport",
Expand Down Expand Up @@ -1463,7 +1465,6 @@
"BALANCE" : "Balance",
"BILLING_SERVICES" : "Services de facturation",
"CASHBOX_MANAGEMENT" : "Caisses et Banques",
"CASHFLOW" : "Cashflow",
"CASH_PAYMENT_REGISTRY" : "Registre des paiements",
"CASH_WINDOW" : "Paiements",
"COMPLEX_JOURNAL_VOUCHER" : "Ajout de transactions",
Expand Down
17 changes: 8 additions & 9 deletions client/src/partials/reports/modals/cashflow.modal.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="modal-header">
<ol class="headercrumb">
<li class="title">
{{ ReportConfigCtrl.report.title_key | translate }}
<span class="badge badge-success text-uppercase">{{ "FORM.LABELS.CREATE" | translate }}</span>
<span translate> {{ ReportConfigCtrl.report.title_key }}</span>
<span class="badge badge-success text-uppercase" translate>FORM.LABELS.CREATE</span>
</li>
</ol>
</div>
Expand All @@ -12,9 +12,8 @@

<div class="form-group"
ng-class="{ 'has-error' : ConfigForm.$submitted && ConfigForm.label.$invalid }">
<label class="control-label">{{ "FORM.LABELS.LABEL" | translate }}</label>
<label class="control-label" translate>FORM.LABELS.LABEL</label>
<input class="form-control" id="label" name="label" ng-model="ReportConfigCtrl.label" autocomplete="off" 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>
Expand All @@ -31,23 +30,23 @@
<div class="checkbox">
<label>
<input type="checkbox" name="weekly" ng-model="ReportConfigCtrl.weekly" ng-true-value="1" ng-false-value="0">
{{ 'FORM.LABELS.WEEKLY_REPORT' | translate }}
<span translate>FORM.LABELS.WEEKLY_REPORT</span>
</label>
</div>

<!-- cashbox selection -->
<div class="form-group"
ng-class="{ 'has-error' : ConfigForm.$submitted && ConfigForm.cashbox.$invalid }">
<label class="control-label">
<span class="fa fa-briefcase"></span> {{ 'FORM.SELECT.CASHBOX' | translate }}
<span class="fa fa-briefcase"></span> <span translate>FORM.SELECT.CASHBOX</span>
</label>
<select
class="form-control"
name="cashbox"
ng-model="ReportConfigCtrl.cashbox"
ng-options="cash as cash.hrlabel for cash in ReportConfigCtrl.cashboxes track by cash.id"
required>
<option value="" disabled>{{ 'FORM.SELECT.CASHBOX' | translate }}</option>
<option value="" disabled translate>FORM.SELECT.CASHBOX</option>
</select>
<div class="help-block" ng-messages="ConfigForm.cashbox.$error" ng-show="ConfigForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
Expand All @@ -61,11 +60,11 @@
class="btn btn-default"
ng-click="ReportConfigCtrl.cancel()"
data-method="cancel">
{{ "FORM.BUTTONS.CANCEL" | translate }}
<span translate>FORM.BUTTONS.CANCEL</span>
</button>

<bh-loading-button loading-state="ConfigForm.$loading">
{{ "FORM.BUTTONS.GENERATE" | translate }}
<span translate>FORM.BUTTONS.GENERATE</span>
</bh-loading-button>
</div>
</form>
47 changes: 47 additions & 0 deletions client/src/partials/reports/modals/cashflowByService.config.js
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 client/src/partials/reports/modals/cashflowByService.modal.html
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>
11 changes: 6 additions & 5 deletions server/models/bhima.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ INSERT INTO unit VALUES
(142, 'Purchase Orders', 'TREE.PURCHASING', 'This module is responsible for creating purchase orders', 138, '/partials/purchases/create', '/purchases/create'),
(143, 'Transaction Type Module', 'TREE.TRANSACTION_TYPE', 'This module is responsible for managing transaction type', 1, '/partials/admin/transaction_type', '/admin/transaction_type'),
(144, 'Reports (Finance)', 'TREE.REPORTS', 'A folder holding all finance reports', 0, '/partials/finance/reports', '/finance/reports'),
(145, 'Cashflow', 'TREE.CASHFLOW', 'The Cashflow Report', 144, '/partials/finance/cashflow', '/reports/cashflow'),
(145, 'Cashflow', 'REPORT.CASHFLOW', 'The Cashflow Report', 144, '/partials/finance/cashflow', '/reports/cashflow'),
(148, 'Chart of Accounts', 'REPORT.CHART_OF_ACCOUNTS', 'The COA Report', 144, '/partials/finance/chart_of_accounts', '/reports/accounts_chart'),
(146, 'Creditor Groups Management', 'TREE.CREDITOR_GROUP', 'Creditor Groups Management module', 1, '/partials/admin/creditor_groups/', '/admin/creditor_groups'),
(147, 'Cash Payment Registry', 'TREE.CASH_PAYMENT_REGISTRY', 'Cash Payment Registry', 5, '/partials/cash/payments/registry', '/payments'),
(149, 'Income Expenses', 'TREE.INCOME_EXPENSE', 'The Report of income and expenses', 144, '/partials/finance/income_expense', '/reports/income_expense'),
(150, 'Balance Report', 'TREE.BALANCE', 'Balance report module', 144, 'null', '/reports/balance'),
(151, 'Customer Debts', 'TREE.CUSTOMER_DEBTS', 'Customer Debts', 144, '/partials/finance/reports/agedDebtors', '/reports/agedDebtors'),
(152, 'Report accounts', 'TREE.REPORT_ACCOUNTS', 'The Report accounts', 144, '/partials/finance/report_accounts', '/reports/report_accounts');
(152, 'Report accounts', 'TREE.REPORT_ACCOUNTS', 'The Report accounts', 144, '/partials/finance/report_accounts', '/reports/report_accounts'),
(153, 'Report Cashflow by Service', 'REPORT.CASHFLOW_BY_SERVICE', 'CashflowByService', 144, '/partials/finance/cashflow/services', '/reports/cashflowByService');

-- Reserved system account type
INSERT INTO `account_type` VALUES
Expand All @@ -61,13 +62,13 @@ INSERT INTO `account_type` VALUES

-- core BHIMA reports
INSERT INTO `report` (`id`, `report_key`, `title_key`) VALUES
(1, 'cashflow', 'TREE.CASHFLOW'),
(1, 'cashflow', 'REPORT.CASHFLOW'),
(2, 'accounts_chart', 'REPORT.CHART_OF_ACCOUNTS'),
(3, 'income_expense', 'REPORT.INCOME_EXPENSE'),
(4, 'balance', 'REPORT.BALANCE'),
(5, 'agedDebtors', 'TREE.CUSTOMER_DEBTS'),
(6, 'report_accounts', 'REPORT.REPORT_ACCOUNTS');

(6, 'report_accounts', 'REPORT.REPORT_ACCOUNTS'),
(7, 'cashflowByService', 'REPORT.CASHFLOW_BY_SERVICE');

-- Supported Languages
INSERT INTO `language` VALUES
Expand Down

0 comments on commit 78620a9

Please sign in to comment.