mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
refactor: financial reports to nestjs
This commit is contained in:
28
temp/CashFlow/CashflowTablePdfInjectable.ts
Normal file
28
temp/CashFlow/CashflowTablePdfInjectable.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { TableSheetPdf } from '../../common/TableSheetPdf';
|
||||
import { ICashFlowStatementQuery } from './Cashflow.types';
|
||||
import { CashflowTableInjectable } from './CashflowTableInjectable';
|
||||
import { HtmlTableCustomCss } from './constants';
|
||||
|
||||
export class CashflowTablePdfInjectable {
|
||||
constructor(
|
||||
private readonly cashflowTable: CashflowTableInjectable,
|
||||
private readonly 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(query: ICashFlowStatementQuery): Promise<Buffer> {
|
||||
const table = await this.cashflowTable.table(query);
|
||||
|
||||
return this.tableSheetPdf.convertToPdf(
|
||||
table.table,
|
||||
table.meta.sheetName,
|
||||
table.meta.formattedDateRange,
|
||||
HtmlTableCustomCss,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user