fix: financial reports i18n

This commit is contained in:
Ahmed Bouhuolia
2025-05-11 17:26:55 +02:00
parent c10cad4256
commit 0c9d961272
19 changed files with 277 additions and 18 deletions

View File

@@ -83,7 +83,6 @@ export class CashFlowStatement extends R.pipe(
this.initDateRangeCollection();
}
// --------------------------------------------
// # NET INCOME NODE
// --------------------------------------------
@@ -228,11 +227,13 @@ export class CashFlowStatement extends R.pipe(
const accountsTotal = this.getAccountsMetaTotal(accounts);
const total = this.getTotalAmountMeta(accountsTotal);
console.log(sectionSchema.label, 'label');
const node = {
sectionType: ICashFlowStatementSectionType.ACCOUNTS,
id: sectionSchema.id,
label: this.i18n.t(sectionSchema.label),
footerLabel: this.i18n.t(sectionSchema.footerLabel),
label: sectionSchema.label,
footerLabel: sectionSchema.footerLabel,
children: accounts,
total,
};
@@ -254,7 +255,7 @@ export class CashFlowStatement extends R.pipe(
(type: string, section: ICashFlowSchemaSection): boolean => {
return type === section.sectionType;
},
);
);
// --------------------------------------------
// # AGGREGATE NODE

View File

@@ -1,17 +1,17 @@
import { Injectable } from '@nestjs/common';
import { ModelObject } from 'objection';
import * as R from 'ramda';
import { I18nService } from 'nestjs-i18n';
import {
ICashFlowStatementQuery,
ICashFlowStatementDOO,
} from './Cashflow.types';
import { CashFlowStatement } from './CashFlow';
import { CashflowSheetMeta } from './CashflowSheetMeta';
import { Injectable } from '@nestjs/common';
import { CashFlowRepository } from './CashFlowRepository';
import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service';
import { Ledger } from '@/modules/Ledger/Ledger';
import { AccountTransaction } from '@/modules/Accounts/models/AccountTransaction.model';
import { I18nService } from 'nestjs-i18n';
import { getDefaultCashflowQuery } from './constants';
@Injectable()

View File

@@ -8,17 +8,17 @@ import {
export const CASH_FLOW_SCHEMA = [
{
id: CASH_FLOW_SECTION_ID.OPERATING,
label: 'OPERATING ACTIVITIES',
label: 'cash_flow_statement.operating_activities',
sectionType: ICashFlowStatementSectionType.AGGREGATE,
children: [
{
id: CASH_FLOW_SECTION_ID.NET_INCOME,
label: 'Net income',
label: 'cash_flow_statement.net_income',
sectionType: ICashFlowStatementSectionType.NET_INCOME,
},
{
id: CASH_FLOW_SECTION_ID.OPERATING_ACCOUNTS,
label: 'Adjustments net income by operating activities.',
label: 'cash_flow_statement.operating_accounts',
sectionType: ICashFlowStatementSectionType.ACCOUNTS,
accountsRelations: [
{ type: ACCOUNT_TYPE.ACCOUNTS_RECEIVABLE, direction: 'mines' },
@@ -34,29 +34,29 @@ export const CASH_FLOW_SCHEMA = [
showAlways: true,
},
],
footerLabel: 'Net cash provided by operating activities',
footerLabel: 'cash_flow_statement.net_cash_operating',
},
{
id: CASH_FLOW_SECTION_ID.INVESTMENT,
sectionType: ICashFlowStatementSectionType.ACCOUNTS,
label: 'INVESTMENT ACTIVITIES',
label: 'cash_flow_statement.investment_activities',
accountsRelations: [{ type: ACCOUNT_TYPE.FIXED_ASSET, direction: 'mines' }],
footerLabel: 'Net cash provided by investing activities',
footerLabel: 'cash_flow_statement.net_cash_investing',
},
{
id: CASH_FLOW_SECTION_ID.FINANCIAL,
label: 'FINANCIAL ACTIVITIES',
label: 'cash_flow_statement.financial_activities',
sectionType: ICashFlowStatementSectionType.ACCOUNTS,
accountsRelations: [
{ type: ACCOUNT_TYPE.LOGN_TERM_LIABILITY, direction: 'plus' },
{ type: ACCOUNT_TYPE.EQUITY, direction: 'plus' },
],
footerLabel: 'Net cash provided by financing activities',
footerLabel: 'cash_flow_statement.net_cash_financing',
},
{
id: CASH_FLOW_SECTION_ID.CASH_BEGINNING_PERIOD,
sectionType: ICashFlowStatementSectionType.CASH_AT_BEGINNING,
label: 'Cash at beginning of period',
label: 'cash_flow_statement.cash_beginning_period',
accountsRelations: [
{ type: ACCOUNT_TYPE.CASH, direction: 'plus' },
{ type: ACCOUNT_TYPE.BANK, direction: 'plus' },
@@ -66,11 +66,11 @@ export const CASH_FLOW_SCHEMA = [
id: CASH_FLOW_SECTION_ID.NET_CASH_INCREASE,
sectionType: ICashFlowStatementSectionType.TOTAL,
equation: 'OPERATING + INVESTMENT + FINANCIAL',
label: 'NET CASH INCREASE FOR PERIOD',
label: 'cash_flow_statement.net_cash_increase',
},
{
id: CASH_FLOW_SECTION_ID.CASH_END_PERIOD,
label: 'CASH AT END OF PERIOD',
label: 'cash_flow_statement.cash_end_period',
sectionType: ICashFlowStatementSectionType.TOTAL,
equation: 'NET_CASH_INCREASE + CASH_BEGINNING_PERIOD',
},

View File

@@ -1,3 +1,5 @@
import * as moment from 'moment';
export const getSalesByItemsDefaultQuery = () => {
return {
fromDate: moment().startOf('month').format('YYYY-MM-DD'),