473,550 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Processing Fees based on Percentage

MX1
Hi,

I've got an invoice form that has a bunch of business rules behind it.
Basically, I'm trying to figure out how to enter a single number in a field
(e.g. $1000) and then have the form do a bunch of math on that number.
Here's the tough part. I need the form to breakdown the number based on a
tiered structure of business rules. For example, the rules might be:

On anything up to $300 take 1% in fees
Anything over $300 and less than $500 take .5% in fees
Anything $500 and over, take .25% in fees

Can anyone think of the most strategic way to do this on a single form in
order to come up with a single fee value? I'd appreciate any input.
Thanks! :)
Nov 13 '05 #1
9 1439
Select or If Then Else Statements might work, but there might be an easier way
to do it.

Michael
Nov 13 '05 #2
There's 2 ways:
1) Use the IIf function and nest 2 or 3 levels of IIf
2) Write a VBA function

Although that fee structure you'd given might be an example, you will end up
getting less in fees if they pay more e.g. 1% of 300 = 3, .25% of 500 = 1.25
You might want to consider a stepped fee structure where they pay 1% for the
first 300 and .5% on the next 200 and .25% on the rest e.g
Value 1% .5% .25% Total
$260.00 $2.60 $0.00 $0.00 $2.60
$440.00 $3.00 $0.70 $0.00 $3.70
$600.00 $3.00 $1.00 $0.25 $4.25

Stewart
"MX1" <mx*@mx1.abc> wrote in message news:JMAJc.8721 6$IQ4.34610@att bi_s02...
Hi,

I've got an invoice form that has a bunch of business rules behind it.
Basically, I'm trying to figure out how to enter a single number in a field (e.g. $1000) and then have the form do a bunch of math on that number.
Here's the tough part. I need the form to breakdown the number based on a
tiered structure of business rules. For example, the rules might be:

On anything up to $300 take 1% in fees
Anything over $300 and less than $500 take .5% in fees
Anything $500 and over, take .25% in fees

Can anyone think of the most strategic way to do this on a single form in
order to come up with a single fee value? I'd appreciate any input.
Thanks! :)

Nov 13 '05 #3
MX1
Thanks Stewart.

Actually, the way it works is the whole amount gets charged a fee. So for
the $1000 example, I'd need the system to loop through and see that the
first $300 gets 1% which is $3. Then we have $700 remaining. The next tier
up to $500 is .5% so that would be $200 at .5% which is $1. Now we have
$500 remaining which hasn't been billed yet. That falls into the last tier
because we've already billed o the first $500. That last tier is .25% which
gets $1.25. Total fees for this customer is $5.25

Now, let's say customer B has $450. He gets same billing amount for the
first portion up to $300 which is $3. Now there is $150 remaining which
falls in the secondary tier of .5% so that is $150 x .5% which yields .75
cents. Total feeds for this customer is $3.75.

Basically, this is a pretty neat problem to crack. The logic is not bad. I
just don't know how to code this into a nested IIF statement. Not sure how
to tell the computer to move from one tier to the next. Any thoughts or an
example on how I could do this would be greatly appreciated.

Thanks a bunch!

"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:cd******** **@news.wave.co .nz...
There's 2 ways:
1) Use the IIf function and nest 2 or 3 levels of IIf
2) Write a VBA function

Although that fee structure you'd given might be an example, you will end up getting less in fees if they pay more e.g. 1% of 300 = 3, .25% of 500 = 1.25 You might want to consider a stepped fee structure where they pay 1% for the first 300 and .5% on the next 200 and .25% on the rest e.g
Value 1% .5% .25% Total
$260.00 $2.60 $0.00 $0.00 $2.60
$440.00 $3.00 $0.70 $0.00 $3.70
$600.00 $3.00 $1.00 $0.25 $4.25

Stewart
"MX1" <mx*@mx1.abc> wrote in message

news:JMAJc.8721 6$IQ4.34610@att bi_s02...
Hi,

I've got an invoice form that has a bunch of business rules behind it.
Basically, I'm trying to figure out how to enter a single number in a

field
(e.g. $1000) and then have the form do a bunch of math on that number.
Here's the tough part. I need the form to breakdown the number based on a tiered structure of business rules. For example, the rules might be:

On anything up to $300 take 1% in fees
Anything over $300 and less than $500 take .5% in fees
Anything $500 and over, take .25% in fees

Can anyone think of the most strategic way to do this on a single form in order to come up with a single fee value? I'd appreciate any input.
Thanks! :)


Nov 13 '05 #4
rkc

"MX1" <mx*@mx1.abc> wrote in message news:JMAJc.8721 6$IQ4.34610@att bi_s02...
Hi,

I've got an invoice form that has a bunch of business rules behind it.
Basically, I'm trying to figure out how to enter a single number in a field (e.g. $1000) and then have the form do a bunch of math on that number.
Here's the tough part. I need the form to breakdown the number based on a
tiered structure of business rules. For example, the rules might be:

On anything up to $300 take 1% in fees
Anything over $300 and less than $500 take .5% in fees
Anything $500 and over, take .25% in fees

Can anyone think of the most strategic way to do this on a single form in
order to come up with a single fee value? I'd appreciate any input.
Thanks! :)


If you were to store your 'business rules' in a table you could probably
use a query to calculate and return a fee amount.

Nov 13 '05 #5
Try (watch wrapping)
Fee:
CCur(IIf([Value]<=300,[Value]*0.01,IIf([Value]<=500,(([Value]-300)*0.005)+3,
(([Value]-500)*0.0025)+4) ))
This is taken from a query and will work inside a text box on a form and
report.

The IIf function is a bit of resource hog especially when nexted. Here's a
function which does the same thing

Function Fee(Optional curIn As Currency) As Currency
Dim curTemp As Currency
Select Case curIn
Case 0
curTemp = 0
Case Is <= 300
curTemp = curIn * 0.01
Case Is <= 500
curTemp = ((curIn - 300) * 0.005) + 3
Case Is > 500
curTemp = ((curIn - 500) * 0.0025) + 4
End Select
Fee = curTemp
End Function

Stewart
"MX1" <mx*@mx1.abc> wrote in message news:nGCJc.8534 5$MB3.60308@att bi_s04...
Thanks Stewart.

Actually, the way it works is the whole amount gets charged a fee. So for
the $1000 example, I'd need the system to loop through and see that the
first $300 gets 1% which is $3. Then we have $700 remaining. The next tier up to $500 is .5% so that would be $200 at .5% which is $1. Now we have
$500 remaining which hasn't been billed yet. That falls into the last tier because we've already billed o the first $500. That last tier is .25% which gets $1.25. Total fees for this customer is $5.25

Now, let's say customer B has $450. He gets same billing amount for the
first portion up to $300 which is $3. Now there is $150 remaining which
falls in the secondary tier of .5% so that is $150 x .5% which yields .75
cents. Total feeds for this customer is $3.75.

Basically, this is a pretty neat problem to crack. The logic is not bad. I just don't know how to code this into a nested IIF statement. Not sure how to tell the computer to move from one tier to the next. Any thoughts or an example on how I could do this would be greatly appreciated.

Thanks a bunch!

"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:cd******** **@news.wave.co .nz...
There's 2 ways:
1) Use the IIf function and nest 2 or 3 levels of IIf
2) Write a VBA function

Although that fee structure you'd given might be an example, you will end
up
getting less in fees if they pay more e.g. 1% of 300 = 3, .25% of 500 = 1.25
You might want to consider a stepped fee structure where they pay 1% for

the
first 300 and .5% on the next 200 and .25% on the rest e.g
Value 1% .5% .25% Total
$260.00 $2.60 $0.00 $0.00 $2.60
$440.00 $3.00 $0.70 $0.00 $3.70
$600.00 $3.00 $1.00 $0.25 $4.25

Stewart
"MX1" <mx*@mx1.abc> wrote in message

news:JMAJc.8721 6$IQ4.34610@att bi_s02... Hi,

I've got an invoice form that has a bunch of business rules behind it.
Basically, I'm trying to figure out how to enter a single number in a

field
(e.g. $1000) and then have the form do a bunch of math on that number.
Here's the tough part. I need the form to breakdown the number based
on a tiered structure of business rules. For example, the rules might be:

On anything up to $300 take 1% in fees
Anything over $300 and less than $500 take .5% in fees
Anything $500 and over, take .25% in fees

Can anyone think of the most strategic way to do this on a single form in order to come up with a single fee value? I'd appreciate any input.
Thanks! :)



Nov 13 '05 #6
"MX1" <mx*@mx1.abc> wrote in
news:nGCJc.8534 5$MB3.60308@att bi_s04:
Thanks Stewart.

Actually, the way it works is the whole amount gets charged a
fee. So for the $1000 example, I'd need the system to loop
through and see that the first $300 gets 1% which is $3. Then
we have $700 remaining. The next tier up to $500 is .5% so
that would be $200 at .5% which is $1. Now we have $500
remaining which hasn't been billed yet. That falls into the
last tier because we've already billed o the first $500. That
last tier is .25% which gets $1.25. Total fees for this
customer is $5.25

Now, let's say customer B has $450. He gets same billing
amount for the first portion up to $300 which is $3. Now
there is $150 remaining which falls in the secondary tier of
.5% so that is $150 x .5% which yields .75 cents. Total feeds
for this customer is $3.75.

Basically, this is a pretty neat problem to crack. The logic
is not bad. I just don't know how to code this into a nested
IIF statement. Not sure how to tell the computer to move from
one tier to the next. Any thoughts or an example on how I
could do this would be greatly appreciated.

Thanks a bunch!

"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:cd******** **@news.wave.co .nz...
There's 2 ways:
1) Use the IIf function and nest 2 or 3 levels of IIf
2) Write a VBA function

Although that fee structure you'd given might be an example,
you will end

up
getting less in fees if they pay more e.g. 1% of 300 = 3,
.25% of 500 =

1.25
You might want to consider a stepped fee structure where they
pay 1% for

the
first 300 and .5% on the next 200 and .25% on the rest e.g
Value 1% .5% .25%
Total
$260.00 $2.60 $0.00 $0.00
$2.60 $440.00 $3.00 $0.70 $0.00
$3.70 $600.00 $3.00 $1.00
$0.25 $4.25

Stewart
"MX1" <mx*@mx1.abc> wrote in message

news:JMAJc.8721 6$IQ4.34610@att bi_s02...
> Hi,
>
> I've got an invoice form that has a bunch of business rules
> behind it. Basically, I'm trying to figure out how to enter
> a single number in a

field
> (e.g. $1000) and then have the form do a bunch of math on
> that number. Here's the tough part. I need the form to
> breakdown the number based on a > tiered structure of business rules. For example, the rules
> might be:
>
> On anything up to $300 take 1% in fees
> Anything over $300 and less than $500 take .5% in fees
> Anything $500 and over, take .25% in fees
>
> Can anyone think of the most strategic way to do this on a
> single form in > order to come up with a single fee value? I'd appreciate
> any input. Thanks! :)
>
>


What you need to do is build a table with your fee scale in it,
sorted DESCENDING.

CAP_Amount basefee MarginalRate
99999999 4.00 .0025
500 3.00 .005
300 0.00 .01

Now you can get the values by querying the TOP 1 row, where
CAP_Amount < invoice_Amount, and do ONE calculation and get the
correct fee:

BaseFee + (Invoice_Amount - CAP_Amount) * marginalRate.

You could also use separate dLookup()s to return the three values.

Bob Quintal

Nov 13 '05 #7
MX1
Thanks. I will give this a shot.

"Bob Quintal" <bq******@gener ation.net> wrote in message
news:Xn******** **************@ 66.150.105.50.. .
"MX1" <mx*@mx1.abc> wrote in
news:nGCJc.8534 5$MB3.60308@att bi_s04:
Thanks Stewart.

Actually, the way it works is the whole amount gets charged a
fee. So for the $1000 example, I'd need the system to loop
through and see that the first $300 gets 1% which is $3. Then
we have $700 remaining. The next tier up to $500 is .5% so
that would be $200 at .5% which is $1. Now we have $500
remaining which hasn't been billed yet. That falls into the
last tier because we've already billed o the first $500. That
last tier is .25% which gets $1.25. Total fees for this
customer is $5.25

Now, let's say customer B has $450. He gets same billing
amount for the first portion up to $300 which is $3. Now
there is $150 remaining which falls in the secondary tier of
.5% so that is $150 x .5% which yields .75 cents. Total feeds
for this customer is $3.75.

Basically, this is a pretty neat problem to crack. The logic
is not bad. I just don't know how to code this into a nested
IIF statement. Not sure how to tell the computer to move from
one tier to the next. Any thoughts or an example on how I
could do this would be greatly appreciated.

Thanks a bunch!

"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:cd******** **@news.wave.co .nz...
There's 2 ways:
1) Use the IIf function and nest 2 or 3 levels of IIf
2) Write a VBA function

Although that fee structure you'd given might be an example,
you will end

up
getting less in fees if they pay more e.g. 1% of 300 = 3,
.25% of 500 =

1.25
You might want to consider a stepped fee structure where they
pay 1% for

the
first 300 and .5% on the next 200 and .25% on the rest e.g
Value 1% .5% .25%
Total
$260.00 $2.60 $0.00 $0.00
$2.60 $440.00 $3.00 $0.70 $0.00
$3.70 $600.00 $3.00 $1.00
$0.25 $4.25

Stewart
"MX1" <mx*@mx1.abc> wrote in message

news:JMAJc.8721 6$IQ4.34610@att bi_s02...
> Hi,
>
> I've got an invoice form that has a bunch of business rules
> behind it. Basically, I'm trying to figure out how to enter
> a single number in a
field
> (e.g. $1000) and then have the form do a bunch of math on
> that number. Here's the tough part. I need the form to
> breakdown the number based on

a
> tiered structure of business rules. For example, the rules
> might be:
>
> On anything up to $300 take 1% in fees
> Anything over $300 and less than $500 take .5% in fees
> Anything $500 and over, take .25% in fees
>
> Can anyone think of the most strategic way to do this on a
> single form

in
> order to come up with a single fee value? I'd appreciate
> any input. Thanks! :)
>
>


What you need to do is build a table with your fee scale in it,
sorted DESCENDING.

CAP_Amount basefee MarginalRate
99999999 4.00 .0025
500 3.00 .005
300 0.00 .01

Now you can get the values by querying the TOP 1 row, where
CAP_Amount < invoice_Amount, and do ONE calculation and get the
correct fee:

BaseFee + (Invoice_Amount - CAP_Amount) * marginalRate.

You could also use separate dLookup()s to return the three values.

Bob Quintal

Nov 13 '05 #8
MX1
Thanks. I'll give this a shot on Monday.
"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:cd******** **@news.wave.co .nz...
Try (watch wrapping)
Fee:
CCur(IIf([Value]<=300,[Value]*0.01,IIf([Value]<=500,(([Value]-300)*0.005)+3, (([Value]-500)*0.0025)+4) ))
This is taken from a query and will work inside a text box on a form and
report.

The IIf function is a bit of resource hog especially when nexted. Here's a
function which does the same thing

Function Fee(Optional curIn As Currency) As Currency
Dim curTemp As Currency
Select Case curIn
Case 0
curTemp = 0
Case Is <= 300
curTemp = curIn * 0.01
Case Is <= 500
curTemp = ((curIn - 300) * 0.005) + 3
Case Is > 500
curTemp = ((curIn - 500) * 0.0025) + 4
End Select
Fee = curTemp
End Function

Stewart
"MX1" <mx*@mx1.abc> wrote in message news:nGCJc.8534 5$MB3.60308@att bi_s04...
Thanks Stewart.

Actually, the way it works is the whole amount gets charged a fee. So for the $1000 example, I'd need the system to loop through and see that the
first $300 gets 1% which is $3. Then we have $700 remaining. The next

tier
up to $500 is .5% so that would be $200 at .5% which is $1. Now we have
$500 remaining which hasn't been billed yet. That falls into the last

tier
because we've already billed o the first $500. That last tier is .25%

which
gets $1.25. Total fees for this customer is $5.25

Now, let's say customer B has $450. He gets same billing amount for the
first portion up to $300 which is $3. Now there is $150 remaining which
falls in the secondary tier of .5% so that is $150 x .5% which yields ..75 cents. Total feeds for this customer is $3.75.

Basically, this is a pretty neat problem to crack. The logic is not bad. I
just don't know how to code this into a nested IIF statement. Not sure how
to tell the computer to move from one tier to the next. Any thoughts or

an
example on how I could do this would be greatly appreciated.

Thanks a bunch!

"Stewart Allen" <sa****@NOT.wav e.THIS.co.nz> wrote in message
news:cd******** **@news.wave.co .nz...
There's 2 ways:
1) Use the IIf function and nest 2 or 3 levels of IIf
2) Write a VBA function

Although that fee structure you'd given might be an example, you will

end
up
getting less in fees if they pay more e.g. 1% of 300 = 3, .25% of 500 = 1.25
You might want to consider a stepped fee structure where they pay 1%
for the
first 300 and .5% on the next 200 and .25% on the rest e.g
Value 1% .5% .25% Total
$260.00 $2.60 $0.00 $0.00 $2.60
$440.00 $3.00 $0.70 $0.00 $3.70
$600.00 $3.00 $1.00 $0.25 $4.25

Stewart
"MX1" <mx*@mx1.abc> wrote in message

news:JMAJc.8721 6$IQ4.34610@att bi_s02...
> Hi,
>
> I've got an invoice form that has a bunch of business rules behind
it. > Basically, I'm trying to figure out how to enter a single number in a field
> (e.g. $1000) and then have the form do a bunch of math on that number. > Here's the tough part. I need the form to breakdown the number based on
a
> tiered structure of business rules. For example, the rules might

be: >
> On anything up to $300 take 1% in fees
> Anything over $300 and less than $500 take .5% in fees
> Anything $500 and over, take .25% in fees
>
> Can anyone think of the most strategic way to do this on a single

form in
> order to come up with a single fee value? I'd appreciate any input.
> Thanks! :)
>
>



Nov 13 '05 #9
"rkc" <rk*@yabba.dabb a.do.rochester. rr.bomb> wrote in
news:bV******** **********@twis ter.nyroc.rr.co m:
If you were to store your 'business rules' in a table you could
probably use a query to calculate and return a fee amount.


And it's exactly the kind of process that benefits from being
wrapped in a class module.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
296
by: qurat | last post by:
Alachisoft TierDeveloper is an O/R mapping and code generation tool that helps software developers do better, more creative and useful work by reducing redundant hand coding. TierDeveloper lets you map your .Net data components against relational tables and also incorporate business rules. Free 30 days trial available at:...
3
1379
by: NoEd | last post by:
I was talking to a couple guys at one of the hospitals I consult with, and they indicated their 401K is charging them $8 per quarter and .0875% based on the value in their accounts at the end of the quarter. This is 35 basis points per year and is on top of the mutual fund fees. How do these fees compare to other 401K plans? My wife has a...
3
1998
by: thomas.porschberg | last post by:
Hi, I want to read records from a database and export it in an arbitrary format. My idea was to feed a class with a String array fetched from the database and let this class fire SAX events as processor input. The basic class hierarchy is:
1
1127
by: zeeshansohail | last post by:
I have two tables named as “COMPANY and BILL_DETAIL” with the following structure. BILL_DETAIL TABLE Name Type Nullable ------------- -------------- -------- BILL_ID NUMBER(7) S_HEAD_CODE VARCHAR2(12) SR_NO NUMBER(9) ...
1
2252
by: assgar | last post by:
Hi I need help solving a porblem. I have a form that displays a checkbox, service code, description and dropdown with fees on each row. The fee_money and unit array only returns a selected value from the first item (checkbox).
1
1557
by: smacky61 | last post by:
How do I summarize a report by finding the totals fees collected for each event and the grand total of all fees. The name of the report is Registered Attendees Report.
0
1598
by: Johannes Nix | last post by:
Hi, this might be of interest for people who are look for practical information on doing real-time signal processing, possibly using multiple CPUs, and wonder whether it's possible to use Python for audio-type worst case latencies (around 25 ms). I've done that in my PhD work, both with real-time requirements on dual-CPU
0
7561
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7488
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7761
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7999
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7845
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5129
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3517
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
801
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.