mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
34 lines
1005 B
TypeScript
34 lines
1005 B
TypeScript
import { Inject, Service } from 'typedi';
|
|
import moment from 'moment';
|
|
import { ICashFlowStatementMeta, ICashFlowStatementQuery } from '@/interfaces';
|
|
import { FinancialSheetMeta } from '../FinancialSheetMeta';
|
|
|
|
@Service()
|
|
export class CashflowSheetMeta {
|
|
@Inject()
|
|
private financialSheetMeta: FinancialSheetMeta;
|
|
|
|
/**
|
|
* CAshflow sheet meta.
|
|
* @param {number} tenantId
|
|
* @param {ICashFlowStatementQuery} query
|
|
* @returns {Promise<ICashFlowStatementMeta>}
|
|
*/
|
|
public async meta(
|
|
tenantId: number,
|
|
query: ICashFlowStatementQuery
|
|
): Promise<ICashFlowStatementMeta> {
|
|
const meta = await this.financialSheetMeta.meta(tenantId);
|
|
const formattedToDate = moment(query.toDate).format('YYYY/MM/DD');
|
|
const formattedFromDate = moment(query.fromDate).format('YYYY/MM/DD');
|
|
const formattedDateRange = `From ${formattedFromDate} | To ${formattedToDate}`;
|
|
|
|
return {
|
|
...meta,
|
|
formattedToDate,
|
|
formattedFromDate,
|
|
formattedDateRange,
|
|
};
|
|
}
|
|
}
|