Minimum Version Required: 22.01
Pre-Conditions
User must have InvoiceEdit permission to run this routine
At least one identifier for customers (CustomerID or CustomerID_Translation) is required
Date information must be provided in at least one supported format
If updating existing invoices, enough identifying information must be included to locate them
Steps
The InvoicesAndPayments EDBL routine imports invoice data and can also process associated payments in a single file. This routine handles both creating new invoices and updating existing ones.
The system performs these operations:
Resolves customer information using CustomerID or CustomerID_Translation
Sets LocationID from the customer record if not explicitly provided
Processes date fields (using Date, DateYYYYMMDD, DateMMDDYY, or DateYYMMDD formats)
Attempts to find existing invoices by matching CustomerID and InvoiceNum
If RouteNum is provided (without RouteID), finds appropriate routes matching date and location
Creates or updates loadsheets and invoices as needed
For invoices marked as Paid, automatically processes payment information
When matching existing invoices, the system uses multiple fields for identification:
CustomerID + HandHeldInvoiceNum
Date + CustomerID + InvoiceNum
If the import action is "Add Only" and matching invoices exist, those records are skipped. For "Update Only", the system will only modify existing invoices. With "Update or Add", the system updates existing invoices or creates new ones as needed.
Fields And Definitions
Identifiers:
CustomerID - Integer, system ID of the customer
CustomerID_Translation - Text, external identifier for the customer used for matching
InvoiceID - Integer, system ID of the invoice
InvoiceNum - Text, invoice number (defaulted to "0" if not provided)
LoadSheetID - Integer, system ID of the load sheet
TranslationInvoiceNum - Text, external invoice number for translation
Date Fields (provide at least one):
Date - Standard date format
DateYYYYMMDD - Text, date in YYYYMMDD format
DateMMDDYY - Text, date in MMDDYY format
DateYYMMDD - Text, date in YYMMDD format
Location Information:
LocationID - Integer, defaults to user's location if not provided
LocationID_Translation - Text, external identifier for location used for matching
Route Information:
RouteID - Integer, system ID of the route
RouteNum - Text, route number used to look up RouteID if not provided
RoutingMethod - Integer, method to use for routing
Status Fields:
Paid - Yes/No, indicates if the invoice is paid
Locked - Yes/No, indicates if the invoice is locked
EDIStatus - Integer, electronic document interchange status
Amount Fields:
InvoiceTotal - Currency, total amount of the invoice
Receipt - Currency, payment amount
Additional Information:
PONum - Text, purchase order number
Memo - Text, additional notes
CheckNum - Text, check number for payment
Deliveryman - Text, person delivering the order
Salesman - Text, sales representative
SalesmanActual - Text, actual sales representative who fulfilled the order
ServerInvoiceID - Integer, server-side invoice ID
ServerLoadSheetID - Integer, server-side load sheet ID
Best Practices
Always include CustomerID or CustomerID_Translation for proper customer identification
Provide date information in a consistent format across all records
Use unique InvoiceNum values that match your existing invoice numbering system
When importing from another system, use consistent translation values for seamless matching
Set Paid to "Yes" only when you're actually including payment information
Include RouteNum if you want to associate invoices with specific routes
For recurring imports, maintain consistent naming conventions for easy tracking
If updating existing invoices, include enough identifying information to ensure the correct invoice is matched