GetNewBatchSalesCreditNote - accountsIQ/API-Wiki GitHub Wiki
GetNewBatchSalesCreditNote pre-filled with defaults for a given customer
Note: The returned batch sales credit note has not yet been stored in the entity and must be saved by calling the CreateBatchSalesCreditNote method.
public WSResult2OfBatchSalesCreditNote GetNewBatchSalesCreditNote(string token, string customerCode)
Public Function GetNewBatchSalesCreditNote(ByVal token As String, ByVal customerCode As String) As WSResult2OfBatchSalesCreditNote
Parameter Type Description
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
customerCode | String | The customer code for which a new batch sales credit note will be created |
The following example checks the validity of the current Supplier defaults:
Integration ws = new Integration();
String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
accountsIQ.BatchSalesCreditNote inv = ws.GetNewBatchSalesCreditNote(auth, "TESTINTEGR");
// Get the account code from a listing method instead
inv.Description = "CreditNote number 1";
inv.ExternalReference = "Ext ref 1";
// Create a batch credit note with two lines
inv.Lines = new accountsIQ.BatchSalesCreditNoteLine[2];
//*************** First line
inv.Lines[0] = new accountsIQ.BatchSalesCreditNoteLine();
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.BatchSalesCreditNoteLine();
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 credit note
accountsIQ.WSResult2OfString wsbatch = ws.CreateBatchSalesCreditNote(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 BatchSalesCreditNote
inv = ws.GetNewBatchSalesCreditNote(auth, "TESTINTEGR")
' Get the account code from a listing method instead
inv.Description = "CreditNote number 1"
inv.ExternalReference = "Ext ref 1"
inv.CreditNoteDate = DateTime.Now
' Create a batch credit note with two lines
inv.Lines = New BatchSalesCreditNoteLine(2 - 1) {}
' *************** First line
inv.Lines(0) = New BatchSalesCreditNoteLine
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 BatchSalesCreditNoteLine
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 credit note
Dim wsbatch As WSResult2OfString = ws.CreateBatchSalesCreditNote(auth, inv)
Assert.IsNotNull(wsbatch)
Assert.IsTrue(Not String.IsNullOrEmpty(wsbatch.Result))
End If