Page 1 of 1

Debtor account display in Sales Orders

PostPosted: Thu Apr 14, 2016 1:39 pm
by Atronics
How can I change the curent display of the debtor in Sales Orders and Quotes from the standard "AccountNo - Account Name" to "AccountName - PhoneNo". I would also like to make the same change in Quotes and Purchase Orders

Re: Debtor account display in Sales Orders  Topic is solved

PostPosted: Thu Apr 14, 2016 3:43 pm
by Mike.Sheen
Atronics wrote:How can I change the curent display of the debtor in Sales Orders and Quotes from the standard "AccountNo - Account Name" to "AccountName - PhoneNo". I would also like to make the same change in Quotes and Purchase Orders


Add handlers for the Read and Create end, then in there you set the text property of the control on the form which displays that information.

For example:

In the Setup method:
Code: Select all
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
   if (JiwaForm is JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm)
   {
      var salesOrderForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm)JiwaForm;
      salesOrderForm.SalesOrder.ReadEnd += SalesOrder_ReadEnd;
      salesOrderForm.SalesOrder.Created += SalesOrder_Created;
   }
}


Then your create / readend handlers would look like this:

Code: Select all
private void SalesOrder_ReadEnd(object sender, System.EventArgs e)
{
   var salesOrder = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)sender;
   var salesOrderForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm)salesOrder.Client;
   
   // To get the phone number we'll read in in the debtor record
   JiwaFinancials.Jiwa.JiwaDebtors.Debtor debtor = JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaDebtors.Debtor>(null);
   debtor.Read(salesOrder.Debtor.DebtorID);
   
   salesOrderForm.DebtorLookup.Text = String.Format("{0} - {1}", salesOrder.Debtor.AccountNo, debtor.Phone);
}


Sample plugin attached.

Re: Debtor account display in Sales Orders

PostPosted: Thu Apr 14, 2016 6:55 pm
by Atronics
That was quick! Thanks, Mike.

Re: Debtor account display in Sales Orders

PostPosted: Fri Apr 29, 2016 10:14 am
by Atronics
Hi Mike,
This plugin causes an error on entering a Warehouse Purchase Order. I can't figure out the problem. The error is "Creditor not found Module: Read"
John I

Re: Debtor account display in Sales Orders

PostPosted: Fri Apr 29, 2016 10:23 am
by Scott.Pearce
Don't you already have a case open for this?

Re: Debtor account display in Sales Orders

PostPosted: Fri Apr 29, 2016 11:59 pm
by Mike.Sheen
Scott.Pearce wrote:Don't you already have a case open for this?


Yes, there is a case logged for this - so this topic is now locked.