Skip to content

Commit

Permalink
Merge pull request #7739 from lomamech/cashflow_synthetic_by_transact…
Browse files Browse the repository at this point in the history
…ion_type

feature : Cashflow report improvement

All tests pass.
  • Loading branch information
jmcameron authored Oct 7, 2024
2 parents ae033ec + 9af88a5 commit 7359bb7
Show file tree
Hide file tree
Showing 18 changed files with 953 additions and 64 deletions.
7 changes: 7 additions & 0 deletions client/src/i18n/en/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@
},
"INFO": {
"ADD_FUNCTION": "Add a function",
"ANALYSIS_ASSOCIATED_ACCOUNTS": "Analysis of associated accounts",
"ANALYSIS_CASH_ACCOUNTS": "Analysis of cash accounts",
"ANALYSIS_TRANSACTION_TYPES": "Analysis of transaction types",
"ASSIGNED_COST_CENTER" : "Assigned cost references",
"ASSIGNED_PROFIT_CENTER" : "Assigned profit references",
"ASSIGNED_PROJECT" : "Assigned to project",
Expand Down Expand Up @@ -193,6 +196,7 @@
"FINANCIAL_DETAIL": "Financial details",
"FIXED_INFO":"This value is fixed and cannot be updated",
"FOUND": "Found",
"GLOBAL_ANALYSIS_ACCOUNT_GROUPING": "Global Account Grouping Analysis",
"GRID_STATE_SUCCESS": "Grid settings saved",
"GROUPS_DEBTOR": "Assign a new debtor group from the options below. Press 'confirm' to permanently update the patient's debtor group",
"GROUPS_PATIENT": "Assign the patient to patient groups from the options below. Press 'confirm' to permanently update the patient's subscribed groups.",
Expand Down Expand Up @@ -260,6 +264,7 @@
"SELECT_RELATED_SERVICES": "Select related services",
"SETTING_PAYMENT_CURRENCY": "An employee's payment setup can only be done with the enterprise's currency",
"SHOWING": "Showing",
"SYNTHETIC_ANALYSIS_ACCOUNT_GROUPING": "Synthetic Account Grouping Analysis",
"SUCCESS":"Operation successfully completed",
"SUPPORT_COST": " is paid by:",
"TAG_NUMBERS_TO_GENERATE": "Generates unique tag numbers that you can put on your goods before counting them in your stock",
Expand Down Expand Up @@ -502,6 +507,7 @@
"EXIT": "Exit",
"EXPENSE_ACCOUNT": "Expense Accounts",
"EXPENSE": "Expenses",
"EXPENSE_CASH_FLOW": "Expense Cashflow",
"EXTRACT_EMPLOYEE_STANDING": "Extract of the Employee Standing by Period",
"EXTRACT_EMPLOYEES_STANDING": "Extract of the Employees Standing by Period",
"FAMILY_ALLOWANCES": "Family allowances",
Expand Down Expand Up @@ -548,6 +554,7 @@
"INCLUDE_ZEROES": "Include lines with zero values",
"INCOME_EXPENSE": "Income and Expenses",
"INCOME": "Income",
"INCOME_CASH_FLOW": "Income Cashflow",
"INCOMPLETE": "incomplete",
"INCREASE": "Increase",
"INDICATOR_HOSPITALIZATION" : "Indicator's hospitalization",
Expand Down
9 changes: 8 additions & 1 deletion client/src/i18n/en/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,21 @@
},
"CASHFLOW": {
"TITLE": "Cash Flow Physical Report",
"CASH_BALANCE": "Cash balance",
"DESCRIPTION": "This report shows changes in the accounts and revenues of the balance sheet on cash",
"OPERATION": "Operation",
"INCOMES": "Income",
"EXPENSES": "Expenses",
"GLOBAL_ANALYSIS_ACCOUNT_GROUPING": "Global Account Grouping Analysis",
"NOT_REFERENCED": "Not referenced",
"OTHERS": "Others",
"TRANSFER": "Transfers",
"IN": "In",
"CONCERNED_ACCOUNT": "This report concerns these accounts"
"CONCERNED_ACCOUNT": "This report concerns these accounts",
"SYNTHETIC_ANALYSIS_ACCOUNT_GROUPING": "Synthetic Account Grouping Analysis",
"TOTAL": "Total",
"TOTAL_EXPENSE": "Total expense",
"TOTAL_INCOME": "Total income"
},
"CASH_INCOME": "Income",
"CHART_OF_ACCOUNTS": "Chart of Accounts",
Expand Down
7 changes: 7 additions & 0 deletions client/src/i18n/fr/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@
},
"INFO": {
"ADD_FUNCTION": "Ajouter une fonction",
"ANALYSIS_ASSOCIATED_ACCOUNTS": "Analyse des comptes associés",
"ANALYSIS_CASH_ACCOUNTS": "Analyse des comptes caisses",
"ANALYSIS_TRANSACTION_TYPES": "Analyse des types des transactions",
"ASSIGNED_COST_CENTER" : "Assigné les references des coûts",
"ASSIGNED_PROFIT_CENTER" : "Assigné les references des profits",
"ASSIGNED_PROJECT" : "Assignée à un projet",
Expand Down Expand Up @@ -193,6 +196,7 @@
"FINANCIAL_DETAIL": "Détails financieres",
"FIXED_INFO":"Cette valeur est fixée, vous ne pouvez pas la modifier",
"FOUND": "Trouvée",
"GLOBAL_ANALYSIS_ACCOUNT_GROUPING": "Analyse Globale de regroupement des comptes",
"GRID_STATE_SUCCESS": "Enregistrement avec succès",
"GROUPS_DEBTOR": "Attribuez un nouveau Groupe Débiteur parmi les options ci-dessous. Appuyez sur 'confirmer' pour une mise à jour permanente du Groupe Débiteur du patient",
"GROUPS_PATIENT": "Attribuer le patient à des groupes parmi les options ci-dessous. Appuyez sur 'confirmer' pour une mise à jour permanente des groupes souscrites du patient.",
Expand Down Expand Up @@ -259,6 +263,7 @@
"SELECT_LOCATION_CONSIDER": "Sélectionnez la localisation à considérer",
"SELECT_RELATED_SERVICES": "Sélectionner les services liées",
"SETTING_PAYMENT_CURRENCY": "La configuration du paiement d'un employé ne peut s'effectuer qu'avec la monnaie de l'entreprise",
"SYNTHETIC_ANALYSIS_ACCOUNT_GROUPING": "Analyse synthétique de regroupement des comptes",
"SHOWING": "Aperçue",
"SUCCESS":"Opération realisée avec succès",
"SUPPORT_COST": " est prise en charge par",
Expand Down Expand Up @@ -505,6 +510,7 @@
"EXIT": "Sorties",
"EXPENSE_ACCOUNT": "Comptes de charges",
"EXPENSE": "Charges",
"EXPENSE_CASH_FLOW": "Dépenses flux de trésorerie",
"EXTRACT_EMPLOYEE_STANDING": "Extrait de la situation financière de l'employé pour la période",
"EXTRACT_EMPLOYEES_STANDING": "Extrait de la situation financière des employés pour la période",
"FAMILY_ALLOWANCES": "Allocations Familiales",
Expand Down Expand Up @@ -551,6 +557,7 @@
"INCLUDE_ZEROES": "Inclure des lignes avec des valeurs zéro",
"INCOME_EXPENSE": "Recettes et dépenses",
"INCOME": "Recettes",
"INCOME_CASH_FLOW": "Recettes flux de trésorerie",
"INCOMPLETE": "incomplet",
"INCREASE": "Augmentation",
"INDICATOR_HOSPITALIZATION" : "Indicateur d'Hospitalisation",
Expand Down
9 changes: 8 additions & 1 deletion client/src/i18n/fr/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,21 @@
},
"CASHFLOW" : {
"TITLE" : "Rapports de flux de trésorerie physique",
"CASH_BALANCE": "Solde",
"DESCRIPTION" : "Ce rapport affiche les variations des comptes et des revenus du bilan sur la trésorerie",
"OPERATION" : "Opération",
"INCOMES" : "Recettes",
"EXPENSES" : "Dépenses",
"GLOBAL_ANALYSIS_ACCOUNT_GROUPING": "Analyse Globale de regroupement des comptes",
"TRANSFER" : "Transferts",
"OTHERS": "Autres",
"NOT_REFERENCED": "Non référencé",
"IN" : "En",
"CONCERNED_ACCOUNT" : "Ce rapport concerne les comptes suivants"
"CONCERNED_ACCOUNT" : "Ce rapport concerne les comptes suivants",
"SYNTHETIC_ANALYSIS_ACCOUNT_GROUPING": "Analyse synthétique de regroupement des comptes",
"TOTAL": "Total",
"TOTAL_EXPENSE": "Total des dépenses",
"TOTAL_INCOME": "Total des récettes"
},
"CASH_INCOME" : "Recettes",
"CHART_OF_ACCOUNTS" : "Plan Comptable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ function CashFlowConfigController($sce, Notify, SavedReports, AppCache, reportDa
vm.previewResult = null;
};

vm.reportDetails.modeReport = 'cash_accounts';

vm.onSelectCronReport = report => {
vm.reportDetails = angular.copy(report);
};

vm.onSelectMode = function onSelectMode(modeReport) {
vm.reportDetails.modeReport = modeReport;
};

vm.requestSaveAs = function requestSaveAs() {
const options = {
url : reportUrl,
Expand Down
78 changes: 72 additions & 6 deletions client/src/modules/reports/generate/cashflow/cashflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,79 @@ <h3 class="text-capitalize" translate>REPORT.CASHFLOW.TITLE</h3>
required="true">
</bh-multiple-cashbox-select>

<div class="checkbox">
<label>
<input type="checkbox" ng-model="ReportConfigCtrl.reportDetails.detailed" ng-true-value="1" ng-false-value="0">
<span translate>FORM.INFO.DETAILED_REPORT</span>
</label>
<div class="panel-body">
<div class="radio">
<label class="radio-inline">
<input
type="radio"
name="modeReport"
value="cash_accounts"
ng-model="ReportConfigCtrl.reportDetails.modeReport"
ng-click="ReportConfigCtrl.onSelectMode('cash_accounts')"
required>
<span translate>
FORM.INFO.ANALYSIS_CASH_ACCOUNTS
</span>
</label>
</div>
<div class="radio">
<label class="radio-inline">
<input
type="radio"
name="modeReport"
value="associated_account"
ng-model="ReportConfigCtrl.reportDetails.modeReport"
ng-click="ReportConfigCtrl.onSelectMode('associated_account')"
required>
<span translate>
FORM.INFO.ANALYSIS_ASSOCIATED_ACCOUNTS
</span>
</label>
</div>
<div class="radio">
<label class="radio-inline">
<input
type="radio"
name="modeReport"
value="transaction_type"
ng-model="ReportConfigCtrl.reportDetails.modeReport"
ng-click="ReportConfigCtrl.onSelectMode('transaction_type')"
required>
<span translate>
FORM.INFO.ANALYSIS_TRANSACTION_TYPES
</span>
</label>
</div>
<div class="radio">
<label class="radio-inline">
<input
type="radio"
name="modeReport"
value="global_analysis"
ng-model="ReportConfigCtrl.reportDetails.modeReport"
ng-click="ReportConfigCtrl.onSelectMode('global_analysis')"
required>
<span translate>
FORM.INFO.GLOBAL_ANALYSIS_ACCOUNT_GROUPING
</span>
</label>
</div>
<div class="radio">
<label class="radio-inline">
<input
type="radio"
name="modeReport"
value="synthetic_analysis"
ng-model="ReportConfigCtrl.reportDetails.modeReport"
ng-click="ReportConfigCtrl.onSelectMode('synthetic_analysis')"
required>
<span translate>
FORM.INFO.SYNTHETIC_ANALYSIS_ACCOUNT_GROUPING
</span>
</label>
</div>
</div>

<bh-loading-button loading-state="ConfigForm.$loading">
<span translate>REPORT.UTIL.PREVIEW</span>
</bh-loading-button>
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions server/controllers/finance/accounts/accountReferenceType.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function lookupAccountReferenceType(id) {
return db.one(sql, [id]);
}


// Lists
function list(req, res, next) {
const sql = `SELECT id, label, fixed FROM account_reference_type;`;
Expand Down Expand Up @@ -45,7 +44,6 @@ function detail(req, res, next) {
.done();
}


// POST /account_reference_type
function create(req, res, next) {
const sql = `INSERT INTO account_reference_type SET ?`;
Expand All @@ -59,7 +57,6 @@ function create(req, res, next) {
.done();
}


// PUT /account_reference_type /:id
function update(req, res, next) {
if (req.body.id) {
Expand Down
50 changes: 50 additions & 0 deletions server/controllers/finance/accounts/references.compute.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Accounts References Computations
*/
const q = require('q');
const db = require('../../../lib/db');
const FilterParser = require('../../../lib/filter');

Expand Down Expand Up @@ -185,7 +186,56 @@ function getAccountsForReference(abbr, isAmoDep = 0) {
return db.exec(queryAccounts, [abbr, isAmoDep, abbr, isAmoDep]);
}

function getAccountsConfigurationReferences(types) {
const typesFormated = types;

const sqlGetReferenceType = `
SELECT art.id AS reference_type_id, art.label AS reference_type_label
FROM account_reference_type AS art
WHERE art.id IN (?)
ORDER BY art.id ASC;`;

const sqlGetReferenceGroup = `
SELECT ar.id, ar.abbr, ar.description AS referenceGroup, ar.reference_type_id
FROM account_reference AS ar
JOIN account_reference_type AS art ON art.id = ar.reference_type_id
WHERE art.id IN (?)
ORDER BY ar.reference_type_id, ar.description ASC;
`;

const sqlGetReferenceAccount = `
SELECT art.id AS reference_type_id, ar.description, ari.account_id, a.label,
a.number, acc.number AS acc_number, acc.id AS acc_id
FROM account_reference_type AS art
JOIN account_reference AS ar ON ar.reference_type_id = art.id
JOIN account_reference_item AS ari ON ari.account_reference_id = ar.id
JOIN account AS a ON a.id = ari.account_id
JOIN account AS acc ON acc.number LIKE CONCAT(a.number, '%')
WHERE art.id IN (?) AND ari.is_exception = 0 AND acc.type_id <> 6
ORDER BY art.id, ar.id ASC;`;

const sqlGetException = `
SELECT art.id AS reference_type_id, ar.description, ari.account_id, a.label,
a.number, acc.number AS acc_number, acc.id AS acc_id
FROM account_reference_type AS art
JOIN account_reference AS ar ON ar.reference_type_id = art.id
JOIN account_reference_item AS ari ON ari.account_reference_id = ar.id
JOIN account AS a ON a.id = ari.account_id
JOIN account AS acc ON acc.number LIKE CONCAT(a.number, '%')
WHERE art.id IN (?) AND ari.is_exception = 1 AND acc.type_id <> 6
ORDER BY art.id, ar.id ASC;
`;

return q.all([
db.exec(sqlGetReferenceType, [typesFormated]),
db.exec(sqlGetReferenceGroup, [typesFormated]),
db.exec(sqlGetReferenceAccount, [typesFormated]),
db.exec(sqlGetException, [typesFormated]),
]);
}

exports.getAccountsForReference = getAccountsForReference;
exports.computeSingleAccountReference = computeSingleAccountReference;
exports.getValueForReference = getValueForReference;
exports.computeAllAccountReference = computeAllAccountReference;
exports.getAccountsConfigurationReferences = getAccountsConfigurationReferences;
Loading

0 comments on commit 7359bb7

Please sign in to comment.