mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat: export reports csv and xlsx (#286)
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { IBalanceSheetQuery } from '@/interfaces';
|
||||
import { BalanceSheetExportInjectable } from './BalanceSheetExportInjectable';
|
||||
import { BalanceSheetTableInjectable } from './BalanceSheetTableInjectable';
|
||||
import BalanceSheetStatementService from './BalanceSheetInjectable';
|
||||
|
||||
@Service()
|
||||
export class BalanceSheetApplication {
|
||||
@Inject()
|
||||
public balanceSheetExport: BalanceSheetExportInjectable;
|
||||
|
||||
@Inject()
|
||||
public balanceSheetTable: BalanceSheetTableInjectable;
|
||||
|
||||
@Inject()
|
||||
public balanceSheet: BalanceSheetStatementService;
|
||||
|
||||
/**
|
||||
* Retrieves the balnace sheet in json format.
|
||||
* @param {numnber} tenantId
|
||||
* @param {IBalanceSheetQuery} query
|
||||
* @returns {Promise<IBalanceSheetStatement>}
|
||||
*/
|
||||
public sheet(tenantId: number, query: IBalanceSheetQuery) {
|
||||
return this.balanceSheet.balanceSheet(tenantId, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet in table format.
|
||||
* @param {number} tenantId
|
||||
* @param {IBalanceSheetQuery} query
|
||||
* @returns {Promise<IBalanceSheetTable>}
|
||||
*/
|
||||
public table(tenantId: number, query: IBalanceSheetQuery) {
|
||||
return this.balanceSheetTable.table(tenantId, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet in XLSX format.
|
||||
* @param {number} tenantId
|
||||
* @param {IBalanceSheetQuery} query
|
||||
* @returns {Promise<Buffer>}
|
||||
*/
|
||||
public xlsx(tenantId: number, query: IBalanceSheetQuery) {
|
||||
return this.balanceSheetExport.xlsx(tenantId, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet in CSV format.
|
||||
* @param {number} tenantId
|
||||
* @param {IBalanceSheetQuery} query
|
||||
* @returns {Promise<Buffer>}
|
||||
*/
|
||||
public csv(tenantId: number, query: IBalanceSheetQuery): Promise<string> {
|
||||
return this.balanceSheetExport.csv(tenantId, query);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user