InvoiceMisc

The InvoiceMisc object represents a miscellaneous charge, credit, or promotion that is added to an invoice. Examples of miscellaneous items are delivery charges, instant rebates, and ‘“price matching”’ discounts.

Add a Miscellaneous Item to an Invoice


POST /invoicing/invoice/misc/add


This endpoint adds a miscellaneous item to an open invoice. Miscellaneous items can’t be added to EPASS without an existing open invoice to add them to.

Invoice Conditions

The following Invoice conditions must be satisfied in order to add any InvoiceMisc record.

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 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

Payload

Required Fields

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

Field Type Description
InvoiceCode string Must be a valid Invoice Code.
Qty integer If not provided, defaults to 1.
MiscCode string Must be a valid MiscCode that is not obsolete and Model Discount is false.
Misc or MiscType must be valid sales divisions as Invoice Type
If the current date is not between Misc.StartDate and Misc.EndDate, we will return a warning message.
Misc Code cannot be Tax1Included, Tax2Included and Tax3Included.
UserCreated string Must be a valid User Code that is not Obsolete. If not provided it will use the Login User.

MiscCode

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

Key Value
MiscDesc Misc -> Description
UpdateHistory Misc -> History
GLRevenue Misc -> GLRevenue
GLCostCr Misc -> GLCostCr
GLCostDb Misc -> GLCostDb
Tax2 Misc -> Tax2
Tax3 Misc -> Tax3
Comment Misc -> CommentCode -> Comment.Description
Warranty If Misc.Warranty is Always Yes, then Yes.
If Misc.Warranty is Always No, then No.
If Misc.Warranty is From Invoice Type and Invoice.SvcInWarranty is No Warranty or Labor Warranty Only, then No, otherwiseYes.
UnitCost Misc -> Cost if Misc -> CostIsPercentageSellingPrice is True then UnitCost will be = Misc.List * Misc.Cost / 100

Potentially Required Fields

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

Field Type Description
SellingPrice integer If the Misc option Do Not Allow Price Reduction is True and the BillTo customer has a valid project code, then the SellingPrice cannot be less than the project price.
If the Misc option Do Not Allow Price Reduction is True and Qty is greater than 0, then the SellingPrice cannot be less than the Misc list price.
If the Misc option Do Not Allow Price Change is True, then the SellingPrice must match the Misc list price.
Comment string If the VarINV option Special Order Comment Required is True and option Special Order Misc Code is the provided MiscCode.
If the Misc option Require Note on Invoice is True.
ServiceTime integer This is the Misc.TimeInMinutes.

addRelatedLines

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

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

Sample: Adding a Misc. Charge to an Invoice

 POST /invoicing/invoice/misc/add 

{
    "tripNo": null,
    "comment": "Add Cool Device",
    "commissionCode": null,
    "branchCode": null,
    "glCostCr": null,
    "glCostDb": null,
    "glRevenue": null,
    "invoiceCode": "1234567",
    "miscCode": "SERVICE",
    "miscDesc": null,
    "qty": null,
    "sellingPrice": null,
    "tax1": null,
    "tax2": null,
    "tax3": null,
    "unitCost": null,
    "userCreated": null,
    "warranty": null
}
 {
    "success": true,
    "warning": false,
    "httpStatusCode": 201,
    "generalMessage": null,
    "exceptionMessage": null,
    "keys": [
        {
            "table": "InvoiceMisc",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 123456
                        }
                    ]
                }
            ]
        },
        {
            "table": "InvoiceAddress",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 123456
                        }
                    ]
                }
            ]
        },
        {
            "table": "InvoiceAudit",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 123456
                        }
                    ]
                }
            ]
        }
    ],
    "messages": [],
    "warnings": []
}

{
    "success": false,
    "warning": false,
    "httpStatusCode": 422,
    "generalMessage": "One or more of the fields has an invalid or missing value.",
    "exceptionMessage": null,
    "keys": [],
    "messages": [
        {
            "code": "INV-040021",
            "message": "Miscs are not allowed on Finished Invoices."
        }
    ],
    "warnings": []
}