feat(server): wip priting financial reports

This commit is contained in:
Ahmed Bouhuolia
2024-02-11 01:14:31 +02:00
parent 9395ef094a
commit b11c531cf5
23 changed files with 438 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
import { Inject, Service } from 'typedi';
import { ITransactionsByVendorsFilter } from '@/interfaces';
import { TableSheetPdf } from '../TableSheetPdf';
import { TransactionsByVendorTableInjectable } from './TransactionsByVendorTableInjectable';
@Service()
export class TransactionsByVendorsPdf {
@Inject()
private transactionsByVendorTable: TransactionsByVendorTableInjectable;
@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: ITransactionsByVendorsFilter
): Promise<Buffer> {
const table = await this.transactionsByVendorTable.table(tenantId, query);
const sheetName = 'Transactions By Vendors';
return this.tableSheetPdf.convertToPdf(
tenantId,
table.table,
sheetName,
table.meta.baseCurrency
);
}
}