Frequent use Script Events: Difference between revisions

From AutoCount Resource Center
Content added Content deleted
(Created page with "{{NavigateDeveloper|collapsed}} ==Introduction== Understand the usage of 5 Frequent use script events ===What is '''MasterColumn''' and '''DetailColumn'''?=== All documen...")
 
Line 19: Line 19:


==Frequent Use Events==
==Frequent Use Events==
{{NavigateDeveloper|collapsed}}
====[[OnMasterColumnChanged]]====
==OnMasterColumnChanged==
'''OnMasterColumnChanged''' is triggered when user changes the value on master area of entry form, except detail area.

===OnMasterColumnChanged event in Sales Invoice===
<syntaxhighlight lang="csharp">
public void OnMasterColumnChanged(BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceMasterColumnChangedEventArgs e)
</syntaxhighlight>

===Example===
*Prompt message box to display Price Category of selected customer, when DebtorCode is changed.
<syntaxhighlight lang="csharp">
public void OnMasterColumnChanged(BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceMasterColumnChangedEventArgs e)
{
if (e.ChangedColumnName == "DebtorCode")
{
DebtorRecord debtor = CommonRecordUtils.GetDebtor(
e.DBSetting, e.MasterRecord.DebtorCode);

if (debtor == null)
{
return;
}
else
{
BCE.Application.AppMessage.ShowMessage(
string.Format("{0}\n{1}\nPrice Category: {2}",
debtor.AccNo, debtor.CompanyName, debtor.PriceCategory));
}
}
}
</syntaxhighlight>

It is important to control only execute the statements when the '''changed is "DebtorCode"'''.


[[Category:Developers]]
[[Category:Script Event]]


====[[OnDetailColumnChanged]]====
====[[OnDetailColumnChanged]]====

Revision as of 06:12, 2 October 2017

Go to menu

Go to top
Resources For AutoCount Software Developers


Introduction

Understand the usage of 5 Frequent use script events

What is MasterColumn and DetailColumn?

All document entry, whether it is Sales Invoice or AR Payment, they consist of at least 2 DataTable, master table and detail table.
Usually the master table is where it stores the document information, such as document number, document date, company name and etc... Whereas, the detail table stores multiple records that are related to this document. Such as Items and account double entry transactions.
MasterColumn is referring to the value of a field in master table. Likewise, DetailColumn is referring to the value of a field in detail table.


Invoice Entry Form
This screen shows there are two highlighted areas in Green and Red,
which are master and detail area respectively.

Frequent Use Events

Go to menu

Go to top
Resources For AutoCount Software Developers


OnMasterColumnChanged

OnMasterColumnChanged is triggered when user changes the value on master area of entry form, except detail area.

OnMasterColumnChanged event in Sales Invoice

public void OnMasterColumnChanged(BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceMasterColumnChangedEventArgs e)

Example

  • Prompt message box to display Price Category of selected customer, when DebtorCode is changed.
public void OnMasterColumnChanged(BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceMasterColumnChangedEventArgs e)
{
    if (e.ChangedColumnName == "DebtorCode")
    {
        DebtorRecord debtor = CommonRecordUtils.GetDebtor(
            e.DBSetting, e.MasterRecord.DebtorCode);

        if (debtor == null)
        {
            return;
        }
        else
        {
            BCE.Application.AppMessage.ShowMessage(
                string.Format("{0}\n{1}\nPrice Category: {2}",
                debtor.AccNo, debtor.CompanyName, debtor.PriceCategory));
        }
    }
}

It is important to control only execute the statements when the changed is "DebtorCode".

OnDetailColumnChanged

BeforeSave

CalcSubTotal

OnFormInitialize


More Application Script Events