From a7a0a7fbe76c5e08361fd56b78677e1426f5f621 Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Mon, 13 Apr 2026 17:52:46 +0200 Subject: [PATCH] fix(server): use correct base currency in financial reports Reports (Receivable Aging Summary, Payable Aging Summary, Inventory Valuation, Sales Tax Liability Summary, Vendor Balance Summary) were not assigning baseCurrency from meta in their constructors, causing currency formatting to fall back to USD instead of the organization's base currency. Closes #1069 Co-Authored-By: Claude Opus 4.6 --- .../modules/APAgingSummary/APAgingSummarySheet.ts | 1 + .../modules/ARAgingSummary/ARAgingSummarySheet.ts | 1 + .../FinancialStatements/modules/AgingSummary/AgingSummary.ts | 2 +- .../modules/InventoryValuationSheet/InventoryValuationSheet.ts | 1 + .../SalesTaxLiabilitySummary/SalesTaxLiabilitySummary.ts | 1 + .../modules/VendorBalanceSummary/VendorBalanceSummaryService.ts | 2 +- 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/server/src/modules/FinancialStatements/modules/APAgingSummary/APAgingSummarySheet.ts b/packages/server/src/modules/FinancialStatements/modules/APAgingSummary/APAgingSummarySheet.ts index a4399b980..754d91889 100644 --- a/packages/server/src/modules/FinancialStatements/modules/APAgingSummary/APAgingSummarySheet.ts +++ b/packages/server/src/modules/FinancialStatements/modules/APAgingSummary/APAgingSummarySheet.ts @@ -38,6 +38,7 @@ export class APAgingSummarySheet extends AgingSummaryReport { this.query = query; this.repository = repository; + this.baseCurrency = meta.baseCurrency; this.numberFormat = this.query.numberFormat; this.dateFormat = meta.dateFormat || DEFAULT_REPORT_META.dateFormat; diff --git a/packages/server/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummarySheet.ts b/packages/server/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummarySheet.ts index 1ad382569..e506b4645 100644 --- a/packages/server/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummarySheet.ts +++ b/packages/server/src/modules/FinancialStatements/modules/ARAgingSummary/ARAgingSummarySheet.ts @@ -44,6 +44,7 @@ export class ARAgingSummarySheet extends AgingSummaryReport { this.query = query; this.repository = repository; + this.baseCurrency = meta.baseCurrency; this.numberFormat = this.query.numberFormat; this.dateFormat = meta.dateFormat || DEFAULT_REPORT_META.dateFormat; diff --git a/packages/server/src/modules/FinancialStatements/modules/AgingSummary/AgingSummary.ts b/packages/server/src/modules/FinancialStatements/modules/AgingSummary/AgingSummary.ts index 137de738c..bd44959eb 100644 --- a/packages/server/src/modules/FinancialStatements/modules/AgingSummary/AgingSummary.ts +++ b/packages/server/src/modules/FinancialStatements/modules/AgingSummary/AgingSummary.ts @@ -18,7 +18,7 @@ import { IARAgingSummaryCustomer } from '../ARAgingSummary/ARAgingSummary.types' export abstract class AgingSummaryReport extends AgingReport { readonly contacts: ModelObject[]; readonly agingPeriods: IAgingPeriod[] = []; - readonly baseCurrency: string; + public baseCurrency: string; readonly query: IAgingSummaryQuery; readonly overdueInvoicesByContactId: Record< number, diff --git a/packages/server/src/modules/FinancialStatements/modules/InventoryValuationSheet/InventoryValuationSheet.ts b/packages/server/src/modules/FinancialStatements/modules/InventoryValuationSheet/InventoryValuationSheet.ts index 5774fadad..dbc11d7d1 100644 --- a/packages/server/src/modules/FinancialStatements/modules/InventoryValuationSheet/InventoryValuationSheet.ts +++ b/packages/server/src/modules/FinancialStatements/modules/InventoryValuationSheet/InventoryValuationSheet.ts @@ -33,6 +33,7 @@ export class InventoryValuationSheet extends FinancialSheet { this.query = query; this.repository = repository; + this.baseCurrency = meta.baseCurrency; this.numberFormat = this.query.numberFormat; this.dateFormat = meta.dateFormat || DEFAULT_REPORT_META.dateFormat; } diff --git a/packages/server/src/modules/FinancialStatements/modules/SalesTaxLiabilitySummary/SalesTaxLiabilitySummary.ts b/packages/server/src/modules/FinancialStatements/modules/SalesTaxLiabilitySummary/SalesTaxLiabilitySummary.ts index 9fe3e02c8..24dbaae48 100644 --- a/packages/server/src/modules/FinancialStatements/modules/SalesTaxLiabilitySummary/SalesTaxLiabilitySummary.ts +++ b/packages/server/src/modules/FinancialStatements/modules/SalesTaxLiabilitySummary/SalesTaxLiabilitySummary.ts @@ -31,6 +31,7 @@ export class SalesTaxLiabilitySummary extends FinancialSheet { this.query = query; this.repository = repository; + this.baseCurrency = meta.baseCurrency; this.dateFormat = meta.dateFormat || DEFAULT_REPORT_META.dateFormat; } diff --git a/packages/server/src/modules/FinancialStatements/modules/VendorBalanceSummary/VendorBalanceSummaryService.ts b/packages/server/src/modules/FinancialStatements/modules/VendorBalanceSummary/VendorBalanceSummaryService.ts index c1203c19d..296777218 100644 --- a/packages/server/src/modules/FinancialStatements/modules/VendorBalanceSummary/VendorBalanceSummaryService.ts +++ b/packages/server/src/modules/FinancialStatements/modules/VendorBalanceSummary/VendorBalanceSummaryService.ts @@ -38,7 +38,7 @@ export class VendorBalanceSummaryService { const reportInstance = new VendorBalanceSummaryReport( this.vendorBalanceSummaryRepository, filter, - { baseCurrency: this.vendorBalanceSummaryRepository.baseCurrency, dateFormat: meta.dateFormat }, + { baseCurrency: meta.baseCurrency, dateFormat: meta.dateFormat }, ); // Triggers `onVendorBalanceSummaryViewed` event.