InvoiceItem

The InvoiceItem object contains the attributes of an “item”, such as its description and cost. In ePASS, items are parts or accessories that are sold to customers or used by service technicians.

Add an Item to an Invoice

POST v1/invoicing/invoice/item/add

This endpoint adds an item to an existing invoice. Items can’t be added to ePASS without an existing invoice to add them to.

Invoice Conditions

An invoice must meet this list of conditions before you can add an item to it.

Condition Value
Invoice Status Invoice Status must be Open or Committed.
Branch Code Must be a valid Branch Code.
If not provided it will use the branch supplied during the login process, and if that is empty it uses the constant value DEFAULT.
Invoice JobStatus Any Job Status cascading that is configured in ePASS will be enforced through the API.
Bill To Customer BillToCustomer must be allowed to charge if the invoice is not an estimate and the payment type is AR.
Credit Limits will be enforced in the following situation:
- The invoice is not an estimate
- Credit Limit is enabled for the Customer
- The Invoice Payment Type is AR
- Require Credit Approval is disabled
- Either the Job Status is dispatchable or Dispatching is disabled completely

Required Fields

The following fields are the absolute minimum fields that should be required to add an item to an invoice.

Field Value
InvoiceCode Must be a valid Invoice Code.
ItemCode Must be a valid Item Code.
Item cannot be Obsolete if the Invoice Variables option Prevent Selling Obsolete Items/Models is True.
If not stock and the Invoice Variables option Warn When Selling Non-Stock Items/Models is True, we will return a warning message.
UserCreated Must be a valid User Code that is not Obsolete. If not provided it will use the Login User.

ItemCode

If a valid ItemCode is provided then the following values will be defaulted from the Item. You can override any of the values that would come from the Item simply by providing your own value.

Key Value
ItemDesc Item -> Description
Tax2 Item -> Tax2
Tax3 Item -> Tax3
UnitCost If the Item.AverageCost is greater than 0, then Item.AverageCost otherwise LastCost

Potentially Required Fields

These fields may be required depending on your ePASS configuration, or there is unique behavior that needs to be mentioned.

Field Value
SellingPrice If the BillTo customer has a valid project code, then the SellingPrice cannot be less than the project price.
If the Item has a valid sale price, then the SellingPrice cannot be less than the sale price.

addRelatedLines

The adding of related detail lines can be controlled using the “addRelatedLines” section. If not provided then no related detail lines will be added.

Key Value Description
Comment Boolean Determines if related Comment lines are added
Misc Boolean Determines if related Misc lines are added

Calculated Fields

Key Value
Total If Status is Open and (Invoice is Estimate or (the Invoice Type option “Total open BO Lines” is True and the Invoice Variable option Automatic Back Order Items is True) or the Item Inventory Variable option Auto Commit Items In Invoicing is false) then the Total will be: SellingPrice.Value * QtyOrdered.Value
Otherwise, the Total will be: SellingPrice.Value * QtyShipped.Value
Status If Invoice is not an Estimate and the Item Variable Auto Commit is True and there is sufficient QOH in the Location then the item will be committed and the Status will be Committed.
Otherwise the status will be Open.

Sample: Add an Item to an Invoice

 {
   "userCreated": null,
   "addRelatedLines": {
       "Misc": true,
       "Comment": true
   },
   "tripNo": null,
   "installed": null,
   "reference": null,
   "branchCode": null,
   "failureCode": null,
   "invoiceCode": "S03418389",
   "itemCode": "item3",
   "locationCode": "190",
   "qtyOrdered": 1,
   "sellingPrice": 120,
   "supplierCode": null,
   "supplierInvoice": null,
   "supplierInvoiceDate": null,
   "taken": null,
   "takenDate": null,
   "tax2": null,
   "tax3": null
}
 {
    "success": true,
    "message": null,
    "lastException": null,
    "recordId": 2345557,
    "code": null,
    "httpStatusCode": 201,
    "messageDetails": []
}


{
    "success": false,
    "message": "One or more of the fields has an invalid or missing value.",
    "lastException": null,
    "recordId": 0,
    "code": null,
    "httpStatusCode": 422,
    "messageDetails": [
        "Items are not allowed on Finished Invoices."
    ]
}