Sales Order Sort Order
Posted: Fri Nov 18, 2022 12:41 pm
Am trying to add a simple sort by staff member to the sales order sort list.
When I go Next its jumping to the next staffname in the alphabet instead of same staffname, next invoice
Also if I then try another sort e.g. sort by name it gets this error.
Have this code. Anybody tried adding extra sorts to sales orders ?
Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
If TypeOf JiwaBusinessLogic Is JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder Then
Dim Salesorder As JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder = JiwaBusinessLogic
Salesorder.SortOrders.Add(New JiwaFinancials.Jiwa.JiwaApplication.IJiwaNavigable.SortKey With {
.Description = "Staff Name",
.FieldName = "hr_staff.fname",
.SortFieldValueMethod = Function() Salesorder.Staff.FirstName
})
Salesorder.BaseFindSQLQuery = "SELECT TOP 1 SO_Main.InvoiceID FROM SO_Main INNER JOIN HR_Staff ON HR_Staff.StaffID = SO_Main.StaffID"
End If
End Sub
When I go Next its jumping to the next staffname in the alphabet instead of same staffname, next invoice
Also if I then try another sort e.g. sort by name it gets this error.
Have this code. Anybody tried adding extra sorts to sales orders ?
Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
If TypeOf JiwaBusinessLogic Is JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder Then
Dim Salesorder As JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder = JiwaBusinessLogic
Salesorder.SortOrders.Add(New JiwaFinancials.Jiwa.JiwaApplication.IJiwaNavigable.SortKey With {
.Description = "Staff Name",
.FieldName = "hr_staff.fname",
.SortFieldValueMethod = Function() Salesorder.Staff.FirstName
})
Salesorder.BaseFindSQLQuery = "SELECT TOP 1 SO_Main.InvoiceID FROM SO_Main INNER JOIN HR_Staff ON HR_Staff.StaffID = SO_Main.StaffID"
End If
End Sub