Skip to content

PaymentEntry

lasalesi edited this page Jun 16, 2017 · 4 revisions

Preparation

Get the client initialised first

Getting a list of records

if (client != null)
{
	List<ERPObject> paymnets = client.ListObjects(DocType.PaymentEntry);

	listPaymentEntries.Items.Clear();
	foreach (ERPObject o in paymnets)
	{
		listPaymentEntries.Items.Add(o.Name);
	}
}

Reading a record

if (client != null)
{
	ERPObject obj = client.GetObject(DocType.PaymentEntry, paymentName);
	PaymentEntry payment = new PaymentEntry(obj);

	txtPaymentPartyType.Text = payment.PartyType;
	numPaymentAmount.Value = Convert.ToDecimal(payment.PaidAmount);
	txtPaymentReference.Text = payment.ReferenceNo;
	datePaymentDate.Value = payment.ReferenceDate;
}

Creating a new record

Note: the following fields are mandatory:

  • Account Paid From,
  • Account Currency
  • Account Paid To
  • Account Currency
  • Paid Amount
  • Exchange Rate
  • Paid Amount
  • Received Amount
  • Exchange Rate
  • Received Amount

Adding a reference

Use something like this to create a new reference item

if (client != null)
{
	PaymentEntryReference r = new PaymentEntryReference();
	r.ReferenceDocType = "Sales Invoice";
	r.Parent = listPaymentEntries.SelectedItem.ToString();
	r.ReferenceName = txtPaymentEntryReference.Text;
	r.TotalAmount = Convert.ToDouble(numPaymentAmount.Value);
	r.OutstandingAmount = Convert.ToDouble(numPaymentAmount.Value);
	r.AllocatedAmount = Convert.ToDouble(numPaymentAmount.Value);
	ERPObject obj = r.Object;
	client.InsertObject(obj);
}

Clone this wiki locally