Skip to content

Tables and subscribers

This section is intended to detail the extensibility of the solution.

The tables and subscribers of the system will be indicated to facilitate the creation of extensions that can be used to adapt the solution to the customer needs.

Tip

Given that the purpose of the solution is to generate XML files that comply with the electronic invoicing regulations of public administrations, the tables and subscribers of the system detailed in this section will be affected by said generation of XML files.

Tables

The system tables that allow the generation of XML files are described in the following sections.

These tables are filled in from system tables (sales/service invoices/credit memos), and from these tables, the XML files that will be digitally signed by the solution are generated.

Documents

  • Table name: INNESGFeHeaders
  • Caption: eSign Facturae Headers
  • Primary key: INNESGFeDocumentType, INNESGFeDocumentNo

This table is created from a sales/service invoice/credit memo.

Documents version

  • Table name: INNESGFeHeadersVersion
  • Caption: eSign Facturae headers version
  • Primary key: INNESGFeDocumentType, INNESGFeDocumentNo, INNESGFeId

This table is created from a Facturae document.

Info

Available from version 21.0.0.0

Lines

  • Table name: INNESGFeLines
  • Caption: eSign Facturae Lines
  • Primary key: INNESGFeDocumentType, INNESGFeDocumentNo, INNESGFeLineNo

This table is created from a sales/service invoice/credit memo line.

Taxes ouputs

  • Table name: INNESGFeTaxesOutput
  • Caption: eSign Facturae Taxes Outputs
  • Primary key: INNESGFeDocumentType, INNESGFeDocumentNo, INNESGFeLineNo

This table is created from taxes of sales/service invoice/credit memo.

Payment details

  • Table name: INNESGFePaymentDetails
  • Caption: eSign Facturae Payment Details
  • Primary key: INNESGFeDocumentType, INNESGFeDocumentNo, INNESGFeLineNo

This table is created from customer entries. They have payment method of sales/services invoice/credit memo.

Attachments

  • Table name: INNESGFeHeadersAttachment
  • Caption: eSign Facturae Document attachment
  • Primary key: INNESGFeDocumentType, INNESGFeDocumentNo, INNESGFeLineNo

This table allows add attachments to the Facturae documents for send to the connectors (gateways).

Attachments 21.0.0.0

  • Table name: INNESGFeAttachment
  • Caption: eSign Facturae attachments
  • Primary key: INNESGFeDocumentType, INNESGFeDocumentNo, INNESGFeLineNo

This table allows you to add attached documents to different entities of the system to send them to the Facturae documents. From the Facturae document they will be sent to the connectors (gateways).

Imported documents

  • Table name: INNESGFeHeadersRead
  • Caption: eSign Facturae headers read
  • Primary key: INNESGFeDocumentNo

This table is created from the imported Facturae documents.

Warning

All tables have the fields INNESGFeDocumentType anad INNESGFeDocumentNo in primary key. INNESGFeDocumentType is an option with values: Invoice, Credit Memo, Invoice Service, Credit Memo Service. INNESGFeDocumentNo is the no. of sales/service invoice/credit memo. These are the tables: Sales Invoice Header, Sales Cr.Memo Header, Service Invoice Header y Service Cr.Memo Header. A partir de cualquier registro de las tablas, y utilizando estos campos, se podría obtener la factura/abono de venta/servicio para realizar las modificacoines oportunas. You can get the sales/service invoice/credit memo using the fields from a record of the tables.

Subscribers

The subscribers of the system allow to modify the next workflows:

  • Generate Facturae document
  • Generate XML file from Facturae document
  • Send XML file to the connectors (gateways)
  • Import XML files to generate purchase invoices/credits memo

All subscribers are in codeunits INNESGFePublishers and INNESGFeImportDocumentHeader.

Table creation

For each of the above tables, a subscriber has been added that allows modifying the value of a record field before being inserted.

OnBeforeInsertHeaders

INNESGFePublishers.OnBeforeInsertHeaders(var Header: INNESGFeHeaders)

Is executed before insert into table INNESGFeHeaders.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeader.

OnBeforeInsertLines

INNESGFePublishers.OnBeforeInsertLines(var Lines: Record INNESGFeLines; Headers: Record INNESGFeHeaders)

Is executed before insert into table INNESGFeLines.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeLines. The field INNESGFeLineNo has the value of Line No. in current document.

OnBeforeInsertTaxesOutputs

INNESGFePublishers.OnBeforeInsertTaxesOutputs(var TaxesOutputs: Record INNESGFeTaxesOutputs, TempVATAmountLine: "VAT Amount Line" temporary; Headers: Record INNESGFeHeaders)

Is executed before insert into table INNESGFeTaxesOutputs.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeTaxesOutputs. Taxes lines are calculated according to the system standard and stored in the temporary table TempVATAmountLine. The field INNESGFeLineNo has the value of line no. in temporary table TempVATAmountLine (Line no. example: 10.000, 20.000, 30.000, etc.).

OnBeforeInsertPaymentDetails

INNESGFePublishers.OnBeforeInsertPaymentDetails(var PaymentDetails: Record INNESGFePaymentDetails, CustLedgerEntry: "Cust. Ledger Entry"; Headers: Record INNESGFeHeaders)

Is executed before insert into table INNESGFePaymentDetails.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFePaymentDetails. The payment lines are calculated according to the customer entries of the system, which are in the table CustLedgerEntry. The field INNESGFeLineNo has the value of line no. in table CustLedgerEntry (Line no. example: 10.000, 20.000, 30.000, etc.).

XML generation

The generation of the XML is divided into 3 basic nodes contained within the main node. This is the basic scheme that is affected by subscribers:

<Facturae>

..<FileHeader>

..<Parties>

..<Invoices>

....<Invoice>

......<Items>

........<InvoiceLine>

  • FileHeader if filled with information of sales/service invoice/credit memo: identifier, version, totlas, etc.
  • Parties is filled with information of buyer and seller of sales/service invoice/credit memose.
  • Invoices is filled with information of sales/service invoice/credit memo.
  • InvoiceLine is filled with information of sales/service invoice/credit memo lines.

The current subscribers are referred to nodes Facturae, FileHeader, Parties, Invoices, Items y InvoiceLine.

OnBeforeGenerateXML

INNESGFePublishers.OnBeforeGenerateXML(var XmlElemRoot: XmlElement; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed before create the nodes FileHeader, Parties and Invoices into node Facturae from XML.

The variable XmlElemRoot has the node Facturae and definitions.

The variable ExecuteNext allows the standar build code of the 3 main nodes FileHeader, Parties and Invoices not to be executed and it is the user who fills in all the XML from the node Facturae. The variable must be value to false.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnAfterGenerateXML

INNESGFePublishers.OnAfterGenerateXML(var XmlElemRoot: XmlElement; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed after create the nodes FileHeader, Parties and Invoices into the node Facturae from XML.

The variable XmlElemRoot has all nodes filled and definitions.

The variable ExecuteNext does not apply.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnBeforeSetFileHeader

INNESGFePublishers.OnBeforeSetFileHeader(var XmlElemRoot: XmlElement; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed before create the node FileHeader into the XML.

The variable XmlElemRoot has the node Facturae and definitions.

The variable ExecuteNext allows the standar build code of the node FileHeader not to be executed and it is the user who fills the node. The variable must be value to false.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnAfterSetFileHeader

INNESGFePublishers.OnAfterSetFileHeader(var XmlElemRoot: XmlElement; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed after create the node FileHeader into the XML.

The variable XmlElemRoot has the node FileHeader into the node Facturae and definitions.

The variable ExecuteNext does not apply.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnBeforeSetParties

INNESGFePublishers.OnBeforeSetParties(var XmlElemRoot: XmlElement; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed before create the node Parties into the XML.

The variable XmlElemRoot has the nodeFileHeader into the node Facturae and definitions.

The variable ExecuteNext allows the standar build code of the node Parties not to be executed and it is the user who fills the node. The variable must be value to false.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnAfterSetParties

INNESGFePublishers.OnAfterSetParties(var XmlElemRoot: XmlElement; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed after create the node Parties into the XML.

The variable XmlElemRoot has the nodes FileHeader and Parties into the node Facturae and definitions.

The variable ExecuteNext does not apply.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnBeforeSetInvoices

INNESGFePublishers.OnBeforeSetInvoices(var XmlElemRoot: XmlElement; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed before create the node Invoices into the XML.

The variable XmlElemRoot has the nodes FileHeader and Parties into the node Facturae and definitions.

The variable ExecuteNext allows the standar build code of the node Invoices not to be executed and it is the user who fills the node. The variable must be value to false.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnAfterSetInvoices

INNESGFePublishers.OnAfterSetInvoices(var XmlElemRoot: XmlElement; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed after create the node Invoices into the XML.

The variable XmlElemRoot has the nodes FileHeader, Parties and Invoices into the node Facturae and definitions.

The variable ExecuteNext does not apply.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnBeforeSetItems

INNESGFePublishers.OnBeforeSetItems(var XmlElemItems: XmlElement; Headers: Record INNESGFeHeaders; var ExecuteNext: Boolean)

Is executed before create the node Invoices/Invoice/Items into the XML.

The variable XmlElemItems is empty.

The variable ExecuteNext allows the standar build code of the node Invoices/Invoice/Items not to be executed and it is the user who fills the node. The variable must be value to false.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnAfterSetItems

INNESGFePublishers.OnAfterSetItems(var XmlElemItems: XmlElement; Headers: Record INNESGFeHeaders)

Is executed after create the node Invoices/Invoice/Items into the XML.

The variable XmlElemItems has the nodes InvoiceLine creates from the lines.

You can obtain the current document (sales/service invoice/credit memo) from primary key of INNESGFeHeaders. This record contains the information to fill the XML.

OnBeforeSetInvoiceLine

INNESGFePublishers.OnBeforeSetInvoiceLine(var XmlElemInvoiceLine: XmlElement; Lines: Record INNESGFeLines; var ExecuteNext: Boolean; Headers: Record INNESGFeHeaders)

Is executed before create the node Invoices/Invoice/Items/InvoiceLine into the XML.

The variable XmlElemInvoiceLine is empty.

The variable ExecuteNext allows the standar build code of the node Invoices/Invoice/Items/InvoiceLine not to be executed and it is the user who fills the node. The variable must be value to false.

You can obtain the current document line (sales/service invoice/credit memo) from primary key of INNESGFeLines. This record contains the information to fill the XML.

OnAfterSetInvoiceLine

INNESGFePublishers.OnAfterSetInvoiceLine(var XmlElemInvoiceLine: XmlElement; Lines: Record INNESGFeLines; Headers: Record INNESGFeHeaders)

Is executed after create the node Invoices/Invoice/Items/InvoiceLine into the XML.

The variable XmlElemInvoiceLine has the nodes filled from lines.

You can obtain the current document line (sales/service invoice/credit memo) from primary key of INNESGFeLines. This record contains the information to fill the XML.

XML import

The import of the XML is divided into 3 basic nodes contained within the main node. This is the basic scheme that is affected by subscribers:

<Facturae>

..<FileHeader>

..<Parties>

..<Invoices>

....<InvoiceTaxOutput>

....<Items>

......<InvoiceLines>

....<InvoicePaymentDetails>

  • FileHeader filled with relative information from FileHeader node.
  • Parties filled with relative information from Parties node.
  • Invoices filled with relative information from Invoices node.
  • InvoiceTaxOutput filled with relative information from TaxOutput node from XML invoices.
  • InvoiceLine filled with relative information from InvoiceLine node from XML invoices.
  • InvoicePaymentDetails filled with relative information from PaymentDetails node from XML invoices.

OnAfterGetFacturae

INNESGFeImportDocumentHeader.OnAfterGetFacturae(var XmlDoc: XmlDocument; var HeadersRead: Record INNESGFeHeadersRead)

Is executed after create the record of table INNESFFeHeadersRead from XML.

The variable XmlDoc has all XML file.

The variable HeadersRead has the record created from XML.

OnAfterGetFileHeader

INNESGFeImportDocumentHeader.OnAfterGetFileHeader(var XmlNodeFileHeader: XmlNode; var HeadersRead: Record INNESGFeHeadersRead)

Is executed after fill the fields of table INNESFFeHeadersRead refered to FileHeader node and before of Modify.

The variable XmlNodeFileHeader has the FileHeader node from XML.

The variable HeadersRead has the record created from XML.

OnAfterGetParties

INNESGFeImportDocumentHeader.OnAfterGetParties(var XmlNodeParties: XmlNode; var HeadersRead: Record INNESGFeHeadersRead)

Is executed after fill the fields of table INNESFFeHeadersRead refered to Parties node and before of Modify.

The variable XmlNodeParties has the Parties node from XML.

The variable HeadersRead has the record created from XML.

OnAfterGetInvoice

INNESGFeImportDocumentHeader.OnAfterGetInvoice(var XmlNodeInvoice: XmlNode; var Invoices: Record INNESGFeInvoices; HeadersRead: Record INNESGFeHeadersRead)

Is executed after fill the fields of table INNESGFeInvoices refered to each line of Invoices node and before of Insert.

The variable XmlNodeInvoice has the Invoice node from XML.

The variable Invoices has the record created from each line of XML.

The variable HeadersRead has the record created form XML.

OnAfterGetInvoiceLine

INNESGFeImportDocumentHeader.OnAfterGetInvoiceLine(var XmlNodeInvoiceLine: XmlNode; var InvoicesLine: Record INNESGFeInvoicesLines; HeadersRead: Record INNESGFeHeadersRead)

Is executed after fill the fields of table INNESGFeInvoicesLines refered to each line of Items\InvoiceLine node and before of Insert.

The variable XmlNodeInvoiceLine has the node Item\InvoiceLine from XML.

The variable InvoicesLine has the record created form each line of XML.

The variable HeadersRead has the record created form XML.

OnAfterGetInvoiceTaxOutput

INNESGFeImportDocumentHeader.OnAfterGetInvoiceTaxOutput(var XmlNodeInvoiceTaxOutput: XmlNode; var InvoicesTaxOutput: Record INNESGFeInvoicesTaxOutput; HeadersRead: Record INNESGFeHeadersRead)

Is executed after fill the fields of table INNESGFeInvoicesTaxOutput refered to each line of TaxesOutputs\Tax node and before of Insert.

The variable XmlNodeInvoiceTaxOutput has the TaxexOutputs\Tax node from XML.

The variable InvoicesTaxOutput has the record created from each line of XML.

The variable HeadersRead has the record created from XML.

OnAfterGetInvoicePaymentDetail

INNESGFeImportDocumentHeader.OnAfterGetInvoicePaymentDetail(var XmlNodeInvoicePaymentDetail: XmlNode; var InvoicesPaymentDetail: Record INNESGFeInvoicesPaymDetail; HeadersRead: Record INNESGFeHeadersRead)

Is executed after fill the fields of table INNESGFeInvoicesPaymentDetail refered to each line of PaymentDetails\Installment node and before of Insert.

The variable XmlNodeInvoicePaymentDetail has the PaymentDetails\Installment node from XML.

The variable InvoicesPaymentDetail has the record created from each line of XML.

The variable HeadersRead has the record created from XML.

Gateway (connectors)

There are the follow connectors generals and depending of gateways.

Warning

Not available in version 21.0.0.0

Generals

OnAfterGenerateXMLBeforeSendToGateway

INNESGFePublishers.OnAfterGenerateXMLBeforeSendToGateway(var Headers: Record INNESGFeHeaders; Customer: Record Customer; var SendToGateway: Boolean)

It is executed once the Facturae document has been generated and before it can be sent to the gateway.

The variable Headers contains the record of the Facturae document.

The variable Customer contains the customer record of the Facturae document.

The variable SendToGateway allows you to indicate whether it is sent to the gateway when registering the sales document.

Tip

This variable is not taken into account if the Send to gateway field is active in Configuration eSign Facturae. It can be used if for certain customers you want to send the Facturae document to the connectors. In this case, the field can be deactivated in eSign Facturae Setup and through the subscriber set the variable SendToGateway = true.

This subscriber is intended to be able to add attachments to the Invoice document. To do this, there is the following function:

Headers.AddAttachmentStream (var IStream: InStream; NameWithFormat: Text)

This function must be called with an InStream that contains a PDF file and with its name and its format.

Face

OnBeforeAddAttachmentFace

INNESGFePublishers.OnBeforeAddAttachmentFace(var Name: Text; var Attachment: Text; HeadersAttachment: Record INNESGFeHeadersAttachment; Headers: Record INNESGFeHeaders)

Is executed before fill the data for attachment sent to the Face platform.

The variable AttachmentName has the attachment name.

The variable Attachment has the attachment (PDF) in base 64.

The variable HeadersAttachment has the attachment record.

The variable Headers has the Facturae document record.

OnBeforeSendFace

INNESGFePublishers.OnBeforeSendFace(var Email: Text; var Name: Text; var InvoiceBase64: Text; Headers: Record INNESGFeHeaders)

Is executed before fill the data for Facturae document sent to the Face platform.

The variable Email has the notification email used by Face platform for notify the document status..

The variable InvoiceBase64 has the Facturae document (XML) in base 64.

The variable Headers has the Facturae document record.

Osakidetza

OnBeforeSendOsak

INNESGFePublishers.OnBeforeSendOsak(var InvoceName: Text; var InvoiceBase64: Text; Headers: Record INNESGFeHeaders)

Is executed before fill the data for Facturae document sent to the Osakidetza platform.

The variable InvoiceBase64 has the Facturae document (XML) in base 64.

The variable Headers has the Facturae document record.

eFact

OnBeforeAddAttachmenteFact

INNESGFePublishers.OnBeforeAddAttachmenteFact(var Extension: Text; var Attachment: Text; HeadersAttachment: Record INNESGFeHeadersAttachment; Headers: Record INNESGFeHeaders)

Is executed before fill the data for attachment sent to the eFact platform.

The variable Extension has the extension attachment.

The variable Attachment has the attachment (PDF) in base 64.

The variable HeadersAttachment has the attachment record.

The variable Headers has the Facturae document record.

OnBeforeSendeFact

INNESGFePublishers.OnBeforeSendeFact(var Receptor: Text; var InvoiceBase64: Text; Headers: Record INNESGFeHeaders)

Is executed before fill the data for Facturae document sent to the eFact platform.

The variable Receptor has the value of Partner id. field from Direction codes used by the eFact platform.

The variable InvoiceBase64 has the Facturae document (XML) in base 64.

The variable Headers has the Facturae document record.

OnBeforeCheckeFact

INNESGFePublishers.OnBeforeCheckeFact(var Reference: Text; var InvoiceNumber: Code[20]; var InvoiceDate: Integer; var InvoiceSupplier: Text; var InvoiceBuyer: Text; var InvoiceTotal: Text; Headers: Record INNESGFeHeaders)

Is executed before fill the data for Facturae document checked in the eFact platform.

The variable Reference has the value of Reference field in Facturae document.

The variable InvoiceNumber has the value of Document no. field in Facturae document.

The variable InvoiceDate has the value of Issue date field in Facturae document (year 4 digits).

The variable InvoiceSupplier has the value of VAT registration no. field in company.

The variable InvoiceBuyer has the value of Partner alias field in customer of Facturae document (Nif partner).

the variable InvoiceTotal has the value of Invoice total field in Facturae document.

The variable Headers has the Facturae document record.

Generals 21.0.0.0

There are the next general suscribers.

OnBeforeSendToGateway

INNESGFePublishers.OnBeforeSendToGateway(Headers: Record INNESGFeHeaders; Customer: Record Customer; var SendToGateway: Boolean)

Is executed before send document to gateway.

The variable Headers has the Facturae document record.

The variable Customer has the customer record.

The variable SendToGateway indicates when the document should send to gateway.

It can be useful when direct delivery to the platform is configured when registering the document and for some client you do not want to send it directly.

OnBeforeSendByEmail

INNESGFePublishers.OnBeforeSendByEmail(Customer: Record Customer; var Email: Text)

Is executed before send to email the document.

The variable Customer has the customer record.

The variable Email contains the email from customer card. This variable can be modified or left blank if you don't want to send the email.

It can be useful to change the email to which a document is sent or not to send it.

Languages

This document is available in these languages: