Hi Danny,
In the payment processing part of the code, we do the following:
- Code: Select all
For Each payment As Payment In SalesOrderPayments
RaiseEvent PaymentProcessingStart(Me, payment)
If payment.Processed = False AndAlso payment.ProcessPayment Then
If SystemSettings.UsePaymentTypeBankAccounts Then
BankAccount = payment.PaymentType.LedgerAccount
Else
If SystemSettings.ChildDebtorsUseChildGLAccounts OrElse Debtor.ParentDebtor.DebtorID = "" Then
BankAccount = Debtor.LedgerDebtorSourcedReceipts
Else
BankAccount = Debtor.ParentDebtor.LedgerDebtorSourcedReceipts
End If
End If
So, you can add a handler for the PaymentProcessingStart event and in there set the Debtor.LedgerDebtorSourcedReceipts or payment.PaymentType.LedgerAccount (depending on how your UsePaymentTypeBankAccounts system setting is set) account by doing a Read on that entity - and then our payment processing code will use that account.
For example - after adding the "Sales Order Entry" to the business logic tab of your plugin, use the following code:
- Code: Select all
Public Class BusinessLogicPlugin
Inherits System.MarshalByRefObject
Implements JiwaApplication.IJiwaBusinessLogicPlugin
Public Overrides Function InitializeLifetimeService() As Object
' returning null here will prevent the lease manager
' from deleting the Object.
Return Nothing
End Function
Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = JiwaBusinessLogic
AddHandler salesOrder.PaymentProcessingStart, AddressOf PaymentProcessingStart
End Sub
Private Sub PaymentProcessingStart(SalesOrder As JiwaSales.SalesOrder.SalesOrder, Payment As JiwaSales.SalesOrder.Payment)
If SalesOrder.Branch.Description = "Perth" Then
' Override the bank account
If SalesOrder.SystemSettings.UsePaymentTypeBankAccounts Then
If SalesOrder.SystemSettings.ChildDebtorsUseChildGLAccounts OrElse SalesOrder.Debtor.ParentDebtor.DebtorID = "" Then
SalesOrder.Debtor.LedgerDebtorSourcedReceipts.ReadRecordFromAccountNo("1000-000-01")
Else
SalesOrder.Debtor.ParentDebtor.LedgerDebtorSourcedReceipts.ReadRecordFromAccountNo("1000-000-01")
End If
Else
payment.PaymentType.LedgerAccount.ReadRecordFromAccountNo("1000-000-01")
End If
End If
End Sub
End Class
Let us know if that works for you.
Mike