setting the sales order line tax rate  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

setting the sales order line tax rate

Postby DannyC » Tue Apr 19, 2016 7:05 pm

Hi,

Just writing a quick little plugin to force the Sales Order line tax rate to "No Code" based on a particular condition - in this case a debtor classification.
It seems I can't set the TaxRate because it is read only.
version 7.0.157.
Language: The proper one. VB .Net.

What do you recommend to set it?
My code at the moment
Code: Select all
   Sub LineAdded(SalesOrderLine As JiwaSales.SalesOrder.SalesOrderLine)
      Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(SalesOrderLine.SalesOrderLines.SalesOrder, JiwaSales.SalesOrder.SalesOrder)
      Dim MyTaxRate As JiwaApplication.JiwaTaxSystemRates.TaxRates =JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaApplication.JiwaTaxSystemRates.TaxRates)(Nothing)
      'MyTaxRate.Read("1c8929e75bd341a19d4d")  doesn't work
      MyTaxRate.Read()   'unsure if this is needed.
      'Find the debtor classification
      If salesOrder.Debtor.Classification.Description = "Whatever" Then
         SalesOrderLine.TaxRate = MyTaxRate
      End If
   End Sub   


Thanks
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: setting the sales order line tax rate

Postby Scott.Pearce » Thu Apr 21, 2016 9:22 am

You don't "set" the tax rate, your .Read() it:

Code: Select all
      If salesOrder.Debtor.Classification.Description = "Whatever" Then
         SalesOrderLine.TaxRate.Read("1c8929e75bd341a19d4d")
      End If


Also, your declaration and use of MyTaxRate is erroneous.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: setting the sales order line tax rate

Postby DannyC » Thu Apr 21, 2016 4:15 pm

How can I set it?
I need it to change based on the debtor class.
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: setting the sales order line tax rate

Postby Scott.Pearce » Thu Apr 21, 2016 5:26 pm

How can I set it?


You can't. You must .Read() it:

Code: Select all
      If salesOrder.Debtor.Classification.Description = "Whatever" Then
         SalesOrderLine.TaxRate.Read("1c8929e75bd341a19d4d")
      ElseIf salesOrder.Debtor.Classification.Description = "Whatever else" Then
         SalesOrderLine.TaxRate.Read("zzzzzzzzzz0000000000")
      End If
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: setting the sales order line tax rate

Postby DannyC » Wed Apr 27, 2016 8:55 pm

Sorry Scott, still no go.
When compiling the code I am getting an error on the Read('nnnnnn') lines
Public Event Read() is an event, and cannot be called directly. Use a RaiseEvent statement to raise an event.
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: setting the sales order line tax rate  Topic is solved

Postby Scott.Pearce » Thu Apr 28, 2016 8:44 am

Try .ReadRecord instead.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: setting the sales order line tax rate

Postby DannyC » Fri Apr 29, 2016 4:04 pm

Duh! Well, thats embarrassing - I should've tried that!

Looks like that has it sorted.
Cheers Scott.
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 1 guest