CreateBatchPurchasesDebitNote - accountsIQ/API-Wiki GitHub Wiki
The CreateBatchPurchasesDebitNote function post a purchases batch debit note to the transaction table.
- A purchases batch debit note directly post transactions to the transaction table. The postings are as follow:
- One Net line for each batch purchases debit note line, hitting the specified GL account of each line
- One VAT line for each batch purchases debit note line, hitting the default Purchases VAT control account (as specified in the Required account list)
- One balancing control line per purchases batch debit note hitting the debitors control specified on the supplier account.
public WSResult2OfString CreateBatchPurchasesDebitNote(string token, BatchPurchasesDebitNote debit note)
Public Function CreateBatchPurchasesDebitNote(ByVal token As String, ByVal debit note As BatchPurchasesDebitNote) As WSResult2OfString
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
debit note | BatchPurchasesDebitNote | Purchases batch debit note to post to the system |
The following example creates a purchases batch debit note for the supplier '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
Integration ws = new Integration();
String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
accountsIQ.BatchPurchasesDebitNote inv = new accountsIQ.BatchPurchasesDebitNote();
// Get the account code from a listing method instead
inv.SupplierCode = "TESTINTEGR";
inv.Description = "DebitNote number 1";
inv.ExchangeRate = 1;
inv.ExternalReference = "Ext ref 1";
inv.DebitNoteDate = DateTime.Now;
// Create a batch debit note with two lines
inv.Lines = new accountsIQ.BatchPurchasesDebitNoteLine[2];
//*************** First line
inv.Lines[0] = new accountsIQ.BatchPurchasesDebitNoteLine();
inv.Lines[0].Description = "Line 1";
// 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.BatchPurchasesDebitNoteLine();
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 debit note
accountsIQ.WSResult2OfString wsbatch = ws.CreateBatchPurchasesDebitNote(auth, inv);
Assert.IsNotNull(wsbatch);
Assert.IsTrue(!String.IsNullOrEmpty(wsbatch.Result));
}
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 BatchPurchasesDebitNote
' Get the account code from a listing method instead
inv.SupplierCode = "TESTINTEGR"
inv.Description = "DebitNote number 1"
inv.ExchangeRate = 1
inv.ExternalReference = "Ext ref 1"
inv.DebitNoteDate = DateTime.Now
' Create a batch debit note with two lines
inv.Lines = New BatchPurchasesDebitNoteLine(2 - 1) {}
' *************** First line
inv.Lines(0) = New BatchPurchasesDebitNoteLine
inv.Lines(0).Description = "Line 1"
' 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 BatchPurchasesDebitNoteLine
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 debit note
Dim wsbatch As WSResult2OfString = ws.CreateBatchPurchasesDebitNote(auth, inv)
Assert.IsNotNull(wsbatch)
Assert.IsTrue(Not String.IsNullOrEmpty(wsbatch.Result))
End If