[ic] Discounting Entire Orders

Jim Balcom interchange-users@interchange.redhat.com
Thu Oct 25 18:10:01 2001


On Thu, 25 Oct 2001, Kevin Walsh wrote:

KW>>Let's see if I understand - Are you asking how to show the fact
KW>>that a 10% discount has been given?  The original question called
KW>>for all orders with a value over 100.00 to be given a 10% discount.

Yep. The original question was not mine and was different.

I will quite often have a 'Happy Hour' and have a storewide discount of 10%,
or an 'Inventory Stock Reduction Sale' and discount everything 15%, etc,
etc.

KW>>
KW>>If this is to be made variable, then perhaps you could work out the
KW>>10% and save it into a scratch value with something like the following:
KW>>
KW>>    [seti discount_pct] query db and set 10 (for 10% discount) [/seti]
KW>>    [seti discount_amount] query db and set 100 (for > $100) [/seti]
KW>>
KW>>    [discount ENTIRE_ORDER]
KW>>        my $pct = (100 - ($::Scratch->{'discount_pct'} || 0)) / 100;
KW>>        my $amt = $::Scratch->{'discount_amount'} or return $s;
KW>>        $s > $amt ? $s * $pct : $s;
KW>>    [/discount]
KW>>
KW>>Then you have the discount set to the rules you want, and have scratch
KW>>values set to those rules.  Your report page can show those scratch
KW>>values to explain the discount applied.

Yep, and then when I am processing the order, I can see what the customer
has been promised, and tell the POS software to apply the discounts.

KW>>All untested - just have a play with it and see what you get.

That gets me started - Thanks!

KW>>If I misunderstood your question, then please ask it again.

You understood it just fine! Thanks!

-= Jim =-

----------------------------------------------------------------
Jim's Linux-Operated Underground Bomb Shelter

Tagline for Thursday, October 25, 2001 at 18:05 PM:
The best substitute for experience is being sixteen.

----------------------------------------------------------------
This Linux System has been up 104 hours

My web page: http://www.idk-enterprises.com
----------------------------------------------------------------