mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat(server): journal sheet csv/xlsx export
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import { Inject } from 'typedi';
|
||||
import { JournalSheetService } from './JournalSheetService';
|
||||
import { IJournalReportQuery, IJournalTable } from '@/interfaces';
|
||||
import { JournalSheetTable } from './JournalSheetTable';
|
||||
|
||||
export class JournalSheetTableInjectable {
|
||||
@Inject()
|
||||
private tenancy: HasTenancyService;
|
||||
|
||||
@Inject()
|
||||
private journalSheetService: JournalSheetService;
|
||||
|
||||
/**
|
||||
* Retrieves the journal sheet in table format.
|
||||
* @param {number} tenantId
|
||||
* @param {IJournalReportQuery} query
|
||||
* @returns {Promise<IJournalTable>}
|
||||
*/
|
||||
public async table(
|
||||
tenantId: number,
|
||||
query: IJournalReportQuery
|
||||
): Promise<IJournalTable> {
|
||||
const journal = await this.journalSheetService.journalSheet(
|
||||
tenantId,
|
||||
query
|
||||
);
|
||||
const table = new JournalSheetTable(journal.data, journal.query, {});
|
||||
|
||||
return {
|
||||
table: {
|
||||
columns: table.tableColumns(),
|
||||
rows: table.tableData(),
|
||||
},
|
||||
query: journal.query,
|
||||
meta: journal.meta,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user