[ic] Discount to subtotal

Jason Osborne rage@sohonetworks.cc
Mon, 12 Feb 2001 05:07:46 -0600


I am no expert, but wouldn't it look a little like this?

notice, i took your percentage...say 12%...subtracted 12% from 100% (since
the item is always 100% of the price) and came up with 88% which is the item
price percentage after the discount.

[discount ENTIRE_ORDER]
                 $original = $s;
                 $f =($s);   # i'm no expert, but do you need those
parentheses there?
                 if ($s <= 19.999) {
                 $discounted = $f * 1.00;  # notice i changed $s to $f here
because you are touching a variable that needs to stay constant. also, this
is taken from 100% since there is no discount from 0.000 to 19.999.
                 } elsif ($s <= 49.999) {
                 $discounted = $f * .95;
                 } elsif ($s <= 99.999) {
                 $discounted = $f * .90;
                 } elsif ($s <= 249.999) {
                 $discounted = $f * .88;
                 } elsif ($s >= 250.000) {
                 $discounted = $f * .85;
                 }
                 $difference = $original - $discounted;
                 return $discounted;
[/discount]

--
Jason Osborne
Data and Telecom Network Solutions
Your total Internetworking solutions provider!
3847 Timberglen Rd., STE 4013
Dallas, TX 75287
Phone: 972-307-0676
Pager: 972-320-2426
Web: http://www.sohonetworks.cc
E-mail: sales@sohonetworks.cc

-----Original Message-----
From: interchange-users-admin@lists.akopia.com
[mailto:interchange-users-admin@lists.akopia.com]On Behalf Of Thomas N.
Stefanidis
Sent: Monday, February 12, 2001 4:48 AM
To: Interchange Mailing list
Subject: [ic] Discount to subtotal


How can i make a discount like this?
from 20.000 till 49.999  5%
from 50.000 till  99.999 10%
form 100.000 from 249.999 12%
form 250.000 and over  15%

I have found this code but i don't know how to change it with my values
:

[discount ENTIRE_ORDER]
                  $original = $s;
                 $f =($s);
                 if ($s <= 2499.99) {
                 $discounted = $s * .93;
                 } elsif ($s <= 4999.99) {
                 $discounted = $f * .88;
                 } elsif ($s <= 9999.99) {
                 $discounted = $f * .83;
                 } elsif ($s <= 19999.99) {
                 $discounted = $f * .81;
                 } elsif ($s >= 20000.00) {
                 $discounted = $f * .78;
                 }
                 $difference = $original - $discounted;
                 return $discounted;
[/discount]


_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users