mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-26 17:49:48 +00:00
- Replace hardcoded date formats ('YYYY/MM/DD') in all Meta classes with meta.dateFormat
- Add IFinancialReportMeta interface with baseCurrency and dateFormat fields
- Add DEFAULT_REPORT_META constant with default date format 'YYYY MMM DD'
- Update all sheet classes to accept IFinancialReportMeta parameter
- Update all services to pass dateFormat from meta to sheet constructors
- Fix customer/vendor transactions date formatting in table rows
- Add TenancyModule to SalesTaxLiabilityModule for dependency injection
- Make dateFormat optional in JournalSheet and GeneralLedger query types
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
881 B
TypeScript
28 lines
881 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import * as moment from 'moment';
|
|
import { FinancialSheetMeta } from '../../common/FinancialSheetMeta';
|
|
import { IBalanceSheetMeta, IBalanceSheetQuery } from './BalanceSheet.types';
|
|
|
|
@Injectable()
|
|
export class BalanceSheetMetaInjectable {
|
|
constructor(private readonly financialSheetMeta: FinancialSheetMeta) {}
|
|
|
|
/**
|
|
* Retrieves the balance sheet meta.
|
|
* @returns {IBalanceSheetMeta}
|
|
*/
|
|
public async meta(query: IBalanceSheetQuery): Promise<IBalanceSheetMeta> {
|
|
const commonMeta = await this.financialSheetMeta.meta();
|
|
const formattedAsDate = moment(query.toDate).format(commonMeta.dateFormat);
|
|
const formattedDateRange = `As ${formattedAsDate}`;
|
|
const sheetName = 'Balance Sheet Statement';
|
|
|
|
return {
|
|
...commonMeta,
|
|
sheetName,
|
|
formattedAsDate,
|
|
formattedDateRange,
|
|
};
|
|
}
|
|
}
|