<?xml version="1.0" encoding="utf-8"?>
  <finScript version="1.00" exportedUtcDate="2025-11-24T22:18:05.0000000">
    <CreatedUserId>ADMIN</CreatedUserId>
    <CreatedUtcDate>2025-09-01T03:36:16.2970000</CreatedUtcDate>
    <UpdatedUserId>ADMIN</UpdatedUserId>
    <UpdatedUtcDate>2025-11-24T21:54:03.0670000</UpdatedUtcDate>
    <ScriptId>HWBAE</ScriptId>
    <Description>Bank Account Edit</Description>
    <ScriptType>HtmlWidget</ScriptType>
    <Active>true</Active>
    <AllowUI>false</AllowUI>
    <Bookmarks />
    <Category />
    <Code>' HtmlWidget_BankAccountEdit
Option Explicit On
Option Strict On

' #################################################################
' Bank Account Edit form HTML Widget
' 
' (c) Copyright Intersoft Systems Limited 2025
' 
' Version: 1.02 (25/11/2025)
' 
' Usage: Location that this Script is used
' #################################################################
' Version        Date  User     Job       Description
' -------  ----------  -------  --------  -------------------------
'    1.00  13/11/2024  ISS      J031331   Created
'    1.01  28/01/2025  ISS      J035004   Ezidebit support
'    1.02  02/09/2025  ISS      J035934   Changes for finPOWER Connect Cloud
'          25/11/2025  ISS      J036255   Monoova support
' #################################################################

' Constants
Private Const FORM_KEY As String = "BankAccounts"

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

' Standard Parameters
Private mBankAccountId 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
    mBankAccountId = .GetString("BankAccountId") ' Always use Startup Parameters since the Branch Id may be updated
  End With
  With mCombinedParameters
    mDuplicateRecordId = .GetString("DuplicateRecordId")
    mPage = .GetString("Page")
    mReadOnly = .GetBoolean("ReadOnly")
  End With
  
  ' Validate
  Main = finBL.HtmlWidgetUtilities.HasPermissionToViewFormKey(FORM_KEY)

  ' Handle Events
  Select Case eventId
    Case ""
      ' Main event, i.e., return initial HTML content (excluding html and body tags)
      returnValue = ScriptInfo.TemplateText
      
    Case "AccountNumberValidate"
      ' Validation for the Account Number Control
      Main = AccountNumberValidate(returnValue)
      
    Case "AccountSortCodeValidate"
      ' Validation for the Account Sort Code
      Main = AccountSortCodeValidate(returnValue)
      
    Case "Finish"
      ' Finish Wizard
      Main = Finish(parametersJson, requestInfo, returnValue)
      
    Case "GetInitialisationInfo"
      ' Get Initialisation Information required for this wizard
      Main = GetInitialisationInfo(returnValue)
      
    Case "WizardValidate"
      ' Validate page
      Main = WizardValidate(parametersJson, returnValue)
      
    Case "ZeptoBankAccountRefresh"
      ' Zepto (Split) Bank Account Refresh
      Main = ZeptoBankAccountRefresh(returnValue)
      
    Case Else
      Main = False
      finBL.Error.ErrorBeginFormat("Unhandled event '{0}'", eventId)

  End Select

End Function

Public Function AccountNumberValidate(ByRef returnValue As String) As Boolean
        
  Dim AccountNumber As String               
  Dim BankBranchName As String  
  Dim BankingDetails As finBankingDetails
  Dim BankName As String
  Dim BankNameShort As String
  Dim obj As Object
  Dim ShowPrompt As Boolean
  Dim strTemp As String
  Dim Success As Boolean
  
  ' Assume Success
  Success = True
  
  ' Initialise
  ShowPrompt = False
  
  ' Unpack
  With mCombinedParameters
    AccountNumber = .GetString("AccountNumber")
    BankNameShort = .GetString("BankNameShort")
  End With
  
  ' Basic Validation
  If Success Then
    If Len(AccountNumber) = 0 Then
      finBL.Error.ErrorBegin("Account Number cannot be blank.")
      Success = False
    End If
  End If
  
  ' Validate using the Banking Details
  If Success Then
    ' Initialise Banking Details
    BankingDetails = finBL.CreateBankingDetails()    
    With BankingDetails
      .PaymentTypePk = finBL.PaymentTypes(isePaymentTypeClass.BankAccount.ToString()).Pk
      .AccountNumber = AccountNumber

      If finBL.CurrentCountry.ValidateBankAccount(BankingDetails, strTemp) Then
        AccountNumber = .AccountNumber
        
        ' Validate Bank Name
        If finBL.CurrentCountry.ValidateBankBranch(BankingDetails, strTemp) Then
          If Len(.BankNameShort) &lt;&gt; 0 AndAlso BankNameShort &lt;&gt; .BankNameShort Then
            BankNameShort = .BankNameShort
            BankName = .BankName
            BankBranchName = .BankBranchName
            ShowPrompt = True
          End If
        End If
      Else
        finBL.Error.ErrorBegin(strTemp)
        Success = False
      End If
    End With
  End If
  
  If Success Then
    ' Build response
    obj = New With {
      .AccountNumber = AccountNumber,
      .BankBranchName = BankBranchName,
      .BankName = BankName,
      .BankNameShort = BankNameShort,
      .ShowPrompt = ShowPrompt
    }
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(obj, returnValue)
  End If
  
  Return Success

End Function        

Public Function AccountSortCodeValidate(ByRef returnValue As String) As Boolean
  
  Dim BankBranchName As String
  Dim BankingDetails As finBankingDetails
  Dim BankName As String
  Dim BankNameShort As String
  Dim obj As Object
  Dim ShowPrompt As Boolean
  Dim SortCode As String
  Dim strTemp As String
  Dim Success As Boolean
  
  ' Assume Success 
  Success = True
  
  ' Initialise
  ShowPrompt = False
  
  ' Unpack
  With mCombinedParameters
    BankNameShort = .GetString("BankNameShort")
    SortCode = .GetString("SortCode")
  End With
  
  ' Basic Validation
  If Success Then
    If Len(SortCode) = 0 Then
      finBL.Error.ErrorBegin("Sort Code cannot be blank.")
      Success = False
    End If
  End If
  
  ' Validate using the Banking Details
  If Success Then
    ' Initialise Banking Details
    BankingDetails = finBL.CreateBankingDetails()
    With BankingDetails
      .PaymentTypePk = finBL.PaymentTypes(isePaymentTypeClass.BankAccount.ToString()).Pk
      .AccountSortCode = SortCode
      
      If finBL.CurrentCountry.ValidateBankAccountSortCode(BankingDetails, strTemp) Then
        SortCode = .AccountSortCode
        
        ' Validate Bank Name
        If finBL.CurrentCountry.ValidateBankBranch(BankingDetails, strTemp) Then
          If Len(.BankNameShort) &lt;&gt; 0 AndAlso BankNameShort &lt;&gt; .BankNameShort Then
            BankNameShort = .BankNameShort
            BankName = .BankName
            BankBranchName = .BankBranchName
            ShowPrompt = True
          End If
        End If
      Else
        finBL.Error.ErrorBegin(strTemp)
        Success = False
      End If
    End With
  End If
  
  If Success Then
    ' Build Response
    obj = New With {
      .BankBranchName = BankBranchName,
      .BankName = BankName,
      .BankNameShort = BankNameShort,
      .ShowPrompt = ShowPrompt,
      .SortCode = SortCode  
    }
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(obj, returnValue)
  End If
  
  Return Success
  
End Function

Public Function Finish(parametersJson As String,
                       requestInfo As finScriptRequestInfo,
                       ByRef returnValue As String) As Boolean
  
  Dim BankAccount As finBankAccount  
  Dim obj As Object
  Dim Record As FormInitialisationInfo                       
  Dim Success As Boolean
  
  ' 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 the Bank Account
  If Success Then
    Success = GetBankAccount(BankAccount)
  End If
  
  ' Validate
  If Success Then
    If Record.Timestamp &lt;&gt; BankAccount.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 BankAccount
      With BankAccount
        ' General
        If Record.AllowPageGeneral Then
          .BankAccountId = Record.BankAccountId
          
          .Active = Record.Active
          .Description = Record.Description
          
          .BankNameShort = Record.ShortName
          .BankName = Record.BankName
          .BranchName = Record.Branch
          .AccountSortCode = Record.SortCode
          .AccountNumber = Record.AccountNo
          
          .EntityId = Record.EntityId
          .CostCentreId = Record.CostCentreId
          
          .Notes = Record.Notes
        End If
        
        ' Options
        If Record.AllowPageOptions Then
          .CalendarBankingId = Record.CalendarIdBanking
          .CalendarProcessingId = Record.CalendarIdProcessing
          
          .GlAccountId = Record.GLAccountId
          .SuspenseGlAccountId = Record.GLSuspenseId
          
          .AllowDirectDebitsOnAnyDate = Record.AllowDirectDebitsOnAnyDate
          .UseNewDirectDebitsExecute = Record.UseNewDirectDebitsExecute
          .OptionRequireCashRegister = Record.OptionRequireCashRegister
          .OptionRequireCashRegisterOnLodgement = Record.OptionRequireCashRegisterOnLodgement
          .OptionLodgeSuspenseItems = Record.OptionLodgeSuspenseItems
          .OptionRetainDeletedSuspenseItems = Record.OptionRetainDeletedSuspenseItems
          
          .PrintedChequesUse = Record.PrintedChequesUse
          .PrintedChequesDocumentId = Record.PrintedChequesDocumentId
          .PrintedChequesNextChequeNumber = Record.PrintedChequesNextChequeNumber
        End If
        
        ' Ezidebit
        Select Case finBL.CountryCode
          Case "AU", "NZ"
            If Record.AllowPageEzidebit Then
              With .ExportService_Ezidebit
                .EddrAllowBankAccounts = Record.EzidebitEddrAllowBankAccounts
                .EddrAllowCreditCards = Record.EzidebitEddrAllowCreditCards
                .EddrEmailDocumentId = Record.EzidebitEddrEmailDocumentId
                .EddrSmsDocumentId = Record.EzidebitEddrSmsDocumentId                
                .FailLogCreate = Record.EzidebitCreateAccountLog
                .FailLogSubject = Record.EzidebitLogSubject
                .FailLogSeverityId = Record.EzidebitLogSeverityId
                .FailLogDelegatedToRoleId = Record.EzidebitLogDelegatedRoleId
              End With
            End If
        End Select
        
        ' Monoova
        Select Case finBL.CountryCode
          Case "AU"
            If Record.AllowPageMonoova Then
              With .ExportService_Monoova 
                .mAccountNumber = Record.MonoovaAccountNo
                
                .RemitterName = Record.MonoovaRemitterName
                
                .SupportsDirectDebits = Record.MonoovaDirectDebits
                
                .SupportsCreditCards = Record.MonoovaCreditCards
                
                .FailLogCreate = Record.MonoovaCreateAccountLog
                .FailLogSubject = Record.MonoovaLogSubject
                .FailLogSeverityId = Record.MonoovaLogSeverityId
                .FailLogDelegatedToRoleId = Record.MonoovaLogDelegatedRoleId
              End With
            End If            
        End Select

        ' Zepto (Split)
        Select Case finBL.CountryCode
          Case "AU"
            ' Zepto (Split)
            If Record.AllowPageZepto Then
              With .ExportService_Split
                .BankAccountId = Record.SplitBankAccount
                .ValidateContactBeforeSend = Record.SplitValidateContactDetails
                
                .FailLogCreate = Record.SplitCreateAccountLog
                .FailLogSubject = Record.SplitLogSubject
                .FailLogSeverityId = Record.SplitLogSeverityId
                .FailLogDelegatedToRoleId = Record.SplitLogDelegatedRoleId
              End With
            End If            
            
          Case "NZ"
            ' ZeptoNZ (OBSOLETE)
            
        End Select
        
        ' Permission
        If Record.AllowPagePermission Then
          .PermissionKeyAllowUI = Record.PermissionKeyBankAccount
        End If
      End With
      
      ' Save
      If Success Then
        Success = BankAccount.Save()
      End If
    
      ' Commit/ Rollback Transaction
      If Success Then
        ' Commit
        finBL.Database.TransactionCommit()
      Else
        ' Rollback
        finBL.Database.TransactionRollback()
      End If
    End If
  End If
  
  Return Success
  
End Function

''' &lt;summary&gt;
'''  Load the Bank Account.
''' &lt;/summary&gt;
Private Function GetBankAccount(ByRef bankAccount As finBankAccount) As Boolean
  
  Dim Success As Boolean
  
  ' Assume Success
  Success = True
  
  ' Validate
  
  ' Create and Load Bank Account
  If Success Then
    ' Create Bank Account
    bankAccount = finBL.CreateBankAccount()
    
    ' Load Bank Account
    If Len(mDuplicateRecordId) &lt;&gt; 0 Then
      ' New Record (by duplicating existing)
      Success = bankAccount.Load(mDuplicateRecordId)
      If Success Then bankAccount.Duplicate()
    ElseIf Len(mBankAccountId) = 0 Then
      ' New record
    Else
      Success = bankAccount.Load(mBankAccountId)
    End If
  End If
  
  Return Success
  
End Function

Public Function GetInitialisationInfo(ByRef response As String) As Boolean
  
  Dim BankAccount As finBankAccount
  Dim FormInitialisationInfo As FormInitialisationInfo
  Dim Success As Boolean
  
  ' Assume Success
  Success = True
  
  ' Validate
  
  ' Get Bank Account
  If Success Then
    Success = GetBankAccount(BankAccount)
  End If
  
  ' Get Initialisation Info
  If Success Then
    FormInitialisationInfo = New FormInitialisationInfo()
    With FormInitialisationInfo
      ' Form
      .PageId = mPage
      
      ' Special Page Handling
      If Len(.PageId) &lt;&gt; 0 Then
        Select Case UCase(.PageId)
          Case "MONOOVAOPTIONS"
            .PageId = "Monoova"
        End Select
      End If   
      
      If finBL.Database.IsReadOnly OrElse mReadOnly OrElse Not finBL.CurrentUser.Permissions.Allow("Admin.BankAccounts") Then
        .ReadOnly = True
      Else
        .ReadOnly = False
      End If
      
      ' Record
      .Pk = BankAccount.Pk
      .Timestamp = BankAccount.Timestamp
      
      ' Page Permissions
      .AllowPageGeneral = True
      .AllowPageOptions = True
      .AllowPagePermission = True
      
      ' Country specific page Permissions
      Select Case finBL.CountryCode
        Case "AU"
          .AllowPageEzidebit = finBL.BankingInterface.IsServiceUsed(iseBankInterfaceService.Ezidebit)
          .AllowPageMonoova = finBL.BankingInterface.IsServiceUsed(iseBankInterfaceService.Monoova)
          .AllowPageZepto = finBL.BankingInterface.IsServiceUsed(iseBankInterfaceService.Split)
          
        Case "NZ"
          .AllowPageEzidebit = finBL.BankingInterface.IsServiceUsed(iseBankInterfaceService.Ezidebit)
          .AllowPageMonoova = False
          ' Zepto NZ nolonger exists
          .AllowPageZepto = False
          
        Case Else
          .AllowPageEzidebit = False
          .AllowPageMonoova = False
          .AllowPageZepto = False
          
      End Select
      
      ' General
      .BankAccountId = BankAccount.BankAccountId ' Always need to return the Bank Account Id
      If .AllowPageGeneral Then
        .Active = BankAccount.Active
        .Description = BankAccount.Description
        
        .ShortName = BankAccount.BankNameShort
        .BankName = BankAccount.BankName
        .Branch = BankAccount.BranchName
        .SortCode = BankAccount.AccountSortCode
        .AccountNo = BankAccount.AccountNumber
        
        .EntityId = BankAccount.EntityId
        .CostCentreId = BankAccount.CostCentreId
        
        .Notes = BankAccount.Notes
      End If
      
      ' Options
      If .AllowPageOptions Then
        .CalendarIdBanking = BankAccount.CalendarBankingId
        .CalendarIdProcessing = BankAccount.CalendarProcessingId
        
        .GLAccountId = BankAccount.GlAccountId
        .GLSuspenseId = BankAccount.SuspenseGlAccountId
        
        .AllowDirectDebitsOnAnyDate = BankAccount.AllowDirectDebitsOnAnyDate
        .UseNewDirectDebitsExecute = BankAccount.UseNewDirectDebitsExecute
        .OptionRequireCashRegister = BankAccount.OptionRequireCashRegister
        .OptionRequireCashRegisterOnLodgement = BankAccount.OptionRequireCashRegisterOnLodgement
        .OptionLodgeSuspenseItems = BankAccount.OptionLodgeSuspenseItems
        .OptionRetainDeletedSuspenseItems = BankAccount.OptionRetainDeletedSuspenseItems
        
        .PrintedChequesUse = BankAccount.PrintedChequesUse
        .PrintedChequesDocumentId = BankAccount.PrintedChequesDocumentId
        .PrintedChequesNextChequeNumber = BankAccount.PrintedChequesNextChequeNumber
      End If
      
      ' Ezidebit
      If .AllowPageEzidebit Then
        .EzidebitEddrAllowBankAccounts = BankAccount.ExportService_Ezidebit.EddrAllowBankAccounts
        .EzidebitEddrAllowCreditCards = BankAccount.ExportService_Ezidebit.EddrAllowCreditCards
        .EzidebitEddrEmailDocumentId = BankAccount.ExportService_Ezidebit.EddrEmailDocumentId
        .EzidebitEddrEmailDocumentFilter = finBL.HtmlWidgetUtilities.EncryptSql(finBL.Documents.GetDataViewFilter(True, isefinDocumentType.Client, False, False, True, "Bank Interface eDDR", True, True, False, iseDocumentFileType.ActiveReportsRpx))
        .EzidebitEddrSmsDocumentId = BankAccount.ExportService_Ezidebit.EddrSmsDocumentId        
        .EzidebitEddrSmsDocumentFilter = finBL.HtmlWidgetUtilities.EncryptSql(finBL.Documents.GetDataViewFilter(True, isefinDocumentType.Client, False, False, True, "Bank Interface eDDR", True, True, False, iseDocumentFileType.ActiveReportsRpx))
        .EzidebitCreateAccountLog = BankAccount.ExportService_Ezidebit.FailLogCreate
        .EzidebitLogSubject = BankAccount.ExportService_Ezidebit.FailLogSubject
        .EzidebitLogSeverityId = BankAccount.ExportService_Ezidebit.FailLogSeverityId
        .EzidebitLogDelegatedRoleId = BankAccount.ExportService_Ezidebit.FailLogDelegatedToRoleId
      End If
      
      ' Monoova
      If .AllowPageMonoova Then
        .MonoovaAccountNo = BankAccount.ExportService_Monoova.mAccountNumber
        
        .MonoovaRemitterName = BankAccount.ExportService_Monoova.RemitterName
        
        .MonoovaDirectDebits = BankAccount.ExportService_Monoova.SupportsDirectDebits
        
        .MonoovaCreditCards = BankAccount.ExportService_Monoova.SupportsCreditCards
        
        .MonoovaCreateAccountLog = BankAccount.ExportService_Monoova.FailLogCreate
        .MonoovaLogSubject = BankAccount.ExportService_Monoova.FailLogSubject
        .MonoovaLogSeverityId = BankAccount.ExportService_Monoova.FailLogSeverityId
        .MonoovaLogDelegatedRoleId = BankAccount.ExportService_Monoova.FailLogDelegatedToRoleId
      End If
      
      ' Zepto (Split)
      If .AllowPageZepto Then
        .SplitBankAccount = BankAccount.ExportService_Split.BankAccountId
        .SplitValidateContactDetails = BankAccount.ExportService_Split.ValidateContactBeforeSend
        
        .SplitCreateAccountLog = BankAccount.ExportService_Split.FailLogCreate
        .SplitLogSubject = BankAccount.ExportService_Split.FailLogSubject
        .SplitLogSeverityId = BankAccount.ExportService_Split.FailLogSeverityId
        .SplitLogDelegatedRoleId = BankAccount.ExportService_Split.FailLogDelegatedToRoleId
      End If
        
      ' Permission
      If .AllowPagePermission Then
        .PermissionKeyBankAccount = BankAccount.PermissionKeyAllowUI
      End If
      
      ' Lists
      
      ' Currently cannot use the widget.UI.InformationListComboBox since it doesn't have a method for getting the description.
      ' Instead converting it to a code Description List - since DBCombo does have a method for getting the description.
      .List_BankShortNames = finBL.InformationLists("BankShortNames").GetCodeDescriptionList()
      
      ' List Filters
      .ChequeDocumentFilter = finBL.HtmlWidgetUtilities.EncryptSql(finBL.Documents.GetDataViewFilter(True, isefinDocumentType.Cheque, False, False, False, Nothing, False, False, False, iseDocumentFileType.WordDocument))
      
      ' Terminology
      .Terminology_Cheque = finBL.CurrentCountry.Terminology(isefinCountryTerminology.Cheque)
      .Terminology_SortCode = finBL.CurrentCountry.Terminology(isefinCountryTerminology.BankSortCode, True)
      
      ' Configuration
      .AddOnCostCentre = finBL.Settings.AddOns.CostCentre      
      .AddOnEntity = finBL.Settings.AddOns.Entity
      .HideOtherPages = mCombinedParameters.GetBoolean("HideOtherPages", False)
      .PromptOnSave = finBL.CloudConnectFunctions.CloudConnectSettings.PromptOnSave
      .ShowSortCode = finBL.CurrentCountry.SupportsBankSortCode
      If finBL.CurrentCountry.Terminology(isefinCountryTerminology.BankSortCode, True) &lt;&gt; finBL.CurrentCountry.Terminology(isefinCountryTerminology.BankSortCode, False) Then
        .Tooltip_SortCode = finBL.CurrentCountry.Terminology(isefinCountryTerminology.BankSortCode, False)
      End If
    End With
  End If
  
  ' Response
  If Success Then
    Success = finBL.Runtime.WebUtilities.SerialiseObjectToJsonString(FormInitialisationInfo, response)
  End If
  
  Return Success
  
End Function

Public Function WizardValidate(parametersJson As String,
                               ByRef returnValue As String) As Boolean

  Dim BankAccount As finBankAccount                               
  Dim ConfirmList As List(Of String)       
  Dim Success As Boolean
  
  ' Assume Success
  Success = True
  
  ' Initialise
  ConfirmList = New List(Of String)
  
  ' Get the BankAccount
  If Success Then
    Success = GetBankAccount(BankAccount)
  End If
  
  Return Success
                               
End Function         

Public Function ZeptoBankAccountRefresh(ByRef returnValue As String) As Boolean
  
  Dim BankAccount As finBankAccount
  Dim BankAccountList As ISCodeDescriptionList
  Dim Success As Boolean
  
  ' Assume Success
  Success = True
  
  ' Initialise
  BankAccountList = finBL.CreateCodeDescriptionList()
  
  ' Load BankAccount
  If Success Then
    Success = GetBankAccount(BankAccount) 
  End If
  
  If Success Then
    Select Case finBL.CountryCode
      Case "AU"
        ' Zepto (Split)
        Success = finBL.BankingInterface.Service_Split.GetBankAccountCodeDescriptionList(BankAccount.Pk, BankAccountList)
        
      Case "NZ:"
        ' ZeptoNZ (OBSOLETE)
        
    End Select
  End If
  
  If Success Then
    returnValue = BankAccountList.ToJsonString(False)
  End If
  
  Return Success
  
End Function

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

  ' Record
  Public Pk As Integer
  Public Timestamp As Integer
  
  ' General
  Public BankAccountId As String
  Public Active As Boolean
  Public Description As String
  
  Public ShortName As String
  Public BankName As String
  Public Branch As String
  Public SortCode As String
  Public AccountNo As String
  
  Public EntityId As String
  Public CostCentreId As String
  
  Public Notes As String
  
  ' Options
  Public CalendarIdBanking As String
  Public CalendarIdProcessing As String
  
  Public GLAccountId As String
  Public GLSuspenseId As String
  
  Public AllowDirectDebitsOnAnyDate As Boolean
  Public UseNewDirectDebitsExecute As Boolean
  Public OptionRequireCashRegister As Boolean
  Public OptionRequireCashRegisterOnLodgement As Boolean
  Public OptionLodgeSuspenseItems As Boolean
  Public OptionRetainDeletedSuspenseItems As Boolean
  
  Public PrintedChequesUse As Boolean
  Public PrintedChequesDocumentId As String
  Public PrintedChequesNextChequeNumber As Integer
  
  ' Ezidebit
  Public EzidebitEddrAllowBankAccounts As Boolean
  Public EzidebitEddrAllowCreditCards As Boolean
  Public EzidebitEddrEmailDocumentId As String
  Public EzidebitEddrEmailDocumentFilter As String
  Public EzidebitEddrSmsDocumentId As String
  Public EzidebitEddrSmsDocumentFilter As String
  Public EzidebitCreateAccountLog As Boolean
  Public EzidebitLogSubject As String
  Public EzidebitLogSeverityId As String
  Public EzidebitLogDelegatedRoleId As String
  
  ' Monoova
  Public MonoovaAccountNo As String
  
  Public MonoovaRemitterName As String
  
  Public MonoovaDirectDebits As Boolean
  
  Public MonoovaCreditCards As Boolean
  
  Public MonoovaCreateAccountLog As Boolean
  Public MonoovaLogSubject As String
  Public MonoovaLogSeverityId As String
  Public MonoovaLogDelegatedRoleId As String
  
  ' Zepto (Split)
  Public SplitBankAccount As String
  Public SplitValidateContactDetails As Boolean
  
  Public SplitCreateAccountLog As Boolean
  Public SplitLogSubject As String
  Public SplitLogSeverityId As String
  Public SplitLogDelegatedRoleId As String
  
  ' Permission (page)
  Public PermissionKeyBankAccount As String
  
  ' Permissions
  Public AllowPageGeneral As Boolean
  Public AllowPageOptions As Boolean
  Public AllowPageEzidebit As Boolean
  Public AllowPageMonoova As Boolean
  Public AllowPageZepto As Boolean
  Public AllowPagePermission As Boolean
  
  ' Lists
  Public List_BankShortNames As Object
  
  ' List Filters
  Public ChequeDocumentFilter As String
  
  ' Terminology
  Public Terminology_Cheque As String
  Public Terminology_SortCode As String
  
  ' Configuration
  Public AddOnCostCentre As Boolean  
  Public AddOnEntity As Boolean
  Public HideOtherPages As Boolean
  Public PromptOnSave As Boolean
  Public ShowSortCode As Boolean
  Public Tooltip_SortCode As String
  
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 FailedPageId As String

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

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

  End Sub

End Class</Code>
    <Language>VisualBasic</Language>
    <Notes>System-supplied HTML Widget to edit a Bank Account.</Notes>
    <PermissionKeyExecute />
    <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="Options"&gt;Options&lt;/li&gt;
        &lt;li tabId="Ezidebit" icon="Logo_Ezidebit"&gt;Ezidebit&lt;/li&gt;
        &lt;li tabId="Monoova" icon="Logo_Monoova"&gt;Monoova&lt;/li&gt;
        &lt;li tabId="Zepto" icon="Logo_Zepto"&gt;Zepto&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"&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="lblCodeAndDescription"&gt;Code and Description&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtBankAccountId"&gt;Code:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtBankAccountId"/&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="lblBankAccountDetails"&gt;Bank Account details&lt;/label&gt;&lt;/th&gt;  
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboShortName"&gt;Short Name:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboShortName"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtBankName"&gt;Bank Name:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtBankName"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtBranch"&gt;Branch:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtBranch"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtSortCode"&gt;Sort Code:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtSortCode"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtAccountNo"&gt;Account No:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtAccountNo"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblEntityAndCostCentre"&gt;Entity and Cost Centre the Bank Account is linked to&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboEntity"&gt;Entity:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboEntity"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboCostCentre"&gt;Cost Centre:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboCostCentre"/&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&gt;
          &lt;th colspan="2"&gt;&lt;input id="txtNotes"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;



    &lt;!-- Options --&gt;
    &lt;div id="pageOptions"&gt;
      &lt;table class="is-form"&gt;
        &lt;colgroup&gt;
          &lt;col style="width:10em" /&gt;
          &lt;col /&gt;
        &lt;/colgroup&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblCalendars"&gt;Calendars for this Bank Account&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboCalendarBanking"&gt;Banking:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboCalendarBanking"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboCalendarProcessing"&gt;Processing:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboCalendarProcessing"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblGLAccounts"&gt;GL Accounts the Bank Account is linked to&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboGLAccount"&gt;GL Account:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboGLAccount"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboGLSuspense"&gt;GL Suspense:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboGLSuspense"/&gt;&lt;/td&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="2"&gt;&lt;input id="chkAllowDirectDebitOnAnyDate" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkUseNewDirectDebitExecuteProcess" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkCashRegisterTransactions" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkCashRegisterLodgement" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkSuspenseItemsLodgement" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkRetainDeletedSuspenseItems" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;        
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblChequePrintingOptions"&gt;Cheque Printing Options&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkUseChequePrinting" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="cboDocumentChequePrinting"&gt;Document:&lt;/label&gt;
          &lt;td&gt;&lt;input id="cboDocumentChequePrinting"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="numNextCheque"&gt;Next&amp;nbsp;Cheque:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="numNextCheque"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;
    
    &lt;!-- Ezidebit --&gt;
    &lt;div id="pageEzidebit"&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="lblEzidebitPaymentMethods"&gt;Define the Payment Methods allowed for Ezidebit eDDR&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkEzidebitEddrBankAccountPaymentMethod" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkEzidebitEddrCreditCardPaymentMethod" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblEzidebitEddrDocuments"&gt;Define the Documents used to send an eDDR request to a Client&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboEzidebitEddrEmailDocumentId"&gt;Email:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboEzidebitEddrEmailDocumentId"/&gt;&lt;/td&gt;
        &lt;/tr&gt;        
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboEzidebitEddrSmsDocumentId"&gt;SMS:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboEzidebitEddrSmsDocumentId"/&gt;&lt;/td&gt;
        &lt;/tr&gt;            
       
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblEzidebitOptionsUponFailure"&gt;Options upon failure&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkEzidebitCreateAnAccountLog" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="txtEzidebitLogSubject"&gt;Subject:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtEzidebitLogSubject"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="cboEzidebitLogSeverityId"&gt;Severity:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboEzidebitLogSeverityId"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="cboEzidebitLogDelegatedRole"&gt;Delegated&amp;nbsp;Role:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboEzidebitLogDelegatedRole"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;
    
    &lt;!-- Monoova --&gt;
    &lt;div id="pageMonoova"&gt;
      &lt;table class="is-form"&gt;
        &lt;colgroup&gt;
          &lt;col style="width:10em" /&gt;
          &lt;col /&gt;
        &lt;/colgroup&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblMonoovaOptions"&gt;Monoova Options&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtMonoovaAccountNo"&gt;Account No.:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtMonoovaAccountNo"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblMonoovaDirectCreditOptions"&gt;Direct Credit Options&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="txtMonoovaRemitterName"&gt;Remitter&amp;nbsp;Name:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtMonoovaRemitterName"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblMonoovaDirectDebitOptions"&gt;Direct Debit Options&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkMonoovaDirectDebits" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblMonoovaCreditCardOptions"&gt;Credit Card Options&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
         &lt;th colspan="2"&gt;&lt;input id="chkMonoovaCreditCards" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblMonoovaOptionsFailure"&gt;Options upon failure&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkMonoovaCreateAccountLog" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="txtMonoovaLogSubject"&gt;Subject:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtMonoovaLogSubject"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="cboMonoovaLogSeverityId"&gt;Severity:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboMonoovaLogSeverityId"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="cboMonoovaLogDelegatedRole"&gt;Delegated&amp;nbsp;Role:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboMonoovaLogDelegatedRole"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;
    
    &lt;!-- ZeptoNZ &amp; Split --&gt;
    &lt;!-- Note: ZeptoNZ is currently obsolete, so this is currently just Split --&gt;
    &lt;div id="pageZepto"&gt;
      &lt;table class="is-form"&gt;
        &lt;colgroup&gt;
          &lt;col style="width:10em" /&gt;
          &lt;col /&gt;
        &lt;/colgroup&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblZeptoOptions"&gt;Zepto Options&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboZeptoBankAccount"&gt;Bank&amp;nbsp;Account:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboZeptoBankAccount"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;td&gt;&lt;button id="cmdZeptoBankAccountRefresh" class="is-button small" icon="Refresh"&gt;Refresh&lt;/button&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkZeptoValidateContactDetails" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblZeptoOptionsFailure"&gt;Options upon failure&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;input id="chkZeptoCreateAccountLog" type="checkbox"/&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="txtZeptoLogSubject"&gt;Subject:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="txtZeptoLogSubject"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="cboZeptoLogSeverity"&gt;Severity:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboZeptoLogSeverity"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="indent1"&gt;&lt;label for="cboZeptoLogDelegatedRole"&gt;Delegated&amp;nbsp;Role:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboZeptoLogDelegatedRole"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&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:8em" /&gt;
          &lt;col /&gt;
        &lt;/colgroup&gt;
        
        &lt;tr&gt;
          &lt;th colspan="2"&gt;&lt;label id="lblPermissionKey"&gt;Permission Key required to use this Bank Account in the User Interface&lt;/label&gt;&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th&gt;&lt;label for="cboPermissionKeyBankAccount"&gt;Permission&amp;nbsp;Key:&lt;/label&gt;&lt;/th&gt;
          &lt;td&gt;&lt;input id="cboPermissionKeyBankAccount"/&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
  lblCodeAndDescription: null,
  txtBankAccountId: null,
  chkActive: null,
  txtDescription: null,
  
  lblBankAccountDetails: null,
  cboShortName: null,
  txtBankName: null,
  txtBranch: null,
  txtSortCode: null,
  txtAccountNo: null,
  
  lblEntityAndCostCentre: null,
  cboEntity: null,
  cboCostCentre: null,
  
  lblNotes: null,
  txtNotes: null,

  // Options
  lblCalendars: null,
  cboCalendarBanking: null,
  cboCalendarProcessing: null,
  
  lblGLAccounts: null,
  cboGLAccount: null,
  cboGLSuspense: null,
  
  lblOtherOptions: null,
  chkAllowDirectDebitOnAnyDate: null,
  chkUseNewDirectDebitExecuteProcess: null,
  chkCashRegisterTransactions: null,
  chkCashRegisterLodgement: null,
  chkSuspenseItemsLodgement: null,
  chkRetainDeletedSuspenseItems: null,
  
  lblChequePrintingOptions: null,
  chkUseChequePrinting: null,
  cboDocumentChequePrinting: null,
  numNextCheque: null,
  
  // Ezidebit
  lblEzidebitPaymentMethods: null,
  chkEzidebitEddrBankAccountPaymentMethod: null,
  chkEzidebitEddrCreditCardPaymentMethod: null,
  lblEzidebitEddrDocuments: null,
  cboEzidebitEddrEmailDocumentId: null,
  cboEzidebitEddrSmsDocumentId: null,
  lblEzidebitOptionsUponFailure: null,
  chkEzidebitCreateAnAccountLog: null,
  txtEzidebitLogSubject: null,
  cboEzidebitLogSeverityId: null,
  cboEzidebitLogDelegatedRole: null,

  // Monoova
  lblMonoovaOptions: null,
  txtMonoovaAccountNo: null,
  
  lblMonoovaDirectCreditOptions: null,
  txtMonoovaRemitterName: null,
  
  lblMonoovaDirectDebitOptions: null,
  chkMonoovaDirectDebits: null,
  
  lblMonoovaCreditCardOptions: null,
  chkMonoovaCreditCards: null,
  
  lblMonoovaOptionsFailure: null,
  chkMonoovaCreateAccountLog: null,
  txtMonoovaLogSubject: null,
  cboMonoovaLogSeverityId: null,
  cboMonoovaLogDelegatedRole: null,
  
  // Zepto (split)
  lblZeptoOptions: null,
  cboZeptoBankAccount: null,
  cmdZeptoBankAccountRefresh: null,
  chkZeptoValidateContactDetails: null,
  
  lblZeptoOptionsFailure: null,
  chkZeptoCreateAccountLog: null,
  txtZeptoLogSubject: null,
  cboZeptoLogSeverity: null,
  cboZeptoLogDelegatedRole: null,

  // Permission
  lblPermissionKey: null,
  cboPermissionKeyBankAccount: null,
}

// Form
var frmMain;
var tabDetails;

// Buttons
var cmdCancel;
var cmdFinish;

// Other

// ==========
// Initialise
// ==========
$(function () {
  // --------
  // Controls
  // --------
  // General
  C.lblCodeAndDescription = widget.UI.Label("lblCodeAndDescription", {});
  C.txtBankAccountId = widget.UI.TextBox("txtBankAccountId", {
    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.lblBankAccountDetails = widget.UI.Label("lblBankAccountDetails", {});
  C.cboShortName = widget.UI.DBCombo("cboShortName", {
    allowBlank: false,
    limitToList: true,
    showDescription: true,
    
    onChange: cboShortName_Change
  });
  C.txtBankName = widget.UI.TextBox("txtBankName", {
    maxLength: 50
  });
  C.txtBranch = widget.UI.TextBox("txtBranch", {
    maxLength: 50
  });
  C.txtSortCode = widget.UI.TextBox("txtSortCode", {
    allowBlank: false,
    maxLength: 10,
    
    onChange: txtSortCode_Change
  });
  C.txtAccountNo = widget.UI.TextBox("txtAccountNo", {
    allowBlank: false,
    maxLength: 30,
    
    onChange: txtAccountNo_Change
  });

  C.lblEntityAndCostCentre = widget.UI.Label("lblEntityAndCostCentre", {});
  C.cboEntity = widget.UI.DBCombo("cboEntity", {
    allowBlank: false,
    limitToList: true,
  });
  C.cboCostCentre = widget.UI.DBCombo("cboCostCentre", {
    limitToList: true,
  });
  
  C.lblNotes = widget.UI.Label("lblNotes", {});
  C.txtNotes = widget.UI.TextBox("txtNotes", {
    multiLine: true,
    rows: 6,
    
  });

  // Options
  C.lblCalendars = widget.UI.Label("lblCalendars", {});
  C.cboCalendarBanking = widget.UI.DBCombo("cboCalendarBanking", {
    allowBlank: false,
    limitToList: true
  });
  C.cboCalendarProcessing = widget.UI.DBCombo("cboCalendarProcessing", {
    allowBlank: false,
    limitToList: true
  });
  
  C.lblGLAccounts = widget.UI.Label("lblGLAccounts", {});
  C.cboGLAccount = widget.UI.DBCombo("cboGLAccount", {
    limitToList: true
  });
  C.cboGLSuspense = widget.UI.DBCombo("cboGLSuspense", {
    limitToList: true
  });
  
  C.lblOtherOptions = widget.UI.Label("lblOtherOptions", {
    tooltipHtml: "&lt;ul&gt;&lt;li&gt;&lt;b&gt;Retain deleted Suspense Items?:&lt;/b&gt; If checked, Suspense Items are flagged as 'deleted' rather than deleted from the database. Note, Suspense Items that have been exported to GL or included on a Lodgement are always retained and never deleted from the database.&lt;/li&gt;"
                  + "&lt;li&gt;&lt;b&gt;Use the new Direct Debit Execute process?:&lt;/b&gt; Using the new Direct Debit Execute process may cause less database locking.&lt;/li&gt;&lt;/ul&gt;"
  });
  C.chkAllowDirectDebitOnAnyDate = widget.UI.CheckBox("chkAllowDirectDebitOnAnyDate", {
    caption: "Allow Direct Debit processing on any date?"
  });
  C.chkUseNewDirectDebitExecuteProcess = widget.UI.CheckBox("chkUseNewDirectDebitExecuteProcess", {
    caption: "Use the new Direct Debit Execute process?"
  });
  C.chkCashRegisterTransactions = widget.UI.CheckBox("chkCashRegisterTransactions", {
    caption: "Require Cash Register when entering Transactions?"
  });
  C.chkCashRegisterLodgement = widget.UI.CheckBox("chkCashRegisterLodgement", {
    caption: "Require Cash Register on Lodgement?"
  });
  C.chkSuspenseItemsLodgement = widget.UI.CheckBox("chkSuspenseItemsLodgement", {
    caption: "Show Suspense Items on Lodgement?"
  });
  C.chkRetainDeletedSuspenseItems = widget.UI.CheckBox("chkRetainDeletedSuspenseItems", {
    caption: "Retain deleted Suspense Items?",
  });
  
  C.lblChequePrintingOptions = widget.UI.Label("lblChequePrintingOptions", {});
  C.chkUseChequePrinting = widget.UI.CheckBox("chkUseChequePrinting", {
    caption: "Use Cheque printing?",
    
    onChange: chkUseChequePrinting_Change
  });
  C.cboDocumentChequePrinting = widget.UI.DBCombo("cboDocumentChequePrinting", {
    allowBlank: false,
    limitToList: true
  });
  C.numNextCheque = widget.UI.NumberBox("numNextCheque", {
    decimals: 0,
    minValue: 0
  });
  
  // Ezidebit
  C.lblEzidebitPaymentMethods = widget.UI.Label("lblEzidebitPaymentMethods", {});
  C.chkEzidebitEddrBankAccountPaymentMethod = widget.UI.CheckBox("chkEzidebitEddrBankAccountPaymentMethod", {
    caption: "Allow Bank Accounts?"
  });  
  C.chkEzidebitEddrCreditCardPaymentMethod = widget.UI.CheckBox("chkEzidebitEddrCreditCardPaymentMethod", {
    caption: "Allow Credit Cards?"
  });  
  C.lblEzidebitEddrDocuments = widget.UI.Label("lblEzidebitPaymentMethods", {});
  C.cboEzidebitEddrEmailDocumentId = widget.UI.DBCombo("cboEzidebitEddrEmailDocumentId", {
    limitToList: true
  });
  C.cboEzidebitEddrSmsDocumentId = widget.UI.DBCombo("cboEzidebitEddrSmsDocumentId", {
    limitToList: true
  });    
  C.lblEzidebitOptionsUponFailure = widget.UI.Label("lblEzidebitOptionsUponFailure", {});
  C.chkEzidebitCreateAnAccountLog = widget.UI.CheckBox("chkEzidebitCreateAnAccountLog", {
    caption: "Create an Account Log when a Bank Transaction fails?",
    
    onChange: chkEzidebitCreateAnAccountLog_Change
  });
  C.txtEzidebitLogSubject = widget.UI.TextBox("txtEzidebitLogSubject", {
    maxLength: 50
  });
  C.cboEzidebitLogSeverityId = widget.UI.DBCombo("cboEzidebitLogSeverityId", {
    limitToList: true
  });
  C.cboEzidebitLogDelegatedRole = widget.UI.DBCombo("cboEzidebitLogDelegatedRole", {
    limitToList: true
  });
  
  // Monoova
  C.lblMonoovaOptions = widget.UI.Label("lblMonoovaOptions", {});
  C.txtMonoovaAccountNo = widget.UI.TextBox("txtMonoovaAccountNo", {
    maxLength: 50
  });
  
  C.lblMonoovaDirectCreditOptions = widget.UI.Label("lblMonoovaDirectCreditOptions", {});
  C.txtMonoovaRemitterName = widget.UI.TextBox("txtMonoovaRemitterName", {
    maxLength: 140
  });
  
  C.lblMonoovaDirectDebitOptions = widget.UI.Label("lblMonoovaDirectDebitOptions", {});
  C.chkMonoovaDirectDebits = widget.UI.CheckBox("chkMonoovaDirectDebits", {
    caption: "Is the Monoova Account setup for Direct Debits?"
  });
  
  C.lblMonoovaCreditCardOptions = widget.UI.Label("lblMonoovaCreditCardOptions", {});
  C.chkMonoovaCreditCards = widget.UI.CheckBox("chkMonoovaCreditCards", {
    caption: "Is the Monoova Account setup for Credit Cards?"
  });
  
  C.lblMonoovaOptionsFailure = widget.UI.Label("lblMonoovaOptionsFailure", {});
  C.chkMonoovaCreateAccountLog = widget.UI.CheckBox("chkMonoovaCreateAccountLog", {
    caption: "Create an Account Log when a Bank Transaction fails?",
    
    onChange: chkMonoovaCreateAccountLog_Change
  });
  C.txtMonoovaLogSubject = widget.UI.TextBox("txtMonoovaLogSubject", {
    maxLength: 50
  });
  C.cboMonoovaLogSeverityId = widget.UI.DBCombo("cboMonoovaLogSeverityId", {
    limitToList: true
  });
  C.cboMonoovaLogDelegatedRole = widget.UI.DBCombo("cboMonoovaLogDelegatedRole", {
    limitToList: true
  });
  
  // Zepto (split)
  C.lblZeptoOptions = widget.UI.Label("lblZeptoOptions", {});
  C.cboZeptoBankAccount = widget.UI.DBCombo("cboZeptoBankAccount", {
    limitToList: false,
    maxLength: 100,
    width: "40em"
  });
  C.cmdZeptoBankAccountRefresh = $("#cmdZeptoBankAccountRefresh");
  C.cmdZeptoBankAccountRefresh.click(cmdZeptoBankAccountRefresh_Click);
  C.chkZeptoValidateContactDetails = widget.UI.CheckBox("chkZeptoValidateContactDetails", {
    caption: "Validate Contact details before sending Transactions to Zpeto?"
  });
  
  C.lblZeptoOptionsFailure = widget.UI.Label("lblZeptoOptionsFailure", {});
  C.chkZeptoCreateAccountLog = widget.UI.CheckBox("chkZeptoCreateAccountLog", {
    caption: "Create an Account Log when a Bank Transaction fails?",
    
    onChange: chkZeptoCreateAccountLog_Change
  });
  C.txtZeptoLogSubject = widget.UI.TextBox("txtZeptoLogSubject", {
    maxLength: 50
  });
  C.cboZeptoLogSeverity = widget.UI.DBCombo("cboZeptoLogSeverity", {
    limitToList: true
  });
  C.cboZeptoLogDelegatedRole = widget.UI.DBCombo("cboZeptoLogDelegatedRole", {
    limitToList: true
  });
  
  // Permission
  C.lblPermissionKey = widget.UI.Label("lblPermissionKey", {});
  C.cboPermissionKeyBankAccount = widget.UI.PermissionKeyComboBox("cboPermissionKeyBankAccount", {
    limitToList: false
  });

  // Grids

  // 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;

  // 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.AllowPageOptions) tabDetails.TabVisible("Options", false);
  if (!mRecord.AllowPageEzidebit) tabDetails.TabVisible("Ezidebit", false);
  if (!mRecord.AllowPageMonoova) tabDetails.TabVisible("Monoova", false);
  if (!mRecord.AllowPageZepto) tabDetails.TabVisible("Zepto", false);
  if (!mRecord.AllowPagePermission) tabDetails.TabVisible("Permission", false);

  // 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
    if (mRecord.AllowPageGeneral) {
      C.txtBankAccountId.Text(mRecord.BankAccountId);
      C.chkActive.Value(mRecord.Active);
      C.txtDescription.Text(mRecord.Description);
      
      C.cboShortName.Text(mRecord.ShortName);
      C.txtBankName.Text(mRecord.BankName);
      C.txtBranch.Text(mRecord.Branch);
      C.txtSortCode.Text(mRecord.SortCode);
      C.txtAccountNo.Text(mRecord.AccountNo);
      
      C.cboEntity.Text(mRecord.EntityId);
      C.cboCostCentre.Text(mRecord.CostCentreId);
      
      C.txtNotes.Text(mRecord.Notes);
    }

    // Options
    if (mRecord.AllowPageOptions) {
      C.cboCalendarBanking.Text(mRecord.CalendarIdBanking);
      C.cboCalendarProcessing.Text(mRecord.CalendarIdProcessing);
      
      C.cboGLAccount.Text(mRecord.GLAccountId);
      C.cboGLSuspense.Text(mRecord.GLSuspenseId);
      
      C.chkAllowDirectDebitOnAnyDate.Value(mRecord.AllowDirectDebitsOnAnyDate);
      C.chkUseNewDirectDebitExecuteProcess.Value(mRecord.UseNewDirectDebitsExecute);
      C.chkCashRegisterTransactions.Value(mRecord.OptionRequireCashRegister);
      C.chkCashRegisterLodgement.Value(mRecord.OptionRequireCashRegisterOnLodgement);
      C.chkSuspenseItemsLodgement.Value(mRecord.OptionLodgeSuspenseItems);
      C.chkRetainDeletedSuspenseItems.Value(mRecord.OptionRetainDeletedSuspenseItems);
      
      C.chkUseChequePrinting.Value(mRecord.PrintedChequesUse);
      C.cboDocumentChequePrinting.Text(mRecord.PrintedChequesDocumentId);
      C.numNextCheque.Value(mRecord.numNextCheque);
    }
    
    // Ezidebit
    if (mRecord.AllowPageEzidebit) {
      C.chkEzidebitEddrBankAccountPaymentMethod.Value(mRecord.EzidebitEddrAllowBankAccounts);
      C.chkEzidebitEddrCreditCardPaymentMethod.Value(mRecord.EzidebitEddrAllowCreditCards);
      C.cboEzidebitEddrEmailDocumentId.Text(mRecord.EzidebitEddrEmailDocumentId);
      C.cboEzidebitEddrSmsDocumentId.Text(mRecord.EzidebitEddrSmsDocumentId);    
      C.chkEzidebitCreateAnAccountLog.Value(mRecord.EzidebitCreateAccountLog);
      C.txtEzidebitLogSubject.Text(mRecord.EzidebitLogSubject);
      C.cboEzidebitLogSeverityId.Text(mRecord.EzidebitLogSeverityId);
      C.cboEzidebitLogDelegatedRole.Text(mRecord.EzidebitLogDelegatedRoleId);
    }
    
    // Monoova
    if (mRecord.AllowPageMonoova) {
      C.txtMonoovaAccountNo.Text(mRecord.MonoovaAccountNo);
    
      C.txtMonoovaRemitterName.Text(mRecord.MonoovaRemitterName);
      
      C.chkMonoovaDirectDebits.Value(mRecord.MonoovaDirectDebits);
      
      C.chkMonoovaCreditCards.Value(mRecord.MonoovaCreditCards);
      
      C.chkMonoovaCreateAccountLog.Value(mRecord.MonoovaCreateAccountLog);
      C.txtMonoovaLogSubject.Text(mRecord.MonoovaLogSubject);
      C.cboMonoovaLogSeverityId.Text(mRecord.MonoovaLogSeverityId);
      C.cboMonoovaLogDelegatedRole.Text(mRecord.MonoovaLogDelegatedRole);
    }
    
    // Zepto (Split)
    if (mRecord.AllowPageZepto) {
      C.cboZeptoBankAccount.Text(mRecord.SplitBankAccount);
      C.chkZeptoValidateContactDetails.Value(mRecord.SplitValidateContactDetails);
      
      C.chkZeptoCreateAccountLog.Value(mRecord.SplitCreateAccountLog);
      C.txtZeptoLogSubject.Text(mRecord.SplitLogSubject);
      C.cboZeptoLogSeverity.Text(mRecord.SplitLogSeverityId);
      C.cboZeptoLogDelegatedRole.Text(mRecord.SplitLogDelegatedRoleId);
    }
    
    // Permission
    if (mRecord.AllowPagePermission) {
      C.cboPermissionKeyBankAccount.Text(mRecord.PermissionKeyBankAccount);
    }
  }

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

  // Update Controls

  // Update fields
  Fields_Update();

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

// ===========
// Save Fields
// ===========
function Fields_Save() {
  // General
  if (mRecord.AllowPageGeneral) {
    mRecord.BankAccountId = C.txtBankAccountId.Text();
    mRecord.Active = C.chkActive.Value();
    mRecord.Description = C.txtDescription.Text();
    
    mRecord.ShortName = C.cboShortName.Text();
    mRecord.BankName = C.txtBankName.Text();
    mRecord.Branch = C.txtBranch.Text();
    mRecord.SortCode = C.txtSortCode.Text();
    mRecord.AccountNo = C.txtAccountNo.Text();
    
    mRecord.EntityId = C.cboEntity.Text();
    mRecord.CostCentreId = C.cboCostCentre.Text();
    
    mRecord.Notes = C.txtNotes.Text();
  }

  // Options
  if (mRecord.AllowPageOptions) {
    mRecord.CalendarIdBanking = C.cboCalendarBanking.Text();
    mRecord.CalendarIdProcessing = C.cboCalendarProcessing.Text();
    
    mRecord.GLAccountId = C.cboGLAccount.Text();
    mRecord.GLSuspenseId = C.cboGLSuspense.Text();
    
    mRecord.AllowDirectDebitsOnAnyDate = C.chkAllowDirectDebitOnAnyDate.Value();
    mRecord.UseNewDirectDebitsExecute = C.chkUseNewDirectDebitExecuteProcess.Value();
    mRecord.OptionRequireCashRegister = C.chkCashRegisterTransactions.Value();
    mRecord.OptionRequireCashRegisterOnLodgement = C.chkCashRegisterLodgement.Value();
    mRecord.OptionLodgeSuspenseItems = C.chkSuspenseItemsLodgement.Value();
    mRecord.OptionRetainDeletedSuspenseItems = C.chkRetainDeletedSuspenseItems.Value();
    
    mRecord.PrintedChequesUse = C.chkUseChequePrinting.Value();
    mRecord.PrintedChequesDocumentId = C.cboDocumentChequePrinting.Text();
    mRecord.PrintedChequesNextChequeNumber = C.numNextCheque.Value();
  }
  
  // Ezidebit
  if (mRecord.AllowPageEzidebit) {
    mRecord.EzidebitEddrAllowBankAccounts = C.chkEzidebitEddrBankAccountPaymentMethod.Value();
    mRecord.EzidebitEddrAllowCreditCards = C.chkEzidebitEddrCreditCardPaymentMethod.Value();
    mRecord.EzidebitEddrEmailDocumentId = C.cboEzidebitEddrEmailDocumentId.Text();
    mRecord.EzidebitEddrSmsDocumentId = C.cboEzidebitEddrSmsDocumentId.Text();    
    mRecord.EzidebitCreateAccountLog = C.chkEzidebitCreateAnAccountLog.Value();
    mRecord.EzidebitLogSubject = C.txtEzidebitLogSubject.Text();
    mRecord.EzidebitLogSeverityId = C.cboEzidebitLogSeverityId.Text();
    mRecord.EzidebitLogDelegatedRoleId = C.cboEzidebitLogDelegatedRole.Text();
  }
  
  // Monoova
  if (mRecord.AllowPageMonoova) {
    mRecord.MonoovaAccountNo = C.txtMonoovaAccountNo.Text();
    
    mRecord.MonoovaRemitterName = C.txtMonoovaRemitterName.Text();
    
    mRecord.MonoovaDirectDebits = C.chkMonoovaDirectDebits.Value();
    
    mRecord.MonoovaCreditCards = C.chkMonoovaCreditCards.Value();
    
    mRecord.MonoovaCreateAccountLog = C.chkMonoovaCreateAccountLog.Value();
    mRecord.MonoovaLogSubject = C.txtMonoovaLogSubject.Text();
    mRecord.MonoovaLogSeverityId = C.cboMonoovaLogSeverityId.Text();
    mRecord.MonoovaLogDelegatedRoleId = C.cboMonoovaLogDelegatedRole.Text();
  }
  
  // Zepto
  if (mRecord.AllowPageZepto) {
    mRecord.SplitBankAccount = C.cboZeptoBankAccount.Text();
    mRecord.SplitValidateContactDetails = C.chkZeptoValidateContactDetails.Value();
    
    mRecord.SplitCreateAccountLog = C.chkZeptoCreateAccountLog.Value();
    mRecord.SplitLogSubject = C.txtZeptoLogSubject.Text();
    mRecord.SplitLogSeverityId = C.cboZeptoLogSeverity.Text();
    mRecord.SplitLogDelegatedRoleId = C.cboZeptoLogDelegatedRole.Text();
  }
  
  // Permission
  if (mRecord.AllowPagePermission) {
    mRecord.PermissionKeyBankAccount = C.cboPermissionKeyBankAccount.Text();
  }
}

// =============
// Update Fields
// =============
function Fields_Update() {
  // Heading
  if (mRecord) {
    if (mRecord.BankAccountId) {
      widget.SetHeading("Bank Account (" + mRecord.BankAccountId + ")");
    }
    else {
      widget.SetHeading("New Bank Account");
    }
  }

  // Lists
  if (mRecord) {
    // General
    if (mRecord.AllowPageGeneral) {
      C.cboShortName.RefreshFromCodeDescriptionList(mRecord.List_BankShortNames, "Short Name", "Bank Name");
      
      C.cboEntity.RefreshFromStandardRange("Entities", null, false, mRecord.EntityId);
      C.cboCostCentre.RefreshFromStandardRange("CostCentres", null, false, mRecord.CostCentreId);
    }
    
    // Options
    if (mRecord.AllowPageOptions) {
      C.cboCalendarBanking.RefreshFromStandardRange("Calendars", null, false, mRecord.CalendarIdBanking);
      C.cboCalendarProcessing.RefreshFromStandardRange("Calendars", null, false, mRecord.CalendarIdProcessing);
      
      C.cboGLAccount.RefreshFromStandardRange("GlAccounts", null, false, mRecord.GLAccountId);
      C.cboGLSuspense.RefreshFromStandardRange("GlAccounts", null, false, mRecord.GLSuspenseId);
      
      C.cboDocumentChequePrinting.RefreshFromStandardRange("Documents", mRecord.ChequeDocumentFilter, false, mRecord.PrintedChequesDocumentId);
    
    }
    
    // Ezidebit
    if (mRecord.AllowPageEzidebit) {
      C.cboEzidebitEddrEmailDocumentId.RefreshFromStandardRange("Documents", mRecord.EzidebitEddrEmailDocumentFilter);
      C.cboEzidebitEddrSmsDocumentId.RefreshFromStandardRange("Documents", mRecord.EzidebitEddrSmsDocumentFilter);    
      C.cboEzidebitLogSeverityId.RefreshFromStandardRange("LogSeverities", null, false, mRecord.EzidebitLogSeverityId);
      C.cboEzidebitLogDelegatedRole.RefreshFromStandardRange("Roles", null, false, mRecord.EzidebitLogDelegatedRoleId);
    }
    
    // Monoova
    if (mRecord.AllowPageMonoova) {
      C.cboMonoovaLogSeverityId.RefreshFromStandardRange("LogSeverities", null, false, mRecord.MonoovaLogSeverityId);
      C.cboMonoovaLogDelegatedRole.RefreshFromStandardRange("Roles", null, false, mRecord.MonoovaLogDelegatedRoleId);
    }
    
    // Zepto
    if (mRecord.AllowPageZepto) {      
      C.cboZeptoLogSeverity.RefreshFromStandardRange("LogSeverities", null, false, mRecord.SplitLogSeverityId);
      C.cboZeptoLogDelegatedRole.RefreshFromStandardRange("Roles", null, false, mRecord.SplitLogDelegatedRoleId);
    }
  }

  // Controls
  if (mRecord) {
    // General
    if (mRecord.AllowPageGeneral) {
      var BankAccountDetails_Tooltip = "";
      if (mRecord.ShowSortCode) BankAccountDetails_Tooltip = "&lt;b&gt;" + mRecord.Terminology_SortCode + ": &lt;/b&gt;" + mRecord.Tooltip_SortCode;
      C.lblBankAccountDetails.TooltipHtml(BankAccountDetails_Tooltip);
      cboShortName_Change();
      C.txtSortCode.VisibleRow(mRecord.ShowSortCode);
      C.txtSortCode.Caption(mRecord.Terminology_SortCode + ":");
      
      if (mRecord.AddOnCostCentre || mRecord.AddOnEntity) {
        if (mRecord.AddOnEntity) {
          if (mRecord.AddOnCostCentre) {
            C.lblEntityAndCostCentre.Text("Entity and Cost Centre the Bank Account is linked to");
          }
          else {
            C.lblEntityAndCostCentre.Text("Entity the Bank Account is linked to");
          }
        }
        else {
          C.lblEntityAndCostCentre.Text("Cost Centre the Bank Account is linked to");
        }
      }
      else {
        C.lblEntityAndCostCentre.VisibleRow(false);
      }
      
      C.cboEntity.VisibleRow(mRecord.AddOnEntity);
      C.cboCostCentre.VisibleRow(mRecord.AddOnCostCentre);
    }

    // Options
    if (mRecord.AllowPageOptions) {
      C.lblCalendars.TooltipHtml("Banking Days are days the Bank is physically open.&lt;br/&gt;Processing Days includes all days the Bank can process transactions, but can be overridden for each Export Service.");
    
      if (mRecord.Terminology_Cheque) {
        C.lblChequePrintingOptions.Text(mRecord.Terminology_Cheque + " Printing Options");
        C.chkUseChequePrinting.Caption("Use " + mRecord.Terminology_Cheque + " printing?");
        C.numNextCheque.Caption("Next" + String.fromCharCode(160) + mRecord.Terminology_Cheque + ":");
      }
      chkUseChequePrinting_Change();
    }
    
    // Ezidebit
    if (mRecord.AllowPageEzidebit) {
      chkEzidebitCreateAnAccountLog_Change();
    }
    
    // Monoova
    if (mRecord.AllowPageMonoova) {
      C.lblMonoovaOptions.TooltipHtml("If applicable, define the Monoova mAccount Number to transact under.&lt;br&gt;Leave blank to use your Primary Monoova Bank Account.");
    
      chkMonoovaCreateAccountLog_Change();
    }
    
    // Zepto   
    if (mRecord.AllowPageZepto) {
      C.lblZeptoOptions.TooltipHtml("If applicable, define the Zepto Bank Account to transact under.&lt;br&gt;Leave blank to use your Primary Zepto Bank Account.");
    
      chkZeptoCreateAccountLog_Change();
    } 
  }

  // 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();
    pageOptions_Refresh();
    pageEzidebit_Refresh();
    pageMonoova_Refresh();
    pageZepto_Refresh();
    pagePermission_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.txtBankAccountId.WidthResizeFromParent();
      C.txtDescription.WidthResizeFromParent();
      
      C.cboShortName.WidthResizeFromParent();
      C.txtBankName.WidthResizeFromParent();
      C.txtBranch.WidthResizeFromParent();
      C.txtSortCode.WidthResizeFromParent();
      C.txtAccountNo.WidthResizeFromParent();
      
      C.cboEntity.WidthResizeFromParent();
      C.cboCostCentre.WidthResizeFromParent();
      
      C.txtNotes.WidthResizeFromParent();
      break;

    case "Options":
      // Options
      C.cboCalendarBanking.WidthResizeFromParent();
      C.cboCalendarProcessing.WidthResizeFromParent();
      
      C.cboGLAccount.WidthResizeFromParent();
      C.cboGLSuspense.WidthResizeFromParent();
      
      C.cboDocumentChequePrinting.WidthResizeFromParent();
      C.numNextCheque.WidthResizeFromParent();
      break;
      
    case "Ezidebit":
      // Ezidebit
      C.cboEzidebitEddrEmailDocumentId.WidthResizeFromParent();
      C.cboEzidebitEddrSmsDocumentId.WidthResizeFromParent();
      C.txtEzidebitLogSubject.WidthResizeFromParent();
      C.cboEzidebitLogSeverityId.WidthResizeFromParent();
      C.cboEzidebitLogDelegatedRole.WidthResizeFromParent();
      break;
      
    case "Monoova":
      // Monoova
      C.txtMonoovaAccountNo.WidthResizeFromParent();
      
      C.txtMonoovaRemitterName.WidthResizeFromParent();
      
      C.txtMonoovaLogSubject.WidthResizeFromParent();
      C.cboMonoovaLogSeverityId.WidthResizeFromParent();
      C.cboMonoovaLogDelegatedRole.WidthResizeFromParent();
      break;
      
    case "Zepto":
      // Zepto (split)
      //C.cboZeptoBankAccount.WidthResizeFromParent(); Width Specified in initialisation
      
      C.txtZeptoLogSubject.WidthResizeFromParent();
      C.cboZeptoLogSeverity.WidthResizeFromParent();
      C.cboZeptoLogDelegatedRole.WidthResizeFromParent();
      break;
      
    case "Permission":
      // Permission
      C.cboPermissionKeyBankAccount.WidthResizeFromParent();
      break;
  }
}

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

    case "Options":
      pageOptions_Refresh();
      break;
      
    case "Ezidebit":
      pageEzidebit_Refresh();
      break;
      
    case "Monoova":
      pageMonoova_Refresh();
      
    case "Zepto":
      pageZepto_Refresh();
      
    case "Permission":
      pagePermission_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));
  params.List_BankShortNames = null;

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

      // Refresh Parent (to show updated details)
      // NOTE: Pass in Record Id just in case this has changed
      widget.RefreshParent(C.txtBankAccountId.Text());
    },

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

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

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

  // Controls
}

// Change Events
function cboShortName_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  // Check that item exists
  if (C.cboShortName.ListExists(C.cboShortName.Text())) {
    // Update Bank Name
    C.txtBankName.Text(C.cboShortName.GetDescription());
  }
}

function txtSortCode_Change(sender, e) {
  // Handlfed
  if (e) e.ChangeHandled = true;
  
  var params = {
    BankNameShort: C.cboShortName.Text(),
    SortCode: C.txtSortCode.Text()
  }
  
  // Block UI
  widget.UI.Block();
  
  // Server side validation
  widget.GetString("AccountSortCodeValidate", params, txtSortCode_Change_PostDone, function(e) {
    widget.UI.MsgBoxAlert(e);
    
    // Enable form
    widget.UI.Unblock();
  });
}

function txtSortCode_Change_PostDone(data) {
  var response;

  // Unpack
  if (data) response = JSON.parse(data);
  
  // Unblock
  widget.UI.Unblock();
  
  if (response) {
    // Always update the Account Sort Code
    C.txtSortCode.Text(response.SortCode);
    
    // Show Prompt?
    if (response.ShowPrompt) {
      widget.UI.MsgBoxConfirm("Update Bank Name to " + response.BankNameShort + ", " + response.BankName + "?",
        {
          captionOk: "Yes",
          captionCancel: "No",
          maxWidth: 500        
        },
        function() {      
          if (response.BankNameShort) C.cboShortName.Text(response.BankNameShort);
          if (response.BankName) C.txtBankName.Text(response.BankName);
          if (response.BankBranchName &amp;&amp; response.BankBranchName.length !== 0) {
            C.txtBranch.Text(response.BankBranchName);
          }        
      });
    }
  }
}

function txtAccountNo_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  var params = {
    AccountNumber: C.txtAccountNo.Text(),
    BankNameShort: C.cboShortName.Text()
  };
  
  // Block UI
  widget.UI.Block();
  
  // Server side validation
  widget.GetString("AccountNumberValidate", params, txtAccountNo_Change_PostDone, function(e) {
    widget.UI.MsgBoxAlert(e);
    
    // Enable form
    widget.UI.Unblock();
  });
}

function txtAccountNo_Change_PostDone(data) {
  var response;

  // Unpack
  if (data) response = JSON.parse(data);
  
  // Unblock
  widget.UI.Unblock();  
  
  if (response) {
    // Always update the Account Number
    C.txtAccountNo.Text(response.AccountNumber);

    // Show Prompt?
    if (response.ShowPrompt) {
      widget.UI.MsgBoxConfirm("Update Bank Name to " + response.BankNameShort + ", " + response.BankName + "?", 
        {
          captionOk: "Yes",
          captionCancel: "No",
          maxWidth: 500
        }, 
        function() {
          if (response.BankNameShort) C.cboShortName.Text(response.BankNameShort);
          if (response.BankName) C.txtBankName.Text(response.BankName);
          if (response.BankBranchName &amp;&amp; response.BankBranchName.length !== 0) {
            C.txtBranch.Text(response.BankBranchName);
          }
      });
    }
  }
}

// ===========
// pageOptions
// ===========
function pageOptions_Refresh() {
  if (!mRecord) return;

  // Reset Controls

  // Update Controls
}

// Change Events
function chkUseChequePrinting_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  C.cboDocumentChequePrinting.VisibleRow(C.chkUseChequePrinting.Value());
  C.numNextCheque.VisibleRow(C.chkUseChequePrinting.Value());
}

// ============
// pageEzidebit
// ============
function pageEzidebit_Refresh() {
  if (!mRecord) return;
  
  // Controls
}

// Change Events
function chkEzidebitCreateAnAccountLog_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  C.txtEzidebitLogSubject.VisibleRow(C.chkEzidebitCreateAnAccountLog.Value());
  C.cboEzidebitLogSeverityId.VisibleRow(C.chkEzidebitCreateAnAccountLog.Value());
  C.cboEzidebitLogDelegatedRole.VisibleRow(C.chkEzidebitCreateAnAccountLog.Value());
}

// ===========
// pageMonoova
// ===========
function pageMonoova_Refresh() {
  if (!mRecord) return;
  
  // Controls
}

// Change Events
function chkMonoovaCreateAccountLog_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  C.txtMonoovaLogSubject.VisibleRow(C.chkMonoovaCreateAccountLog.Value());
  C.cboMonoovaLogSeverityId.VisibleRow(C.chkMonoovaCreateAccountLog.Value());
  C.cboMonoovaLogDelegatedRole.VisibleRow(C.chkMonoovaCreateAccountLog.Value());
}

// =========
// pageZepto
// =========
function pageZepto_Refresh() {
  if (!mRecord) return;
  
  // Controls
}

// Change Events
function chkZeptoCreateAccountLog_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  C.txtZeptoLogSubject.VisibleRow(C.chkZeptoCreateAccountLog.Value());
  C.cboZeptoLogSeverity.VisibleRow(C.chkZeptoCreateAccountLog.Value());
  C.cboZeptoLogDelegatedRole.VisibleRow(C.chkZeptoCreateAccountLog.Value());
}

// Click Events
function cmdZeptoBankAccountRefresh_Click(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;
  
  // Block UI
  widget.UI.Block();
  
  widget.GetString("ZeptoBankAccountRefresh", {}, cmdZeptoBankAccountRefresh_Click_PostDone, 
    function(e) {
    widget.UI.MsgBoxAlert(e);
    
    // Enable form
    widget.UI.Unblock();
  });
}

function cmdZeptoBankAccountRefresh_Click_PostDone(data) {
  // Unblock
  widget.UI.Unblock();
  
  if (data) {
    var response = JSON.parse(data);
  
    if (response) {
      C.cboZeptoBankAccount.RefreshFromCodeDescriptionList(response, "Id", "Title");
    }
  }
}

// ==============
// pagePermission
// ==============
function pagePermission_Refresh() {
  if (!mRecord) return;
  
  // Controls
}

// ====================
// 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 />
    <UniqueId>4IICYuXpY0uhfc3KUP-hHw</UniqueId>
    <AllowRefresh>true</AllowRefresh>
    <Caption />
    <HtmlWidgetAllowInitialEventCaching>false</HtmlWidgetAllowInitialEventCaching>
    <HtmlWidgetMaxHeight>0</HtmlWidgetMaxHeight>
    <HtmlWidgetMaxWidth>0</HtmlWidgetMaxWidth>
    <HtmlWidgetDarkModeNotSupported>false</HtmlWidgetDarkModeNotSupported>
    <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>BankAccount</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="BankAccountId" type="Range">
            <BlankTip />
            <Caption>Bank Account Id</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>BankAccounts</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.BankAccounts</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,Options,PaymentMethods,ImportServices,ExportServices,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>