Change to Sales Order Processing and Batch Processing Screen  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Change to Sales Order Processing and Batch Processing Screen

Postby SBarnes » Fri Oct 21, 2016 2:57 pm

Hi All,

I have a requirement to change the processing of a sales order under certain conditions, namely I need to create multiple debtor transactions per sales order history if certain custom fields are set. Mike's advice which I am following is to take over the processing in process start event and then throw a ClientCancelledException at the end so that Jiwa won't try and process the order. This works fine for a single order but in the batch processing screen will result in candidates that look like they haven't processed even though I can put in a success message in the ClientCancelledException constructor.

Is it possible to to inherit from the Batch Processing Object such as

Code: Select all
   class SplitBatchProcess : JiwaFinancials.Jiwa.JiwaSales.BatchProcessing.BatchProcess
   {
      public override void Process()
      {

      
      }
   }


and then override the Process to ignore client ClientCancelledException and then attach this new object to the Jiwa Batch processing form or is there another type of exception that can be thrown that will make Jiwa think everything processed correctly as this would be an easier solution?

Any help is appreciated.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Change to Sales Order Processing and Batch Processing Sc

Postby perry » Wed Nov 02, 2016 11:20 am

ProcessCandidate has property of "Exception" and "Remark". I would try to overwrite these 2 at the end of batch process.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Change to Sales Order Processing and Batch Processing Sc

Postby SBarnes » Fri Nov 04, 2016 11:01 pm

Thanks Perry,

I'll have a look at this, I had developed part of an idea for a work around but looking at changing those two properties would be far simpler.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Change to Sales Order Processing and Batch Processing Sc

Postby SBarnes » Sat Nov 12, 2016 5:16 pm

Hi Perry,

what you have suggested does work the only problem I have now is getting the run number used by the form what I suspect I am going to have to try is aborting in the the process end event rather than start and grabbing the run number off the last history at that point and by also flagging on the sales order that its being used in the batch processing screen by using the the Generic object collection which is going to make it still fairly complicated.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Change to Sales Order Processing and Batch Processing Sc

Postby Mike.Sheen » Sun Nov 13, 2016 2:08 pm

SBarnes wrote:Is it possible to to inherit from the Batch Processing Object such as

Code: Select all
   class SplitBatchProcess : JiwaFinancials.Jiwa.JiwaSales.BatchProcessing.BatchProcess
   {
      public override void Process()
      {

      
      }
   }


and then override the Process to ignore client ClientCancelledException and then attach this new object to the Jiwa Batch processing form or is there another type of exception that can be thrown that will make Jiwa think everything processed correctly as this would be an easier solution?

Any help is appreciated.


You can do that, but then you'd have to provide a custom batch processing form to use your business logic instead of ours because we haven't got any dependency injection providing an easy way to do that (assuming this is going to be invoked via the user via a form) - if it's some other process and not via our standard batch processing form then things are a bit simpler - you just need to replicate what we do in our batch process method and add a try catch on client cancelled and deal with it that way.

I can't see an easy solution to this without modifying our code to allow the level of customisation you need. There is also the consideration that various other aspects of the system (reports, for example) may make the assumption that only one debtor transaction exists for any given sales order history (snapshot).

We can add an event to be fired from the process method which passes you the necessary information (sales order object, candidate debtor transaction) and allows you to return by reference a list of debtor transaction objects, which we could then create for you. Some considerations as how to handle payment allocations (if there are payments on the order) would need to be made.

We could also add a property (or method parameter) and allow that property to be set on the sales order which is an anonymous method which we invoke for building the debtor transactions, and/or the processing in general. We do something similar for the ProcessPayments of a sales order:

Code: Select all
Public Sub ProcessPayments(Optional x As Func(Of JiwaCashBook.CashBookTransaction, JiwaCashBook.CashBookTransaction) = Nothing)


We added the above to allow the cashbook receipt transaction created to have the transaction customised as desired - specifically in Magento integrations to set the reference to be a PayPal or CC provider transaction reference to assist in reconciliation.

Following the same approach, when we build a debtor transaction, we could check if the sales order process method has been provided a method as a parameter for debtor transaction construction, and invoke that instead of our transaction construction, and alter our framework to have a list of transactions instead of just one.

Lots of options, but we'd need to modify things our end to make this work in a robust and clean way.

I suggest creating an improvement request via http://helpdesk.jiwa.com.au with your requirements to get things started.

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: Change to Sales Order Processing and Batch Processing Sc

Postby SBarnes » Sun Nov 13, 2016 2:57 pm

Hi Mike,

I do agree with you this becoming quite a complex customisation but its already happening in a version prior to 7 for the client so it's now a case of replicating it, but I do see your point that the only "clean" way to do would be through delegating the debtor transaction building which does raise the question of if it was done as part of Jiwa's main code would doing the same thing for the journals also be worthwhile as it would definitely create a high level of flexibility?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Change to Sales Order Processing and Batch Processing Sc  Topic is solved

Postby Mike.Sheen » Fri May 19, 2017 9:44 pm

FYI this had been implemented in 7.00.181.00 - sample plugin showing how to split the debtor transactions and journals is attached to the issue DEV-5665.
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: Change to Sales Order Processing and Batch Processing Sc

Postby SBarnes » Sat May 20, 2017 7:08 am

Hi Mike,

I can only say two things

ABSOLUTELY FANTASTIC and THANKS :D
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 17 guests