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.