More ranges for Manual Backorder Release  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Re: More ranges for Manual Backorder Release

Postby Mike.Sheen » Mon Jun 03, 2019 5:56 pm

Hi Danny,

I've come full circle on this and have concluded you still need to essentially re-do the business logic and form to extend this in any meaningful way.

The code I showed to replace the AddRange method won't actually work (I've gone and tried it) because the item being added to the collection of lines has properties which are classes that contain friend property setters - so any class outside the assembly won't be allowed to set certain properties... for instance, this part:

Code: Select all
If manualBoReleaseForm.ManualBOBatch.InventoryItems.Contains(InventoryID) = False Then
   newInventoryItem = manualBoReleaseForm.Manager.CollectionItemFactory.CreateCollectionItem(Of InventoryItem)
   newInventoryItem.Inventory.ReadRecord(InventoryID)
   newInventoryItem.QuantityAvailable = .Sanitise(SQLReader, "QuantityAvailable")
   newInventoryItem.RecID = InventoryID
   manualBoReleaseForm.ManualBOBatch.InventoryItems.Add(newInventoryItem)
End If


will not be able to work because the QuantityAvailable property of the InventoryItem class has a friend setter. And you cannot just inherit from InventoryItem and shadow the setter because you still won't be able to add that to the InventoryItems collection because it wan'ts it's type of InventoryItem, not a decended one.

And there's a whole bunch more in other classes - specifically SalesOrder and BatchLine.

I think perhaps what Nina was doing was repurposing the Manual BO Release form so that it did something completely different? I can't see how Nina's code could have added to the BatchLines collection and have the form behave as it should after that point.
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: More ranges for Manual Backorder Release

Postby DannyC » Tue Jun 04, 2019 9:06 am

I can't see how Nina's code could have added to the BatchLines collection and have the form behave as it should after that point.


I've fiddled a bit more too and can't get it going. Nina has missed a key part of code...There seems to be a custom class or namespace called CustomRanges which is essential for Nina's code to be complete. Nina, if you have that code too, that'd be great!
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: More ranges for Manual Backorder Release

Postby Mike.Sheen » Tue Jun 04, 2019 8:42 pm

Hi Danny,

Nina was generous enough to communicate with me via a side-channel to give me some guidance on how they implemented this. It's not appropriate for Nina to share the code, so I'll whip something up clean-room fashion to re-invent the technique and post it here, thereby sidestepping any IP / privacy issues around it - so stay tuned!

Hint: reflection

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

Re: More ranges for Manual Backorder Release

Postby DannyC » Wed Jun 05, 2019 12:54 pm

Nina was generous enough to communicate with me via a side-channel

Cool! Thanks Nina, really appreciated & definitely understand re confidentiality.

Cheers
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: More ranges for Manual Backorder Release  Topic is solved

Postby Mike.Sheen » Wed Jun 19, 2019 3:27 pm

As promised, attached is a sample plugin for 7.2 which achieves this.

As per the plugin description:
Adds 2 ranges to the Manual BO Realse Batch form which are passed to the stored procedure used to return results to the BackOrders grid.
The Documents tab contains a SQL script to create a custom stored procedure which accepts the two extra parameters.

Plugin Manual BO Release Batch Extend Ranges.xml
(53.2 KiB) Downloaded 133 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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: More ranges for Manual Backorder Release

Postby DannyC » Thu Jun 27, 2019 12:20 pm

Mike,

That's great.
I tweaked the stored procedure to actually use the passed in parameters and it works!
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: More ranges for Manual Backorder Release

Postby DannyC » Fri Sep 04, 2020 6:24 pm

Another question about the Manual Backorder Release screen.

The plugin from this thread is awesome for extending the ranges and passing into a custom stored proc...but I have been asked if it's possible to add a couple of columns to the results grid.
1. Unprocessed backorders
2. Qty on purchase orders

I don't need to know the SQL to get the figures above, but I do need assistance to show those extra columns on the grid.

Would be grateful for any guidance.
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: More ranges for Manual Backorder Release

Postby SBarnes » Fri Sep 04, 2020 6:33 pm

I'll be honest I haven't looked if the form operates the same way as the debtors sales screen in that it draws each line as its added to the collection of line for the business object and at this time on a Friday night I am not going to but if it does which you can probably work out for yourself by looking at the code in Just Decompile then have a look at this post viewtopic.php?f=26&t=1366
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: More ranges for Manual Backorder Release

Postby SBarnes » Fri Sep 04, 2020 7:04 pm

Ok it doesn't operate like the other form but Mike is displaying the lines by calling the following code in the plugin so after that code if you had added some columns to the grid in your set up you could in theory roll over the grid and fill them in or alternatively have a look at DisplayBatchLine and DisplayBatchLines in the form and rewrite them to include the extra columns and do away with Mike's code below.

Code: Select all
      ' Invoke the private method of the form to display the lines
      'manualBoReleaseForm.GetType.InvokeMember("DisplayBatchLines", BindingFlags.NonPublic Or BindingFlags.Instance, Nothing, Me, Nothing)
      Dim dynMethod As MethodInfo = manualBoReleaseForm.GetType().GetMethod("DisplayBatchLines", BindingFlags.NonPublic Or BindingFlags.Instance)
      dynMethod.Invoke(manualBoReleaseForm, Nothing)
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: More ranges for Manual Backorder Release

Postby SBarnes » Tue Sep 22, 2020 11:55 am

Hi Mike,

There is a bug in the plugin provided on this forum post, what happens is the when you tick the fulfil button it is not changing the quantities which is normal Jiwa behaviour.

Interestingly if you disable the plugin any batches created whilst the plugin was active still have the same problem it is only when you disable the plugin and create a new batch that you don't get the problems.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

PreviousNext

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron