mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
33 lines
900 B
TypeScript
33 lines
900 B
TypeScript
import { Inject, Service } from 'typedi';
|
|
import { FinancialSheetMeta } from '../FinancialSheetMeta';
|
|
import { IBalanceSheetMeta, IBalanceSheetQuery } from '@/interfaces';
|
|
import moment from 'moment';
|
|
|
|
@Service()
|
|
export class BalanceSheetMetaInjectable {
|
|
@Inject()
|
|
private financialSheetMeta: FinancialSheetMeta;
|
|
|
|
/**
|
|
* Retrieve the balance sheet meta.
|
|
* @param {number} tenantId -
|
|
* @returns {IBalanceSheetMeta}
|
|
*/
|
|
public async meta(
|
|
tenantId: number,
|
|
query: IBalanceSheetQuery
|
|
): Promise<IBalanceSheetMeta> {
|
|
const commonMeta = await this.financialSheetMeta.meta(tenantId);
|
|
const formattedAsDate = moment(query.toDate).format('YYYY/MM/DD');
|
|
const formattedDateRange = `As ${formattedAsDate}`;
|
|
const sheetName = 'Balance Sheet Statement';
|
|
|
|
return {
|
|
...commonMeta,
|
|
sheetName,
|
|
formattedAsDate,
|
|
formattedDateRange,
|
|
};
|
|
}
|
|
}
|