Import-Nav2016PurchaseInvoices
1.0.0
NAV accepts the same file by hand through Incoming Documents.
The G/L account and the dimensions of a line are not part of the standard. The script reads them
from cac:InvoiceLine/cbc:AccountingCost, written like this:
GL=8210;DEPARTMENT=ADM;PROJECT=TOYOTA
GL is the G/
NAV accepts the same file by hand through Incoming Documents.
The G/L account and the dimensions of a line are not part of the standard. The script reads them
from cac:InvoiceLine/cbc:AccountingCost, written like this:
GL=8210;DEPARTMENT=ADM;PROJECT=TOYOTA
GL is the G/L account number. Every other key is the code of a dimension that is a Shortcut
Dimension 1..8 in General Ledger Setup. A line without GL= is an error, unless config.json sets
defaultGLAccount. The vendor is taken from cbc:CustomerAssignedAccountID (NAV Vendor No.); when
that is missing, it is looked up by VAT number. Every line becomes a G/L account line with
quantity 1 and the amount of cbc:LineExtensionAmount. Credit notes and document-level allowances
and charges (cac:AllowanceCharge) are not supported.
Goes through the incoming folder. For every *.xml file it:
1. checks that the vendor exists in NAV;
2. checks whether an unposted invoice with the same vendor and Vendor Invoice No. already
exists;
3. if not, creates the invoice with all its lines and dimensions through the SOAP web service
over Page 51 "Purchase Invoice": with one Create call, or, when the vendor card carries a
currency, in three steps (see New-InvoiceInSteps);
4. moves the file to processed (success) or to error (failure, together with an .err.txt
file that holds the reason).
Nothing is posted. The invoice stays in the Purchase Invoices list and waits for Post.
The settings are read from config.json. -CreateSampleConfig creates a sample file; its fields
are described in the NOTES section (Get-Help -Full).
Installation Options
Owners
Package Details
Author(s)
- Tonchev
Tags
NAV DynamicsNAV NAV2016 PEPPOL UBL PurchaseInvoice SOAP Import
Functions
ConvertFrom-ConfigJson Get-ConfigText Write-Log Get-AuthParams Get-ServiceUrl Read-ErrorAnswer Get-FaultString Get-FaultFromText Invoke-NavSoap Get-ShortcutDimMap Get-VendorCurrency ConvertTo-NavFilterPattern Get-ChildText Test-InvoiceExists Test-DateString ConvertTo-ShortcutDims Complete-InvoiceFromNav Open-RecordRequest Close-RecordRequest Write-HeaderDetails Write-InvoiceLines ConvertTo-CreateXml ConvertTo-CreateHeaderXml ConvertTo-ClearCurrencyXml ConvertTo-CompleteXml ConvertTo-DeleteXml ConvertTo-PreviewXml Get-LocalCurrencyCode Get-XText ConvertTo-Dec ConvertFrom-AccountingCost Find-VendorNoByVat Get-NoAccountMessage Read-PeppolInvoice Move-ToFolder ConvertTo-FileNamePart Move-ToErrorFolder Read-InvoiceRecord New-InvoiceInOneCall Invoke-InvoiceChange New-InvoiceInSteps Import-InvoiceFile New-FolderIfMissing
Dependencies
This script has no dependencies.
Release Notes
1.0.0 - First published version.
FileList
- Import-Nav2016PurchaseInvoices.nuspec
- Import-Nav2016PurchaseInvoices.ps1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 1.0.0 (current version) | 11 | 11/23/2026 |