#Description: Example Function to stop Direct Debits for a Loan Account.
#Author: Intersoft Systems Limited
#Version: 1.00
#Last Updated: 20/04/2020

''' <summary>
'''  Stops Loan Account Direct Debits until the date specified.
''' </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="directDebitStopToDate">
'''  The date to stop Direct Debits to, or Nothing to clear the current Stop date.
''' </param>
''' <returns>
'''  A Boolean value indicating success.
''' </returns>
Private Function Account_StopDirectDebits(accountPk As Integer,
																	  		  directDebitStopToDate As Date,
																					authorisedName As String,
																				  authorisedReason As String) As Boolean

  Dim AccountDirectDebitStop As finAccountDirectDebitStop
  Dim Success As Boolean

  ' Assume Success
  Success = True

  ' Create Objects
  AccountDirectDebitStop = finBL.CreateAccountDirectDebitStop()
	
  With AccountDirectDebitStop
    ' Load Account
    Success = .AccountLoadPk(accountPk)

    If Success Then
      ' Update Properties
			.AuthorisedName = authorisedName
			.AuthorisedReason = authorisedReason
			.DirectDebitStopToDate = directDebitStopToDate

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

  ' Return Success
  Return Success

End Function