<?xml version="1.0" encoding="utf-8"?>
  <finScript version="1.00" exportedUtcDate="2024-01-07T20:22:42.0000000">
    <CreatedUserId>ADMIN</CreatedUserId>
    <CreatedUtcDate>2018-08-03T04:03:55.8210000</CreatedUtcDate>
    <UpdatedUserId>ADMIN</UpdatedUserId>
    <UpdatedUtcDate>2024-01-07T20:22:31.0080000</UpdatedUtcDate>
    <ScriptId>HWAMI</ScriptId>
    <Description>Account Maturity Instruction Change</Description>
    <ScriptType>HtmlWidget</ScriptType>
    <Active>true</Active>
    <AllowUI>false</AllowUI>
    <Bookmarks />
    <Category />
    <Code>' HtmlWidget_AccountMaturityInstructionChange
Option Explicit On
Option Strict On

' #################################################################
' Account Maturity Instruction Change wizard HTML Widget
'
' Version: 1.08 (08/01/2024)
'
' Usage: System-defined HTML Widget
' #################################################################
' Version        Date  User     Job       Description
' -------  ----------  -------  --------  -------------------------
'    1.07  17/03/2023  ISS      J030670   Fixed startup glitch
'    1.08  08/01/2024  ISS      J032698   Updated Permission Keys
' #################################################################

' Constants
Private Const FORM_KEY As String = "AccountMaturityInstructionChange"

' Common Parameters
Private mAccountId As String
Private mShowHistory As Boolean

' Objects
Private mCombinedParameters As ISKeyValueList
Private mParameters As ISKeyValueList
Private mStartupParameters As ISKeyValueList

Public Function Main(eventId As String,
                     parametersJson As String,
                     startUpParametersJson As String,
                     hostingContext As isefinHtmlWidgetHostingContext,
                     requestInfo As finScriptRequestInfo,
                     ByRef returnValue As String) As Boolean

  ' Assume Success
  Main = True

  ' Get Parameters
  mParameters = finBL.CreateKeyValueList()
  mParameters.FromSimpleJsonString(parametersJson)
  mStartupParameters = finBL.CreateKeyValueList()
  mStartupParameters.FromSimpleJsonString(startUpParametersJson)

  ' Get Combined Parameters (Startup Parameters updated with event Parameters)
  mCombinedParameters = mStartupParameters.Clone()
  mCombinedParameters.UpdateFromKeyValueList(mParameters, True)

  ' Get Common Parameters
  With mCombinedParameters
    mAccountId = .GetString("AccountId")
    mShowHistory = .GetBoolean("ShowHistory")
  End With

  ' Handle Events
  Select Case eventId
    Case ""
      ' Main event, i.e., return initial HTML content (excluding html and body tags)
      returnValue = ScriptInfo.TemplateText

    Case "Finish"
      ' Finish wizard
      Main = Finish(parametersJson, requestInfo, returnValue)

    Case "GetHistory"
      ' Get History records
      Main = GetHistory(returnValue)

    Case "GetInitialisationInfo"
      ' Get Initialisation Information required for this wizard
      Main = GetInitialisationInfo(returnValue)

    Case "WizardValidate"
      ' Validate wizard page
      Main = WizardValidate(parametersJson, returnValue)

    Case Else
      finBL.Error.ErrorBeginFormat("Unhandled event '{0}'.", eventId)
      Main = False
  End Select

End Function

''' &lt;summary&gt;
'''  Get History records.
''' &lt;/summary&gt;
Public Function GetHistory(ByRef response As String) As Boolean

  Dim AccountHistoryItems As finAccountHistoryItems
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Get History Items
  If Success Then
    If finBL.AccountFunctions.GetAccountHistoryItemsByType(mAccountId, isefinAccountHistoryType.MaturityInstructionChange, AccountHistoryItems) Then
      Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(AccountHistoryItems.ToHtmlWidgetJsonObject(), response)
    Else
      Success = False
    End If
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Get Initialisation Information required for this wizard.
''' &lt;/summary&gt;
Public Function GetInitialisationInfo(ByRef response As String) As Boolean

  Dim AccountMaturityInstructionChange As finAccountMaturityInstructionChange
  Dim FormInitialisationInfo As FormInitialisationInfo
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Validate
  If Len(mAccountId) = 0 Then
    Success = False
    finBL.Error.ErrorBegin("Account Id not specified.")
  ElseIf finBL.CurrentUserInformation.IsAccountFilteredOut(mAccountId) Then
    Success = False
    finBL.Error.ErrorBegin("You do not have permission to view this record.")
  ElseIf Not (finBL.CurrentUser.Permissions.Allow("Account.MaturityInstruction.Revise") OrElse finBL.CurrentUser.Permissions.Allow("Account.MaturityInstruction.View")) Then
    Success = False
    finBL.Error.ErrorBegin("You do not have permission to either view or change Account Maturity Instruction details.")
  End If

  ' Create Maturity Instruction Change object
  If Success Then
    Success = CreateAccountMaturityInstructionChange(Nothing, AccountMaturityInstructionChange)
  End If

  ' Get Initialisation Info
  If Success Then
    FormInitialisationInfo = New FormInitialisationInfo()
    With FormInitialisationInfo
      ' Record
      .RecordId = AccountMaturityInstructionChange.Account.AccountId
      .RecordDescription = AccountMaturityInstructionChange.Account.Name

      ' General
      .BankingDetailsJson = AccountMaturityInstructionChange.BankingDetails.ToHtmlWidgetJsonString
      .MaturityAccount = AccountMaturityInstructionChange.MaturityAccountId
      .MaturityAccountType = AccountMaturityInstructionChange.MaturityAccountTypeId
      .MaturityInstruction = AccountMaturityInstructionChange.MaturityInstructionText
      .MaturityPaymentType = AccountMaturityInstructionChange.MaturityPaymentTypeText
      .MaturityTransferToAccount = AccountMaturityInstructionChange.MaturityTransferToAccountId
      .MaturityValue = AccountMaturityInstructionChange.MaturityValue

      ' Account Summary
      .AccountSummaryHtml = finBL.Utilities.GetHtmlFromSummaryTables(finBL.SummaryPageStandardBlocks().Account_FinancialDetails(ScriptInfo, AccountMaturityInstructionChange.Account, Nothing, False, Nothing), "", False, "", ScriptInfo.Target, "Existing Maturity Instruction details")

      ' Permissions
      .CanChange = Not finBL.Database.IsReadOnly AndAlso finBL.CurrentUser.Permissions.Allow("Account.MaturityInstruction.Revise")
      .CanViewHistory = finBL.CurrentUser.Permissions.Allow("Account.MaturityInstruction.View")

      ' Lists
      .AuthorisedByNameList = finBL.AccountFunctions.GetByWhomList(AccountMaturityInstructionChange.Account, True, False, True).ToCsvString()
      .MaturityInstructionList = finBL.Enums.isefinAccountMaturityInstruction_ToCodeDescriptionList(AccountMaturityInstructionChange.Account.AccountType.MaturityAvailableInstructions).ToJsonObject()
      .ReinvestCommonClient = AccountMaturityInstructionChange.Account.AccountType.MaturityReinvestmentCommonClient
      .TransferCommonClient = AccountMaturityInstructionChange.Account.AccountType.MaturityTransferCommonClient

      If .ReinvestCommonClient OrElse .TransferCommonClient Then
        .CommonClientAccountList = finBL.AccountFunctions.GetRelatedAccountsCodeDescriptionList(AccountMaturityInstructionChange.Account).ToJsonObject(False)
      End If

      .MaturityPaymentTypeList = finBL.Enums.isefinAccountMaturityPaymentType_ToCodeDescriptionList(AccountMaturityInstructionChange.Account.AccountType.MaturityPaymentAvailableTypes).ToJsonObject()

      ' List Filters
      .MaturityAccountTypeListFilter = AccountMaturityInstructionChange.MaturityAccountTypeDataViewFilter

      ' Configuration
      .PromptOnCommit = finBL.CloudConnectFunctions.CloudConnectSettings.PromptOnCommit
      .ShowHistory = mShowHistory
    End With
  End If

  ' Response
  If Success Then
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(FormInitialisationInfo, response)
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Create a finAccountMaturityInstructionChange object from Web Service properties.
''' &lt;/summary&gt;
''' &lt;returns&gt;
'''  A Boolean value indicating success.
''' &lt;/returns&gt;
Private Function CreateAccountMaturityInstructionChange(parameters As WizardFinishParameters,
                                                        ByRef accountMaturityInstructionChange As finAccountMaturityInstructionChange) As Boolean

  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Initialise
  accountMaturityInstructionChange = finBL.CreateAccountMaturityInstructionChange()

  ' Update
  With accountMaturityInstructionChange
    ' Load Account
    Success = .AccountLoad(mAccountId)

    ' Update
    If Success AndAlso parameters IsNot Nothing Then
      ' General
      .AuthorisedName = parameters.AuthorisedName
      .AuthorisedReason = parameters.AuthorisedReason
      .Reference = parameters.Reference

      ' Details
      .MaturityInstructionText = parameters.MaturityInstruction
      .MaturityValue = parameters.MaturityValue
      .MaturityAccountTypeId = parameters.MaturityAccountType
      .MaturityAccountId = parameters.MaturityAccount
      .MaturityPaymentTypeText = parameters.MaturityPaymentType
      .MaturityTransferToAccountId = parameters.MaturityTransferToAccount
      .BankingDetails.FromHtmlWidgetJsonString(parameters.BankingDetailsJson)
    End If
  End With

  Return Success

End Function

''' &lt;summary&gt;
'''  Finish, i.e., Commit changes.
''' &lt;/summary&gt;
''' &lt;param name="parametersJson"&gt;
'''  A JSON formatted WizardFinishParameters object.
''' &lt;/param&gt;
Private Function Finish(parametersJson As String,
                        requestInfo As finScriptRequestInfo,
                        ByRef returnValue As String) As Boolean

  Dim AccountMaturityInstructionChange As finAccountMaturityInstructionChange
  Dim obj As Object
  Dim Success As Boolean
  Dim Warning As String
  Dim WizardFinishParameters As WizardFinishParameters

  ' Assume Success
  Success = True

  ' Parse Parameters
  If finBL.Runtime.WebUtilities.DeserialiseJsonStringToObject(parametersJson, GetType(WizardFinishParameters), obj) Then
    WizardFinishParameters = DirectCast(obj, WizardFinishParameters)
  Else
    Success = False
  End If

  ' Create Maturity Instruction Change object
  If Success Then
    Success = CreateAccountMaturityInstructionChange(WizardFinishParameters, AccountMaturityInstructionChange)
  End If

  ' Execute
  If Success Then
    Success = AccountMaturityInstructionChange.ExecuteCommit(Warning)
  End If

  ' Finalise
  If Success Then
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(New WizardFinishDetails(Warning), returnValue)
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Validate a Wizard page.
''' &lt;/summary&gt;
''' &lt;param name="parametersJson"&gt;
'''  A JSON formatted object containing information required to validate a Wizard page.
''' &lt;/param&gt;
''' &lt;param name="returnValue"&gt;
'''  A JSON object; "true" if validation passed, otherwise, information as to why validation failed.
''' &lt;/param&gt;
Private Function WizardValidate(parametersJson As String,
                                ByRef returnValue As String) As Boolean

  Dim ConfirmList As List(Of String)
  Dim Data As Object
  Dim FailedControlId As String
  Dim FailedMessage As String
  Dim PageId As String
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Get Parameters
  ' NOTE: Use the module mCombinedParameters since this contains Startup and event Parameters in a single Key/Value List
  With mCombinedParameters
    PageId = .GetString("PageId")
  End With

  ' Validate Page
  Select Case PageId
    Case "General"
      ' General
      If WizardValidate_General(parametersJson, ConfirmList) Then
        Data = ConfirmList
      Else
        Success = False
      End If
  End Select

  ' Finalise
  If Success Then
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(New WizardValidateResponse(Data, FailedMessage, FailedControlId), returnValue)
  End If

  Return Success

End Function

Private Function WizardValidate_General(parametersJson As String,
                                        ByRef confirmList As List(Of String)) As Boolean

  Dim AccountMaturityInstructionChange As finAccountMaturityInstructionChange
  Dim obj As Object
  Dim Success As Boolean
  Dim WizardFinishParameters As WizardFinishParameters

  ' Assume Success
  Success = True

  ' Initialise ByRef
  confirmList = New List(Of String)()

  ' Parse Parameters
  If finBL.Runtime.WebUtilities.DeserialiseJsonStringToObject(parametersJson, GetType(WizardFinishParameters), obj) Then
    WizardFinishParameters = DirectCast(obj, WizardFinishParameters)
  Else
    Success = False
  End If

  ' Create Interest Change object
  If Success Then
    Success = CreateAccountMaturityInstructionChange(WizardFinishParameters, AccountMaturityInstructionChange)
  End If

  If Success Then
    ' Reinvestment Value greater than Original Investment Value
    If AccountMaturityInstructionChange.MaturityValue &gt; AccountMaturityInstructionChange.Account.InvestmentValue Then
      confirmList.Add(String.Format("Are you sure you want the Reinvestment Value to be greater than the original Investment Value of {0}.", finBL.FormatCurrency(AccountMaturityInstructionChange.Account.InvestmentValue, True)))
    End If

    ' Banking Information
    Select Case AccountMaturityInstructionChange.MaturityInstruction
      Case isefinAccountMaturityInstruction.PayoutAll, isefinAccountMaturityInstruction.ReinvestAmount, isefinAccountMaturityInstruction.ReinvestPrincipal
        If AccountMaturityInstructionChange.MaturityPaymentType = isefinAccountMaturityPaymentType.DirectCredit Then
          If Not AccountMaturityInstructionChange.BankingDetails.IsValid(False, False) Then
            confirmList.Add("Invalid Banking Details. " &amp; finBL.Error.Message())
          End If
        End If
    End Select
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Wizard Initialisation Information.
''' &lt;/summary&gt;
Public Class FormInitialisationInfo

  ' Record
  Public RecordId As String
  Public RecordDescription As String

  ' Details
  Public MaturityInstruction As String
  Public MaturityValue As Decimal
  Public MaturityAccountType As String
  Public MaturityAccount As String
  Public MaturityPaymentType As String
  Public MaturityTransferToAccount As String
  Public BankingDetailsJson As String

  ' Account Summary
  Public AccountSummaryHtml As String

  ' Permissions
  Public CanChange As Boolean
  Public CanViewHistory As Boolean

  ' Lists
  Public AuthorisedByNameList As String
  Public MaturityInstructionList As Object
  Public CommonClientAccountList As Object
  Public MaturityPaymentTypeList As Object
  Public ReinvestCommonClient As Boolean
  Public TransferCommonClient As Boolean

  ' List Filters
  Public MaturityAccountTypeListFilter As String

  ' Configuration
  Public PromptOnCommit As Boolean
  Public ShowHistory As Boolean

End Class



''' &lt;summary&gt;
'''  Validation details.
''' &lt;/summary&gt;
Public Class WizardValidateResponse

  Public Data As Object
  Public FailedMessage As String
  Public FailedControlId As String

  Public Sub New(data As Object,
                 failedMessage As String,
                 failedControlId As String)

    Me.Data = data
    Me.FailedMessage = failedMessage
    Me.FailedControlId = failedControlId

  End Sub

End Class


''' &lt;summary&gt;
'''  Finish Parameters.
''' &lt;/summary&gt;
Public Class WizardFinishParameters

  ' General
  Public AuthorisedName As String
  Public AuthorisedReason As String
  Public Reference As String

  ' Details
  Public MaturityInstruction As String
  Public MaturityValue As Decimal
  Public MaturityAccountType As String
  Public MaturityAccount As String
  Public MaturityPaymentType As String
  Public MaturityTransferToAccount As String
  Public BankingDetailsJson As String
End Class


''' &lt;summary&gt;
'''  Finish details.
''' &lt;/summary&gt;
Public Class WizardFinishDetails

  ' General
  Public Warning As String

  Public Sub New(warning As String)

    Me.Warning = warning

  End Sub

End Class</Code>
    <Language>VisualBasic</Language>
    <Notes>System defined HTML Widget.

Used as a finPOWER Connect Cloud compatible version of the form "AccountMaturityInstructionChange".

NOTE: Only applies to Fixed Term Deposit Accounts.</Notes>
    <PermissionKeyExecute />
    <ReferenceLinq>false</ReferenceLinq>
    <RunWithoutPrompts>false</RunWithoutPrompts>
    <TemplateText>&lt;div id="frmMain" class="is-widget-content" style="visibility:hidden"&gt;

  &lt;!-- Form Header --&gt;
  &lt;header&gt;
    &lt;div class="header"&gt;&lt;/div&gt;
    &lt;div class="summary"&gt;&lt;/div&gt;
    &lt;!-- Tabs --&gt;
    &lt;div id="tabWizard" class="is-tabs"&gt;
      &lt;ul&gt;
        &lt;li tabId="History" tooltipText=""&gt;Maturity Instruction Change History&lt;/li&gt;
        &lt;li tabId="General" tooltipText="Specify a new Maturity Instruction for the Account."&gt;Maturity Instruction Details&lt;/li&gt;
      &lt;ul&gt;
    &lt;/div&gt;
  &lt;/header&gt;

  &lt;!-- Pages --&gt;
  &lt;div class="is-widget-form-body"&gt;
    &lt;!-- History --&gt;
    &lt;div id="pageHistory"&gt;
      &lt;table class="is-form" style="height:100%"&gt;
        &lt;tr style="height:100%"&gt;
          &lt;th colspan="2" style="height:100%"&gt;&lt;div id="gridHistory" style="height:100%"&gt;&lt;/div&gt;&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;

    &lt;!-- General --&gt;
    &lt;div id="pageGeneral" style="display:flex; flex-direction:column"&gt;
      &lt;!-- Page Controls --&gt;
      &lt;div&gt;
        &lt;table class="is-form"&gt;
          &lt;colgroup&gt;
            &lt;col style="width:8em" /&gt;
            &lt;col /&gt;
          &lt;/colgroup&gt;

          &lt;tr&gt;&lt;th colspan="2"&gt;&lt;label id="lblAccount"&gt;Account&lt;/label&gt;&lt;/th&gt;&lt;/tr&gt;
          &lt;tr&gt;
            &lt;th&gt;&lt;label for="cboRecord"&gt;Account:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="cboRecord" /&gt;&lt;/td&gt;
          &lt;/tr&gt;

          &lt;tr&gt;&lt;th colspan="2"&gt;&lt;label id="lblAuthorisationDetails"&gt;Authorisation details&lt;/label&gt;&lt;/th&gt;&lt;/tr&gt;
          &lt;tr&gt;
            &lt;th&gt;&lt;label for="cboAuthorisedBy"&gt;By Whom:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="cboAuthorisedBy" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;th&gt;&lt;label for="txtReference"&gt;Reference:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="txtReference"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;th&gt;&lt;label for="txtReason"&gt;Reason:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="txtReason"/&gt;&lt;/td&gt;
          &lt;/tr&gt;

          &lt;tr&gt;&lt;th colspan="2"&gt;&lt;label id="lblNewMaturityInstructionDetails"&gt;New Maturity Instruction&lt;/label&gt;&lt;/th&gt;&lt;/tr&gt;
          &lt;tr&gt;
            &lt;th&gt;&lt;label for="cboMaturityInstruction"&gt;Instruction:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="cboMaturityInstruction" /&gt;&lt;/td&gt;
          &lt;/tr&gt;

          &lt;tr class="trReinvestment"&gt;&lt;th colspan="2"&gt;&lt;label id="lblReinvestment"&gt;Reinvestment details&lt;/label&gt;&lt;/th&gt;&lt;/tr&gt;
          &lt;tr class="trReinvestment"&gt;
            &lt;th&gt;&lt;label for="numMaturityValue"&gt;Reinvest:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="numMaturityValue"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="trReinvestment"&gt;
            &lt;th&gt;&lt;label for="cboMaturityAccountType"&gt;To Type:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="cboMaturityAccountType"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="trReinvestment"&gt;
            &lt;th&gt;&lt;label for="cboMaturityAccount"&gt;Or Account:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="cboMaturityAccount"/&gt;&lt;/td&gt;
          &lt;/tr&gt;

          &lt;tr class="trRepayment"&gt;&lt;th colspan="2"&gt;&lt;label id="lblRepayment"&gt;Repayment details&lt;/label&gt;&lt;/th&gt;&lt;/tr&gt;
          &lt;tr class="trRepayment"&gt;
            &lt;th&gt;&lt;label for="cboMaturityPaymentType"&gt;Pay Type:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="cboMaturityPaymentType" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="trRepayment"&gt;
            &lt;th&gt;&lt;label for="cboMaturityTransferToAccount"&gt;Transfer to:&lt;/label&gt;&lt;/th&gt;
            &lt;td&gt;&lt;input id="cboMaturityTransferToAccount" /&gt;&lt;/td&gt;
          &lt;/tr&gt;

          &lt;tbody class="trRepayment" id="apdPaymentDetails"&gt;&lt;/tbody&gt;
        &lt;/table&gt;
      &lt;/div&gt;

      &lt;!-- Summary Page --&gt;
      &lt;div style="flex-grow:1"&gt;
        &lt;div id="wbAccountSummary"&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;!-- Form Footer --&gt;
  &lt;footer&gt;
    &lt;button id="cmdHistory" class="is-button" style="float:left"&gt;History&lt;/button&gt;

    &lt;button id="cmdCancel" class="is-button"&gt;Cancel&lt;/button&gt;
    &lt;button id="cmdBack" class="is-button"&gt;&amp;lt; Back&lt;/button&gt;
    &lt;button id="cmdNext" class="is-button"&gt;Next &amp;gt;&lt;/button&gt;
    &lt;button id="cmdFinish" class="is-button ok"&gt;Finish&lt;/button&gt;
  &lt;/footer&gt;

&lt;/div&gt;


&lt;script&gt;
// Properties
var mRecord;
var mRecord_History;

// Controls
var C = {
  // History
  gridHistory: null,

  // General
  lblAccount: null,
  cboRecord: null,

  lblAuthorisationDetails: null,
  cboAuthorisedBy: null,
  txtReference: null,
  txtReason: null,

  lblNewMaturityInstructionDetails: null,
  cboMaturityInstruction: null,

  // Reinvest
  lblReinvestment: null,
  numMaturityValue: null,
  cboMaturityAccountType: null,
  cboMaturityAccount: null,

  // Repay
  lblRepayment: null,
  cboMaturityPaymentType: null,
  cboMaturityTransferToAccount: null,
  apdPaymentDetails: null,

  wbAccountSummary: null,
}

// Form
var frmMain;
var tabWizard;

// Other
var mValueData;

// Wizard Buttons
var cmdCancel;
var cmdBack;
var cmdNext;
var cmdFinish;
var cmdHistory;

// ==========
// Initialise
// ==========
$(function () {

  // --------
  // Controls
  // --------
  //   General
  C.lblAccount = widget.UI.Label("lblAccount", {});
  C.cboRecord = widget.UI.DBCombo("cboRecord", {
    autoReadOnly: false,
    readOnly: true,
    showDropdown: false,
    width: widget.UI.FIELD_WIDTH_CODE_10,
  });

  C.lblAuthorisationDetails = widget.UI.Label("lblAuthorisationDetails", {});
  C.cboAuthorisedBy = widget.UI.ComboBox("cboAuthorisedBy", {
    allowBlank: false,
    maxLength: 50,
  });
  C.txtReference = widget.UI.TextBox("txtReference", {
    maxLength: 20,
  });
  C.txtReason = widget.UI.TextBox("txtReason", {
    multiLine: true,
    rows: 3,
    maxLength: 1024,
  });

  C.lblNewMaturityInstructionDetails = widget.UI.Label("lblNewMaturityInstructionDetails", {});
  C.cboMaturityInstruction = widget.UI.ComboBox("cboMaturityInstruction", {
    allowBlank: false,

    onChange: cboMaturityInstruction_Change,
  });

  C.lblReinvestment = widget.UI.Label("lblReinvestment", {});
  C.numMaturityValue = widget.UI.NumberBox("numMaturityValue", {
    decimals: -1,
    minValue: 0,
    maxValue: 999999999999999,
    width: widget.UI.FIELD_WIDTH_CODE_10,
  });
  C.cboMaturityAccountType = widget.UI.DBCombo("cboMaturityAccountType", {
    width: widget.UI.FIELD_WIDTH_CODE_10,
  });
  C.cboMaturityAccount = widget.UI.DBCombo("cboMaturityAccount", {
    limitToList: false,
    width: widget.UI.FIELD_WIDTH_CODE_10,
  });

  C.lblRepayment = widget.UI.Label("lblRepayment", {});
  C.cboMaturityPaymentType = widget.UI.ComboBox("cboMaturityPaymentType", {
    allowBlank: false,
    width: widget.UI.FIELD_WIDTH_CODE_10,

    onChange: cboMaturityPaymentType_Change,
  });
  C.cboMaturityTransferToAccount = widget.UI.DBCombo("cboMaturityTransferToAccount", {
    width: widget.UI.FIELD_WIDTH_CODE_10,
  });

  C.apdPaymentDetails = widget.UI.AccountOutgoingPaymentDetails("apdPaymentDetails", { });

  C.wbAccountSummary = widget.UI.PreviewPane("wbAccountSummary", {});

  // Grids
  C.gridHistory = widget.UI.Grid("gridHistory", {
    stickyHeader: true,

    onInitialiseRow: gridHistory_InitialiseRow,
  });

  // Create Widget form
  // NOTE: Hide by default for a cleaner startup
  frmMain = new widget.UI.Form("frmMain", { visible: false });

  // Create Tabs
  tabWizard = new widget.UI.Tabs("tabWizard", { style: "wizard" });

  // Handle Wizard Buttons
  cmdCancel = $("#cmdCancel");
  cmdBack = $("#cmdBack");
  cmdNext = $("#cmdNext");
  cmdFinish = $("#cmdFinish");
  cmdCancel.click(tabWizard_Cancel);
  cmdBack.click(function() { tabWizard_Move(-1); });
  cmdNext.click(function() { tabWizard_Move(1); });
  cmdFinish.click(function() { Form_ExecuteAction("Finish"); });

  cmdHistory = $("#cmdHistory");
  cmdHistory.click(function() { Form_ExecuteAction("History"); });

  // Reset
  Form_Reset();
});

// ==========
// Reset Form
// ==========
function Form_Reset() {
  // Defaults

  // Set Tab
  tabWizard.SelectedTabId("General");

  // Resize
  Form_Resize();

  // Load Record (i.e., initialise wizard)
  Record_Load();
}

// ===========
// Load Record
// ===========
function Record_Load() {
  // Initialise
  mRecord = null;
  mRecord_History = null;

  // Hide content
  frmMain.Visible(false);

  // Block UI
  widget.UI.Block("Initialising, please wait...");

  // Load Initialisation details
  widget.GetString("GetInitialisationInfo", {},
    // Success
    function (data) {
      mRecord = JSON.parse(data);
      Fields_Load();
    },

    // Fail
    function (message) {
      widget.UI.MsgBoxAlert("fail: " + message);
      Fields_Load();
    }
  );
}

// ===========
// Load Fields
// ===========
function Fields_Load() {
  if (mRecord) {
    // General
    C.cboRecord.RefreshUnbound(mRecord.RecordId, mRecord.RecordDescription);

    C.cboMaturityInstruction.Text(mRecord.MaturityInstruction);

    C.numMaturityValue.Value(mRecord.MaturityValue);
    C.cboMaturityAccountType.Text(mRecord.MaturityAccountType);
    C.cboMaturityAccount.Text(mRecord.MaturityAccount);

    C.cboMaturityPaymentType.Text(mRecord.MaturityPaymentType);
    C.cboMaturityTransferToAccount.Text(mRecord.MaturityTransferToAccount);
    C.apdPaymentDetails.Initialise(mRecord.RecordId);
    C.apdPaymentDetails.FromBankingDetailsJson(mRecord.BankingDetailsJson)

    C.wbAccountSummary.SetContent(mRecord.AccountSummaryHtml, false);
  }

  // Unblock UI
  widget.UI.Unblock();

  // Update fields
  Fields_Update();

  // Update Controls
  pageGeneral_Refresh();

  // Refresh Tab
  tabWizard_Refresh();
  tabWizard_Resize();
}

// ===========
// Save Fields
// ===========
function Fields_Save() {
  // Not used by this wizard since there is no concept of updating an object behind the wizard
}

// =============
// Update Fields
// =============
function Fields_Update() {
  // Information Lists

  // Lists
  if (mRecord) {
    C.cboAuthorisedBy.ListFromCsvString(mRecord.AuthorisedByNameList);
    C.cboMaturityInstruction.ListFromCollection(mRecord.MaturityInstructionList, "Description");

    C.cboMaturityAccountType.RefreshFromStandardRange("AccountTypes", mRecord.MaturityAccountTypeListFilter);
    C.cboMaturityPaymentType.ListFromCollection(mRecord.MaturityPaymentTypeList, "Description");

    // Reinvest to Account
    if (mRecord.ReinvestCommonClient) {
      C.cboMaturityAccount.LimitToList(true);
      C.cboMaturityAccount.RefreshFromCollection(mRecord.CommonClientAccountList, "Code", "Description");
    }
    else {
      C.cboMaturityAccount.RefreshFromStandardRange("Accounts");
    }

    // Transfer to Account
    if (mRecord.TransferCommonClient) {
      C.cboMaturityTransferToAccount.LimitToList(true);
      C.cboMaturityTransferToAccount.RefreshFromCollection(mRecord.CommonClientAccountList, "Code", "Description");
    }
    else {
      C.cboMaturityTransferToAccount.RefreshFromStandardRange("Accounts");
    }
  }

  // Controls

  // Update Buttons
  tabWizard_UpdateButtons();

  // Show content
  frmMain.Visible(mRecord != null);

  // Show History
  if (mRecord) {
    if ((mRecord.ShowHistory || !mRecord.CanChange) &amp;&amp; mRecord.CanViewHistory) {
      Form_ExecuteAction("History");
    }
  }

  // Resize Tab
  tabWizard_Resize();
}

// ===========
// Resize Form
// ===========
function Form_Resize() {
  // General

  // Tab
  tabWizard_Resize();
}

// ==============
// Wizard Buttons
// ==============
function tabWizard_Cancel() {
  if (widget.CanClose()) {
    widget.Close();
  }
  else {
    widget.Reset();
  }
}

function tabWizard_UpdateButtons() {
  // Back, Next, Finish Buttons Valid?
  var tabIndex = tabWizard.SelectedTabIndex();
  cmdBack.prop("disabled", tabIndex &lt;= 0);
  cmdNext.prop("disabled", tabIndex &gt;= tabWizard.TabCount() - 1);
  cmdFinish.prop("disabled", !cmdNext.prop("disabled"));

  // Exceptions
  if (mRecord &amp;&amp; mRecord.CanViewHistory) {
    cmdBack.prop("disabled", tabIndex &lt;= 0);
  }
  else {
    cmdBack.prop("disabled", tabIndex &lt;= 1); // History page not available
  }
  if (tabIndex == 0 || (mRecord &amp;&amp; !mRecord.CanViewHistory)) {
    cmdHistory.hide();
  }
  else {
    cmdHistory.show();
  }
  if (mRecord &amp;&amp; !mRecord.CanChange) {
    cmdNext.prop("disabled", true);
    cmdFinish.prop("disabled", true);
  }
}

// ==========
// Resize Tab
// ==========
function tabWizard_Resize() {
  switch (tabWizard.SelectedTabId()) {
    case "History":
      break;

    case "General":
      C.cboAuthorisedBy.WidthResizeFromParent();
      C.txtReference.ResizeFromParent();
      C.txtReason.ResizeFromParent();
      C.wbAccountSummary.ResizeFromParent();
      break;

    default:
      break;
  }
}

// ===========
// Wizard Move
// ===========
function tabWizard_Move(direction) {
  var Ok;

  // Validate
  if (direction &gt; 0) {
    tabWizard_Validate(function () { tabWizard_MovePost(direction); });
  }
  else {
    // Can always move backwards
    tabWizard_MovePost(direction);
  }
}

function tabWizard_MovePost(direction) {
  var Ok = true;

  // Find Next Tab to Move To
  if (Ok) {
    var found = false;
    var newTab = tabWizard.SelectedTabIndex();

    do {
      newTab += direction;

      switch (tabWizard.GetTabIdByIndex(newTab)) {
        default:
          found = true;
          break;
      }

      // Found?
      if (found) {
        break;
      }
      else if (newTab == tabWizard.TabCount() - 1) {
        // Just in case!
        widget.UI.MsgBoxAlert("tabWizard_MovePost: Tab not handled!");
        break;
      }
    }
    while (true);

    // Refresh the New Tab
    tabWizard_Refresh(newTab);
  }
}

// ===========
// Refresh Tab
// ===========
function tabWizard_Refresh(newTab) {
  // Moving forward onto tab, so Load information
  if (newTab &gt;= tabWizard.SelectedTabIndex()) {
    switch (tabWizard.GetTabIdByIndex(newTab)) {
      default:
        break;
    }
  }

  // Make Tab it
  tabWizard.SelectedTabIndex(newTab);

  // Special
  switch(tabWizard.SelectedTabId()) {
    case "History":
      // Load History (we move back to this page, not forward!)
      if (!mRecord_History) {
        gridHistory_Refresh();
      }
      else {
        // Refresh (e.g., to show hidden rows)
        C.gridHistory.VirtualDataRefresh(mRecord_History);

        // Activate Last Row
        C.gridHistory.ActivateLastDataRow();
      }
      break;
  }

  // Tweak fields

  // Update Heading
  switch (tabWizard.SelectedTabId()) {
    case "History":
      frmMain.RefreshHeading(tabWizard.TabCaption(tabWizard.SelectedTabId()), "Maturity Instruction History for Account '" + mRecord.RecordId + "', " + mRecord.RecordDescription + ".");
      break;

    default:
      frmMain.RefreshHeading(tabWizard.TabCaption(tabWizard.SelectedTabId()), tabWizard.TabTooltipText(tabWizard.SelectedTabId()));
      break;
  }

  // Back, Next command buttons valid?
  tabWizard_UpdateButtons();

  // Resize Wizard
  tabWizard_Resize();

  // Focus
  switch (tabWizard.SelectedTabId()) {
    default:
      tabWizard.FocusFirst();
      break;
  }
}

// ===============
// Validate Wizard
// ===============
function tabWizard_Validate(validCallback) {
  // Validate
  var Ok = tabWizard.Validate(true);

  // Other client-side validation
  if (Ok) {
    switch (tabWizard.SelectedTabId()) {
      case "General":
        // Server side validation required
        break;

      default:
        // No validation
        validCallback();
        return;
    }
  }

  // Server-side validation
  if (Ok) {
    var params;

    switch (tabWizard.SelectedTabId()) {
      case "General":
        params = CreateFinishParameters();
        break;
    }

    if (params) {
      // Disable Form
      frmMain.FormDisable("Validating");

      // Extend parameters
      params.pageId = tabWizard.SelectedTabId();

      // Call WizardValidate method in Script
      widget.GetString("WizardValidate",
                       params,
                       function (data) { tabWizard_ValidatePost(validCallback, data); },
                       tabWizard_ValidateFail);
    }
    else {
      // No server-side validation
      validCallback();
    }
  }
}

function tabWizard_ValidatePost(validCallback, data) {
  // Enable form
  frmMain.FormEnable();

  // Parse Data
  var o = {};
  if (data) o = JSON.parse(data);

  if (o.FailedMessage) {
    // -----------------
    // Validation failed
    // -----------------
    var o = JSON.parse(data);
    widget.UI.MsgBoxAlert(o.FailedMessage);
    if (o.FailedControlId) $("#" + o.FailedControlId).focus();
  }
  else {
    // ---------------------
    // Validation successful
    // ---------------------
    // Validation could pass back additional information, e.g., to use in tabWizard_Refresh
    switch (tabWizard.SelectedTabId()) {
      case "General":
        // General
        if (o.Data &amp;&amp; o.Data.length != 0) {
          // Confirm warnings
          widget.UI.MsgBoxConfirmList("To continue, please approve the following:",
                                      o.Data,
                                      {
                                        heading: "Additional Confirmation",
                                        icon: "Warning",
                                      },
                                      function () { validCallback(); },
                                      null);

          // Allow callbacks to continue
          return;
        };

        break;
    }

    // Callback
    validCallback();
  }
}

function tabWizard_ValidateFail(errorMessage)
{
  widget.UI.MsgBoxAlert(errorMessage);

  // Enable form
  frmMain.FormEnable();
}

// ========================
// Create Finish Parameters
// ========================
function CreateFinishParameters() {
  var params = {
    // General
    AuthorisedName: C.cboAuthorisedBy.Text(),
    Reference: C.txtReference.Text(),
    AuthorisedReason: C.txtReason.Text(),

    MaturityInstruction: C.cboMaturityInstruction.Text(),
    MaturityValue: C.numMaturityValue.Value(),
    MaturityAccountType: C.cboMaturityAccountType.Text(),
    MaturityAccount: C.cboMaturityAccount.Text(),
    MaturityPaymentType: C.cboMaturityPaymentType.Text(),
    MaturityTransferToAccount: C.cboMaturityTransferToAccount.Text(),
    BankingDetailsJson: C.apdPaymentDetails.ToBankingDetailsJson(),
  };

  return params;
}

// =================
// Execute an Action
// =================
function Form_ExecuteAction(actionId) {
  switch (actionId.toUpperCase()) {
    case "FINISH":
      // Finish
      Form_ExecuteAction_Finish();
      break;

    case "HISTORY":
      // Show History page
      tabWizard_Refresh(0);
      break;

    default:
      window.alert(mViewName + ".Form_ExecuteAction: Unhandled action '" + actionId + "'");
      break;
  }
}

// =============
// Finish Action
// =============
function Form_ExecuteAction_Finish() {
  // Validate
  tabWizard_Validate(function () {
    if (mRecord.PromptOnCommit) {
      // Confirm
      var heading = "Update Maturity Instruction";
      var message = "Are you sure you want to update Maturity Instruction for this Account?";
      widget.UI.MsgBoxConfirm(message, { heading: heading }, Form_ExecuteAction_FinishPost);
    }
    else {
      // Commit without prompting
      Form_ExecuteAction_FinishPost();
    }
  });
}

function Form_ExecuteAction_FinishPost() {
  // Disable Form
  widget.UI.Block("Committing, please wait...");

  // Create Parameters
  var params = CreateFinishParameters();

  // Finish
  widget.GetString("Finish", params,
    function (data) {
      data = JSON.parse(data);

      // Unblock UI
      widget.UI.Unblock()

      // Finalise
      if (data.Warning) {
        widget.UI.MsgBoxAlert("The Maturity Instructions were successfully updated but the following warning was given:\n\n" + data.Warning, {}, Form_ExecuteAction_FinishPost_Finalise);
      }
      else {
        Form_ExecuteAction_FinishPost_Finalise();
      }
    },

    function (data) {
      // Show Error
      widget.UI.MsgBoxAlert(data);

      // Enable Form
      widget.UI.Unblock();
    }
  );
}

function Form_ExecuteAction_FinishPost_Finalise() {
  // Close Form
  widget.Close();

  // Refresh Parent (to show updated details)
  widget.RefreshParent();
}

// ===========
// pageGeneral
// ===========
function pageGeneral_Refresh() {
  if (!mRecord) return;

  // Initialise
  var MaturityInstruction = C.cboMaturityInstruction.ListIndex() == -1 ? mRecord.MaturityInstruction : mRecord.MaturityInstructionList[C.cboMaturityInstruction.ListIndex()].Code;
  var MaturityPaymentType = C.cboMaturityPaymentType.ListIndex() == -1 ? mRecord.MaturityPaymentType : mRecord.MaturityPaymentTypeList[C.cboMaturityPaymentType.ListIndex()].Code;

  // Controls
  switch(MaturityInstruction.toUpperCase()) {
    case "PAYOUTALL":
        C.numMaturityValue.ReadOnly(true);
        C.cboMaturityAccount.ReadOnly(true);
        C.cboMaturityAccountType.ReadOnly(true);
        C.cboMaturityPaymentType.ReadOnly(false);

        $(".trReinvestment").hide();
        $(".trRepayment").show();
        break;

      case "REINVESTALL":
        C.numMaturityValue.ReadOnly(true);
        C.cboMaturityAccount.ReadOnly(false);
        C.cboMaturityAccountType.ReadOnly(false);
        C.cboMaturityPaymentType.ReadOnly(true);

        $(".trReinvestment").show();
        $(".trRepayment").hide();
        break;

      case "REINVESTAMOUNT":
        C.numMaturityValue.ReadOnly(false);
        C.cboMaturityAccount.ReadOnly(false);
        C.cboMaturityAccountType.ReadOnly(false);
        C.cboMaturityPaymentType.ReadOnly(false);

        $(".trReinvestment").show();
        $(".trRepayment").show();
        break;

      case "REINVESTPRINCIPAL":
        C.numMaturityValue.ReadOnly(true);
        C.cboMaturityAccount.ReadOnly(false);
        C.cboMaturityAccountType.ReadOnly(false);
        C.cboMaturityPaymentType.ReadOnly(false);

        $(".trReinvestment").show();
        $(".trRepayment").show();
        break;

      case "TOBEADVISED":
        C.numMaturityValue.ReadOnly(true);
        C.cboMaturityAccount.ReadOnly(true);
        C.cboMaturityAccountType.ReadOnly(true);
        C.cboMaturityPaymentType.ReadOnly(true);

        $(".trReinvestment").hide();
        $(".trRepayment").hide();
        break;
  }

  if (C.cboMaturityPaymentType.ReadOnly() || MaturityPaymentType.length &lt; 1) {
    C.cboMaturityTransferToAccount.VisibleRow(false);
    C.apdPaymentDetails.Visible(false);
  }
  else {
    switch(MaturityPaymentType.toUpperCase()) {
      case "CHEQUE":
          C.cboMaturityTransferToAccount.VisibleRow(false);
          C.apdPaymentDetails.Visible(true);

          // Filter by Cheque
          C.apdPaymentDetails.PaymentTypeCategoryFilter("Cheque");
          break;

      case "DIRECTCREDIT":
          C.cboMaturityTransferToAccount.VisibleRow(false);
          C.apdPaymentDetails.Visible(true);

          // Filter by Direct Credits (not a true Payment Type Category)
          C.apdPaymentDetails.PaymentTypeCategoryFilter("DirectCredit");
          break;

      case "TRANSFER":
          C.cboMaturityTransferToAccount.VisibleRow(true);
          C.apdPaymentDetails.Visible(false);
          break;
    }
  }
}

// ======================
// cboMaturityInstruction
// ======================
function cboMaturityInstruction_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;

  pageGeneral_Refresh();
}

// ======================
// cboMaturityPaymentType
// ======================
function cboMaturityPaymentType_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;

  pageGeneral_Refresh();
}

// ===========
// gridHistory
// ===========
function gridHistory_Refresh() {
  // Add Columns
  C.gridHistory.ClearColumns();
  C.gridHistory.AddColumnDate("Date", { caption: "Date"});
  C.gridHistory.AddColumnCode("CreatedUserId", { caption: "User", width: "10em"});
  C.gridHistory.AddColumnString("Reference", { caption: "Reference", width: "10em"});
  C.gridHistory.AddColumnString("Description", { caption: "Description"});
  C.gridHistory.AddColumnString("Notes", { caption: "Notes"});

  // Fetch data
  widget.GetString("GetHistory", {},
  function (data) {
    // Parse Data
    mRecord_History = JSON.parse(data);

    // Refresh Grid
    C.gridHistory.VirtualDataRefresh(mRecord_History);

    // Activate Last Row
    C.gridHistory.ActivateLastDataRow();
  },

  function (data) {
    // Error
    widget.UI.MsgBoxAlert(data);
  });
}

function gridHistory_InitialiseRow(e) {
  var item = mRecord_History[e.row.listIndex];

  // Automatic data binding
  e.row.AutoBind(item);
}

&lt;/script&gt;</TemplateText>
    <TemplateTextBookmarks />
    <TimeoutSeconds>60</TimeoutSeconds>
    <UniqueId>59C92vsfyUSLL2c5pCQcTA</UniqueId>
    <AllowRefresh>true</AllowRefresh>
    <Caption />
    <HtmlWidgetAllowInitialEventCaching>false</HtmlWidgetAllowInitialEventCaching>
    <HtmlWidgetMaxHeight>1024</HtmlWidgetMaxHeight>
    <HtmlWidgetMaxWidth>800</HtmlWidgetMaxWidth>
    <HtmlWidgetNeverApplyStyling>false</HtmlWidgetNeverApplyStyling>
    <HtmlWidgetResourceChartsApex>false</HtmlWidgetResourceChartsApex>
    <HtmlWidgetResourceCssSummaryPage2>false</HtmlWidgetResourceCssSummaryPage2>
    <HtmlWidgetResourceCssWidget>true</HtmlWidgetResourceCssWidget>
    <HtmlWidgetResourceJQuery>true</HtmlWidgetResourceJQuery>
    <HtmlWidgetResourceJQueryVersion />
    <HtmlWidgetSpecialEventGetFolderCount>false</HtmlWidgetSpecialEventGetFolderCount>
    <HtmlWidgetSpecialEventShowAsSummaryPage>false</HtmlWidgetSpecialEventShowAsSummaryPage>
    <HtmlWidgetSummaryPageObjectType>None</HtmlWidgetSummaryPageObjectType>
    <Icon />
    <RestrictedOriginsListEnabled>false</RestrictedOriginsListEnabled>
    <RunAsAdministrator>false</RunAsAdministrator>
    <WebServiceName />
    <WebServiceAllowAnonymous>false</WebServiceAllowAnonymous>
    <WebServiceSendDebugInformation>false</WebServiceSendDebugInformation>
    <ShowInMenu>None</ShowInMenu>
    <ParametersType>Custom</ParametersType>
    <Parameters>
      <ISParameterDefs version="1.00">
        <Parameters>
          <Parameter name="" type="SectionStart">
            <BlankTip />
            <Caption>TESTING</Caption>
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText>These are the Parameters required by this HTML Widget to function correctly.
They are listed here for testing purposes only.</TooltipText>
            <SectionColumns>1</SectionColumns>
            <Visible>true</Visible>
          </Parameter>
          <Parameter name="AccountId" type="List">
            <BlankTip />
            <Caption />
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <DefaultValueExpression />
            <Enabled>true</Enabled>
            <HideDescription>false</HideDescription>
            <IndentLevel>0</IndentLevel>
            <Mandatory>false</Mandatory>
            <NonPersistable>false</NonPersistable>
            <ReadOnly>false</ReadOnly>
            <ReadOnly2>false</ReadOnly2>
            <Value />
            <Visible>true</Visible>
            <List>RANGE.Accounts</List>
            <LimitToList>false</LimitToList>
            <MaxLength>0</MaxLength>
            <Rows>1</Rows>
          </Parameter>
          <Parameter name="ShowHistory" type="Boolean">
            <BlankTip />
            <Caption />
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <DefaultValueExpression />
            <Enabled>true</Enabled>
            <HideDescription>false</HideDescription>
            <IndentLevel>0</IndentLevel>
            <NonPersistable>false</NonPersistable>
            <ReadOnly>false</ReadOnly>
            <ReadOnly2>false</ReadOnly2>
            <Value>False</Value>
            <Visible>true</Visible>
          </Parameter>
        </Parameters>
      </ISParameterDefs>
    </Parameters>
  </finScript>