CreateBatchSalesInvoiceGetBackTransactionID - accountsIQ/API-Wiki GitHub Wiki

The CreateBatchSalesInvoiceGetBackTransactionID function posts a sales batch invoice to the transaction table and returns the ID of the newly created transaction, or -1 upon failure.

A sales batch invoice directly posts 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.

The function is identical to CreateBatchSalesInvoice except that it returns the ID of the newly created Transaction.

Declaration

C#

public WSResult2OfString CreateBatchSalesInvoiceGetBackTransactionID(string token, BatchSalesInvoice inv, out int transactionID)

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.CreateBatchSalesInvoiceGetBackTransactionID(auth, inv, out int transactionID);
    Assert.IsNotNull(wsbatch);
    Assert.IsTrue(!String.IsNullOrEmpty(wsbatch.Result));
    Assert.AreNotEqual(-1, transactionID);
}

See Also

Concepts

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