mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat(server): financial sheet meta
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user