POSTING INVOICES OT ONE BATCH

When using the Sage 300 WebApi, is it possible to post several invoices to the same batch in Sage?

  • Hi  your question could mean a few different things but I'll take a guess that your problem is:

    1. You have setup A/R Invoice integration between a membership or billing system and Sage 300 via the Web API.
    2. When the integration runs and there is only a single invoice to push into Sage 300, the Web API creates a new A/R invoice batch with 1 entry in it.
    3. You do not post the invoice batch, leaving it open.
    4. Later, the integration runs again and another invoice is pushed into Sage 300 via the Web API.
    5. Instead of the second invoice being placed as entry 2 in the first unposted batch, a second invoice batch is created with 1 entry.
    6. You now have two open A/R invoice batches both with 1 entry.
    7. You're worried this will make a long mess of your A/R Invoice Batch Listing
    8. You want all A/R invoices created by the Web API integration to go into the next open batch until you post it.

    Is this correct as it was a common question long before the Web API when integration was done with Sage 300 VB Macros and other methods?  Awaiting your clarification. Cheers.

  • Hi   you got it right. That's the issue I'm dealing with. I want all A/R invoices created by the web API integration to go to the same open batch until posted, instead of creating a new batch every time an invoice is pushed.

  • 0

    Yes, you can.

    For something like AR Invoice with multiple entries with multiple lines per entry:

    {
      "BatchDate": "2024-11-15",
      "BatchStatus": "Open",
      "Description": "Test Multi Entry",
      "Invoices": [
        {
          "CustomerNumber": "1400",
          "DocumentType": "Invoice",
          "InvoiceType": "Summary",
          "DocumentDate": "2024-11-15",
          "DueDate": "2024-11-15",
          "InvoiceDetails": [
            {
              "DistributionCode": "CACCSE",
              "ExtendedAmountWithTIP": 200
            }
          ]
        },
        {
          "CustomerNumber": "1200",
          "DocumentType": "Invoice",
          "InvoiceType": "Summary",
          "DocumentDate": "2024-11-15",
          "DueDate": "2024-11-15",
          "InvoiceDetails": [
            {
              "DistributionCode": "CACCSE",
              "ExtendedAmountWithTIP": 200
            },
            {
              "DistributionCode": "ITEM",
              "ExtendedAmountWithTIP": 300
            },
            {
              "DistributionCode": "CACCSE",
              "ExtendedAmountWithTIP": 400
            },
            {
              "DistributionCode": "ITEM",
              "ExtendedAmountWithTIP": 500
            }
          ]
        }
      ]
    }

  • 0 in reply to SergeB

    Hi  that's cool and will insert multiple invoice entries into the initial batch though what happens when the call is repeated with new sets of invoices throughout the day?  I haven't done any testing/dev yet (I will when I get a chance), but will your call above insert those two invoices into the most recent open batch? i.e. if you were to run this call 3 times 30 mins apart, after 90 minutes would you have 3 batches with 2 invoices in each, or one batch with 6 invoices?  I think  wants multiple API calls to insert invoices into the most recent open batch until its posted or set 'Ready to Post'.  Only then would the next call open a new batch, with subsequent calls populating that batch via the same process until its posted or set ready to post again, so on, so fourth. 

  • 0 in reply to Tim - Accsys Consulting

    If you repeate that POST call, you will create new batches all day long.

    If you want to update/add to an existing batch #54:

    HTTP PATCH : /Sage300WebApi/v1.0/-/SAMINC/AR/ARInvoiceBatches(54)

    Body:

    {
      "BatchStatus": "Open",  
      "Invoices": [
        {
          "CustomerNumber": "1400",
          "DocumentType": "Invoice",
          "InvoiceType": "Summary",
          "DocumentDate": "2024-11-15",
          "DueDate": "2024-11-15",
          "InvoiceDetails": [
            {
              "DistributionCode": "CACCSE",
              "ExtendedAmountWithTIP": 50
            }
          ]
        },
        {
          "CustomerNumber": "1200",
          "DocumentType": "Invoice",
          "InvoiceType": "Summary",
          "DocumentDate": "2024-11-15",
          "DueDate": "2024-11-15",
          "InvoiceDetails": [
            {
              "DistributionCode": "CACCSE",
              "ExtendedAmountWithTIP": 50
            },
            {
              "DistributionCode": "ITEM",
              "ExtendedAmountWithTIP": 50
            }
          ]
        }
      ]
    }

    ^ That will add a new entry to batch 54.

    If you want to update an existing entry in that batch, same URL but then you need to specify the EntryNumber.

    This payload will update entry #1 by adding another line detail:

    {
      "BatchStatus": "Open",  
      "Invoices": [
        {
          "EntryNumber": 1,
          "CustomerNumber": "1400",
          "DocumentType": "Invoice",
          "InvoiceType": "Summary",
          "DocumentDate": "2024-11-15",
          "DueDate": "2024-11-15",
          "InvoiceDetails": [
            {
              "DistributionCode": "CACCSE",
              "ExtendedAmountWithTIP": 50
            }
          ]
        }
      ]
    }