HTTP Operation Type Object DTO Why-DTOs?
(Mutation Why 200?) postSalesInvoice PostSalesInvoiceGLDtoInput

Description

The PostSalesInvoice service allows for the posting of a sales invoice to generate ledger entries that are associated with the sales invoice journal.
This service also creates ledger entries based on the provided sales invoice details, facilitating financial tracking and management within the system.

This functionality can be related to Sales Open Items Settlement as it is necessary for an invoice to be posted before settlements can be applied to it.

img

Functionality

Input Parameters

Invoice Details: Specify the details of the sales invoice that is being posted.

Response

The service can return the following fields:

These fields confirm that the sales invoice has been successfully posted.

Key Value
Authorization Bearer Current access Token How to find?
X-TenantId Current tenant id How to find?
X-OrganizationId Current organization Id How to find?
x-api-key Primary or secondary subscription key of your app How to find?
graphQL Query
mutation($input: PostSalesInvoiceGLDtoInput!) {
  postSalesInvoice(input: $input) {
    accountingEntryId
    accountingEntryNumber
    accountingEntries {
        accountingEntryId
        accountingEntryNumber
    }
  }
}
graphQL Variables
{
  "input": {
    "salesInvoiceId": "96771689-53b9-4f4c-add3-40eb31e38254",
    "accountingEntryDescription": "Sales Invoice No. 0007 27/06/2024",
    "journalTypeId": "6fdf8926-cfdd-4ef8-8f89-39d6bfa622da"
  }
}
Example Response: Returns the Identifiers of the Accounting Entry
{
    "data": {
        "postSalesInvoice": {
            "accountingEntryId": "4b4a0742-392b-4170-bfd4-969a2c882f44",
            "accountingEntryNumber": 1516,
            "accountingEntries": [
                {
                    "accountingEntryId": "4b4a0742-392b-4170-bfd4-969a2c882f44",
                    "accountingEntryNumber": 1516
                }
            ]
        }
    }
}

postSalesInvoice Input parameters

Fields Type Description Length
salesInvoiceId UUID Unique identifier of the sales invoice  
accountingEntryDescription String Description of the accounting entry being created 200
journalTypeId UUID Identifier for the SALES_INVOICE journal  

postSalesInvoice Response

Fields Type Description
accountingEntryId UUID Unique identifier of the primary ledger entry created
accountingEntryNumber Integer Ledger entry number of the primary ledger entry
accountingEntries Array List of all related ledger entries
  • accountingEntryId
UUID Unique identifier of a related ledger entry
  • accountingEntryNumber
Integer Ledger entry number of a related ledger entry
Info
  • In cases where sales invoices include deductions from previously invoiced deposits, two ledger entries may be generated for a single invoice:
    • One for the invoice amount excluding the deposit deduction.
    • One for the deposit deduction itself.
  • To maintain response compatibility:
    • accountingEntryId and accountingEntryNumber continue to return information for the first ledger entry.
    • The accountingEntries array includes all generated ledger entries, including the first one.
New Logic for Sales Ledger Account Selection

The determination of the sales ledger account during invoice posting will evolve.

Currently, the selection is based on:

Scenario Sales Account Used
  • National Customer
  • VIES Customer
  • Foreign Customer
salesAccountingAccountId from the product,
or if not set, defaultSaleProductsAccountId from organizationAccountingSetupByOrgId

In the next release, the logic will be updated to:

Scenario Sales Account Used
National Customer (e.g., FR for Sage Active FR) salesAccountingAccountId from the product,
or if not set, defaultSaleProductsAccountId from organizationAccountingSetupByOrgId
Customer from a VIES country (e.g., BE, IT, PT, etc. ) intracommunityAccountId from organizationAccountingSetupByOrgId
Customer from a non-VIES country (e.g., US, JP, etc.) foreignAccountId from organizationAccountingSetupByOrgId

This change will allow for a more accurate and automated assignment of the appropriate sales ledger account, depending on the customer’s country and VIES membership.