mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
feat(server): wip printing financial reports
This commit is contained in:
@@ -3,6 +3,7 @@ import { IVendorBalanceSummaryQuery } from '@/interfaces';
|
||||
import { VendorBalanceSummaryTableInjectable } from './VendorBalanceSummaryTableInjectable';
|
||||
import { VendorBalanceSummaryExportInjectable } from './VendorBalanceSummaryExportInjectable';
|
||||
import { VendorBalanceSummaryService } from './VendorBalanceSummaryService';
|
||||
import { VendorBalanceSummaryPdf } from './VendorBalanceSummaryPdf';
|
||||
|
||||
@Service()
|
||||
export class VendorBalanceSummaryApplication {
|
||||
@@ -15,6 +16,9 @@ export class VendorBalanceSummaryApplication {
|
||||
@Inject()
|
||||
private vendorBalanceSummaryExport: VendorBalanceSummaryExportInjectable;
|
||||
|
||||
@Inject()
|
||||
private vendorBalanceSummaryPdf: VendorBalanceSummaryPdf;
|
||||
|
||||
/**
|
||||
* Retrieves the vendor balance summary sheet in sheet format.
|
||||
* @param {number} tenantId
|
||||
@@ -59,4 +63,14 @@ export class VendorBalanceSummaryApplication {
|
||||
): Promise<string> {
|
||||
return this.vendorBalanceSummaryExport.csv(tenantId, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the vendor balance summary sheet in pdf format.
|
||||
* @param {number} tenantId
|
||||
* @param {IVendorBalanceSummaryQuery} query
|
||||
* @returns {Promise<Buffer>}
|
||||
*/
|
||||
public pdf(tenantId: number, query: IVendorBalanceSummaryQuery) {
|
||||
return this.vendorBalanceSummaryPdf.pdf(tenantId, query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { IVendorBalanceSummaryQuery } from '@/interfaces';
|
||||
import { TableSheetPdf } from '../TableSheetPdf';
|
||||
import { VendorBalanceSummaryTableInjectable } from './VendorBalanceSummaryTableInjectable';
|
||||
|
||||
@Service()
|
||||
export class VendorBalanceSummaryPdf {
|
||||
@Inject()
|
||||
private vendorBalanceSummaryTable: VendorBalanceSummaryTableInjectable;
|
||||
|
||||
@Inject()
|
||||
private tableSheetPdf: TableSheetPdf;
|
||||
|
||||
/**
|
||||
* Retrieves the sales by items sheet in pdf format.
|
||||
* @param {number} tenantId
|
||||
* @param {number} query
|
||||
* @returns {Promise<IBalanceSheetTable>}
|
||||
*/
|
||||
public async pdf(
|
||||
tenantId: number,
|
||||
query: IVendorBalanceSummaryQuery
|
||||
): Promise<Buffer> {
|
||||
const table = await this.vendorBalanceSummaryTable.table(tenantId, query);
|
||||
const sheetName = 'Sales By Items';
|
||||
|
||||
return this.tableSheetPdf.convertToPdf(
|
||||
tenantId,
|
||||
table.table,
|
||||
sheetName,
|
||||
table.meta.baseCurrency
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user