#Description: Example Function to update an Account's Statement Cycle.
#Author: Intersoft Systems Limited
#Version: 1.00
#Last Updated: 20/04/2020

''' <summary>
'''  Updates an Account's Statement Cycle.
''' </summary>
''' <param name="accountPk">
'''  The Primary Key of the Account. If you already have the Account object loaded, set to Account.Pk.
''' </param>
''' <param name="statementCycle">
'''  The new Statement Cycle. E.g. "e" for "Eom of Month", "6m10" for 6 Monthly on day 10 of the month.
''' </param>
''' <param name="statementDateNext">
'''  The next date a Satement is due.
''' </param>
''' <param name="reference">
'''  Your Reference for the Statement change. Maximum of 20 characters.
''' </param>
''' <param name="authorisedName">
'''  The Name of the person who authorised the change. Maximum of 100 characters.
''' </param>
''' <param name="authorisedReason">
'''  The reason given for the change.
''' </param>
''' <returns>
'''  A Boolean value indicating success.
''' </returns>
Private Function Account_StatementChange(accountPk As Integer,
																	  		 statementCycle As String,
																				 statementDateNext As Date,
                                         reference As String,
                                         authorisedName As String,
																				 authorisedReason As String) As Boolean

  Dim AccountStatementChange As finAccountStatementChange
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Create Objects
  AccountStatementChange = finBL.CreateAccountStatementChange()
	
  With AccountStatementChange
    ' Load Account
    Success = .AccountLoadPk(accountPk)

    If Success Then
      ' Update Properties
      .AuthorisedName = authorisedName
      .AuthorisedReason = authorisedReason
      .Reference = reference
      .StatementCycle = statementCycle
      .StatementDateNext = statementDateNext

      ' Commit (if there are changes)
      If .HasChanges() Then
        Success = .ExecuteCommit()
			End If
    End If
  End With

  ' Return Success
  Return Success

End Function