mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat(server): financial sheet meta
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { FinancialSheetMeta } from '../FinancialSheetMeta';
|
||||
import { IBalanceSheetMeta } from '@/interfaces';
|
||||
import { IBalanceSheetMeta, IBalanceSheetQuery } from '@/interfaces';
|
||||
import moment from 'moment';
|
||||
|
||||
@Service()
|
||||
export class BalanceSheetMetaInjectable {
|
||||
@@ -12,12 +13,21 @@ export class BalanceSheetMetaInjectable {
|
||||
* @param {number} tenantId -
|
||||
* @returns {IBalanceSheetMeta}
|
||||
*/
|
||||
public async meta(tenantId: number): Promise<IBalanceSheetMeta> {
|
||||
public async meta(
|
||||
tenantId: number,
|
||||
query: IBalanceSheetQuery
|
||||
): Promise<IBalanceSheetMeta> {
|
||||
const commonMeta = 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 {
|
||||
...commonMeta,
|
||||
sheetName: 'Balance Sheet',
|
||||
formattedFromDate,
|
||||
formattedToDate,
|
||||
formattedDateRange
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user