37 lines
924 B
TypeScript
37 lines
924 B
TypeScript
import type { DTO } from "@erp/core";
|
|
import { FastReportRenderer } from "@erp/core/api";
|
|
|
|
export type IssuedInvoiceReportPDFRendererParams = {
|
|
companySlug: string;
|
|
documentId: string;
|
|
};
|
|
|
|
export class IssuedInvoiceReportPDFRenderer extends FastReportRenderer {
|
|
protected readonly templateName = "issued-invoice.frx";
|
|
protected companySlug!: string;
|
|
|
|
render(source: DTO, params: IssuedInvoiceReportPDFRendererParams) {
|
|
this.companySlug = params.companySlug;
|
|
|
|
return this.renderInternal({
|
|
inputData: source,
|
|
format: "PDF",
|
|
storageKey: {
|
|
documentType: "customer-invoice",
|
|
documentId: params.documentId,
|
|
format: "PDF",
|
|
},
|
|
});
|
|
}
|
|
|
|
protected resolveTemplatePath(): string {
|
|
const templatePath = this.templateResolver.resolveTemplatePath(
|
|
"customer-invoices",
|
|
this.companySlug,
|
|
this.templateName
|
|
);
|
|
|
|
return templatePath;
|
|
}
|
|
}
|