<?xml version="1.0" encoding="utf-8"?>
  <finScript version="1.00" exportedUtcDate="2023-10-26T01:40:05.0000000">
    <CreatedUserId>ADMIN</CreatedUserId>
    <CreatedUtcDate>2023-07-10T23:34:05.7200000</CreatedUtcDate>
    <UpdatedUserId>ADMIN</UpdatedUserId>
    <UpdatedUtcDate>2023-10-26T01:39:34.4470000</UpdatedUtcDate>
    <ScriptId>TT</ScriptId>
    <Description>Transaction Type Edit</Description>
    <ScriptType>HtmlWidget</ScriptType>
    <Active>true</Active>
    <AllowUI>false</AllowUI>
    <Bookmarks />
    <Category />
    <Code>' HtmlWidget_TransactionTypeEdit
Option Explicit On
Option Strict On

' #################################################################
' Transaction Type Edit form HTML Widget
'
' Version: 1.01 (26/10/2023)
'
' Usage: System-supplied HTML Widget
' #################################################################
' Version        Date  User     Job       Description
' -------  ----------  -------  --------  -------------------------
'    1.00  25/08/2023  ISS      J030256   Created
'    1.01  26/10/2023  ISS      J032286   Updated 'DuplicateRecordId' Parameters Standard Range
' #################################################################

' Constants
Private Const FORM_KEY As String = "TransactionTypes"

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

' Standard Parameters
Private mTransactionTypeId As String
Private mElementId As String
Private mDuplicateRecordId As String
Private mPage As String
Private mReadOnly As Boolean

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 Standard Parameters
  With mStartupParameters
    mTransactionTypeId = .GetString("TransactionTypeId") ' Always use Startup Parameters since the Transaction Type Id may be updated
  End With
  With mCombinedParameters
    mElementId = .GetString("ElementId")
    mDuplicateRecordId = .GetString("DuplicateRecordId")
    mPage = .GetString("Page")
    mReadOnly = .GetBoolean("ReadOnly")
  End With

  ' Update Parameters
  If Len(mTransactionTypeId) &lt;&gt; 0 Then mElementId = ""
  
  ' Validate
  Main = finBL.HtmlWidgetUtilities.HasPermissionToViewFormKey(FORM_KEY)

  ' Handle Events
  If Main Then
    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 "GetInitialisationInfo"
        ' Get Initialisation Information required for this wizard
        Main = GetInitialisationInfo(returnValue)

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

End Function

''' &lt;summary&gt;
'''  Load Transaction Type.
''' &lt;/summary&gt;
Private Function GetTransactionType(ByRef transactionType As finTransactionType) As Boolean

  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Validate

  ' Create and Load Transaction Type
  If Success Then
    ' Create Transaction Type
    transactionType = finBL.CreateTransactionType()

    ' Load Transaction Type
    If Len(mDuplicateRecordId) &lt;&gt; 0 Then
      ' New record (by duplicating existing)
      Success = transactionType.Load(mDuplicateRecordId)
      If Success Then transactionType.Duplicate()
    ElseIf Len(mTransactionTypeId) = 0 Then
      ' New record
    Else
      Success = transactionType.Load(mTransactionTypeId)
    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 ElementRO As finElementRO
  Dim FormInitialisationInfo As FormInitialisationInfo
  Dim Success As Boolean
  Dim TransactionType As finTransactionType
  Dim TransactionTypeAccountType As finTransactionTypeAccountType

  ' Assume Success
  Success = True

  ' Validate
  If Len(mElementId) &lt;&gt; 0 AndAlso Not finBL.Elements.Exists(mElementId) Then
    Success = False
    finBL.Error.ErrorBeginFormat("Invalid Element Id '{0}'.", mElementId)
  End If
  
  ' Get Transaction Type
  If Success Then
    Success = GetTransactionType(TransactionType)
  End If

  ' Get Initialisation Info
  If Success Then
    FormInitialisationInfo = New FormInitialisationInfo()
    With FormInitialisationInfo
      ' Form
      .PageId = mPage
      If finBL.Database.IsReadOnly OrElse mReadOnly OrElse Not finBL.CurrentUser.Permissions.Allow("Admin.TransactionTypes") Then
        .ReadOnly = True
      Else
        .ReadOnly = False
      End If

      ' Record
      .Pk = TransactionType.Pk
      .Timestamp = TransactionType.Timestamp

      ' Page Permissions (defined here since they are used below)
      .AllowPageGeneral = True
      .AllowPageOther = True
      .AllowPageDefaults = True
      .AllowPageAccountTypes = True
      .AllowPagePermission = True

      ' General
      .TransactionTypeId = TransactionType.TransactionTypeId ' Always need to return Transaction Type Id
      If .AllowPageGeneral Then
        .Active = TransactionType.Active
        .Description = TransactionType.Description
        .ElementId = TransactionType.ElementId        
        .Notes = TransactionType.Notes
      End If

      ' Other
      If .AllowPageOther Then
        .AllowTransactionEntry = TransactionType.AllowTransactionEntry
        .AllowTransactionEntrySingle = TransactionType.AllowTransactionEntrySingle
        .CreditInterest = TransactionType.CreditInterest
        .CreditInterestDefaultAutoPostWithholdingTax = TransactionType.CreditInterestDefaultAutoPostWithholdingTax
        .CreditInterestAllowAutoPostWithholdingTax = TransactionType.CreditInterestAllowAutoPostWithholdingTax
        .ShowElementColumn = TransactionType.ShowElementColumn
        .AllowDisbursementEntry = TransactionType.AllowDisbursementEntry
        .AllowBankTransactions = TransactionType.AllowBankTransactions
        .AllowBankEntry = TransactionType.AllowBankEntry
        .AllowAccountPaymentWizard = TransactionType.AllowAccountPaymentWizard
        .AllowAccountRefundWizard = TransactionType.AllowAccountRefundWizard
        .AllowAccountWithdrawalWizard = TransactionType.AllowAccountWithdrawalWizard
        .AllowAccountCloseWizard = TransactionType.AllowAccountCloseWizard
        .AllowBankTransactionsAnyElementType = TransactionType.AllowBankTransactionsAnyElementType
        .EnterBatchTotal = TransactionType.EnterBatchTotal
        .AllowPartialCommit = TransactionType.AllowPartialCommit
        .PrintReceipt = TransactionType.PrintReceipt
      End If      
      
      ' Defaults
      If .AllowPageDefaults Then
        .TransactionReference = TransactionType.TransactionReference
        .TransactionValue = TransactionType.TransactionValue
        .TransactionNotes = TransactionType.TransactionNotes
        .DefaultBankAccountId = TransactionType.DefaultBankAccountId
        .NextBatchId = TransactionType.NextBatchId
      End If

      ' Account Types
      If .AllowPageAccountTypes Then
        .AllowAllAccountTypes = TransactionType.AllowAllAccountTypes
        
        For Each TransactionTypeAccountType In TransactionType.AccountTypes
          .AccountTypes.Add(New AccountType(TransactionTypeAccountType))
        Next 
      End If
      
      ' Permission
      If .AllowPagePermission Then
        .PermissionKeyOpen = TransactionType.PermissionKeyOpen
        .PermissionKeyCommit = TransactionType.PermissionKeyCommit
      End If
      
      ' Update Defaults if creating from an Element
      If Len(mElementId) &lt;&gt; 0 Then
        With finBL.Elements(mElementId)
          FormInitialisationInfo.Description = .Description
          FormInitialisationInfo.ElementId = .ElementId
          FormInitialisationInfo.TransactionNotes = .TransactionNotes
          FormInitialisationInfo.TransactionReference = .TransactionReference
          FormInitialisationInfo.TransactionTypeId = .ElementId
          FormInitialisationInfo.TransactionValue = .TransactionValue
        End With
      End If
      
      ' Permissions

      ' Lists
      For Each ElementRO In finBL.Elements
        .Elements.Add(New Element(ElementRO))
      Next
      .PermissionKeyListCsv = finBL.Permissions.GetPermissionKeysList().ToCsvString()

      ' Configuration
      .AddonsDepositAccount = finBL.Settings.AddOns.DepositAccount
      .AddonsDisbursements = finBL.Settings.AddOns.Disbursements
      .ElementListSQLWhere = finBL.HtmlWidgetUtilities.EncryptSql(finBL.Elements.GetDataViewFilter_TransactionType())
      .HideOtherPages = mCombinedParameters.GetBoolean("HideOtherPages", False)
      .PromptOnSave = finBL.CloudConnectFunctions.CloudConnectSettings.PromptOnSave
    End With
  End If

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

  Return Success

End Function

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

  Dim AccountType As AccountType
  Dim obj As Object
  Dim Record As FormInitialisationInfo
  Dim Success As Boolean
  Dim TransactionType As finTransactionType
  Dim TransactionTypeAccountType As finTransactionTypeAccountType

  ' Assume Success
  Success = True

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

  ' Get Transaction Type
  If Success Then
    Success = GetTransactionType(TransactionType)
  End If

  ' Validate
  If Success Then
    If Record.Timestamp &lt;&gt; TransactionType.Timestamp Then
      Success = False
      finBL.Error.ErrorBegin("This record has been updated by another User.")
    End If
  End If

  ' Update and Save
  ' NOTE: Recheck Permissions in addition to the 'AllowPage' properties before updating to prevent spoofing
  If Success Then
    ' Begin Transaction
    If finBL.Database.TransactionBegin() Then
      ' Update Transaction Type
      With TransactionType
        If Record.AllowPageGeneral Then
          .TransactionTypeId = Record.TransactionTypeId
          .Active = Record.Active
          .Description = Record.Description  
          .ElementId = Record.ElementId          
          .Notes = Record.Notes
        End If
  
        ' Other
        If Record.AllowPageOther Then
          .AllowTransactionEntry = Record.AllowTransactionEntry
          .AllowTransactionEntrySingle = Record.AllowTransactionEntrySingle
          .CreditInterest = Record.CreditInterest
          .CreditInterestDefaultAutoPostWithholdingTax = Record.CreditInterestDefaultAutoPostWithholdingTax
          .CreditInterestAllowAutoPostWithholdingTax = Record.CreditInterestAllowAutoPostWithholdingTax
          .ShowElementColumn = Record.ShowElementColumn
          .AllowDisbursementEntry = Record.AllowDisbursementEntry
          .AllowBankTransactions = Record.AllowBankTransactions
          .AllowBankEntry = Record.AllowBankEntry
          .AllowAccountPaymentWizard = Record.AllowAccountPaymentWizard
          .AllowAccountRefundWizard = Record.AllowAccountRefundWizard
          .AllowAccountWithdrawalWizard = Record.AllowAccountWithdrawalWizard
          .AllowAccountCloseWizard = Record.AllowAccountCloseWizard
          .AllowBankTransactionsAnyElementType = Record.AllowBankTransactionsAnyElementType
          .EnterBatchTotal = Record.EnterBatchTotal
          .AllowPartialCommit = Record.AllowPartialCommit
          .PrintReceipt = Record.PrintReceipt
        End If      
        
        ' Defaults
        If Record.AllowPageDefaults Then
          .TransactionReference = Record.TransactionReference
          .TransactionValue = Record.TransactionValue
          .TransactionNotes = Record.TransactionNotes
          .DefaultBankAccountId = Record.DefaultBankAccountId
          .NextBatchId = Record.NextBatchId
        End If
  
        ' Account Types
        If Record.AllowPageAccountTypes Then
          .AllowAllAccountTypes = Record.AllowAllAccountTypes
          
          For Each TransactionTypeAccountType In .AccountTypes
            For Each AccountType In Record.AccountTypes
              If TransactionTypeAccountType.AccountTypePk = AccountType.AccountTypePk Then
                TransactionTypeAccountType.Available = AccountType.Available
                Exit For
              End If
            Next 
          Next 
        End If
        
        ' Permission
        If Record.AllowPagePermission Then
          .PermissionKeyOpen = Record.PermissionKeyOpen
          .PermissionKeyCommit = Record.PermissionKeyCommit
        End If
      End With

      ' Save
      If Success Then
        Success = TransactionType.Save()
      End If

      ' Commit/ Rollback Transaction
      If Success Then
        finBL.Database.TransactionCommit()
      Else
        finBL.Database.TransactionRollback()
      End If
    Else
      Success = False
    End If
  End If

  Return Success

End Function

''' &lt;summary&gt;
'''  Validate a Wizard page.
''' &lt;/summary&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 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
  End Select

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

  Return Success

End Function


''' &lt;summary&gt;
'''  Wizard Initialisation Information.
''' &lt;/summary&gt;
''' &lt;remarks&gt;
'''  This object is also used to save the Employment.
''' &lt;/remarks&gt;
Public Class FormInitialisationInfo

  ' Form
  Public PageId As String
  Public [ReadOnly] As Boolean

  ' Record
  Public Pk As Integer
  Public Timestamp As Integer

  ' General
  Public TransactionTypeId As String
  Public Active As Boolean
  Public Description As String
  Public ElementId As String
  Public Notes As String

  ' Other
  Public AllowTransactionEntry As Boolean
  Public AllowTransactionEntrySingle As Boolean
  Public CreditInterest As Boolean
  Public CreditInterestDefaultAutoPostWithholdingTax As Boolean
  Public CreditInterestAllowAutoPostWithholdingTax As Boolean
  Public ShowElementColumn As Boolean
  Public AllowDisbursementEntry As Boolean
  Public AllowBankTransactions As Boolean
  Public AllowBankEntry As Boolean
  Public AllowAccountPaymentWizard As Boolean
  Public AllowAccountRefundWizard As Boolean
  Public AllowAccountWithdrawalWizard As Boolean
  Public AllowAccountCloseWizard As Boolean
  Public AllowBankTransactionsAnyElementType As Boolean
  Public EnterBatchTotal As Boolean
  Public AllowPartialCommit As Boolean
  Public PrintReceipt As Boolean

  ' Defaults
  Public TransactionReference As String
  Public TransactionValue As Decimal
  Public TransactionNotes As String
  Public DefaultBankAccountId As String
  Public NextBatchId As String
  
  ' Account Types
  Public AllowAllAccountTypes As Boolean
  Public AccountTypes As New List(Of AccountType)
  
  ' Permission
  Public PermissionKeyOpen As String
  Public PermissionKeyCommit As String
  
  ' Permissions
  Public AllowPageGeneral As Boolean
  Public AllowPageOther As Boolean
  Public AllowPageDefaults As Boolean
  Public AllowPageAccountTypes As Boolean
  Public AllowPagePermission As Boolean

  ' Lists  
  Public Elements As New List(Of Element)
  Public PermissionKeyListCsv As String

  ' Configuration
  Public AddonsDepositAccount As Boolean
  Public AddonsDisbursements As Boolean
  Public ElementListSQLWhere As String
  Public HideOtherPages As Boolean
  Public PromptOnSave As Boolean

End Class



''' &lt;summary&gt;
'''  Transaction Type Account Type.
''' &lt;/summary&gt;
Public Class AccountType
  
  Public AccountTypeId As String
  Public AccountTypePk As Integer
  Public Active As Boolean
  Public Available As Boolean
  Public Description As String
  
  Public Sub New()
  End Sub    
  
  Public Sub New(transactionTypeAccountType As finTransactionTypeAccountType)
    
    With transactionTypeAccountType
      Me.AccountTypeId = .AccountTypeId
      Me.AccountTypePk = .AccountTypePk
      Me.Active = .Active
      Me.Available = .Available      
      Me.Description = .Description
    End With
    
  End Sub
  
End Class



''' &lt;summary&gt;
'''  Element.
''' &lt;/summary&gt;
Public Class Element
  
  Public ElementId As String
  Public ElementType As String
  
  Public Sub New()
  End Sub  
  
  Public Sub New(elementRO As finElementRO)
    
    With elementRO
      Me.ElementId = .ElementId
      Me.ElementType = .ElementType.ToString()
    End With
    
  End Sub
  
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</Code>
    <Language>VisualBasic</Language>
    <Notes>System-supplied HTML Widget to edit a Transaction Type.</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;!-- Tabs --&gt;
    &lt;div id="tabDetails" class="is-tabs"&gt;
      &lt;ul&gt;
        &lt;li tabId="General"&gt;General&lt;/li&gt;
        &lt;li tabId="Other"&gt;Other&lt;/li&gt;
        &lt;li tabId="Defaults"&gt;Defaults&lt;/li&gt;
        &lt;li tabId="AccountTypes"&gt;Account Types&lt;/li&gt;
        &lt;li tabId="Permission"&gt;Permission&lt;/li&gt;
      &lt;ul&gt;
    &lt;/div&gt;
  &lt;/header&gt;


  &lt;!-- Pages --&gt;
  &lt;div class="is-widget-form-body"&gt;
    &lt;!-- General --&gt;
    &lt;div id="pageGeneral"&gt;
      &lt;table class="is-form" style="height:100%"&gt;
        &lt;colgroup&gt;
          &lt;col style="width:6em" /&gt;
          &lt;col /&gt;
        &lt;/colgroup&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblCodeAndName"&gt;Code and Description&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtTransactionTypeId"&gt;Code:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtTransactionTypeId"/&gt; &lt;input id="chkActive" type="checkbox"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtDescription"&gt;Description:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtDescription"/&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblElement"&gt;Element to post Transactions to&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;        
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboElementId"&gt;Element:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboElementId"/&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblNotes"&gt;Notes&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr style="height:100%"&gt;
          &lt;th colspan="2" style="height:100%"&gt;&lt;input id="txtNotes" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;


    &lt;!-- Other --&gt;
    &lt;div id="pageOther"&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="lblUsage"&gt;Usage options&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkAllowTransactionEntry" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2" class="indent1"&gt;&lt;input id="chkCreditInterest" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2" class="indent2"&gt;&lt;input id="chkCreditInterestDefaultAutoPostWithholdingTax" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2" class="indent2"&gt;&lt;input id="chkCreditInterestAllowAutoPostWithholdingTax" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1" class="indent1"&gt;&lt;input id="chkShowElementColumn" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1" class="indent1"&gt;&lt;input id="chkAllowDisbursementEntry" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1"&gt;&lt;input id="chkAllowTransactionEntrySingle" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1"&gt;&lt;input id="chkAllowBankTransactions" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1" class="indent1"&gt;&lt;input id="chkAllowBankEntry" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1" class="indent1"&gt;&lt;input id="chkAllowAccountPaymentWizard" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1" class="indent1"&gt;&lt;input id="chkAllowAccountRefundWizard" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1" class="indent1"&gt;&lt;input id="chkAllowAccountWithdrawalWizard" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1" class="indent1"&gt;&lt;input id="chkAllowAccountCloseWizard" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1" class="indent1"&gt;&lt;input id="chkAllowBankTransactionsAnyElementType" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1"&gt;&lt;input id="chkEnterBatchTotal" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1"&gt;&lt;input id="chkAllowPartialCommit" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblOtherOptions"&gt;Other options&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="1"&gt;&lt;input id="chkPrintReceipt" type="checkbox" /&gt;&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;
    
    
    &lt;!-- Defaults --&gt;
    &lt;div id="pageDefaults"&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="lblDefaultValues"&gt;Default values for this Transaction Type&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;    
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboTransactionReference"&gt;Reference:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboTransactionReference"/&gt;&lt;/td&gt;
        &lt;/tr&gt;  
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="numTransactionValue"&gt;Value:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="numTransactionValue"/&gt;&lt;/td&gt;
        &lt;/tr&gt;   
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtTransactionNotes"&gt;Notes:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtTransactionNotes"/&gt;&lt;/td&gt;
        &lt;/tr&gt; 
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboDefaultBankAccountId"&gt;Bank Account:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboDefaultBankAccountId"/&gt;&lt;/td&gt;
        &lt;/tr&gt; 
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblNextBatchId"&gt;Next Batch Id or Batch Id default format&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;   
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboNextBatchId"&gt;Next Batch Id:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboNextBatchId"/&gt;&lt;/td&gt;
        &lt;/tr&gt;  
      &lt;/table&gt;
    &lt;/div&gt;
    
    
    &lt;!-- Account Types --&gt;
    &lt;div id="pageAccountTypes"&gt;
      &lt;div style="display:flex; flex-direction:column; position:absolute; top:0; left:0; right:0; bottom:0; padding:4px"&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="lblAvailableAccountTypes"&gt;Account Types available to this Transaction Type&lt;/label&gt;&lt;/th&gt;
            &lt;/tr&gt;     
            &lt;tr&gt;
              &lt;th colspan="1"&gt;&lt;input id="chkAllowAllAccountTypes" type="checkbox" /&gt;&lt;/th&gt;
            &lt;/tr&gt;   
          &lt;/table&gt;
        &lt;/div&gt;
        
        &lt;div style="position:relative; flex-grow:1; max-width:1024px; margin-left:8px; margin-top:8px;"&gt;
          &lt;div id="gridAccountTypes" class="is-dock-fill"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;      
    &lt;/div&gt;
    
    &lt;!-- Permission --&gt;
    &lt;div id="pagePermission"&gt;
      &lt;table class="is-form"&gt;
        &lt;colgroup&gt;
          &lt;col style="width:6em" /&gt;
          &lt;col /&gt;
        &lt;/colgroup&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblPermission"&gt;Permission Keys required for this Transaction Type&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;    
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboPermissionKeyOpen"&gt;Open:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboPermissionKeyOpen"/&gt;&lt;/td&gt;
        &lt;/tr&gt; 
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboPermissionKeyCommit"&gt;Commit:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboPermissionKeyCommit"/&gt;&lt;/td&gt;
        &lt;/tr&gt;         
      &lt;/table&gt;
    &lt;/div&gt;
  &lt;/div&gt;


  &lt;!-- Form Footer --&gt;
  &lt;footer&gt;
    &lt;button id="cmdCancel" class="is-button"&gt;Cancel&lt;/button&gt;
    &lt;button id="cmdFinish" class="is-button ok"&gt;Save&lt;/button&gt;
  &lt;/footer&gt;

&lt;/div&gt;


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

var mOriginalJson;

// Controls
var C = {
  //   General
  lblCodeAndName: null,
  chkActive: null,
  txtTransactionTypeId: null,
  txtDescription: null,
    
  lblElement: null,
  cboElementId: null,

  lblNotes: null,
  txtNotes: null,

  //   Other
  lblUsage: null,
  chkAllowTransactionEntry: null,
  chkCreditInterest: null,
  chkCreditInterestDefaultAutoPostWithholdingTax: null,
  chkCreditInterestAllowAutoPostWithholdingTax: null,
  chkShowElementColumn: null,
  chkAllowDisbursementEntry: null,
  chkAllowTransactionEntrySingle: null,
  chkAllowBankTransactions: null,
  chkAllowBankEntry: null,
  chkAllowAccountPaymentWizard: null,
  chkAllowAccountRefundWizard: null,
  chkAllowAccountWithdrawalWizard: null,
  chkAllowAccountCloseWizard: null,
  chkAllowBankTransactionsAnyElementType: null,
  chkEnterBatchTotal: null,
  chkAllowPartialCommit: null,
  
  lblOtherOptions: null,
  chkPrintReceipt: null,
  
  //   Defaults
  lblDefaultValues: null,
  cboTransactionReference: null,
  numTransactionValue: null,
  txtTransactionNotes: null,
  cboDefaultBankAccountId: null,
  
  lblNextBatchId: null,
  cboNextBatchId: null,
  
  //   Account Types
  lblAvailableAccountTypes: null,
  chkAllowAllAccountTypes: null,
  gridAccountTypes: null,
  
  //   Permission
  lblPermission: null,
  cboPermissionKeyOpen: null,
  cboPermissionKeyCommit: null,
}

// Form
var frmMain;
var tabDetails;

// Buttons
var cmdCancel;
var cmdFinish;

// Other
var mElement;

// ==========
// Initialise
// ==========
$(function () {
  // --------
  // Controls
  // --------
  //   General
  C.lblCodeAndName = widget.UI.Label("lblCodeAndName", {});
  C.txtTransactionTypeId = widget.UI.TextBox("txtTransactionTypeId", {
    allowBlank: false,
    maxLength: 10,
    width: widget.UI.FIELD_WIDTH_CODE_10,
  });
  C.chkActive = widget.UI.CheckBox("chkActive", {
    caption: "Active?",
  });
  C.txtDescription = widget.UI.TextBox("txtDescription", {
    allowBlank: false,
    maxLength: 50,
  });
  
  C.lblElement = widget.UI.Label("lblElement", {});
  C.cboElementId = widget.UI.DBCombo("cboElementId", {
    allowBlank: false,
    limitToList: true,
    
    onChange: cboElementId_Change,
  });

  C.lblNotes = widget.UI.Label("lblNotes", {});
  C.txtNotes = widget.UI.TextBox("txtNotes", {
    multiLine: true,
  });

  //   Other
  C.lblUsage = widget.UI.Label("lblUsage", {});
  C.chkAllowTransactionEntry = widget.UI.CheckBox("chkAllowTransactionEntry", {
    caption: "Transaction Entry allowed?",
    captionWrap: true,
    
    onChange: chkAllowTransactionEntry_Change,
  });
  C.chkCreditInterest = widget.UI.CheckBox("chkCreditInterest", {
    caption: "Credit Interest?",
    captionWrap: true,
    tooltipText: "Indicates this is Credit Interest for Deposit Accounts. Credit Interest values are entered as positive values.",
    
    onChange: chkCreditInterest_Change,
  });
  C.chkCreditInterestDefaultAutoPostWithholdingTax = widget.UI.CheckBox("chkCreditInterestDefaultAutoPostWithholdingTax", {
    caption: "Default Auto Post Withholding Tax?",
    captionWrap: true,
  });
  C.chkCreditInterestAllowAutoPostWithholdingTax = widget.UI.CheckBox("chkCreditInterestAllowAutoPostWithholdingTax", {
    caption: "Allow user to update Auto Post Withholding Tax?",
    captionWrap: true,
  });
  C.chkShowElementColumn = widget.UI.CheckBox("chkShowElementColumn", {
    caption: "Show Element column?",
    captionWrap: true,
  });
  C.chkAllowDisbursementEntry = widget.UI.CheckBox("chkAllowDisbursementEntry", {
    caption: "Allow Disbursement Entry?",
    captionWrap: true,
  });
  C.chkAllowTransactionEntrySingle = widget.UI.CheckBox("chkAllowTransactionEntrySingle", {
    caption: "Single Transaction Entry allowed?",
    captionWrap: true,
  });
  C.chkAllowBankTransactions = widget.UI.CheckBox("chkAllowBankTransactions", {
    caption: "Bank Transactions allowed?",
    captionWrap: true,
    
    onChange: chkAllowBankTransactions_Change,
  });
  C.chkAllowBankEntry = widget.UI.CheckBox("chkAllowBankEntry", {
    caption: "Bank Entry allowed?",
    captionWrap: true,
  });
  C.chkAllowAccountPaymentWizard = widget.UI.CheckBox("chkAllowAccountPaymentWizard", {
    caption: "Account Payment wizard allowed?",
    captionWrap: true,
  });
  C.chkAllowAccountRefundWizard = widget.UI.CheckBox("chkAllowAccountRefundWizard", {
    caption: "Account Refund wizard allowed?",
    captionWrap: true,
  });
  C.chkAllowAccountWithdrawalWizard = widget.UI.CheckBox("chkAllowAccountWithdrawalWizard", {
    caption: "Account Withdrawal wizard allowed?",
    captionWrap: true,
  });
  C.chkAllowAccountCloseWizard = widget.UI.CheckBox("chkAllowAccountCloseWizard", {
    caption: "Account Close wizard allowed?",
    captionWrap: true,
  });
  C.chkAllowBankTransactionsAnyElementType = widget.UI.CheckBox("chkAllowBankTransactionsAnyElementType", {
    caption: "Allow any Element?",
    captionWrap: true,
  });
  C.chkEnterBatchTotal = widget.UI.CheckBox("chkEnterBatchTotal", {
    caption: "User must enter a Batch Total?",
    captionWrap: true,
  });
  C.chkAllowPartialCommit = widget.UI.CheckBox("chkAllowPartialCommit", {
    caption: "Allow partial commit of Batches?",
    captionWrap: true,
  });
  
  C.lblOtherOptions = widget.UI.Label("lblOtherOptions", {});
  C.chkPrintReceipt = widget.UI.CheckBox("chkPrintReceipt", {
    caption: "If applicable, default 'Print Receipt/ Advice' as checked?",
    captionWrap: true,
  });

  //   Defaults
  C.lblDefaultValues = widget.UI.Label("lblDefaultValues", {
    tooltipText: "Reference substitutions include '[Seq]Sequence'=Sequenced values; '[User]'=User's code",
  });
  C.cboTransactionReference = widget.UI.ComboBox("cboTransactionReference", {
    listCsv: "[Seq],[User]",
    maxLength: 20,
  });
  C.numTransactionValue = widget.UI.NumberBox("numTransactionValue", {
    minValue: 0,
    maxValue: 999999999999999,
    width: "8em",
  });
  C.txtTransactionNotes = widget.UI.TextBox("txtTransactionNotes", {
    maxLength: 255,
    multiLine: true,
    rows: 4,
  });
  C.cboDefaultBankAccountId = widget.UI.DBCombo("cboDefaultBankAccountId", {
    limitToList: true,
  });
  
  C.lblNextBatchId = widget.UI.Label("lblNextBatchId", {
    tooltipText: "The next Batch Id to use for a batch of this Transaction Type.\n\nSubstitutions include '[YMD]'=current Year, Month and Day; '[Seq]'=Sequence.",
  });
  C.cboNextBatchId = widget.UI.ComboBox("cboNextBatchId", {
    maxLength: 20,
    listCsv: "[YMD].[Seq]",    
  });

  //   Account Types
  C.lblAvailableAccountTypes = widget.UI.Label("lblAvailableAccountTypes", {
    tooltipText: "Depending on the Element Type, not all Account Types will be available",
  });
  C.chkAllowAllAccountTypes = widget.UI.CheckBox("chkAllowAllAccountTypes", {
    caption: "Allow all Account Types?",
    
    onChange: chkAllowAllAccountTypes_Change,
  });

  //   Permission
  C.lblPermission = widget.UI.Label("lblPermission", {
    tooltipText: "Open:\nEnter a Permission Key to control Users that can open and edit Transactions for this Transaction Type\n\nCommit:\nEnter a Permission Key to control Users that can commit Transactions for this Transaction Type",
  });
  C.cboPermissionKeyOpen = widget.UI.ComboBox("cboPermissionKeyOpen", {});
  C.cboPermissionKeyCommit = widget.UI.ComboBox("cboPermissionKeyCommit", {});

  // Grids
  C.gridAccountTypes = widget.UI.Grid("gridAccountTypes", {
    allowMultiRowSelect: true,
    allowGroupingsCollapse: true,
    docked: true,    
    showRowSelectors: true,
    stickyHeader: true,

    onAction: gridAccountTypes_Action,
    onBeforeCellUpdate: gridAccountTypes_BeforeCellUpdate,
    onInitialiseRow: gridAccountTypes_InitialiseRow,
  });  

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

  // Create Tabs
  tabDetails = new widget.UI.Tabs("tabDetails", {
    style: "normal",
    onSelectedTabChanged: tabDetails_Refresh,
  });

  // Handle resize
  $(window).resize(Form_Resize);

  // Disable Close Button (this causes the 'FormClose' notification action to be invoked instead)
  widget.DisableCloseButton();
  widget.ActionNotificationHandle(Widget_NotificationHandler)

  // Handle Wizard Buttons
  cmdCancel = $("#cmdCancel");
  cmdFinish = $("#cmdFinish");
  cmdCancel.click(tabDetails_Cancel);
  cmdFinish.click(Form_ExecuteAction_Finish);

  // Reset
  Form_Reset();
});

// ==========
// Reset Form
// ==========
function Form_Reset() {  
  // Resize
  Form_Resize();

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

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

  // Hide content
  frmMain.Visible(false);

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

  // Load Initialisation details
  widget.GetString("GetInitialisationInfo", {},
    // Success
    Record_Load_Done,

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

function Record_Load_Done(data) {
  // Initialise
  mRecord = JSON.parse(data);

  // Set Tab
  if (mRecord &amp;&amp; mRecord.PageId) {
    tabDetails.SelectedTabId(mRecord.PageId);

    // Hide other Pages
    if (mRecord.HideOtherPages) {
      tabDetails.ShowSingleTab(mRecord.PageId);
    }
  }
  else {
    tabDetails.SelectedTabId("General");
  }

  // Page Permissions
  if (!mRecord.AllowPageGeneral) tabDetails.TabVisible("General", false);
  if (!mRecord.AllowPageOther) tabDetails.TabVisible("Other", false);
  if (!mRecord.AllowPageDefaults) tabDetails.TabVisible("Defaults", false);
  if (!mRecord.AllowPageAccountTypes) tabDetails.TabVisible("AccountTypes", false);
  if (!mRecord.AllowPagePermission) tabDetails.TabVisible("Permission", false);

  // Give Collections ability to lookup by code
  widget.ArrayAllowLookupById(mRecord.Elements, "ElementId");

  // Load Fields
  Fields_Load();

  // Save Fields (so UserData is in correct format for mOriginalJson)
  Fields_Save();

  // Save original JSON for Form_IsDirty
  mOriginalJson = JSON.stringify(mRecord);
}

// ===========
// Load Fields
// ===========
function Fields_Load() {
  if (mRecord) {
    // General
    C.txtTransactionTypeId.Text(mRecord.TransactionTypeId);
    C.chkActive.Value(mRecord.Active);
    C.txtDescription.Text(mRecord.Description);    
    C.cboElementId.Text(mRecord.ElementId);
    C.txtNotes.Text(mRecord.Notes);

    // Other
    C.chkAllowTransactionEntry.Value(mRecord.AllowTransactionEntry);
    C.chkAllowTransactionEntrySingle.Value(mRecord.AllowTransactionEntrySingle);
    C.chkCreditInterest.Value(mRecord.CreditInterest);
    C.chkCreditInterestDefaultAutoPostWithholdingTax.Value(mRecord.CreditInterestDefaultAutoPostWithholdingTax);
    C.chkCreditInterestAllowAutoPostWithholdingTax.Value(mRecord.CreditInterestAllowAutoPostWithholdingTax);
    C.chkShowElementColumn.Value(mRecord.ShowElementColumn);
    C.chkAllowDisbursementEntry.Value(mRecord.AllowDisbursementEntry);
    C.chkAllowBankTransactions.Value(mRecord.AllowBankTransactions);
    C.chkAllowBankEntry.Value(mRecord.AllowBankEntry);
    C.chkAllowAccountPaymentWizard.Value(mRecord.AllowAccountPaymentWizard);
    C.chkAllowAccountRefundWizard.Value(mRecord.AllowAccountRefundWizard);
    C.chkAllowAccountWithdrawalWizard.Value(mRecord.AllowAccountWithdrawalWizard);
    C.chkAllowAccountCloseWizard.Value(mRecord.AllowAccountCloseWizard);
    C.chkAllowBankTransactionsAnyElementType.Value(mRecord.AllowBankTransactionsAnyElementType);
    C.chkEnterBatchTotal.Value(mRecord.EnterBatchTotal);
    C.chkAllowPartialCommit.Value(mRecord.AllowPartialCommit);    
    C.chkPrintReceipt.Value(mRecord.PrintReceipt);
    
    // Defaults
    C.cboTransactionReference.Text(mRecord.TransactionReference);
    C.numTransactionValue.Value(mRecord.TransactionValue);
    C.txtTransactionNotes.Text(mRecord.TransactionNotes);
    C.cboDefaultBankAccountId.Text(mRecord.DefaultBankAccountId);
    C.cboNextBatchId.Text(mRecord.NextBatchId);
    
    // Account Types
    C.chkAllowAllAccountTypes.Value(mRecord.AllowAllAccountTypes);
    
    // Permission
    C.cboPermissionKeyOpen.Text(mRecord.PermissionKeyOpen);
    C.cboPermissionKeyCommit.Text(mRecord.PermissionKeyCommit);
  }

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

  // Update Controls  
  cboElementId_Change();
  chkAllowTransactionEntry_Change();
  chkAllowAllAccountTypes_Change();

  // Update fields
  Fields_Update();

  // Refresh Tab
  tabDetails_Refresh();
  tabDetails_Resize();
}

// ===========
// Save Fields
// ===========
function Fields_Save() {
  // General
  mRecord.TransactionTypeId = C.txtTransactionTypeId.Text();
  mRecord.Active = C.chkActive.Value();
  mRecord.Description = C.txtDescription.Text();
  mRecord.ElementId = C.cboElementId.Text();
  mRecord.Notes = C.txtNotes.Text();

  // Other
  mRecord.AllowTransactionEntry = C.chkAllowTransactionEntry.Value();
  mRecord.AllowTransactionEntrySingle = C.chkAllowTransactionEntrySingle.Value();
  mRecord.CreditInterest = C.chkCreditInterest.Value();
  mRecord.CreditInterestDefaultAutoPostWithholdingTax = C.chkCreditInterestDefaultAutoPostWithholdingTax.Value();
  mRecord.CreditInterestAllowAutoPostWithholdingTax = C.chkCreditInterestAllowAutoPostWithholdingTax.Value();
  mRecord.ShowElementColumn = C.chkShowElementColumn.Value();
  mRecord.AllowDisbursementEntry = C.chkAllowDisbursementEntry.Value();
  mRecord.AllowBankTransactions = C.chkAllowBankTransactions.Value();
  mRecord.AllowBankEntry = C.chkAllowBankEntry.Value();
  mRecord.AllowAccountPaymentWizard = C.chkAllowAccountPaymentWizard.Value();
  mRecord.AllowAccountRefundWizard = C.chkAllowAccountRefundWizard.Value();
  mRecord.AllowAccountWithdrawalWizard = C.chkAllowAccountWithdrawalWizard.Value();
  mRecord.AllowAccountCloseWizard = C.chkAllowAccountCloseWizard.Value();
  mRecord.AllowBankTransactionsAnyElementType = C.chkAllowBankTransactionsAnyElementType.Value();
  mRecord.EnterBatchTotal = C.chkEnterBatchTotal.Value();
  mRecord.AllowPartialCommit = C.chkAllowPartialCommit.Value();    
  mRecord.PrintReceipt = C.chkPrintReceipt.Value();
  
  // Defaults
  mRecord.TransactionReference = C.cboTransactionReference.Text();
  mRecord.TransactionValue = C.numTransactionValue.Value();
  mRecord.TransactionNotes = C.txtTransactionNotes.Text();
  mRecord.DefaultBankAccountId = C.cboDefaultBankAccountId.Text();
  mRecord.NextBatchId = C.cboNextBatchId.Text();
  
  // Account Types
  mRecord.AllowAllAccountTypes = C.chkAllowAllAccountTypes.Value();
  
  // Permission
  mRecord.PermissionKeyOpen = C.cboPermissionKeyOpen.Text();
  mRecord.PermissionKeyCommit = C.cboPermissionKeyCommit.Text();
}

// =============
// Update Fields
// =============
function Fields_Update() {
  // Heading
  if (mRecord) {
    if (mRecord.Pk) {
      widget.SetHeading("Transaction Type (" + mRecord.TransactionTypeId + ")");
    }
    else {
      widget.SetHeading("New Transaction Type");
    }
  }

  // Lists
  if (mRecord) {
    // General
    C.cboElementId.RefreshFromStandardRange("Elements", mRecord.ElementListSQLWhere);
    
    // Defaults
    C.cboDefaultBankAccountId.RefreshFromStandardRange("BankAccounts", "", false, mRecord.DefaultBankAccountId);
    
    // Permission
    C.cboPermissionKeyOpen.ListFromCsvString(mRecord.PermissionKeyListCsv);
    C.cboPermissionKeyCommit.ListFromCsvString(mRecord.PermissionKeyListCsv);
  }

  // Controls
  if (mRecord) {
  }

  // Pages
  if (mRecord) {
    // NOTE: Even though many pages are updated in tabDetails_Refresh, we must update them here to ensure controls are hidden since this is not a wizard and all pages are validated on "Finish"
    pageGeneral_Refresh();
    pageOther_Refresh();
    pageDefaults_Refresh();
  }

  // Read-Only?
  if (mRecord &amp;&amp; mRecord.ReadOnly) {
    cmdFinish.prop("disabled", true);
    frmMain.FormReadOnly(C, true);
  }

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

  // Resize Tab
  tabDetails_Resize();
}

// ===========
// Resize Form
// ===========
function Form_Resize() {
  // Mobile Optimisations
  var el = $(".mobile-indent th.indent1, .mobile-indent th.no-indent1");
  if (window.innerWidth &lt; 500) {
    el.addClass("no-indent1").removeClass("indent1");
  }
  else {
    el.addClass("indent1").removeClass("no-indent1");
  }

  // General

  // Tab
  tabDetails_Resize();
}

// ========
// Is Dirty
// ========
function Form_IsDirty() {
  if (mRecord) {
    // Save Fields
    Fields_Save();

    // Is Dirty?
    return mOriginalJson != JSON.stringify(mRecord);
  }
  else {
    return false;
  }
}

// ==============
// Wizard Buttons
// ==============
function tabDetails_Cancel() {
  if (Form_IsDirty()) {
    // Confirm
    widget.UI.MsgBoxConfirm("Are you sure you want to close this form without saving your changes?", { heading: "Close Form" }, tabDetails_Cancel_Finalise);
  }
  else {
    // Cancel immediately
    tabDetails_Cancel_Finalise();
  }
}

function tabDetails_Cancel_Finalise() {
  if (widget.CanClose()) {
    widget.Close();
  }
  else {
    widget.Reset();
  }
}

// ==========
// Resize Tab
// ==========
function tabDetails_Resize() {
  switch (tabDetails.SelectedTabId()) {
    case "General":
      // General
      C.txtDescription.WidthResizeFromParent();
      C.txtNotes.ResizeFromParent();
      break;

    case "Other":
      // Other
      break;
      
    case "Defaults":
      // Defaults
      C.cboTransactionReference.WidthResizeFromParent();
      C.txtTransactionNotes.WidthResizeFromParent();
      C.cboDefaultBankAccountId.WidthResizeFromParent();
      C.cboNextBatchId.WidthResizeFromParent();
      break;
      
    case "Permission":
      C.cboPermissionKeyOpen.WidthResizeFromParent();
      C.cboPermissionKeyCommit.WidthResizeFromParent();
      break;
  }
}

// ===========
// Refresh Tab
// ===========
function tabDetails_Refresh() {
   // Load details
  switch (tabDetails.SelectedTabId()) {
    case "General":
      pageGeneral_Refresh();
      break;

    case "Other":
      pageOther_Refresh();
      break;

    case "Defaults":
      pageDefaults_Refresh();
      break;

    case "AccountTypes":
      pageAccountTypes_Refresh();
      break;

    default:
      break;
  }

  // Resize
  tabDetails_Resize();

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

// =================
// Execute an Action
// =================
function Form_ExecuteAction(actionId, data) {
  switch(actionId) {
    default:
      window.alert("Unhandled action '" + actionId + "'");
  }
}

// =============
// Finish Action
// =============
function Form_ExecuteAction_Finish() {
  // Assume Success
  var Ok = true;

  // Validate
  Ok = tabDetails.Validate();

  // Prompt
  if (Ok) {
    if (mRecord.PromptOnSave) {
      // Confirm
      widget.UI.MsgBoxConfirm("Are you sure you want to save this record?",
                              { heading: "Save" },
                              Form_ExecuteAction_FinishPost);

    }
    else {
      // Save without prompting
      Form_ExecuteAction_FinishPost();
    }
  }
}

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

  // Create Parameters
  // NOTE: We will simply update mRecord, clone this and send back (less some information)
  Fields_Save();
  var params = JSON.parse(JSON.stringify(mRecord));

  // Finish
  widget.GetString("Finish", params,
    function (data) {
      // Close Form
      widget.Close();

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

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

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

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

  // Controls
}

// =========
// pageOther
// =========
function pageOther_Refresh() {
  if (!mRecord) return;

  // Hide Controls
  C.chkAllowTransactionEntry.VisibleRow(false);
  C.chkCreditInterest.VisibleRow(false);
  C.chkCreditInterestDefaultAutoPostWithholdingTax.VisibleRow(false);
  C.chkCreditInterestAllowAutoPostWithholdingTax.VisibleRow(false);
  C.chkShowElementColumn.VisibleRow(false);
  C.chkAllowDisbursementEntry.VisibleRow(false);
  C.chkAllowTransactionEntrySingle.VisibleRow(false);
  C.chkAllowBankTransactions.VisibleRow(false);
  C.chkAllowBankEntry.VisibleRow(false);
  C.chkAllowAccountPaymentWizard.VisibleRow(false);
  C.chkAllowAccountRefundWizard.VisibleRow(false);
  C.chkAllowAccountWithdrawalWizard.VisibleRow(false);
  C.chkAllowAccountCloseWizard.VisibleRow(false);
  C.chkAllowBankTransactionsAnyElementType.VisibleRow(false);

  // Read-only Controls (may be some overlap with hiding rows above, this is intentional)
  C.chkCreditInterest.ReadOnly(true);
  C.chkCreditInterestDefaultAutoPostWithholdingTax.ReadOnly(true);
  C.chkCreditInterestAllowAutoPostWithholdingTax.ReadOnly(true);
  C.chkShowElementColumn.ReadOnly(true);
  C.chkAllowDisbursementEntry.ReadOnly(true);
  C.chkAllowBankEntry.ReadOnly(true);
  C.chkAllowAccountPaymentWizard.ReadOnly(true);
  C.chkAllowAccountRefundWizard.ReadOnly(true);
  C.chkAllowAccountWithdrawalWizard.ReadOnly(true);
  C.chkAllowAccountCloseWizard.ReadOnly(true);
  C.chkAllowBankTransactionsAnyElementType.ReadOnly(true);

  // Element Types
  var AllowTransactionEntry = false;
  var AllowBankTransactions = false;
  var ElementTypeIsInterest = false;
  
  if (mElement) {
    AllowTransactionEntry = true;
    
    switch (mElement.ElementType) {
      case "Interest":
        ElementTypeIsInterest = true;
        break;
        
      case "Investment":
      case "InvestmentAdditional":
      case "PaymentReceived":
      case "Refund":
      case "Withdrawal":
        AllowBankTransactions = true;
        break;
    }
  }
  
  // Controls
  // Transaction Entry
  if (AllowTransactionEntry) {
    C.chkAllowTransactionEntry.VisibleRow(true);
    C.chkAllowTransactionEntrySingle.VisibleRow(true);
    C.chkShowElementColumn.VisibleRow(true);    
    if (mRecord.AddonsDisbursements) C.chkAllowDisbursementEntry.VisibleRow(true);
  
    // Interest Element Type
    if (mRecord.AddonsDepositAccount &amp;&amp; ElementTypeIsInterest) {
      C.chkCreditInterest.VisibleRow(true);
      C.chkCreditInterestDefaultAutoPostWithholdingTax.VisibleRow(true);
      C.chkCreditInterestAllowAutoPostWithholdingTax.VisibleRow(true);
    }
  
    if (C.chkAllowTransactionEntry.Value()) {
      C.chkCreditInterest.ReadOnly(false);
      C.chkShowElementColumn.ReadOnly(false);
      C.chkAllowDisbursementEntry.ReadOnly(false);
      
      // Interest Element Type
      if (ElementTypeIsInterest &amp;&amp; C.chkCreditInterest.Value() &amp;&amp; C.chkCreditInterest.Value()) {        
        C.chkCreditInterestDefaultAutoPostWithholdingTax.ReadOnly(false);
        C.chkCreditInterestAllowAutoPostWithholdingTax.ReadOnly(false);
      }              
    }
  }  
  
  // Bank Transactions Allowed
  if (AllowBankTransactions) {
    C.chkAllowBankTransactions.VisibleRow(true);
    C.chkAllowBankEntry.VisibleRow(true);
    C.chkAllowBankTransactionsAnyElementType.VisibleRow(true);
    
    switch (mElement.ElementType) {
      case "Investment":
      case "InvestmentAdditional":
        C.chkAllowAccountPaymentWizard.VisibleRow(true);
        break;
        
      case "PaymentReceived":
        C.chkAllowAccountPaymentWizard.VisibleRow(true);
        C.chkAllowAccountCloseWizard.VisibleRow(true);
        break;
        
      case "Refund":
        C.chkAllowAccountRefundWizard.VisibleRow(true);
        C.chkAllowAccountCloseWizard.VisibleRow(true);
        break;
        
      case "Withdrawal":
        C.chkAllowAccountWithdrawalWizard.VisibleRow(true);
        C.chkAllowAccountCloseWizard.VisibleRow(true);
        break;
    }
    
    if (C.chkAllowBankTransactions.Value()) {
      C.chkAllowBankEntry.ReadOnly(false);
      C.chkAllowAccountPaymentWizard.ReadOnly(false);
      C.chkAllowAccountRefundWizard.ReadOnly(false);
      C.chkAllowAccountWithdrawalWizard.ReadOnly(false);
      C.chkAllowAccountCloseWizard.ReadOnly(false);
      C.chkAllowBankTransactionsAnyElementType.ReadOnly(false);
    }
  }
}

// ============
// pageDefaults
// ============
function pageDefaults_Refresh() {
  if (mElement) {
    // Reset controls
    C.numTransactionValue.VisibleRow(false);
    
    // Show Controls based upon Element Type
    switch (mElement.ElementType) {
      case "Investment":
      case "InvestmentAdditional":
      case "PaymentReceived":
        // numTransactionValue remains hidden
        break;
        
      default:
        C.numTransactionValue.VisibleRow(true);
        break;
    }
  }
}

// ================
// pageAccountTypes
// ================
function pageAccountTypes_Refresh() {
  // Refresh Grid
  gridAccountTypes_Refresh();
}

// ============
// cboElementId
// ============
function cboElementId_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  // Get Client Group
  mElement = mRecord.Elements.GetItem(C.cboElementId.Text());
  
  // Update Controls
  if (e &amp;&amp; mElement) {
    switch (mElement.ElementType) {
      case "Investment":
      case "InvestmentAdditional":
        C.chkAllowTransactionEntry.Value(false);
        C.chkAllowTransactionEntrySingle.Value(false);
        C.chkAllowBankTransactions.Value(true);
        C.chkAllowBankEntry.Value(true);
        C.chkAllowAccountPaymentWizard.Value(false);
        C.chkAllowAccountRefundWizard.Value(false);
        C.chkAllowAccountWithdrawalWizard.Value(false);
        C.chkAllowAccountCloseWizard.Value(false);
        break;
        
      case "PaymentReceived":
        C.chkAllowTransactionEntry.Value(false);
        C.chkAllowTransactionEntrySingle.Value(false);
        C.chkAllowBankTransactions.Value(true);
        C.chkAllowBankEntry.Value(true);
        C.chkAllowAccountPaymentWizard.Value(true);
        C.chkAllowAccountRefundWizard.Value(false);
        C.chkAllowAccountWithdrawalWizard.Value(false);
        C.chkAllowAccountCloseWizard.Value(true);
        break;
        
      case "Refund":
        C.chkAllowTransactionEntry.Value(false);
        C.chkAllowTransactionEntrySingle.Value(false);
        C.chkAllowBankTransactions.Value(true);
        C.chkAllowBankEntry.Value(true);
        C.chkAllowAccountPaymentWizard.Value(false);
        C.chkAllowAccountRefundWizard.Value(true);
        C.chkAllowAccountWithdrawalWizard.Value(false);
        C.chkAllowAccountCloseWizard.Value(true);
        break;
        
      case "Withdrawal":
        C.chkAllowTransactionEntry.Value(false);
        C.chkAllowTransactionEntrySingle.Value(false);
        C.chkAllowBankTransactions.Value(true);
        C.chkAllowBankEntry.Value(true);
        C.chkAllowAccountPaymentWizard.Value(false);
        C.chkAllowAccountRefundWizard.Value(false);
        C.chkAllowAccountWithdrawalWizard.Value(false);
        C.chkAllowAccountCloseWizard.Value(mRecord &amp;&amp; mRecord.AddonsDepositAccount);
        break;
        
      default:
        C.chkAllowTransactionEntry.Value(false);
        C.chkAllowTransactionEntrySingle.Value(false);
        break;
    }
  }
}

// ========================
// chkAllowBankTransactions
// ========================
function chkAllowBankTransactions_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  // Update Controls
  pageOther_Refresh();
}

// ========================
// chkAllowTransactionEntry
// ========================
function chkAllowTransactionEntry_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  // Update Controls
  pageOther_Refresh();
}

// =================
// chkCreditInterest
// =================
function chkCreditInterest_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  // Update Controls
  pageOther_Refresh();
}

// =======================
// chkAllowAllAccountTypes
// =======================
function chkAllowAllAccountTypes_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  // Update Controls
  C.gridAccountTypes.Visible(!C.chkAllowAllAccountTypes.Value());  
}

// ================
// gridAccountTypes
// ================
function gridAccountTypes_Refresh() {
  // Add Columns
  C.gridAccountTypes.ClearColumns();
  C.gridAccountTypes.AddColumnBoolean("Available", { caption: "Available", allowEdit: !mRecord.ReadOnly });
  C.gridAccountTypes.AddColumnBoolean("Active", { caption: "Active" });
  C.gridAccountTypes.AddColumnCode("AccountTypeId", { caption: "Account Type", width: "10em" });
  C.gridAccountTypes.AddColumnString("Description", { caption: "Description" });

  // Actions
  if (!mRecord.ReadOnly) {
    C.gridAccountTypes.Actions().Define([{ actionId: "SelectAll", tooltipText:"Select all valid rows", icon: "Select_All" },
                                         { actionId: "SelectNone", tooltipText:"Select no rows", icon: "Select_None" },
                                         { actionId: "SelectUp", tooltipText:"Select all rows above and including the current row", icon: "Select_Up" },
                                         { actionId: "SelectDown", tooltipText:"Select all rows below and including the current row", icon: "Select_Down" },                                         
                                         {},
                                         { actionId: "Check", tooltipText: "Check selected row(s)", icon: "Checkbox_Checked" },
                                         { actionId: "Uncheck", tooltipText: "Uncheck selected row(s)", icon: "Checkbox_Unchecked" }
                                        ]);
  }

  // Refresh
  C.gridAccountTypes.VirtualDataRefresh(mRecord.AccountTypes);

  // Activate First Row
  C.gridAccountTypes.ActivateFirstDataRow();
}

function gridAccountTypes_InitialiseRow(e) {
  var item = mRecord.AccountTypes[e.row.listIndex];
  
  // Update cells
  e.row.AutoBind(item);
  
  // Styling
  e.row.cells.Available.readOnly = mRecord.ReadOnly;
  e.row.cells.Active.readOnly = true;
  e.row.cells.AccountTypeId.readOnly = true;
  e.row.cells.Description.readOnly = true;
  
  // Hyperlinks
  e.row.cells.AccountTypeId.hyperlink = "app://FormShow?form=AccountTypes&amp;id=" + widget.UI.HtmlEncode(item.AccountTypeId);
}

function gridAccountTypes_Action(actionId) {
  switch (actionId.toUpperCase()) {
    case "SELECTUP":
    case "SELECTDOWN":
      var activeRowIndex = C.gridAccountTypes.ActiveDataRowListIndex();
      var indexes = [];

      for(var i = 0; i &lt; mRecord.AccountTypes.length; i++) {        
        if(actionId.toUpperCase() == "SELECTUP" &amp;&amp; i &lt;= activeRowIndex) {
          indexes.push(i);
        }
        else if(actionId.toUpperCase() == "SELECTDOWN" &amp;&amp; i &gt;= activeRowIndex) {
          indexes.push(i);
        }
      }
      C.gridAccountTypes.SetSelectedRowIndexes(indexes, true);
      break;

    case "SELECTALL":
      var indexes = [];
      for(var i = 0; i &lt; mRecord.AccountTypes.length; i++) {
        indexes.push(i);
      }
      C.gridAccountTypes.SetSelectedRowIndexes(indexes, true);
      break;

    case "SELECTNONE":
      C.gridAccountTypes.SetSelectedRowIndexes([], true);
      break;

    case "SELECTGROUP":
      var i = C.gridAccountTypes.ActiveDataRowListIndex();
      
      if (i != -1) {
        var item = mRecord.AccountTypes[i];
        
        if (item.RoleType) {
          var indexes = [];
          
          for(var j = 0; j &lt; mRecord.AccountTypes.length; j++) {        
            var item2 = mRecord.AccountTypes[j];
            
            if (item2.RoleType == item.RoleType) indexes.push(j);
          }          
          C.gridAccountTypes.SetSelectedRowIndexes(indexes, true);
        }
      }
      break;

    case "CHECK":
    case "UNCHECK":
      var selectedItems = C.gridAccountTypes.GetSelectedRowIndexes(true, true);

      for(var i = 0; i &lt; selectedItems.length; i++) {
        var item = mRecord.AccountTypes[selectedItems[i]];
        item.Available = (actionId.toUpperCase() == "CHECK")
      }
      C.gridAccountTypes.VirtualDataRefresh(mRecord.AccountTypes, true, { retainSelectedRows: true });
      break;
  }
}

function gridAccountTypes_BeforeCellUpdate(e) {
  var item = mRecord.AccountTypes[e.row.listIndex];
  
  switch(e.columnKey) {      
    case "Available":
      item.Available = e.newValue;
      break;
  }
}

// ====================
// Notification Handler
// ====================
function Widget_NotificationHandler(actionId, data) {
   switch(actionId) {
     case "FormClose":
      // Form Close button is disabled so act as if 'Cancel' has been clicked
      tabDetails_Cancel();
      break;
   }
}
&lt;/script&gt;</TemplateText>
    <TemplateTextBookmarks />
    <TimeoutSeconds>60</TimeoutSeconds>
    <UniqueId>wTAyxOcWk0izLN86NxXONg</UniqueId>
    <AllowRefresh>true</AllowRefresh>
    <Caption>Transaction Type</Caption>
    <HtmlWidgetAllowInitialEventCaching>false</HtmlWidgetAllowInitialEventCaching>
    <HtmlWidgetMaxHeight>800</HtmlWidgetMaxHeight>
    <HtmlWidgetMaxWidth>800</HtmlWidgetMaxWidth>
    <HtmlWidgetNeverApplyStyling>false</HtmlWidgetNeverApplyStyling>
    <HtmlWidgetResourceChartsApex>false</HtmlWidgetResourceChartsApex>
    <HtmlWidgetResourceCssSummaryPage2>false</HtmlWidgetResourceCssSummaryPage2>
    <HtmlWidgetResourceCssWidget>true</HtmlWidgetResourceCssWidget>
    <HtmlWidgetResourceJQuery>true</HtmlWidgetResourceJQuery>
    <HtmlWidgetResourceJQueryVersion />
    <HtmlWidgetSpecialEventGetFolderCount>false</HtmlWidgetSpecialEventGetFolderCount>
    <Icon>TransactionType</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>Form options.</Caption>
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <SectionColumns>1</SectionColumns>
            <Visible>true</Visible>
          </Parameter>
          <Parameter name="HideOtherPages" type="Boolean">
            <BlankTip />
            <Caption>Hide pages other than the one being edited?</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>True</Value>
            <Visible>true</Visible>
          </Parameter>
          <Parameter name="" type="SectionStart">
            <BlankTip />
            <Caption>Configuration options.</Caption>
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <SectionColumns>1</SectionColumns>
            <Visible>true</Visible>
          </Parameter>
          <Parameter name="" type="SectionStart">
            <BlankTip />
            <Caption>TESTING</Caption>
            <StandaloneOnly>false</StandaloneOnly>
            <TooltipText />
            <SectionColumns>1</SectionColumns>
            <Visible>true</Visible>
          </Parameter>
          <Parameter name="TransactionTypeId" type="Range">
            <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>
            <LimitToList>false</LimitToList>
            <MaxLength>10</MaxLength>
            <RangeSingle>true</RangeSingle>
            <RangeType>Standard</RangeType>
            <RangeLookupSource>TransactionTypes</RangeLookupSource>
            <RangeLookupSqlWhere />
          </Parameter>
          <Parameter name="ElementId" type="Range">
            <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>
            <LimitToList>false</LimitToList>
            <MaxLength>10</MaxLength>
            <RangeSingle>true</RangeSingle>
            <RangeType>Standard</RangeType>
            <RangeLookupSource>Elements</RangeLookupSource>
            <RangeLookupSqlWhere />
          </Parameter>
          <Parameter name="DuplicateRecordId" 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.TransactionTypes</List>
            <LimitToList>false</LimitToList>
            <MaxLength>0</MaxLength>
            <Rows>1</Rows>
          </Parameter>
          <Parameter name="Page" 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>General,Other,Defaults,AccountTypes,Permission</List>
            <LimitToList>false</LimitToList>
            <MaxLength>0</MaxLength>
            <Rows>1</Rows>
          </Parameter>
          <Parameter name="ReadOnly" 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>