Invoice documents — PDF, image, printing, notes to the accounts

How the invoice PDF, the QUiCK and Számlázz.hu invoice images, download and bulk printing work, the storage rule, and the PDF generator for the notes to the accounts.

Invoice documents always go to the document centre according to the owner company's storage rule and are linked to the invoice with doc_link. This article summarises the endpoints that produce and serve documents.

Endpoints

EndpointBehaviourRight
generatePdfLoads header and items per invoice, builds the PDF with the pdftemplate library, files it under the owner's “invoice” storage rule (resolveObjStorage) via Dlbtdocstore::fileDocument and links it. Errors are collected per invoice; invoices out of scope are skipped.core modify + pdf (BASE)
downloadServes the legacy document record, only when linked to an invoice in scope; streams a Drive file with the service account, a local file from storage.image (BASE) + scope
printdocs, printfileFetches the document-centre documents of the selected invoices (dlbtdocstore->fetch), merges them into one PDF (mergePdfs) and puts a token in the session; printfile serves the file with the token (expired token: error_print_expired); purgePrintCache clears the cache.list and image
makequickQUiCK search by invoice number (Quick::matchInvoice), image download, cover page stripped if needed, upload under the company's “invoice” (else “document”) rule, addDoc + addDocLink; an identical existing document is only linked. For some posting types the image may be skipped (Quick::skipsImage).core modify + quick (SUBSCRIPTION)
szamlazzpdfDownloads the PDF with the supplier's Számlázz.hu key, checks the format, Dlbtdocstore::addDocument(), then reads the document back.core modify + szamlazzpdf (BASE)
saveSettingUser setting: automatic invoice PDF (auto_generate_invoice_pdf).core modify only

Error keys

error_pdf_engine, error_pdf_not_found, error_pdf_no_storage, error_pdf_none, error_print_expired, error_objstorage_missing, error_objstorage_account, error_szamlazz_invoice, error_szamlazz_no_key, error_szamlazz_fetch, error_szamlazz_store.

Data model

Table names carry the installation's own prefix in the database: doc, doc_link, the legacy invoice_document link; services: pdftemplate, dlbtdocstore, quick, masterdata/apiaccount.

Notes to the accounts PDF (finance/invoice.reportannual)

A generator included in the invoice controller as a trait builds the notes to the annual, simplified or micro-entity financial statements with FPDI. It loads the report header, company data, address, configuration, contacts, balance sheet, profit and loss, cash flow, asset movement, headcount and tax data, writes a PDF into the tmp_report storage folder and returns the file name and size. Tables read: fin_report, fin_report_type, fin_report_config, fin_statement_schema, fin_statement_value, fin_line_item, fin_cash_flow, fin_asset_movement, fin_headcount_detail, fin_tax_calculation, fin_company_contact, company, company_address, address.

Known limitations: the report ID is hard-coded to 2 in the code (it overrides the request parameter); only core modify is checked, no function right and no content scope; no call from the admin templates was found.