Hyperlink and Drill Down to Form from JiwaGrid  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Hyperlink and Drill Down to Form from JiwaGrid

Postby SBarnes » Sun Oct 08, 2017 9:34 am

Hi Guys

The following code will drill down and load the sales order screen for values provided

Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.DrillDownByFormNumber(line.InvoiceHistory.InvoiceID,300);


Is there a way to embed this in the Jiwa Grid like a hyperlink and secondly is there a list of the form numbers where the invoice for instance is 300, I have already looked in SY_Forms and the value is not kept there?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Hyperlink and Drill Down to Form from JiwaGrid

Postby Mike.Sheen » Sun Oct 08, 2017 2:02 pm

Hi Stuart,

The DrillDownByFormNumber is a legacy compatibility method provided to assist where old version 6 breakout scripts are converted to version 7 plugins. We generally don't use that, and I think there is only a handful of places where it is still used in our code which we have not got to converting yet.

Instead, we use the SetDrillDown method when populating the cells in a grid, which uses the SY_Forms.Classname to provide the form to load.

For instance, in sales order entry, when we display a sales order line, we set the drill down for the PartNo column like so:

Code: Select all
grdLines.SetDrillDown("PartNo", Row, "JiwaFinancials.Jiwa.JiwaInventoryUI.InventoryMaintenanceForm", SalesOrderLine.InventoryID)


The grid will then handle the double right click and load the inventory maintenance form for the provided InventoryID.

The DrillDownByFormNumber method simply maps the old version 6 form numbers to the SY_Forms.Classname:

Code: Select all
Public Sub DrillDownByFormNumber(ByVal DrillDownID As String, ByVal LegacyFormNo As Integer, Optional NewRecord As Boolean = False)
   Dim className As String = Nothing

   Select Case LegacyFormNo
      Case 100
         className = "JiwaFinancials.Jiwa.JiwaInventoryUI.InventoryMaintenanceForm"
      Case 101
         className = "JiwaFinancials.Jiwa.JiwaStockTransferUI.MainForm"
      Case 108
         className = "JiwaFinancials.Jiwa.JiwaBOAllocUI.frmBOAllocation"
      Case 124
         className = "JiwaFinancials.Jiwa.JiwaStockTakeUI.frmMain"
      Case 140
         className = "JiwaFinancials.Jiwa.JiwaWhouseTransferUI.WarehouseTransferOut"
      Case 141
         className = "JiwaFinancials.Jiwa.JiwaWhouseTransferUI.WarehouseTransferIn"
      Case 200
         className = "JiwaFinancials.Jiwa.JiwaDebtorsUI.frmDebtor"
      Case 300
         className = "JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm"
      Case 301
         className = "JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.BackToBackSalesOrderEntryForm"
      Case 302
         className = "JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.CreditNoteForm"
      Case 400
         className = "JiwaFinancials.Jiwa.JiwaPurchaseOrdersUI.PurchaseOrders"
      Case 401
         className = "JiwaFinancials.Jiwa.JiwaPurchaseOrdersUI.BackToBackPurchaseOrders"
      Case 410
         className = "JiwaFinancials.Jiwa.JiwaInvReceivalUI.MainForm"
      Case 411
         className = "JiwaFinancials.Jiwa.JiwaPurchaseInvoicesUI.MainForm"
      Case 421
         className = "JiwaFinancials.Jiwa.JiwaLandedCostUI.BookIn.BookIn"
      Case 450
         className = "JiwaFinancials.Jiwa.JiwaSalesUI.SalesQuote.SalesQuoteEntryForm"
      Case 500
         className = "JiwaFinancials.Jiwa.JiwaGeneralLedgerUI.MainForm"
      Case 510
         className = "JiwaFinancials.Jiwa.JiwaJournalSetsUI.MainForm"
      Case 530
         className = "JiwaFinancials.Jiwa.JiwaBankRecUI.MainForm"
      Case 550
         className = "JiwaFinancials.Jiwa.JiwaCashBookUI.frmCashBookReceipts"
      Case 551
         className = "JiwaFinancials.Jiwa.JiwaCashBookUI.frmCashBookPayments"
      Case 800
         className = "JiwaFinancials.Jiwa.JiwaCreditorsUI.frmCreditor"
      Case 801
         className = "JiwaFinancials.Jiwa.JiwaCreditorChqPayUI.CreditorChqPay"
      Case 803
         className = "JiwaFinancials.Jiwa.JiwaCRBatchTXUI.CreditorTransactions"
      Case 804
         className = "JiwaFinancials.Jiwa.JiwaCRBatchTXUI.CreditorDebitAdjustment"
      Case 806
         className = "JiwaFinancials.Jiwa.JiwaCRBatchTXUI.CreditorPayment"
      Case 808
         className = "JiwaFinancials.Jiwa.JiwaCRBatchTXUI.CreditorCreditAdjustment"
      Case 900
         className = "JiwaFinancials.Jiwa.JiwaContactsUI.frmContact"
      Case 1240
         className = "JiwaFinancials.Jiwa.JiwaJobCostingUI.MainForm"
      Case 398
         className = "JiwaFinancials.Jiwa.JiwaPriceSchemesUI.frmPriceScheme"
      Case 203
         className = "JiwaFinancials.Jiwa.JiwaDebtorBatchTransUI.DebtorReceipt"
      Case 204
         className = "JiwaFinancials.Jiwa.JiwaDebtorBatchTransUI.DebtorCreditAdjustment"
      Case 206
         className = "JiwaFinancials.Jiwa.JiwaDebtorBatchTransUI.DebtorInvoice"
      Case 207
         className = "JiwaFinancials.Jiwa.JiwaDebtorBatchTransUI.DebtorDebitAdjustment"
      Case 1000
         className = "JiwaFinancials.Jiwa.JiwaServiceManagerUI.Jobs"
      Case 1290
         className = "JiwaFinancials.Jiwa.JiwaJobCostingUI.CostEntry"
      Case 1400
         className = "JiwaFinancials.Jiwa.JiwaBillOfMaterialsUI.BillMaintenance.BillMaintenance"
      Case 1401
         className = "JiwaFinancials.Jiwa.JiwaBillOfMaterialsUI.WorkOrder.WorkOrder"
      Case 1504
         className = "JiwaFinancials.Jiwa.JiwaSupplierReturnsUI.Credit.Credit"
   End Select

   If className Is Nothing Then
      Throw New Exception("Legacy FormNo " & LegacyFormNo & " is not known.")
   End If

   Dim form As JiwaApplication.IJiwaForm = FormFactory.CreateForm(className)
   If NewRecord Then
      form.DrillDownID = DrillDownID
      form.Start()
      form.NewRecord()
   Else
      form.DrillDownID = DrillDownID
      form.Start()
      ' form.ReadRecord(DrillDownID)
   End If
End Sub


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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Hyperlink and Drill Down to Form from JiwaGrid

Postby SBarnes » Sun Oct 08, 2017 5:51 pm

Hi Mike,

Thanks for that.

Will this also work to drill into any custom forms inheriting from the base Maintenance or base Process Action or do you have to add some additional code in the custom form?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Hyperlink and Drill Down to Form from JiwaGrid

Postby Mike.Sheen » Sun Oct 08, 2017 5:54 pm

SBarnes wrote:Hi Mike,

Thanks for that.

Will this also work to drill into any custom forms inheriting from the base Maintenance or base Process Action or do you have to add some additional code in the custom form?


Hi Stuart,

Yes - that will work, as long as there is an entry in the SY_Forms table - the grid will load the assembly and create an instance of the class and invoke it appropriately.

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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Hyperlink and Drill Down to Form from JiwaGrid

Postby SBarnes » Sun Oct 08, 2017 5:56 pm

Thanks
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Hyperlink and Drill Down to Form from JiwaGrid

Postby SBarnes » Tue Oct 10, 2017 1:19 pm

Hi Mike,

This works but is there a property to make the mouse over turn to the hand so the user knows they can drill down or does this require code in a plugin directly?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Hyperlink and Drill Down to Form from JiwaGrid  Topic is solved

Postby Mike.Sheen » Fri Nov 10, 2017 9:57 am

The cursor will change to Cursors.Hand when the mouse moves over a cell with the "DrillDown" encoded property in the tag of the column header set to "1".

When adding columns this is set for you if you passed the DrillDown parameter as true - but you can also set it at any time using the StoreProperty method to adjust the text in the Tag of the column header:

Code: Select all
grdLines.ActiveSheet.ColumnHeader.Cells(1, columnNumber).Tag = StoreProperty(grdLines.ActiveSheet.ColumnHeader.Cells(1, columnNumber).Tag, "DrillDown", "1")


Now the step you're probably missing is when you add a row to the grid and populate the data you should also be copying the column header tag to the cell tag - that will cause the DrillDown property for the cell to be the same as the header:
Code: Select all
' copy col header tag into each cell tag.
For Each column As FarPoint.Win.Spread.Column In grdLines.ActiveSheet.Columns
   grdLines.ActiveSheet.Cells(Row, column.Index).Tag = grdLines.ActiveSheet.ColumnHeader.Cells(1, column.Index).Tag
Next


Or you can set the drilldown for an individual cell explicitly:
Code: Select all
grdLines.ActiveSheet.Cells(Row, columnNumber).Tag = grdLines.StoreProperty(grdLines.ActiveSheet.Cells(Row, columnNumber).Tag, "DrillDown", "1")
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Hyperlink and Drill Down to Form from JiwaGrid

Postby SBarnes » Sat Nov 11, 2017 3:41 pm

Thanks that fixed it
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 14 guests