CreateBatchSalesInvoice - accountsIQ/API-Wiki GitHub Wiki

The CreateBatchSalesInvoice function post a sales batch invoice to the transaction table.

A sales batch invoice directly post transactions to the transaction table. The postings are as follow:

One Net line for each batch sales invoice line, hitting the specified GL account of each line

One VAT line for each batch sales invoice line, hitting the default Sales VAT control account (as specified in the Required account list)

One balancing control line per sales batch invoice hitting the debtors control specified on the customer account.

Declaration

C#

public WSResult2OfString CreateBatchSalesInvoice(string token, BatchSalesInvoice inv)

Visual Basic

Public Function CreateBatchSalesInvoice(ByVal token As String, ByVal inv As BatchSalesInvoice) As WSResult2OfString

Parameter List

Parameter Type Description

Parameter Type Description
token String The session token retrieved during authentication.
inv BatchSalesInvoice Sales Batch invoice to post to the system.

Example

The following example creates a sales batch invoice for the customer 'TESTINTEGR' with two lines:

One line hitting the 2000 GL account with a tax rate of 21%

One line hitting the 3000 GL account with a no tax element

C#

Integration ws = new Integration();

String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
    accountsIQ.BatchSalesInvoice inv = new accountsIQ.BatchSalesInvoice();

    // Get the account code from a listing method instead
    inv.CustomerCode = "TESTINTEGR";
    inv.Description = "Invoice number 1";
    inv.ExchangeRate = 1;
    inv.ExternalReference = "Ext ref 1";
    inv.InvoiceDate = DateTime.Now;

    // Create a batch invoice with two lines
    inv.Lines = new accountsIQ.BatchSalesInvoiceLine[2];

    //*************** First line
    inv.Lines[0] = new accountsIQ.BatchSalesInvoiceLine();
    inv.Lines[0].Description = "Line 1";
    inv.Lines[0].DepartmentID = "DEPT1";

    // Get the GL account code from a listing method
    inv.Lines[0].GLAccountCode = "2000";
    inv.Lines[0].NetAmount = 100;
    // Get the tax code & rate from a listing method
    inv.Lines[0].TaxCode = "NT";
    inv.Lines[0].TaxRate = 0.21;

    //*************** Second line
    inv.Lines[1] = new accountsIQ.BatchSalesInvoiceLine();
    inv.Lines[1].Description = "Line 2";
    // Get the GL account code from a listing method
    inv.Lines[1].GLAccountCode = "3000";
    inv.Lines[1].NetAmount = 100;
    // Get the tax code & rate from a listing method
    inv.Lines[1].TaxCode = "NT";
    inv.Lines[1].TaxRate = 0;

    //*************** Save the batch invoice
    accountsIQ.WSResult2OfString wsbatch = ws.CreateBatchSalesInvoice(auth, inv);
    Assert.IsNotNull(wsbatch);
    Assert.IsTrue(!String.IsNullOrEmpty(wsbatch.Result));
}

Visual Basic

Dim ws As New Integration_1_1

Dim auth As String = ws.Login(entityID, partnerKey, userKey)
If (Not auth Is Nothing) Then
    Dim inv As New BatchSalesInvoice

    ' Get the account code from a listing method instead
    inv.CustomerCode = "TESTINTEGR"
    inv.Description = "Invoice number 1"
    inv.ExchangeRate = 1
    inv.ExternalReference = "Ext ref 1"
    inv.InvoiceDate = DateTime.Now

    ' Create a batch invoice with two lines
    inv.Lines = New BatchSalesInvoiceLine(2  - 1) {}

    ' *************** First line
    inv.Lines(0) = New BatchSalesInvoiceLine
    inv.Lines(0).Description = "Line 1"
    inv.Lines(0).DepartmentID = "DEPT1"
    ' Get the GL account code from a listing method
    inv.Lines(0).GLAccountCode = "2000"
    inv.Lines(0).NetAmount = 100
    ' Get the tax code & rate from a listing method
    inv.Lines(0).TaxCode = "NT"
    inv.Lines(0).TaxRate = 0.21

    ' *************** Second line
    inv.Lines(1) = New BatchSalesInvoiceLine
    inv.Lines(1).Description = "Line 2"
    ' Get the GL account code from a listing method
    inv.Lines(1).GLAccountCode = "3000"
    inv.Lines(1).NetAmount = 100
    ' Get the tax code & rate from a listing method
    inv.Lines(1).TaxCode = "NT"
    inv.Lines(1).TaxRate = 0

    ' *************** Save the batch invoice
    Dim wsbatch As WSResult2OfString = ws.CreateBatchSalesInvoice(auth, inv)
    Assert.IsNotNull(wsbatch)
    Assert.IsTrue(Not String.IsNullOrEmpty(wsbatch.Result))
End If

See Also

Concepts

⚠️ **GitHub.com Fallback** ⚠️