Using the Purchase Invoice
Various aspects of the purchase invoice are important to be aware of when you integrate purchase invoices from the Application Integration Framework (AIF) with other, third-party applications or when you adjust purchase invoice functionality for the AIF.
When an XML purchase invoice document is received in the AIF, the AxdPurchInvoice class validates the deserialized XML purchase invoice document data with the required Microsoft Dynamics AX business logic and creates a new purchase invoice based on the document data.
Inbound from the AIF to Microsoft Dynamics AX.
New purchase invoices are received from the AIF and registered in the form.
The treatment of duplicate received purchase invoices is determined by the parameter settings in > > > > .
The user processes further invoice approval posting by retrieving the invoice from the invoice register.
During registration, a validation on the field level takes place. If the validation fails, an entry in the history log is created.
The following Axd class and Ax<table> classes are used to generate the sales invoice.
Supportive Invoice Information Table
To support users when they are approving the invoice journal, a new journal table (VendInvoiceInfo) with relevant information is used. The content in the table is derived from the deserialized purchase invoice document.
The fields of the VendInvoiceInfo table are:
Item line price amounts
The read-only form, VendInvoiceInfo, displays the information from the VendInvoiceInfo table and is accessed from the form in > > > .
Synchronizing with the Invoice Approval form
The content in the VendInvoiceInfo table is synchronized with the content in the invoice approval form by using the TableId and RecId values.
To maintain the correct relation to the VendInvoiceInfo table when the invoice approval form is retrieved from the invoice register and a new journal entry is created, the RecId for the VendInvoiceInfo table is overwritten with the RecId of the new journal entry.
The following section describes form notes and mandatory fields that you must be aware of when receiving the purchase invoice.
Consider form notes from the following tables:
Form notes in the purchase invoice document will be created in the DocuRef table. The inherent business logic in Microsoft Dynamics AX is used to create the form notes.
Conditions for Adding Notes
The following relations between the DocuRef table and other tables must be respected when you integrate sales order documents.
Adding Notes to the Purchase Invoice
DocuRef.RefRecId = LedgerJournalTrans.RecId
DocuRef.RefTableId = LedgerJournalTrans.TableId
DocuRef.Restriction = “Internal”
DocuRef.TypeId = Only notes of the type “Notes” can be received. If the purchase invoice document contains notes of any other type than “Notes”, the purchase invoice document will not result in an error. Instead, the value in the Document Type setup form will be used instead.
Purchase Invoice Mandatory Fields
The following fields must contain values for the purchase invoice document to be valid. No default values are defined by the Axd class.
Vendor account number
Journal number values can be generated and inserted only by the Axd class in Microsoft Dynamics AX. Values originating from deserialized XML documents are ignored and overwritten with the journal number from Microsoft Dynamics AX.
The TypeID field is mandatory if notes are attached to the purchase invoice. Only notes of the type “Notes” can be received.
Trading Partner Identification
Partner identification (type and ID) is returned by the GetPartner method of the Axd class, AxPurchInvoice.
Partner Type: The value of the Partner Type field is set by the Axd class to “Vendor”.
Partner Id: The Partner ID is derived from the field in the LedgerJournalTrans table.
All inbound purchase invoices are received in the form, independent of the endpoint that is sending the purchase invoice document.
Default invoice registers for inbound purchase invoice documents are selected in > > > > .
Notes in all inbound documents, including purchase invoices can be received in Microsoft Dynamics AX but only if the notes type that is to be received is set up in the document management parameters form in > > > > > .This setting for the notes type ID is global for all inbound documents and for all endpoints.
The global value in the Document Type field will be applied to the notes type ID of the inbound document, regardless of the original value of the notes type ID in the deserialized XML document.
Only purchase invoice notes of the type will be accepted by the application. If the document settings are set to permit other types of notes (file, image, document, worksheet), the settings are overruled by the AxdPurchaseInvoice class, and only purchase invoice notes of the type will be permitted.
The purchase invoice document notes are defaulted to , which permits reception of the document
Security and Restrictions
The Security key for receiving and processing purchase invoices is also linked to the VendInvoiceInfo table and is therefore equal to the VendTables security key.
The Configuration key for receiving and processing purchase invoices is linked to the VendInvoiceInfo table and therefore is equal to LedgerBasic.