mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat(server): wip printing financial reports
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { Inject } from 'typedi';
|
||||
import { CashflowTableInjectable } from './CashflowTableInjectable';
|
||||
import { TableSheetPdf } from '../TableSheetPdf';
|
||||
import { ICashFlowStatementQuery } from '@/interfaces';
|
||||
|
||||
export class CashflowTablePdfInjectable {
|
||||
@Inject()
|
||||
private cashflowTable: CashflowTableInjectable;
|
||||
|
||||
@Inject()
|
||||
private tableSheetPdf: TableSheetPdf;
|
||||
|
||||
/**
|
||||
* Converts the given cashflow sheet table to pdf.
|
||||
* @param {number} tenantId - Tenant ID.
|
||||
* @param {IBalanceSheetQuery} query - Balance sheet query.
|
||||
* @returns {Promise<Buffer>}
|
||||
*/
|
||||
public async pdf(
|
||||
tenantId: number,
|
||||
query: ICashFlowStatementQuery
|
||||
): Promise<Buffer> {
|
||||
const table = await this.cashflowTable.table(tenantId, query);
|
||||
const sheetName = 'Cashflow Sheet';
|
||||
|
||||
return this.tableSheetPdf.convertToPdf(
|
||||
tenantId,
|
||||
table.table,
|
||||
sheetName,
|
||||
table.meta.baseCurrency
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user