Re: Billing coding problem
- From: Igor Neyman <igor.neyman@xxxxxxxxx>
- To: sbecker6925@xxxxxxxxx
- Date: Fri, 19 Aug 2011 11:24:36 -0400
Let's call it "capacity".
amount_to_bill = flat_fee +
(CASE WHEN ((capacity > 10) AND (capacity <= 20))
THEN (capacity - 10)*rate1
WHEN (capacity > 20) THEN 10*rate1
ELSE 0
END) +
(CASE WHEN ((capacity > 20) AND (capacity <= 50))
THEN (capacity - 20)*rate2
WHEN (capacity > 50) THEN 30*rate2
ELSE 0
END) +
(CASE WHEN (capacity > 50) THEN (capacity -
50)*rate3
ELSE 0
END) ;
HTH,
Igor Neyman
On Fri, Aug 19, 2011 at 11:07 AM, Sandra Becker <sbecker6925@xxxxxxxxx>wrote:
> Oracle - EE 10.2
>
> I have been asked to code an Apex application to replace our current poorly
> performing, inaccurate and woefully inadequate billing procedures, most of
> which is manual. Very sad state of affairs for a software company, but
> there you have it. The problem stems from the way we bill certain customers
> for archiving their data. Billing is a tiered structure:
>
> First 10g - flat fee
> 11-20g - rate 1
> 21-50g - rate 2
> Over 50g - rate 3
>
> To further complicate, each rate level bills only for the gig that fall in
> that level. Two examples:
>
> customer has 15g; they would be billed flat fee + (5g * rate1).
>
> customer has 200g; they would be billed flat fee + (10 * rate1) +
> (30 * rate2) + (150 * rate3)
>
> My math skills not being what they should be, I'm having difficulty coming
> up with the code to accurately calculate the billing amount. Any help will
> be greatly appreciated.
>
> --
> Sandy
> Transzap, Inc.
>
Other related posts: