Sales Order - Inventory search form  Topic is solved

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

Sales Order - Inventory search form

Postby Atronics » Mon Jul 13, 2015 3:25 pm

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.
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10

Re: Sales Order - Inventory search form

Postby Mike.Sheen » Wed Jul 15, 2015 7:33 pm

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
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Plugin Sample - Custom Search - Email

Postby Atronics » Thu Jul 16, 2015 11:39 am

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.
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10

Re: Plugin Sample - Custom Search - Email

Postby Atronics » Thu Jul 16, 2015 1:45 pm

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
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10

Re: Sales Order - Inventory search form  Topic is solved

Postby Scott.Pearce » Thu Jul 16, 2015 3:08 pm

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 + "' "
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Sales Order - Inventory search form

Postby Atronics » Thu Jul 16, 2015 3:57 pm

Thanks, Scott. All working well! I will explore the formatting.
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests