mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
feat(server): wip priting financial reports
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
import { TransactionsByCustomersTableInjectable } from './TransactionsByCustomersTableInjectable';
|
||||
import { TransactionsByCustomersExportInjectable } from './TransactionsByCustomersExportInjectable';
|
||||
import { TransactionsByCustomersSheet } from './TransactionsByCustomersService';
|
||||
import { TransactionsByCustomersPdf } from './TransactionsByCustomersPdf';
|
||||
|
||||
@Service()
|
||||
export class TransactionsByCustomerApplication {
|
||||
@@ -18,6 +19,9 @@ export class TransactionsByCustomerApplication {
|
||||
@Inject()
|
||||
private transactionsByCustomersSheet: TransactionsByCustomersSheet;
|
||||
|
||||
@Inject()
|
||||
private transactionsByCustomersPdf: TransactionsByCustomersPdf;
|
||||
|
||||
/**
|
||||
* Retrieves the transactions by customers sheet in json format.
|
||||
* @param {number} tenantId
|
||||
@@ -69,4 +73,17 @@ export class TransactionsByCustomerApplication {
|
||||
): Promise<Buffer> {
|
||||
return this.transactionsByCustomersExport.xlsx(tenantId, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the transactions by vendors sheet in PDF format.
|
||||
* @param {number} tenantId
|
||||
* @param {ITransactionsByCustomersFilter} query
|
||||
* @returns {Promise<Buffer>}
|
||||
*/
|
||||
public pdf(
|
||||
tenantId: number,
|
||||
query: ITransactionsByCustomersFilter
|
||||
): Promise<Buffer> {
|
||||
return this.transactionsByCustomersPdf.pdf(tenantId, query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { ITransactionsByCustomersFilter } from '@/interfaces';
|
||||
import { Inject } from 'typedi';
|
||||
import { TableSheetPdf } from '../TableSheetPdf';
|
||||
import { TransactionsByCustomersTableInjectable } from './TransactionsByCustomersTableInjectable';
|
||||
|
||||
export class TransactionsByCustomersPdf {
|
||||
@Inject()
|
||||
private transactionsByCustomersTable: TransactionsByCustomersTableInjectable;
|
||||
|
||||
@Inject()
|
||||
private tableSheetPdf: TableSheetPdf;
|
||||
|
||||
/**
|
||||
* Retrieves the transactions by customers in PDF format.
|
||||
* @param {number} tenantId - Tenant ID.
|
||||
* @param {IBalanceSheetQuery} query - Balance sheet query.
|
||||
* @returns {Promise<Buffer>}
|
||||
*/
|
||||
public async pdf(
|
||||
tenantId: number,
|
||||
query: ITransactionsByCustomersFilter
|
||||
): Promise<Buffer> {
|
||||
const table = await this.transactionsByCustomersTable.table(
|
||||
tenantId,
|
||||
query
|
||||
);
|
||||
const sheetName = 'Transactions By Customers';
|
||||
|
||||
return this.tableSheetPdf.convertToPdf(
|
||||
tenantId,
|
||||
table.table,
|
||||
sheetName,
|
||||
table.meta.baseCurrency
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user