Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Net to gross calculation in PL/SQL

3234864May 9 2016 — edited May 12 2016

I've a table with different products with a range minimum and maximum and I've a discount rate for each product within the ranges.

Basically we make the invoice and based on the amount of the invoice we calculate the discount based on the scale.

My table (with data  for one product:)

PROD_IDMINMAXRATE
1250049991
15000249992
12500010000003

I already have the calculation for calculating the discount based on the given invoice amount.

if amount is less than 2500 then no discount

above 2500 we check if it is between the first range than 1% dc. the amount the remains after the 4999 gets 2% dc uptil 24999. And if there is still an amount after the 24999 the dc is 3% up till 1000000.

This is easily done within a PL/SQL function.

My issue is with the reverse calculation. Given the net amount f.i. 52000, I've to calculate the gross amount. I started working in the same way from gross to net, but offcourse this is not the right way to begin. Could someone assist me on this isse  for how to start this in PL/SQL ?

Thanks in advance/

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2016
Added on May 9 2016
18 comments
4,382 views