Entry of a Direct Sales Invoice in a Non-Default Currency

A point-of-sale (POS) system can create and process direct sales invoices—that is, invoices for which neither a sales order nor a shipment has been created—in a currency that differs from the default currency of the customer account. The POS system creates the direct sales invoice in the needed currency and releases the invoice.

For simplicity, this example does not include the creation of the payment or the application of the payment to the invoice. You can find an example showing how to create and apply a payment in Entry of a Direct Sales Invoice.

In this topic, you will implement HTTP requests for the following user scenario. A customer comes to the U.S. store and picks up two boxes of large jars of apple jam. The customer would like to buy them, return a previously purchased small jar of apple jam, cancel the order of the cleaning service, and pay in euros. In the POS system, one invoice is created for this operation. The customer pays the difference between the sale and return.

Testing of the Requests

Before you test the code below, you need to do the following to configure your client application and the MYOB Acumatica instance to be used:

  1. Deploy a new MYOB Acumatica instance with the U100 dataset. For details on deploying an instance, see To Deploy an MYOB Acumatica Instance.
  2. To sign in to the instance in the client application, use the tenant name (which you specified when you created the instance) and the HEADOFFICE branch.
  3. If you use Postman as the client application for testing, in the IntegrationDevelopmentGuide.postman_collection.json collection (which is located in the IntegrationDevelopment\Help folder of the Help-and-Training-Examples repository on GitHub), make sure the collection variables have the proper values.
  4. On the Enable/Disable Features (CS100000) form, make sure that the Inventory and Order Management, Multicurrency Accounting, and Advanced SO Invoices features are enabled.
  5. Configure multicurrency support as follows:
    1. On the Currencies (CM202000) form, open EUR, select the Active and Use for Accounting boxes, and specify the following values in the other boxes:
      • Realized Gain Account: 83100
      • Realized Loss Account: 83100
      • Unrealized Gain Account: 84000
      • Unrealized Loss Account: 84000
      • Revaluation Gain Account: 83200
      • Revaluation Loss Account: 83200
      • Rounding Gain Account: 83100
      • Rounding Loss Account: 83100

      Save your changes.

    2. On the Currency Management Preferences (CM101000) form, click Save.
    3. On the Currency Rate Entry tab of the Currency Rates (CM301000) form, add a row with the following settings:
      • From Currency: EUR
      • Currency Rate Type: SPOT
      • Currency Effective Date: Today
      • Currency Rate: 1.1
      • Mult./Div.: Multiply

      Save your changes.

Tip: In the request examples below, <MYOB Acumatica instance URL> is the URL of the MYOB Acumatica instance (such as https://my.acumatica.com/MyInstance). You can omit the instance name in the URL (such as https://my.acumatica.com) if the instance is installed in the root of the website.

Step 1: Configure the Customer

You use the following example of an HTTP request to enable the currency overriding and the rate overriding for the FRUITICO customer and to assign the SPOT currency rate type to the customer.

PUT / HTTP/1.1
Host: [<Acumatica ERP instance URL>]/entity/Default/23.200.001/Customer
Accept: application/json
Content-Type: application/json

{
    "CustomerID": {"value": "FRUITICO"},
    "EnableCurrencyOverride": {"value": true},
    "EnableRateOverride": {"value": true},
    "CurrencyRateType": {"value": "SPOT"}
}

Step 2: Create an Invoice

You use the following example of an HTTP request to create an invoice containing the items the customer is buying and those the customer is returning, and release the invoice from hold.

PUT ?$expand=Details HTTP/1.1
Host: [<Acumatica ERP instance URL>]/entity/Default/23.200.001/SalesInvoice
Accept: application/json
Content-Type: application/json

{
    "CustomerID": {"value": "FRUITICO"},
    "Type": {"value": "Invoice"},
    "Currency": {"value": "EUR"},
    "Hold": {"value": false},
    "Details":
    [
        {
            "Branch": {"value": "HEADOFFICE"},
            "InventoryID": {"value": "APJAM96"},
            "WarehouseID": {"value": "WHOLESALE"},
            "Qty": {"value": 2},
            "UOM": {"value": "JBOX"},
            "Location": {"value": "L3R1S2"}
        },
        {
            "Branch": {"value": "HEADOFFICE"},
            "InventoryID": {"value": "APJAM08"},
            "WarehouseID": {"value": "WHOLESALE"},
            "Location": {"value": "L1R1S2"},
            "Qty": {"value": -1},
            "UOM": {"value": "PIECE"}
        },
        {
            "Branch": {"value": "HEADOFFICE"},
            "InventoryID": {"value": "CLEANING"},
            "Qty": {"value": -1},
            "UOM": {"value": "HOUR"}
        }
    ]
}

Step 3: Release the Invoice

You use the following example of an HTTP request to release the invoice that you created at the previous step (whose reference number is assumed to be 000118).

POST /ReleaseSalesInvoice HTTP/1.1
Host: [<Acumatica ERP instance URL>]/entity/Default/23.200.001/SalesInvoice
Accept: application/json
Content-Type: application/json

{
  "entity" : {
      "ReferenceNbr": {"value": "000118"},
      "Type": {"value": "Invoice"}
      },
  "parameters" : {}
}

At this point, you would check the status of this operation by performing similar actions to those described in Execute an Action That Is Present in an Endpoint. For simplicity, the checking requests are not provided here.