Sales Order - Inventory search form

Posted:
Mon Jul 13, 2015 3:25 pm
by Atronics
In V6 we could edit and add additional search criteria. Can you point me to were I can modify the columns that appear in an inventory search. I can access the SQL query, but am unable to edit /save it.
Re: Sales Order - Inventory search form

Posted:
Wed Jul 15, 2015 7:33 pm
by Mike.Sheen
Atronics wrote:In V6 we could edit and add additional search criteria. Can you point me to were I can modify the columns that appear in an inventory search. I can access the SQL query, but am unable to edit /save it.
Have a look at
this post in the samples forum - I think that is what you are after.
Mike
Re: Plugin Sample - Custom Search - Email

Posted:
Thu Jul 16, 2015 11:39 am
by Atronics
Thanks, Mike. I can follow that OK. However, how do I know the name of the search form to amend? e.g. In your code "If .CurrentSearchMode = JiwaApplication.JiwaSearch.clsSearch.SearchModes.jswEmailMessages Then", the jsqEmailMessages is identified. Is there a list of the names of the search forms? In V6 they were numbered.
Re: Plugin Sample - Custom Search - Email

Posted:
Thu Jul 16, 2015 1:45 pm
by Atronics
Mike, I figured out the answer to my previous post and built to search. However, I have two questions relating to the following code.
1. How do I format the vbStrings to show only two decimal places?
2. How do I get the SQL query to select records only from the current logical warehouse? It currently gets all SoH records.
' Add "Simple" search to Inventory search options
Dim AOption As New JiwaApplication.JiwaSearch.SearchOption
With AOption
.Title = "Simple Search"
.SQLStr = "Select IN_Main.InventoryID, IN_Main.PartNo, IN_Main.Description, IN_Main.Units, IN_WarehouseSOH.QuantityLeft - IN_WarehouseSOH.QuantityAllocated As SoH, IN_Main.DefaultPrice FROM IN_Main LEFT JOIN IN_WarehouseSOH On IN_Main.InventoryID = IN_WarehouseSOH.InventoryID "
.OrderBy = "ORDER BY PartNo"
.AddColumn ("InventoryID", vbString, "", 0, 1)
.AddColumn ("Part No.", vbstring, "", 15, 2)
.AddColumn ("Item", vbString, "", 45,3)
.AddColumn ("Units", vbString, "", 8, 4)
.AddColumn ("SoH", vbString, "", 12, 5)
.AddColumn ("RRP", vbString, "", 12, 6)
End With
Re: Sales Order - Inventory search form 

Posted:
Thu Jul 16, 2015 3:08 pm
by Scott.Pearce
Atronics wrote:1. How do I format the vbStrings to show only two decimal places?
Decimal places can be controlled by passing a parameter to the AddColumn() function. Intellisense on that function will reveal some other interesting optional parameters which can give you even greater control (such as specifying the column ordinal in the search query to use for the decimal places count!). Below sets the SoH search column to show 2 decimal places for all rows:
- Code: Select all
.AddColumn ("SoH", vbString, "", 12, 5, , 2)
Atronics wrote:2. How do I get the SQL query to select records only from the current logical warehouse? It currently gets all SoH records.
You can add in a WHERE clause and get the current IN_LogicaIID from the JiwaApplication object (which is always available to you):
- Code: Select all
.SQLStr = "SELECT IN_Main.InventoryID, IN_Main.PartNo, IN_Main.Description, IN_Main.Units, IN_WarehouseSOH.QuantityLeft - IN_WarehouseSOH.QuantityAllocated [SoH], IN_Main.DefaultPrice " +
"FROM IN_Main " +
"LEFT JOIN IN_WarehouseSOH ON IN_Main.InventoryID = IN_WarehouseSOH.InventoryID " +
"WHERE IN_WarehouseSOH.IN_LogicalID = '" + JiwaApplication.Manager.Instance.Database.CurrentLogicalWarehouseID + "' "
Re: Sales Order - Inventory search form

Posted:
Thu Jul 16, 2015 3:57 pm
by Atronics
Thanks, Scott. All working well! I will explore the formatting.