UNPKG

@fin.cx/einvoice

Version:

A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.

52 lines (51 loc) 1.69 kB
import * as plugins from '../plugins.js'; /** * A class to convert a given ILetter with invoice data * into a Factur-X compliant XML (also compatible with ZUGFeRD and EN16931). * * Factur-X is the French implementation of the European e-invoicing standard EN16931, * which is also implemented in Germany as ZUGFeRD. Both formats are based on * UN/CEFACT Cross Industry Invoice (CII) XML schemas. */ export declare class FacturXEncoder { constructor(); /** * Alias for createFacturXXml to maintain backward compatibility */ createZugferdXml(letterArg: plugins.tsclass.business.ILetter): string; /** * Creates a Factur-X compliant XML based on the provided letter data. * This XML is also compliant with ZUGFeRD and EN16931 standards. */ createFacturXXml(letterArg: plugins.tsclass.business.ILetter): string; /** * Helper: Determine if the letter is in draft or final. */ private isDraft; /** * Helper: Format date to certain patterns (very minimal example). * e.g. 'yyyyMMdd' => '20231231' */ private formatDate; /** * Helper: Map your custom 'unitType' to an ISO code or similar. */ private mapUnitType; /** * Example: Sum all VAT amounts from items. */ private sumAllVat; /** * Example: Extract main (or highest) VAT rate from items as representative. * In reality, you might list multiple 'ApplicableTradeTax' blocks by group. */ private extractMainVatRate; /** * Example: Sum net amounts (without VAT). */ private calcLineTotalNet; /** * Example: net + VAT = grand total */ private calcGrandTotal; }