You will need
1. add a custom column to handle selection of from/to supplier in the "Range Grid"
2. a custom SP to handle new filter (with same number of output columns + name)
3. intercept FindStockStart
assuming you know how to do step 1 and 2

Below is what you need for step 3
- Code: Select all
Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
Dim stocktake As JiwaStockTake.StockTake = JiwaBusinessLogic
AddHandler stocktake.FindStockStart, AddressOf FindstockStart
End Sub
Private Sub FindstockStart(sender As Object, e As CancelEventArgs, SQLCmd As SqlCommand)
Dim stocktake As JiwaStockTake.StockTake = sender
SQLCmd.CommandText = "your custom stored proc here"
SQLCmd.CommandType = CommandType.StoredProcedure
If stocktake.Client IsNot Nothing Then
Dim ui As JiwaStockTakeUI.frmMain = stocktake.Client
SQLCmd.Parameters.Add(New SqlParameter("@MaxRow", ui.MaxRowsNumericEditor.Value))
Dim FromSupplier, ToSupplier as string
FromSupplier = "" 'get this from custom grid column
ToSupplier = "" 'get this from custom grid column
SQLCmd.Parameters.Add(New SqlParameter("@FromSupplier", FromSupplier))
SQLCmd.Parameters.Add(New SqlParameter("@ToSupplier", ToSupplier))
End If
End Sub
There is only 1 issue with above code that I cannot resolve. ui.MaxRowsNumericEditor.Value always reverted to "default max count" during this event, even if user changed it on UI.