GetNewPurchasesDebitNote - accountsIQ/API-Wiki GitHub Wiki

The GetNewPurchasesDebitNote creates a new debit note (represented by a CreditNote object with a ledger type of Purchases) for a given Supplier account. It fills the DebitNote defaulting the information with the related Supplier's information.

Declaration

C#

public WSResult2OfCreditNote GetNewPurchasesDebitNote(string token, string SupplierCode)

Visual Basic

Public Function GetNewPurchasesDebitNote(ByVal token As String, ByVal SupplierCode As String) As WSResult2OfCreditNote

Parameter List

Parameter Type Description
token String The session token retrieved during authentication.
SupplierCode String Code of the Supplier to create a new Purchases DebitNote for.

Example

C#

Integration ws = new Integration();

String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
  WSResult2OfCreditNote result = ws.GetNewPurchasesDebitNote(auth, "TESTINTEGR");
  Assert.IsNotNull(result.Result);

  InvoiceLine line = new InvoiceLine();
  line.StockItemID = "STOCKITEM1";
  line.StockItemPrice = 100M;
  line.TaxCode = "NT";
  line.TaxRate = 0.21M;
  line.StockItemDescription = "From default";
  line.StockItemCost = 50M;
  line.CreditNotedQuantity = 10;
  line.NetAmount = 1000M;
  line.TaxAmoutn = line.NetAmount * line.TaxRate;
  line.GrossAmount = (1 + line.TaxRate) * line.NetAmount;
  line.GLAccountCode = "1000";
  line.ActualPrice = 100M;
  line.LocationID = "1";
  line.SublocationID = "BIN1";
  line.GLAccountCode = "1000";
  line.OpeningStockGLAccountCode = "2000";
  result.Result.AccountName = "Test integrator partner";
  result.Result.ExternalReference = "NEWSALESCreditNote0001";

  result.Result.Lines = new CreditNoteLine[1];
  result.Result.Lines[0] = line;
  result.Result.ExchangeRate = 1;
  result.Result.InvoiceNumber = "000023"; // Unlike the sales side, the invoice number is required

  WSResultStatus r = ws.SaveCreditNote(auth, result.Result, true);
  Assert.IsTrue(r.Status == OperationStatus.Created);
}

Visual Basic

Dim ws As New Integration

Dim auth As String = ws.Login(entityID, partnerKey, userKey)
If (Not auth Is Nothing) Then
Dim result As WSResult2OfCreditNote = Me.ws.GetNewPurchasesDebitNote(Me.auth, "TESTINTEGR")
Assert.IsNotNull(result.Result)
Dim line As New InvoiceLine
line.StockItemID = "STOCKITEM1"
line.StockItemPrice = 100
line.TaxCode = "NT"
line.TaxRate = 0.21
line.StockItemDescription = "From default"
line.StockItemCost = 50
line.CreditNotedQuantity = 10
line.NetAmount = 1000
line.TaxAmoutn = line.NetAmount * line.TaxRate
line.GrossAmount = (Decimal.op_Increment(line.TaxRate) * line.NetAmount)
line.GLAccountCode = "1000"
line.ActualPrice = 100
line.LocationID = "1"
line.SublocationID = "BIN1"
line.GLAccountCode = "1000"
line.OpeningStockGLAccountCode = "2000"
result.Result.AccountName = "Test integrator partner"
result.Result.ExternalReference = "NEWSALESCreditNote0001"
result.Result.Lines = New CreditNoteLine() { line }
result.Result.ExchangeRate = 1
result.Result.InvoiceNumber = "000023" ' Unlike the sales side, the invoice number is required
Assert.IsTrue((Me.ws.SaveCreditNote(Me.auth, result.Result, True).Status = OperationStatus.Created))
End If

See Also

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