Sales Order batch printing/emailing sortable grid

Discussions relating to plugin development, and the Jiwa API.

Sales Order batch printing/emailing sortable grid

Postby DannyC » Wed Feb 05, 2020 3:36 pm

Any reason why the batch printing/emailing grid can't be sorted?
I have a client who really needs it.
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: Sales Order batch printing/emailing sortable grid

Postby Scott.Pearce » Wed Feb 05, 2020 3:42 pm

Sorting is a grid-only/UI thing. The underlying collection is the order in which the actions are processed when the "Process" button is clicked.

To change the order in which the actions are processed, you need to modify the underlying stored procedure that spits back rows when you click the "Go" button. The stored proc used is defined at System Settings->System Configuration->Invoicing->StoredProcForGettingActionsInSOBatchPrinting
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Sales Order batch printing/emailing sortable grid

Postby Mike.Sheen » Wed Feb 05, 2020 3:45 pm

Scott.Pearce wrote:Sorting is a grid-only/UI thing. The underlying collection is the order in which the actions are processed when the "Process" button is clicked.

To change the order in which the actions are processed, you need to modify the underlying stored procedure that spits back rows when you click the "Go" button. The stored proc used is defined at System Settings->System Configuration->Invoicing->StoredProcForGettingActionsInSOBatchPrinting


You could also allow sorting on the grid, hook into the grid sorted event and in there renumber the itemNo property of each item in the backing collection which would then cause the print / email to be performed in the order the user sorted by.

And while you're at it, add the row header and allow row-drag and dropping to reorder.

Should only take a few minutes. Get cracking, Scott.
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: Sales Order batch printing/emailing sortable grid

Postby Scott.Pearce » Wed Feb 05, 2020 3:52 pm

On it.

Logged as https://service.jiwa.com.au/browse/DEV-8052 and will also include in next SR.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Sales Order batch printing/emailing sortable grid

Postby Mike.Sheen » Wed Feb 05, 2020 3:52 pm

Scott.Pearce wrote:On it.

Logged as https://service.jiwa.com.au/browse/DEV-8052 and will also include in next SR.


I meant as a plugin!
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: Sales Order batch printing/emailing sortable grid

Postby DannyC » Wed Feb 05, 2020 4:19 pm

Well either would be good.
A plugin for 7.2.1 for now, until the next SR is released.

Luv ya work fellas.
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: Sales Order batch printing/emailing sortable grid

Postby SBarnes » Wed Feb 05, 2020 8:56 pm

Actually a change to the Jiwa Grid so that there was a flag passed in for making it sortable would be good on AddColumn, just so long as it didn't break existing code.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Sales Order batch printing/emailing sortable grid

Postby Mike.Sheen » Thu Feb 06, 2020 6:54 pm

SBarnes wrote:Actually a change to the Jiwa Grid so that there was a flag passed in for making it sortable would be good on AddColumn, just so long as it didn't break existing code.


I think we already do have an AllowSort parameter passed to AddColumn - it's just this form must have not set that to true when adding the columns - probably because when the user sorted the grid it didn't change the order it was actually printed / emailed in. In all other places in Jiwa where we let the user sort a grid, we don't renumber the ItemNo property of each item of the backing collection because we didn't want just UI sorting to result in the business logic going and setting the ItemNo property dirtying all items in the collection resulting in every item being updated on save... but in this case it seems reasonable to have a UI sort doing exactly that.
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: Sales Order batch printing/emailing sortable grid

Postby SBarnes » Thu Feb 06, 2020 7:05 pm

Ah now I get the idea behind your original post on this it shouldn't be that hard to do it in a plugin after having a look at how the grid was setup to have the column ids and know which column is which and then hook up to the sort event and access the business logic object in a form plugin
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Sales Order batch printing/emailing sortable grid

Postby SBarnes » Fri Feb 07, 2020 11:08 am

Ok this became little more difficult than I thought in doing this for the service release it may be worth noting the following(apologies if any of this is obvious)

1. Turning sorting on wasn't that difficult on the grid, however it might be nice if the grid had an alter column method that took the same params as add column

2. Because repainting the entire grid can be slow when there a lots of candidates its better to just up date the line number on the grid and stay away from the backing store until the user is ready to process.

3. Only update the candidates collection when the user presses the process button. However is appears DisplayActions on the form only iterates over the collection and doesn't take into account the line number, so I had to using a working collection to get them in order and clear and refill the candidates.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
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 5 guests