Trying to add/ change Sales Order Journal  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Trying to add/ change Sales Order Journal

Postby Ernst » Thu Mar 30, 2023 4:31 pm

Hi, In JIWA 721 is it possible to add lines to the end of the sales order journal that has been generated.
Client want to 2 freight cost lines and also change the debtor freight line depending on logic.

Ive tried this code as per below to get to it. But get a Compiler Error: Type Expected? The Types look good to me??

I can load up a full plugin.

Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
If TypeOf JiwaBusinessLogic Is JiwaSales.SalesOrder.SalesOrder Then
Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(JiwaBusinessLogic, JiwaSales.SalesOrder.SalesOrder)
AddHandler salesOrder.Process_DebtorTransactionsStart, AddressOf Process_DebtorTransactionsStart

Private Sub Process_DebtorTransactionsStart(ByVal SalesOrder As JiwaSales.SalesOrder.SalesOrder, ByRef DebtorTransactions As system.Collections.Generic.List(Of JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.DebtorTransaction ), ByRef JournalSets As system.Collections.Generic.List(Of JiwaFinancials.Jiwa.JiwaJournalSets ))

Compiler Error: Type Expected?
User avatar
Ernst
Kohai
Kohai
 
Posts: 219
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: Trying to add/ change Sales Order Journal

Postby SBarnes » Thu Mar 30, 2023 5:15 pm

Hi Ernst

The event you are going after is the correct one Mike very kindly added this a few years ago when I needed to create multiple debtor transactions against the sales order i.e. payments at 30 days, 60 days and 90 days, hence the reason for the lists, that being said it looks like the following in c#

Code: Select all
salesorder.Process_DebtorTransactionsStart += Process_DebtorTransactionsStart;


and

Code: Select all
public void Process_DebtorTransactionsStart(JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder SalesOrder, ref List<JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.DebtorTransaction> DebtorTransactions, ref List<JournalSet> JournalSets)
{
}


Telerik converts it to

Code: Select all
Public Sub Process_DebtorTransactionsStart(ByVal SalesOrder As JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder, ByRef DebtorTransactions As List(Of JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.DebtorTransaction), ByRef JournalSets As List(Of JournalSet))
End Sub


I also have the following using statements at the top of the plugin

Code: Select all
using JiwaFinancials.Jiwa.JiwaSales.SalesOrder;
using JiwaFinancials.Jiwa.JiwaJournalSets;



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

Re: Trying to add/ change Sales Order Journal

Postby Mike.Sheen » Thu Mar 30, 2023 5:21 pm

Process_JournalSetsSaveStart and Process_JournalSetsSaveEnd events are also useful for meddling with the journal set(s) emitted from processing a sales order.
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: Trying to add/ change Sales Order Journal

Postby SBarnes » Thu Mar 30, 2023 5:26 pm

The other thing I just remembered also is that whilst it will checks that everything adds up it doesn't validate the the tax value against the codes you set i.e. it didn't check that the GST was 10% and on the transaction if you touch it make sure that you set the amount and the fx amount otherwise this can cause problems with allocations further down the track.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Trying to add/ change Sales Order Journal

Postby Mike.Sheen » Thu Mar 30, 2023 5:40 pm

SBarnes wrote:The other thing I just remembered also is that whilst it will checks that everything adds up it doesn't validate the the tax value against the codes you set i.e. it didn't check that the GST was 10% and on the transaction if you touch it make sure that you set the amount and the fx amount otherwise this can cause problems with allocations further down the track.


It doesn't seem like Ernst wants to do anything with tax, so that shouldn't be a concern here.

Ernst your error is probably something you've overlooked - I can't readily see what.

I want to introduce you to the Code tag when putting code on forums.

It's the Code button above the textbox you put your post in.

If you put code in forum posts, decorating the code blocks with these tags provides us with the basic courtesy of being able to read your code without causing headaches or seizures.

For example, here's a code block with the event signatures of the events you would be interested in for this topic:
Code: Select all
Public Event Process_DebtorTransactionsStart(SalesOrder As SalesOrder, ByRef DebtorTransactions As List(Of DebtorTransaction), ByRef JournalSets As List(Of Jiwa.JiwaJournalSets.JournalSet))
Public Event Process_DebtorTransactionsEnd(SalesOrder As SalesOrder, ByRef DebtorTransactions As List(Of DebtorTransaction), ByRef JournalSets As List(Of Jiwa.JiwaJournalSets.JournalSet))
Public Event Process_JournalSetsSaveStart(SalesOrder As SalesOrder, ByRef DebtorTransactions As List(Of DebtorTransaction), ByRef JournalSets As List(Of Jiwa.JiwaJournalSets.JournalSet))
Public Event Process_JournalSetsSaveEnd(SalesOrder As SalesOrder, ByRef DebtorTransactions As List(Of DebtorTransaction), ByRef JournalSets As List(Of Jiwa.JiwaJournalSets.JournalSet))


It's much easier to read than plain text.

Also, providing an actual plugin with all unnecessary and irrelevant bits stripped out with no dependencies on non-standard stuff and just showing the problem you have is always going to be the fastest way to help us to help you.

Of course, taking the time and effort to do that might not be the quickest for you, but it will mean you've done everything you can to make it as easy as possible for us to help you - and if you want someone to help you, rule #1 is don't make it hard for them to do so.
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: Trying to add/ change Sales Order Journal

Postby SBarnes » Thu Mar 30, 2023 5:48 pm

Mike.Sheen wrote:Also, providing an actual plugin with all unnecessary and irrelevant bits stripped out with no dependencies on non-standard stuff and just showing the problem you have is always going to be the fastest way to help us to help you.


I couldn't agree more although it probably won't be the problem in this case, I've seen instances where someone has posted code where there was noting wrong with it and asking why it wouldn't work but the problem was they didn't have the correct form references or business logic references on the plugin so the code was not being called at all and a second set of eyes spots these kind of things fairly quickly.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Trying to add/ change Sales Order Journal

Postby Ernst » Thu Mar 30, 2023 6:03 pm

Thanks for all the help.

The code from Stuart, didnt like lists and didnt like the Journal name.

Have fixed those and back to Compiler Error: Type expected.

See plugin below

Plugin Sales Order Adjust Journal.xml
(33.35 KiB) Downloaded 34 times
User avatar
Ernst
Kohai
Kohai
 
Posts: 219
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: Trying to add/ change Sales Order Journal

Postby Ernst » Thu Mar 30, 2023 6:08 pm

OK Got it compiled by adding a .Journalset at he end of sub.

So is it possible to add lines to Journal using this breakout Or the Process_journalset Start breakout?
User avatar
Ernst
Kohai
Kohai
 
Posts: 219
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: Trying to add/ change Sales Order Journal

Postby SBarnes » Thu Mar 30, 2023 6:11 pm

yeah JiwaFinancials.Jiwa.JiwaJournalSets is the namespace not the class
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Trying to add/ change Sales Order Journal

Postby Ernst » Thu Mar 30, 2023 6:15 pm

Thanks Mike, will look out for the code button, does make it easier to read.
User avatar
Ernst
Kohai
Kohai
 
Posts: 219
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 33 guests

cron