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:
@@ -75,6 +75,7 @@ export default class CustomerBalanceSummaryReportController extends BaseFinancia
|
|||||||
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
||||||
ACCEPT_TYPE.APPLICATION_CSV,
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
ACCEPT_TYPE.APPLICATION_XLSX,
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Retrieves the xlsx format.
|
// Retrieves the xlsx format.
|
||||||
@@ -109,6 +110,19 @@ export default class CustomerBalanceSummaryReportController extends BaseFinancia
|
|||||||
filter
|
filter
|
||||||
);
|
);
|
||||||
return res.status(200).send(table);
|
return res.status(200).send(table);
|
||||||
|
// Retrieves the pdf format.
|
||||||
|
} else if (ACCEPT_TYPE.APPLICATION_PDF === acceptType) {
|
||||||
|
const buffer = await this.customerBalanceSummaryApp.pdf(
|
||||||
|
tenantId,
|
||||||
|
filter
|
||||||
|
);
|
||||||
|
|
||||||
|
res.set({
|
||||||
|
'Content-Type': 'application/pdf',
|
||||||
|
'Content-Length': buffer.length,
|
||||||
|
});
|
||||||
|
return res.send(buffer);
|
||||||
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.customerBalanceSummaryApp.sheet(
|
const sheet = await this.customerBalanceSummaryApp.sheet(
|
||||||
tenantId,
|
tenantId,
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export default class GeneralLedgerReportController extends BaseFinancialReportCo
|
|||||||
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
||||||
ACCEPT_TYPE.APPLICATION_XLSX,
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
ACCEPT_TYPE.APPLICATION_CSV,
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
]);
|
]);
|
||||||
// Retrieves the table format.
|
// Retrieves the table format.
|
||||||
if (ACCEPT_TYPE.APPLICATION_JSON_TABLE === acceptType) {
|
if (ACCEPT_TYPE.APPLICATION_JSON_TABLE === acceptType) {
|
||||||
@@ -95,6 +96,17 @@ export default class GeneralLedgerReportController extends BaseFinancialReportCo
|
|||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
);
|
);
|
||||||
return res.send(buffer);
|
return res.send(buffer);
|
||||||
|
// Retrieves the pdf format.
|
||||||
|
} else if (ACCEPT_TYPE.APPLICATION_PDF === acceptType) {
|
||||||
|
const pdfContent = await this.generalLedgerApplication.pdf(
|
||||||
|
tenantId,
|
||||||
|
filter
|
||||||
|
);
|
||||||
|
res.set({
|
||||||
|
'Content-Type': 'application/pdf',
|
||||||
|
'Content-Length': pdfContent.length,
|
||||||
|
});
|
||||||
|
return res.send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.generalLedgerApplication.sheet(tenantId, filter);
|
const sheet = await this.generalLedgerApplication.sheet(tenantId, filter);
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ export default class InventoryDetailsController extends BaseController {
|
|||||||
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
||||||
ACCEPT_TYPE.APPLICATION_CSV,
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
ACCEPT_TYPE.APPLICATION_XLSX,
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
]);
|
]);
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
if (acceptType === ACCEPT_TYPE.APPLICATION_CSV) {
|
if (acceptType === ACCEPT_TYPE.APPLICATION_CSV) {
|
||||||
@@ -127,6 +128,15 @@ export default class InventoryDetailsController extends BaseController {
|
|||||||
filter
|
filter
|
||||||
);
|
);
|
||||||
return res.status(200).send(table);
|
return res.status(200).send(table);
|
||||||
|
// Retrieves the pdf format.
|
||||||
|
} else if (acceptType === ACCEPT_TYPE.APPLICATION_PDF) {
|
||||||
|
const buffer = await this.inventoryItemDetailsApp.pdf(tenantId, filter);
|
||||||
|
|
||||||
|
res.set({
|
||||||
|
'Content-Type': 'application/pdf',
|
||||||
|
'Content-Length': buffer.length,
|
||||||
|
});
|
||||||
|
return res.send(buffer);
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.inventoryItemDetailsApp.sheet(
|
const sheet = await this.inventoryItemDetailsApp.sheet(
|
||||||
tenantId,
|
tenantId,
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ export default class InventoryValuationReportController extends BaseFinancialRep
|
|||||||
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
||||||
ACCEPT_TYPE.APPLICATION_XLSX,
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
ACCEPT_TYPE.APPLICATION_CSV,
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
@@ -104,6 +105,15 @@ export default class InventoryValuationReportController extends BaseFinancialRep
|
|||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
);
|
);
|
||||||
return res.send(buffer);
|
return res.send(buffer);
|
||||||
|
// Retrieves the pdf format.
|
||||||
|
} else if (ACCEPT_TYPE.APPLICATION_PDF === acceptType) {
|
||||||
|
const pdfContent = await this.inventoryValuationApp.pdf(tenantId, filter);
|
||||||
|
|
||||||
|
res.set({
|
||||||
|
'Content-Type': 'application/pdf',
|
||||||
|
'Content-Length': pdfContent.length,
|
||||||
|
});
|
||||||
|
return res.status(200).send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const { data, query, meta } = await this.inventoryValuationApp.sheet(
|
const { data, query, meta } = await this.inventoryValuationApp.sheet(
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export default class JournalSheetController extends BaseFinancialReportControlle
|
|||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
} else if (ACCEPT_TYPE.APPLICATION_CSV === acceptType) {
|
} else if (ACCEPT_TYPE.APPLICATION_CSV === acceptType) {
|
||||||
const buffer = await this.journalSheetApp.csv(tenantId, filter);
|
const buffer = await this.journalSheetApp.csv(tenantId, filter);
|
||||||
|
|
||||||
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
|
res.setHeader('Content-Disposition', 'attachment; filename=output.csv');
|
||||||
res.setHeader('Content-Type', 'text/csv');
|
res.setHeader('Content-Type', 'text/csv');
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ export default class PurchasesByItemReportController extends BaseFinancialReport
|
|||||||
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
||||||
ACCEPT_TYPE.APPLICATION_XLSX,
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
ACCEPT_TYPE.APPLICATION_CSV,
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// JSON table response format.
|
// JSON table response format.
|
||||||
if (ACCEPT_TYPE.APPLICATION_JSON_TABLE === acceptType) {
|
if (ACCEPT_TYPE.APPLICATION_JSON_TABLE === acceptType) {
|
||||||
const table = await this.purchasesByItemsApp.table(tenantId, filter);
|
const table = await this.purchasesByItemsApp.table(tenantId, filter);
|
||||||
@@ -100,6 +100,15 @@ export default class PurchasesByItemReportController extends BaseFinancialReport
|
|||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
);
|
);
|
||||||
return res.send(buffer);
|
return res.send(buffer);
|
||||||
|
// PDF response format.
|
||||||
|
} else if (ACCEPT_TYPE.APPLICATION_PDF === acceptType) {
|
||||||
|
const pdfContent = await this.purchasesByItemsApp.pdf(tenantId, filter);
|
||||||
|
|
||||||
|
res.set({
|
||||||
|
'Content-Type': 'application/pdf',
|
||||||
|
'Content-Length': pdfContent.length,
|
||||||
|
});
|
||||||
|
return res.send(pdfContent);
|
||||||
// Json response format.
|
// Json response format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.purchasesByItemsApp.sheet(tenantId, filter);
|
const sheet = await this.purchasesByItemsApp.sheet(tenantId, filter);
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ export default class SalesTaxLiabilitySummary extends BaseFinancialReportControl
|
|||||||
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
||||||
ACCEPT_TYPE.APPLICATION_CSV,
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
ACCEPT_TYPE.APPLICATION_XLSX,
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
@@ -97,6 +98,16 @@ export default class SalesTaxLiabilitySummary extends BaseFinancialReportControl
|
|||||||
|
|
||||||
return res.send(buffer);
|
return res.send(buffer);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
|
} else if (acceptType === ACCEPT_TYPE.APPLICATION_PDF) {
|
||||||
|
const pdfContent = await this.salesTaxLiabilitySummaryApp.pdf(
|
||||||
|
tenantId,
|
||||||
|
filter
|
||||||
|
);
|
||||||
|
res.set({
|
||||||
|
'Content-Type': 'application/pdf',
|
||||||
|
'Content-Length': pdfContent.length,
|
||||||
|
});
|
||||||
|
return res.status(200).send(pdfContent);
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.salesTaxLiabilitySummaryApp.sheet(
|
const sheet = await this.salesTaxLiabilitySummaryApp.sheet(
|
||||||
tenantId,
|
tenantId,
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export default class TransactionsByCustomersReportController extends BaseFinanci
|
|||||||
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
||||||
ACCEPT_TYPE.APPLICATION_CSV,
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
ACCEPT_TYPE.APPLICATION_XLSX,
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
]);
|
]);
|
||||||
try {
|
try {
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export default class TransactionsByVendorsReportController extends BaseFinancial
|
|||||||
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
ACCEPT_TYPE.APPLICATION_JSON_TABLE,
|
||||||
ACCEPT_TYPE.APPLICATION_CSV,
|
ACCEPT_TYPE.APPLICATION_CSV,
|
||||||
ACCEPT_TYPE.APPLICATION_XLSX,
|
ACCEPT_TYPE.APPLICATION_XLSX,
|
||||||
|
ACCEPT_TYPE.APPLICATION_PDF,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Retrieves the xlsx format.
|
// Retrieves the xlsx format.
|
||||||
@@ -101,6 +102,17 @@ export default class TransactionsByVendorsReportController extends BaseFinancial
|
|||||||
filter
|
filter
|
||||||
);
|
);
|
||||||
return res.status(200).send(table);
|
return res.status(200).send(table);
|
||||||
|
// Retrieves the pdf format.
|
||||||
|
} else if (ACCEPT_TYPE.APPLICATION_PDF === acceptType) {
|
||||||
|
const pdfContent = await this.transactionsByVendorsApp.pdf(
|
||||||
|
tenantId,
|
||||||
|
filter
|
||||||
|
);
|
||||||
|
res.set({
|
||||||
|
'Content-Type': 'application/pdf',
|
||||||
|
'Content-Length': pdfContent.length,
|
||||||
|
});
|
||||||
|
return res.send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.transactionsByVendorsApp.sheet(
|
const sheet = await this.transactionsByVendorsApp.sheet(
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
import { GeneralLedgerTableInjectable } from './GeneralLedgerTableInjectable';
|
import { GeneralLedgerTableInjectable } from './GeneralLedgerTableInjectable';
|
||||||
import { GeneralLedgerExportInjectable } from './GeneralLedgerExport';
|
import { GeneralLedgerExportInjectable } from './GeneralLedgerExport';
|
||||||
import { GeneralLedgerService } from './GeneralLedgerService';
|
import { GeneralLedgerService } from './GeneralLedgerService';
|
||||||
|
import { GeneralLedgerPdf } from './GeneralLedgerPdf';
|
||||||
|
|
||||||
export class GeneralLedgerApplication {
|
export class GeneralLedgerApplication {
|
||||||
@Inject()
|
@Inject()
|
||||||
@@ -17,6 +18,9 @@ export class GeneralLedgerApplication {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private GLSheet: GeneralLedgerService;
|
private GLSheet: GeneralLedgerService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private GLPdf: GeneralLedgerPdf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the G/L sheet in json format.
|
* Retrieves the G/L sheet in json format.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
@@ -63,4 +67,17 @@ export class GeneralLedgerApplication {
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return this.GLExport.csv(tenantId, query);
|
return this.GLExport.csv(tenantId, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the G/L sheet in pdf format.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @param {IGeneralLedgerSheetQuery} query
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public pdf(
|
||||||
|
tenantId: number,
|
||||||
|
query: IGeneralLedgerSheetQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
return this.GLPdf.pdf(tenantId, query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { Inject, Service } from "typedi";
|
||||||
|
import { TableSheetPdf } from "../TableSheetPdf";
|
||||||
|
import { GeneralLedgerTableInjectable } from "./GeneralLedgerTableInjectable";
|
||||||
|
import { IGeneralLedgerSheetQuery } from "@/interfaces";
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class GeneralLedgerPdf {
|
||||||
|
@Inject()
|
||||||
|
private generalLedgerTable: GeneralLedgerTableInjectable;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private tableSheetPdf: TableSheetPdf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the general ledger sheet table to pdf.
|
||||||
|
* @param {number} tenantId - Tenant ID.
|
||||||
|
* @param {IGeneralLedgerSheetQuery} query -
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public async pdf(
|
||||||
|
tenantId: number,
|
||||||
|
query: IGeneralLedgerSheetQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
const table = await this.generalLedgerTable.table(tenantId, query);
|
||||||
|
const sheetName = 'General Ledger';
|
||||||
|
|
||||||
|
return this.tableSheetPdf.convertToPdf(
|
||||||
|
tenantId,
|
||||||
|
table.table,
|
||||||
|
sheetName,
|
||||||
|
table.meta.baseCurrency
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import { Inject, Service } from 'typedi';
|
|||||||
import { InventoryDetailsExportInjectable } from './InventoryDetailsExportInjectable';
|
import { InventoryDetailsExportInjectable } from './InventoryDetailsExportInjectable';
|
||||||
import { InventoryDetailsTableInjectable } from './InventoryDetailsTableInjectable';
|
import { InventoryDetailsTableInjectable } from './InventoryDetailsTableInjectable';
|
||||||
import { InventoryDetailsService } from './InventoryDetailsService';
|
import { InventoryDetailsService } from './InventoryDetailsService';
|
||||||
|
import { InventoryDetailsTablePdf } from './InventoryDetailsTablePdf';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class InventortyDetailsApplication {
|
export class InventortyDetailsApplication {
|
||||||
@@ -18,6 +19,9 @@ export class InventortyDetailsApplication {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private inventoryDetails: InventoryDetailsService;
|
private inventoryDetails: InventoryDetailsService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private inventoryDetailsPdf: InventoryDetailsTablePdf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the inventory details report in sheet format.
|
* Retrieves the inventory details report in sheet format.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
@@ -63,4 +67,14 @@ export class InventortyDetailsApplication {
|
|||||||
public csv(tenantId: number, query: IInventoryDetailsQuery): Promise<string> {
|
public csv(tenantId: number, query: IInventoryDetailsQuery): Promise<string> {
|
||||||
return this.inventoryDetailsExport.csv(tenantId, query);
|
return this.inventoryDetailsExport.csv(tenantId, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the inventory details report in PDF format.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @param {IInventoryDetailsQuery} query
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public pdf(tenantId: number, query: IInventoryDetailsQuery) {
|
||||||
|
return this.inventoryDetailsPdf.pdf(tenantId, query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { Inject, Service } from "typedi";
|
||||||
|
import { InventoryDetailsTableInjectable } from "./InventoryDetailsTableInjectable";
|
||||||
|
import { TableSheetPdf } from "../TableSheetPdf";
|
||||||
|
import { IInventoryDetailsQuery } from "@/interfaces";
|
||||||
|
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class InventoryDetailsTablePdf {
|
||||||
|
@Inject()
|
||||||
|
private inventoryDetailsTable: InventoryDetailsTableInjectable;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private tableSheetPdf: TableSheetPdf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given inventory details sheet table to pdf.
|
||||||
|
* @param {number} tenantId - Tenant ID.
|
||||||
|
* @param {IBalanceSheetQuery} query - Balance sheet query.
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public async pdf(
|
||||||
|
tenantId: number,
|
||||||
|
query: IInventoryDetailsQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
const table = await this.inventoryDetailsTable.table(tenantId, query);
|
||||||
|
const sheetName = 'Inventory Items Details';
|
||||||
|
|
||||||
|
return this.tableSheetPdf.convertToPdf(
|
||||||
|
tenantId,
|
||||||
|
table.table,
|
||||||
|
sheetName,
|
||||||
|
table.meta.baseCurrency
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import { Inject, Service } from 'typedi';
|
|||||||
import { InventoryValuationSheetService } from './InventoryValuationSheetService';
|
import { InventoryValuationSheetService } from './InventoryValuationSheetService';
|
||||||
import { InventoryValuationSheetTableInjectable } from './InventoryValuationSheetTableInjectable';
|
import { InventoryValuationSheetTableInjectable } from './InventoryValuationSheetTableInjectable';
|
||||||
import { InventoryValuationSheetExportable } from './InventoryValuationSheetExportable';
|
import { InventoryValuationSheetExportable } from './InventoryValuationSheetExportable';
|
||||||
|
import { InventoryValuationSheetPdf } from './InventoryValuationSheetPdf';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class InventoryValuationSheetApplication {
|
export class InventoryValuationSheetApplication {
|
||||||
@@ -19,6 +20,9 @@ export class InventoryValuationSheetApplication {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private inventoryValuationExport: InventoryValuationSheetExportable;
|
private inventoryValuationExport: InventoryValuationSheetExportable;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private inventoryValuationPdf: InventoryValuationSheetPdf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the inventory valuation json format.
|
* Retrieves the inventory valuation json format.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
@@ -73,4 +77,17 @@ export class InventoryValuationSheetApplication {
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return this.inventoryValuationExport.csv(tenantId, query);
|
return this.inventoryValuationExport.csv(tenantId, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the inventory valuation pdf format.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @param {IInventoryValuationReportQuery} query
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public pdf(
|
||||||
|
tenantId: number,
|
||||||
|
query: IInventoryValuationReportQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
return this.inventoryValuationPdf.pdf(tenantId, query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { Inject, Service } from "typedi";
|
||||||
|
import { InventoryValuationSheetTableInjectable } from "./InventoryValuationSheetTableInjectable";
|
||||||
|
import { TableSheetPdf } from "../TableSheetPdf";
|
||||||
|
import { IInventoryValuationReportQuery } from "@/interfaces";
|
||||||
|
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class InventoryValuationSheetPdf {
|
||||||
|
@Inject()
|
||||||
|
private inventoryValuationTable: InventoryValuationSheetTableInjectable;
|
||||||
|
|
||||||
|
@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: IInventoryValuationReportQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
const table = await this.inventoryValuationTable.table(tenantId, query);
|
||||||
|
const sheetName = 'Inventory Valuation Sheet';
|
||||||
|
|
||||||
|
return this.tableSheetPdf.convertToPdf(
|
||||||
|
tenantId,
|
||||||
|
table.table,
|
||||||
|
sheetName,
|
||||||
|
table.meta.baseCurrency
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
} from '@/interfaces/PurchasesByItemsSheet';
|
} from '@/interfaces/PurchasesByItemsSheet';
|
||||||
import { PurchasesByItemsTableInjectable } from './PurchasesByItemsTableInjectable';
|
import { PurchasesByItemsTableInjectable } from './PurchasesByItemsTableInjectable';
|
||||||
import { PurchasesByItemsService } from './PurchasesByItemsService';
|
import { PurchasesByItemsService } from './PurchasesByItemsService';
|
||||||
|
import { PurchasesByItemsPdf } from './PurchasesByItemsPdf';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class PurcahsesByItemsApplication {
|
export class PurcahsesByItemsApplication {
|
||||||
@@ -19,6 +20,9 @@ export class PurcahsesByItemsApplication {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private purchasesByItemsExport: PurchasesByItemsExport;
|
private purchasesByItemsExport: PurchasesByItemsExport;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private purchasesByItemsPdf: PurchasesByItemsPdf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the purchases by items in json format.
|
* Retrieves the purchases by items in json format.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
@@ -70,4 +74,17 @@ export class PurcahsesByItemsApplication {
|
|||||||
): Promise<Buffer> {
|
): Promise<Buffer> {
|
||||||
return this.purchasesByItemsExport.xlsx(tenantId, query);
|
return this.purchasesByItemsExport.xlsx(tenantId, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the purchases by items in pdf format.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @param {IPurchasesByItemsReportQuery} filter
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public pdf(
|
||||||
|
tenantId: number,
|
||||||
|
filter: IPurchasesByItemsReportQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
return this.purchasesByItemsPdf.pdf(tenantId, filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { TableSheetPdf } from '../TableSheetPdf';
|
||||||
|
import { PurchasesByItemsTableInjectable } from './PurchasesByItemsTableInjectable';
|
||||||
|
import { IPurchasesByItemsReportQuery } from '@/interfaces/PurchasesByItemsSheet';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class PurchasesByItemsPdf {
|
||||||
|
@Inject()
|
||||||
|
private purchasesByItemsTable: PurchasesByItemsTableInjectable;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private tableSheetPdf: TableSheetPdf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given journal sheet table to pdf.
|
||||||
|
* @param {number} tenantId - Tenant ID.
|
||||||
|
* @param {IBalanceSheetQuery} query - Balance sheet query.
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public async pdf(
|
||||||
|
tenantId: number,
|
||||||
|
query: IPurchasesByItemsReportQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
const table = await this.purchasesByItemsTable.table(tenantId, query);
|
||||||
|
const sheetName = 'Purchases By Items';
|
||||||
|
|
||||||
|
return this.tableSheetPdf.convertToPdf(
|
||||||
|
tenantId,
|
||||||
|
table.table,
|
||||||
|
sheetName,
|
||||||
|
table.meta.baseCurrency
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import { SalesTaxLiabilitySummaryQuery } from '@/interfaces/SalesTaxLiabilitySum
|
|||||||
import { SalesTaxLiabilitySummaryTableInjectable } from './SalesTaxLiabilitySummaryTableInjectable';
|
import { SalesTaxLiabilitySummaryTableInjectable } from './SalesTaxLiabilitySummaryTableInjectable';
|
||||||
import { SalesTaxLiabilitySummaryExportInjectable } from './SalesTaxLiabilitySummaryExportInjectable';
|
import { SalesTaxLiabilitySummaryExportInjectable } from './SalesTaxLiabilitySummaryExportInjectable';
|
||||||
import { SalesTaxLiabilitySummaryService } from './SalesTaxLiabilitySummaryService';
|
import { SalesTaxLiabilitySummaryService } from './SalesTaxLiabilitySummaryService';
|
||||||
|
import { SalesTaxLiabiltiySummaryPdf } from './SalesTaxLiabiltiySummaryPdf';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class SalesTaxLiabilitySummaryApplication {
|
export class SalesTaxLiabilitySummaryApplication {
|
||||||
@@ -15,6 +16,9 @@ export class SalesTaxLiabilitySummaryApplication {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private salesTaxLiabilityTable: SalesTaxLiabilitySummaryTableInjectable;
|
private salesTaxLiabilityTable: SalesTaxLiabilitySummaryTableInjectable;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private salesTaxLiabiltiyPdf: SalesTaxLiabiltiySummaryPdf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the sales tax liability summary in json format.
|
* Retrieves the sales tax liability summary in json format.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
@@ -60,4 +64,17 @@ export class SalesTaxLiabilitySummaryApplication {
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return this.salesTaxLiabilityExport.csv(tenantId, query);
|
return this.salesTaxLiabilityExport.csv(tenantId, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the sales tax liability summary in PDF format.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @param {SalesTaxLiabilitySummaryQuery} query
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public pdf(
|
||||||
|
tenantId: number,
|
||||||
|
query: SalesTaxLiabilitySummaryQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
return this.salesTaxLiabiltiyPdf.pdf(tenantId, query):
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { TableSheetPdf } from '../TableSheetPdf';
|
||||||
|
import { SalesTaxLiabilitySummaryTableInjectable } from './SalesTaxLiabilitySummaryTableInjectable';
|
||||||
|
import { ISalesByItemsReportQuery } from '@/interfaces';
|
||||||
|
import { SalesTaxLiabilitySummaryQuery } from '@/interfaces/SalesTaxLiabilitySummary';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class SalesTaxLiabiltiySummaryPdf {
|
||||||
|
@Inject()
|
||||||
|
private salesTaxLiabiltiySummaryTable: SalesTaxLiabilitySummaryTableInjectable;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private tableSheetPdf: TableSheetPdf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given sales tax liability summary table to pdf.
|
||||||
|
* @param {number} tenantId - Tenant ID.
|
||||||
|
* @param {ISalesByItemsReportQuery} query - Balance sheet query.
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public async pdf(
|
||||||
|
tenantId: number,
|
||||||
|
query: SalesTaxLiabilitySummaryQuery
|
||||||
|
): Promise<Buffer> {
|
||||||
|
const table = await this.salesTaxLiabiltiySummaryTable.table(tenantId, query);
|
||||||
|
const sheetName = 'Sales Tax Liability Summary';
|
||||||
|
|
||||||
|
return this.tableSheetPdf.convertToPdf(
|
||||||
|
tenantId,
|
||||||
|
table.table,
|
||||||
|
sheetName,
|
||||||
|
table.meta.baseCurrency
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
import { TransactionsByCustomersTableInjectable } from './TransactionsByCustomersTableInjectable';
|
import { TransactionsByCustomersTableInjectable } from './TransactionsByCustomersTableInjectable';
|
||||||
import { TransactionsByCustomersExportInjectable } from './TransactionsByCustomersExportInjectable';
|
import { TransactionsByCustomersExportInjectable } from './TransactionsByCustomersExportInjectable';
|
||||||
import { TransactionsByCustomersSheet } from './TransactionsByCustomersService';
|
import { TransactionsByCustomersSheet } from './TransactionsByCustomersService';
|
||||||
|
import { TransactionsByCustomersPdf } from './TransactionsByCustomersPdf';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class TransactionsByCustomerApplication {
|
export class TransactionsByCustomerApplication {
|
||||||
@@ -18,6 +19,9 @@ export class TransactionsByCustomerApplication {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private transactionsByCustomersSheet: TransactionsByCustomersSheet;
|
private transactionsByCustomersSheet: TransactionsByCustomersSheet;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private transactionsByCustomersPdf: TransactionsByCustomersPdf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the transactions by customers sheet in json format.
|
* Retrieves the transactions by customers sheet in json format.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
@@ -69,4 +73,17 @@ export class TransactionsByCustomerApplication {
|
|||||||
): Promise<Buffer> {
|
): Promise<Buffer> {
|
||||||
return this.transactionsByCustomersExport.xlsx(tenantId, query);
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
import { TransactionsByVendorExportInjectable } from './TransactionsByVendorExportInjectable';
|
import { TransactionsByVendorExportInjectable } from './TransactionsByVendorExportInjectable';
|
||||||
import { TransactionsByVendorTableInjectable } from './TransactionsByVendorTableInjectable';
|
import { TransactionsByVendorTableInjectable } from './TransactionsByVendorTableInjectable';
|
||||||
import { TransactionsByVendorsInjectable } from './TransactionsByVendorInjectable';
|
import { TransactionsByVendorsInjectable } from './TransactionsByVendorInjectable';
|
||||||
|
import { TransactionsByVendorsPdf } from './TransactionsByVendorPdf';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class TransactionsByVendorApplication {
|
export class TransactionsByVendorApplication {
|
||||||
@@ -19,6 +20,9 @@ export class TransactionsByVendorApplication {
|
|||||||
@Inject()
|
@Inject()
|
||||||
private transactionsByVendorSheet: TransactionsByVendorsInjectable;
|
private transactionsByVendorSheet: TransactionsByVendorsInjectable;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private transactionsByVendorPdf: TransactionsByVendorsPdf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the transactions by vendor in sheet format.
|
* Retrieves the transactions by vendor in sheet format.
|
||||||
* @param {number} tenantId
|
* @param {number} tenantId
|
||||||
@@ -72,4 +76,14 @@ export class TransactionsByVendorApplication {
|
|||||||
): Promise<Buffer> {
|
): Promise<Buffer> {
|
||||||
return this.transactionsByVendorExport.xlsx(tenantId, query);
|
return this.transactionsByVendorExport.xlsx(tenantId, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the transactions by vendor in PDF format.
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @param {ITransactionsByVendorsFilter} query
|
||||||
|
* @returns {Promise<Buffer>}
|
||||||
|
*/
|
||||||
|
public pdf(tenantId: number, query: ITransactionsByVendorsFilter) {
|
||||||
|
return this.transactionsByVendorPdf.pdf(tenantId, query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user