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