get the price mode from the sales order line object?  Topic is solved

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

get the price mode from the sales order line object?

Postby DannyC » Mon Aug 30, 2021 5:18 pm

From the object JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine I want to get the returned price mode, so whether it's Percentage, Actual or None (assuming the price has come from Debtor Specific price, Debtor Classification Price, Debtor Group price, etc).

I've looked in
Code: Select all
soLine.PriceSelected

and
Code: Select all
soLine.PriceSelected.SourcePrice
but neither gives me the mode of the returned price.

Do I just need to whip up an SQL select statement to find the mode?
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: get the price mode from the sales order line object?

Postby Mike.Sheen » Mon Aug 30, 2021 6:30 pm

DannyC wrote:From the object JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine I want to get the returned price mode, so whether it's Percentage, Actual or None (assuming the price has come from Debtor Specific price, Debtor Classification Price, Debtor Group price, etc).

I've looked in
Code: Select all
soLine.PriceSelected

and
Code: Select all
soLine.PriceSelected.SourcePrice
but neither gives me the mode of the returned price.

We don't have properties of prices which aren't universally generic available from there - just what we knew would be fairly generic and useful (like the price in dollars and cents, does the price have a date range, quantity break and so on).

DannyC wrote:Do I just need to whip up an SQL select statement to find the mode?


That's a good way to do it - in the case of a debtor specific price, the soLine.PriceSelected.SourceID is the RecID from the IN_DebtorSpecificPrice table, so using that you can find the other values you're interested in. Just be aware that a debtor specific price might not be the source of the price, so SourceID will need to link to something else - you can work out which table columns SourceID links to by looking at the stored proc backing the price - whatever goes into the RecID column being returned by the stored procs is what ends up in the SourceID property of the soLine.PriceSelected.SourceID.
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: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: get the price mode from the sales order line object?  Topic is solved

Postby DannyC » Mon Aug 30, 2021 11:03 pm

I was thinking about the sourceID, but then I thought it would be more readable if I used the description so I knocked up a routine which basically fires off the relevant SQL statement to find the OPMode. Pretty much like this:
Code: Select all
switch (soLine.PriceSelected.SourcePrice.Description)
{
   case "Debtor Specific Price":
      //do stuff to get the mode.
   break;
   
   case "Debtor Parent Price":
      //do stuff to get the mode.            
   break;
      
   case "Debtor Classification Price":
      //do stuff to get the mode.
   break;
      
   case "Debtor Group Price":
      //do stuff to get the mode.
   break;
      
   case "Debtor Parent Classification Price":
      //do stuff to get the mode.
   break;
}
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 4 guests