Article Details
Id:13114
Product:finPOWER Connect
Type:NEW
Version:2.03.01
Opened:30/06/2015
Closed:21/07/2015
Released:07/08/2015
Job: J015808

Income Distribution; scripting functionality added

The following changes have been made to Income Distribution and related functions.

  • Income Distribution wizard.
    • Transaction page now shows the Days in the Period and the Distribution Rate.
    • Audit information now saves "PeriodDays", "TotalAverageDailyBalance" and "DistributionRate".
  • Income Distribution Report, printed from last page of wizard:
    • Header now includes Days and Distribution Rate.
    • Total on Balance and Average Daily Balance Columns.
  • Income Distribution scripts
    • New Object Event script type added for Income Distributions, "IncomeDistribution".
    • The example code below shows the events added.
      • Note, it is possible to manipulate the Distribution in the "RefreshPost" event.
    • It is now possible to use a "BatchCommitPre" or "BatchCommitPost" script to handle additional processing.
      • Note, it is preferable to use the TransactionNotes on finIncomeDistributionItem object if this is all that needs changing.
      • Transactions created now link the BatchTransaction.Tag back to the finIncomeDistributionItem object.
Public Function Main(eventId As String, ByRef eventHandled As Boolean, source As Object, sourceIndex As Integer, contextData1 As Object, contextData2 As Object, parameters As Object) As Boolean

  Dim IncomeDistribution As finIncomeDistribution
  Dim IncomeDistributionItem As finIncomeDistributionItem

  ' Assume Success
  Main = True

  ' Initialise
  IncomeDistribution = DirectCast(source, finIncomeDistribution)

  ' Handle Events
  Select Case eventId
    Case "RefreshPost"
      ' Runs at the end of Refresh
      ' Use to update the Income Distribution values

      ' Double the Distribution!!
      For Each IncomeDistributionItem In IncomeDistribution.IncomeDistributionItems
        IncomeDistributionItem.Distribution = IncomeDistributionItem.Distribution * 2
      Next

    Case "ExecuteCommitPre"
      ' Runs at the start of ExecuteCommit
      ' Return False to cancel

      ' Save the Distribution Rate on the Transaction created
      For Each IncomeDistributionItem In IncomeDistribution.IncomeDistributionItems
        IncomeDistributionItem.TransactionNotes = String.Format("Distribution, Rate is {0}", finBL.FormatPercentage(IncomeDistribution.DistributionRate / 100,4))
      Next

    Case "ExecuteCommitPreInTransaction"
      ' Runs during ExecuteCommit, after a Database Transaction has begun but before any work has started
      ' Return False to cancel

    Case "ExecuteCommitPostInTransaction"
      ' Runs during ExecuteCommit, after work has been completed but before the Database Transaction is committed
      ' Use to implement additional functionality that must be part of the overall Commit

    Case "ExecuteCommitPost"
      ' Runs at the end of ExecuteCommit
      ' Since the Database Transaction is complete use with caution. Any failure here will not affect the overall Commit

  End Select

End Function
  • finIncomeDistribution Business Layer object
    • New "DistributionRate" property.
    • New "PeriodDays" property.
  • finIncomeDistributionItems Business Layer collection
    • New "TotalAverageDailyBalance" and "TotalBalanceClosing" totals.
    • New "Parent" property, points back to finIncomeDistribution.
  • finIncomeDistributionItem Business Layer object
    • New "TransactionNotes" property.
      • Use to override the Notes on the Transaction created for the Account.
    • New "Parent" property, points back to finIncomeDistributionItems.
    • New "Tag" property. Can be used to store additional information.