InvoiceModel

The InvoiceModel object contains attributes of a product model that is sold to customers, such as its selling price, color, and general description. Examples of a model would be a stove or a dishwasher.

Add a Model to an Invoice

POST v1/invoicing/invoicemodel/add

This endpoint adds a product model to an existing invoice. Models 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 a model to it.

Condition Value
Invoice Status Invoice Status must be Open or Committed.
Branch Code The invoice must have 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 If the Invoice JobStatus has Require All Serials to be Reserved enabled then you cannot add InvoiceModel records via the API.
Any Job Status cascading that is configured in ePASS will be enforced through the API.
Estimate If the Invoice is an estimate then there are no restrictions related to the customer being allowed to charge or credit limits.
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

Required Fields

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

Field Value
InvoiceCode Must be a valid Invoice Code.
QtyOrdered If not provided, default to 1. Must be greater than zero.
ModelCode Must be a valid Model Code that is not Substituted.
If To Be Discontinued is checked for the model we will return a warning message.
If the Invoice Variables option Prevent Selling Obsolete Items/Models is True then model code cannot be obsolete.
If the Invoice Variables option Prevent Selling Inactive Items/Models is True then model code must be active.
UserCreated Must be a valid User Code that is not Obsolete. If not provided it will use the Login User.

ModelCode

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

Key Value
ModelDesc Model -> Description
Color Model -> Color
Features Model -> FeaturesCode.Description
Tax1 Model -> Tax1
Tax2 Model -> Tax2
Tax3 Model -> Tax3
Tax1CostList Model -> Tax1CostList
Tax1Included Model -> Tax1Included
Tax1Percentage Model -> Tax1Percentage if Tax1Included is True
StandardCost If the Invoice Type is configured to set Standard Cost to either the Project Cost from a specific List Price, or the Project Cost from a Customer Project, then that cost will be used for StandardCost.
Otherwise it will come from the Model.StandardCost.
LandedCost If the Invoice Type is configured to set LandedCost to either the Project Cost from a specific List Price, or the Project Cost from a Customer Project, then that cost will be used for LandedCost.
Otherwise it will come from the Model.LandedCost.
ReplacementCost If the Invoice Type is configured to set ReplacementCost to either the Project Cost from a specific List Price, or the Project Cost from a Customer Project, then that cost will be used for ReplacementCost.
Otherwise it will come from the Model.ReplacementCost.
OriginalCost If the Invoice Type is configured to set OriginalCost to either the Project Cost from a specific List Price, or the Project Cost from a Customer Project, then that cost will be used for OriginalCost.
Otherwise it will come from the Model.OriginalCost.
AverageCost Model -> AverageCost
LastCost Model -> LastCost
NewUsed Model -> NewUsed
ManufacturersWarranty Model -> ManufacturersWarranty
Spiff Model -> Spiff if the Invoice Type option Spiff Number is 1 and the current date is between Model.SpiffStartDate and Model.SpiffEndDate.
Model -> Spiff2 if the Invoice Type option Spiff Number is 2 and the current date is between Model.Spiff2StartDate and Model.Spiff2EndDate.

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 Model has a valid SalesPrice1, then the SellingPrice cannot be less than SalePrice1.
If the Model has a valid SalesPrice2, then the SellingPrice cannot be less than SalePrice2.
If the BillTo customer does not have a valid project code and the Invoice Type option Disable Min Selling Price is not checked, then the SellingPrice cannot be less than Minimum Selling Price.
Color If the Invoice Type option Require Model Color is True, then the Color field is required.
Reference If the Invoice Type option Require Reference is True, then the Reference field is required.

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
MiscEcoFees Boolean Determines if related Eco Fees are added

Sample: Add a Model to an Invoice

  {
    "userCreated": null,
    "color": null,
    "reference": null,
    "tripNo": null,
    "branchCode": null,
    "featuresCode": null,
    "features": null,
    "invoiceCode": "S03253937",
    "locationCode": "190",
    "modelCode": "EPR628S1",
    "qtyOrdered": null,
    "sellingPrice": 1039.99,
    "tax2": null,
    "tax3": null,
    "addRelatedLines": {
        "Misc": false,
        "MiscEcoFees": false,
        "Comment": false
    }
}
  
 {
    "success": true,
    "warning": false,
    "httpStatusCode": 201,
    "generalMessage": null,
    "exceptionMessage": null,
    "keys": [
        {
            "table": "InvoiceModel",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 2345527
                        }
                    ]
                }
            ]
        },
        {
            "table": "InvoiceAddress",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 7057185
                        }
                    ]
                }
            ]
        },
        {
            "table": "InvoiceAudit",
            "keys": [
                {
                    "key": "ID",
                    "fields": [
                        {
                            "fieldName": "ID",
                            "fieldValue": 6398597
                        }
                    ]
                }
            ]
        }
    ],
    "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-09002",
            "message": "InvoiceCode is required."
        }
    ],
    "warnings": []
}