Difference between revisions of "How AutoCount Application Script Works"

From AutoCount Resource Center
Jump to navigation Jump to search
m (Undo revision 9526 by DanielY (talk))
Tag: Undo
(One intermediate revision by the same user not shown)
(No difference)

Latest revision as of 03:07, 17 July 2018


AutoCount Application Script provides flexibility and expandability for programmers to enhance application's (AutoCount Accounting) calculation, accessible, layout and etc. at runtime.

How Application Script works?
When a specific action is called in the application, it fires events call.
Method that is matching the method's name and signature of the event will be fired.

Example of OnNewDocument event method

Take OnNewDocument of Sale Invoice for example.

public void OnNewDocument(BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceEventArgs e)
    BCE.Application.AppMessage.ShowMessage("Hello AutoCount Application Script");
  • OnNewDocument event method is fired when the application opens a new document.

  • Which then statement (scripting) in OnNewDocument event method can be executed;
    In this example, a message "Hello AutoCount Application Script" is prompted, when OnNewDocument is fired.

  • In order for the application to fire OnNewDocument method, it requires:-
  1. The class that encapsulate OnNewDocument must be registered with correct script name;
    BCE.AutoCount.Scripting.ScriptManager.GetOrCreate(dbSetting).RegisterByType("IV", typeof(InvoiceScript));
    The class InvoiceScript is registered with a script name of "IV", which the script name must be recognized in AutoCount Accounting.

  2. Name of the method such as OnNewDocument, must be identical to the name that has been defined in AutoCount Accounting.

  3. Argument of the method must be same as the Argument that is defined in the Event Method.
    The event method of OnNewDocument's Event Argument is BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceEventArgs.
    The Event Arguments holds necessary objects and properties that are passed from application.

Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers