mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
refactor: financial reports to nestjs
This commit is contained in:
32
temp/BalanceSheet/BalanceSheetMeta.ts
Normal file
32
temp/BalanceSheet/BalanceSheetMeta.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
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,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Retrieve the balance sheet meta.
|
||||
* @param {number} tenantId -
|
||||
* @returns {IBalanceSheetMeta}
|
||||
*/
|
||||
public async meta(
|
||||
query: IBalanceSheetQuery
|
||||
): Promise<IBalanceSheetMeta> {
|
||||
const commonMeta = await this.financialSheetMeta.meta();
|
||||
const formattedAsDate = moment(query.toDate).format('YYYY/MM/DD');
|
||||
const formattedDateRange = `As ${formattedAsDate}`;
|
||||
const sheetName = 'Balance Sheet Statement';
|
||||
|
||||
return {
|
||||
...commonMeta,
|
||||
sheetName,
|
||||
formattedAsDate,
|
||||
formattedDateRange,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user