Plugin enabling  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Plugin enabling

Postby Professional » Fri Dec 16, 2016 11:49 am

Hi,
Is there a simple way to not execute a plugin under certain circumstances or is it a matter of checking for that somewhere in the code?
For example say the Sales Order Customer Panel Plugin and you don't want that to appear for Cash Only customers but do for account customers.
Thanks,
Jeff
Professional
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Mon Dec 08, 2008 3:45 pm

Re: Plugin enabling  Topic is solved

Postby Mike.Sheen » Sat Dec 17, 2016 12:05 pm

Hi Jeff,

You would need to modify the plugin to hide or show the panel based on the debtor.

By adding a handler in the ReadEnd and CreateEnd events you can examine the debtor and then set the splitter control for the customer panel to be expanded or not.

With our current plugin we already do listen to the ReadEnd and CreateEnd events, so you can just modify that - so for example in the ReadEnd it currently looks like this:
Code: Select all
Public Sub SalesOrder_ReadCompleted(sender As Object, e As System.EventArgs)
   ReadCustomerSalesHistory()
   DisplayProductDetailsForRow(0)             
End Sub


Changing it to the below will hide the panel when the AccountNo is "1001":
Code: Select all
Public Sub SalesOrder_ReadCompleted(sender As Object, e As System.EventArgs)
   ReadCustomerSalesHistory()
   DisplayProductDetailsForRow(0)
      
   Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = sender
   If salesOrder.Debtor.AccountNo = "1001" Then
      Splitter.Collapsed = True
   Else
      Splitter.Collapsed = False         
   End If                
End Sub


Attached is a plugin demonstrating this. Disable the standard Customer Panel plugin, import the attached and search for "1001" and change that to be the account no you're using for cash sales (there will be two places "1001" occurs - the methods SalesOrder_ReadCompleted and SalesOrder_Created), then save and log out and log back in.

Mike
Attachments
Plugin Modified Sales Order Customer Panel.xml
Sample Plugin
(81.51 KiB) Downloaded 137 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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Plugin enabling

Postby Professional » Mon Dec 19, 2016 3:25 pm

Thanks Mike That's a big help Cheers
Professional
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Mon Dec 08, 2008 3:45 pm


Return to Technical and or Programming

Who is online

Users browsing this forum: Google [Bot] and 12 guests