More range(s) for Stocktake form  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

More range(s) for Stocktake form

Postby DannyC » Mon Jun 07, 2021 5:00 pm

Along similar lines as viewtopic.php?f=26&t=1139

Client has asked how hard it would be to add a range for Supplier.

I've reviewed the plugin from the thread above but it's beyond me to add a range.

Don't need a column in the lines to display the supplier, all I really need to do is just add a range filter so the user can just get items for a given supplier(s).
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: More range(s) for Stocktake form

Postby SBarnes » Mon Jun 07, 2021 5:58 pm

It's actually a bit different to the post you mentioned as this doesn't involve a stored procedure but a method on the Stocktake object called find stock that needs to be redone, its definitely doable but I'd say allowing 2 -3 hours would be fair in case of any difficulties to get it done with following same principles and adding the lookups and buttons to the ranges grid.

I am assuming you are only going with the default supplier for products?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: More range(s) for Stocktake form

Postby DannyC » Wed Jun 09, 2021 2:01 pm

It's actually a bit different to the post you mentioned as this doesn't involve a stored procedure but a method on the Stocktake object called find stock

Yeah, I studied the form in Just Decompile and was aware that the Find Stock click event will need redoing. But not sure how to do it.

I am assuming you are only going with the default supplier for products?

Assume correct.
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: More range(s) for Stocktake form  Topic is solved

Postby perry » Tue Jun 15, 2021 1:35 pm

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.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests