Purchase Order Generation - SoH in other warehouses  Topic is solved

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

Purchase Order Generation - SoH in other warehouses

Postby Atronics » Mon Dec 21, 2015 11:39 am

One of our sites with multiple warehouses wants to see SoH available, as a total figure, in warehouses other than the one in which the PO Generation form is being created. For some items it would be preferable to ship the item from another location, rather than purchase it. How can I add this new column to the grid?
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10

Re: Purchase Order Generation - SoH in other warehouses  Topic is solved

Postby Mike.Sheen » Mon Dec 21, 2015 1:28 pm

Atronics wrote:One of our sites with multiple warehouses wants to see SoH available, as a total figure, in warehouses other than the one in which the PO Generation form is being created. For some items it would be preferable to ship the item from another location, rather than purchase it. How can I add this new column to the grid?


Adding a column can be done at the Setup time of the FormPlugin class. You'd also add handlers there on when the user clicks the "Go" button and probably also and the read to get the SOH for other warehouses and set that in the grid.

i.e.:

Add the column and add the handlers:
Code: Select all
// Add the column to the grid.
poGenerationform.ProductsJiwaGrid.AddColumn("OtherSOH", new FarPoint.Win.Spread.CellType.NumberCellType(), "SOH other Warehouses", 8, false, true, true, true, 0, false, false, 0, false);
// Lock the column
poGenerationform.ProductsJiwaGrid.LockColumn(true, "OtherSOH", -1);

// Add a handler for when a form is read to populate the other SOH column
poGenerationform.PurchaseOrderGeneration.ReadEnd += PurchaseOrderGeneration_ReadEnd;
      
// Add a handler for when the user clicks the GetCandidatesUltraButton
poGenerationform.GetCandidatesUltraButton.Click += GetCandidatesUltraButton_Click;


Once done, setting the value is simply iterating through the grid, getting the inventory id of each item a row in the grid represents, calling a SQL query to get a sum of the quantity in other warehouses and putting that value in the grid - eg:

Code: Select all
private void PopulateOtherSOHColumn(JiwaFinancials.Jiwa.JiwaPurchaseOrderGenerationUI.MainForm poGenerationForm)
{                   
   for(int row = 0; row < poGenerationForm.ProductsJiwaGrid.ActiveSheet.RowCount; row++)
   {
      string purchaseOrderKey = poGenerationForm.ProductsJiwaGrid.get_GridText("PurchaseOrderKey", row).ToString();
      string purchaseOrderLineKey = poGenerationForm.ProductsJiwaGrid.get_GridText("PurchaseOrderLineKey", row).ToString();
      
      if(purchaseOrderKey.Trim().Length > 0 && purchaseOrderLineKey.Trim().Length > 0)
      {
         JiwaFinancials.Jiwa.JiwaPurchaseOrderGeneration.PurchaseOrder purchaseOrder = poGenerationForm.PurchaseOrderGeneration.PurchaseOrders[purchaseOrderKey];
         JiwaFinancials.Jiwa.JiwaPurchaseOrderGeneration.Line purchaseOrderLine = purchaseOrder.Lines[purchaseOrderLineKey];
         
         decimal SOHOtherWarehouses = GetSOHOtherWarehouses(purchaseOrderLine.Inventory.InventoryID, poGenerationForm.PurchaseOrderGeneration.LogicalWarehouseResidingIn.IN_LogicalID);
         
         poGenerationForm.ProductsJiwaGrid.set_GridText("OtherSOH", row, SOHOtherWarehouses);
      }
   }
}


Attached is a plugin which does all this.
Attachments
Plugin PO Generation - Add Other Warehouses SOH Column.xml
Sample Plugin
(33.64 KiB) Downloaded 630 times
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: Purchase Order Generation - SoH in other warehouses

Postby Atronics » Tue Jan 05, 2016 9:37 am

Thanks, Mike.
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 3 guests