You can use the Import Designer to import Invoices from another Accredo company, or another accounting system, into Accredo.
Accredo provides a sample import definition files for most masterfiles, including Invoices, in the \Imports\EDIImports\SampleImports directory. Corresponding export script files for all import files are also provided in the \Scripts\EDIExports\SampleExports directory.
When designing an Import routine, we recommend starting with an existing sample import definition, and modifying it to meet your requirements. The Accredo supplied file is INInvoice.pfi.
Go to Navigator > Setup > Data Interchange > Import Designer.
Click
Load... (Alt+L) to load the supplied sample Invoice routine, or another Invoice import routing.
Import File
You will need an invoice file to import. You can create a file from Accredo by running the sample Invoice Export script. If you have an existing invoice file to import, you can modify the sample Import routine to match your file.
Set the Default Input File to your input file.
You can click the View Data... (Alt+W) button to see the data in the input file.
Definition Tab
The Definition tab is used to define the overall Import routine. The code on the Definition tab will call the code on the other tabs.
The code in the sample Invoice Import file starts with:
Dim Data as Object
Data = CreateObject("Accredo.InInvoiceData")
If you place the cursor in the InInvoiceData text then press F1, the InInvoiceData Documentation will be displayed. This shows all the properties and methods of the InInvoiceData object. Some properties, such as Line have their own properties and methods. This is another object within the INInvoiceData object. The InInvoiceData.Line object contains the Invoice Line information. Other sub-objects are Charge, Ship and Banking. The code creates objects for each of these:
Dim Line as ObjectLine = Data.LineDim Charge as ObjectCharge = Data.ChargeDim Ship as ObjectShip = Data.ShipDim Banking as ObjectBanking = Data.Banking
If you are importing each of these objects, you need a LineType tab for each one. In the example, there are 5 line types. Check your input file to see how the data can map to the main InInvoice object, and the sub-objects. In the examples, each line in the input file begins with a line type, showing which object the line has data for.
The following code sets up a loop that reads each line of the data file, and processes the relevant line type.
Do Until ImportFile.EOF ImportFile.BeginTransaction ImportFile.GetNextLine If ImportFile.LineType = "" Then ' Do nothing with blank lines ElseIf Upper(ImportFile.LineType) = "COMMENT" Then ' Do nothing with comment lines ElseIf Upper(ImportFile.LineType) = "ININVOICE" Then ProcessLineType(1) HeadError = ImportFile.Error ImportFile.GetNextLine Do Until Upper(ImportFile.LineType) <> "ININVLN" If Not HeadError Then ProcessLineType(2) If ImportFile.Error Then Line.Cancel ImportFile.Result = False End If ImportFile.GetNextLine Loop Do Until Upper(ImportFile.LineType) <> "ININVCHG" If Not HeadError Then ProcessLineType(3) If ImportFile.Error Then Charge.Cancel ImportFile.Result = False End If ImportFile.GetNextLine Loop Do Until Upper(ImportFile.LineType) <> "ININVSHP" If Not HeadError Then ProcessLineType(4) If ImportFile.Error Then Ship.Cancel ImportFile.Result = False End If ImportFile.GetNextLine Loop Do Until Upper(ImportFile.LineType) <> "ININVBANK" If Not HeadError Then ProcessLineType(5) If ImportFile.Error Then Banking.Cancel ImportFile.Result = False End If ImportFile.GetNextLine Loop ImportFile.Rewind ProcessSave Else Print "Unknown line: " & ImportFile.LineType ImportFile.Error = True End If If ImportFile.Error And Data.Editing Then Data.Cancel ImportFile.EndTransactionLoopData = Nothing
This code checks the first field (LineType) of the line. If it is blank, or contains COMMENT (for header lines) it does nothing. If it recognises the Line Type, it calls the relevant Line Type code, then calls Process Save. It displays a message if the Line Type is unknown, and it cancels if there is an error processing the line.
See Import Invoices Example - Process Save tab, Import Invoices Example - Line Type 1 tab and Import Invoices Example - Other Line Type tabs for the rest of the example.