[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [Fwd: Pricing Routines to perform Unit Price conversions before used in sub/totaling]
****** message to minivend-users from "Mr. Christopher F. Miller" <cfm@maine.com> ******
On Wed, Apr 21, 1999 at 10:51:05AM -0700, Barry Treahy wrote:
> Could never get Chris's routine call suggestion to work, I suspect that
> the routine was not correctly exporting as a global routine, but it did
> move me in a direction that was helpful and I appreciate that once I
> realized that I could just embed an equation in the CommonAdjust
> statement, something that Mike H or good documentation could have
> resolved weeks ago.
>
> CommonAdjust pricing:q10,q25,q50,q100,q200,q500,q1000:,
> ;products:price, &$s*1.12/1.6+70-$s
...
> >>
> >>sub item_price {
> >> &{$Vend::Cfg->{ItemPriceRoutine}}(@_);
> >>}
> >>
> >>is being passed parameters, the item-code and the item-quantity as well
> >>as an optional pricing database. I've also learned that the & in Perl
> >>is a reference pointer to a procedural routine entry point. So it would
> >>seem that calls to item_price is just a generic dispatch to a
> >>configurable pricing routine.
>
> Christopher Miller's message this morning made reference to a subroutine call from CommonAdjust. Chris, can you
> post a sample of your ClientPricing code? This may be a method that is more flexible than my hardcode hack...
CommonAdjust specials:price:, ;products:price, &{Vend::ClientPricing::lobsters();}
You can do pretty much whatever you want; this below adds a dollar to the price of item 10009:
################ snip ##############
#!/usr/bin/perl
#
# Clients.pm for Minivend
# rev 1999-03-14, cfm
# Put client specific code, eg pricing routines, here
#
package Vend::ClientPricing;
require Exporter;
$VERSION = substr(q$Revision: 1.18 $, 10);
$DEBUG = 0;
@ISA = qw(Exporter);
@EXPORT = qw (
lobsters
);
use Carp;
sub lobsters {
my $s = $Vend::Interpolate::s;
my $item = $Vend::Interpolate::item;
my $adj=0;
# Do whatever you want to price here
if ( $item->{code} eq "10009" ) {
return 1;
}
return $adj;
}
1;
__END__
##########################
--
Christopher F. Miller, Publisher cfm@maine.com
MaineStreet Communications, Inc 208 Portland Road, Gray, ME 04039
1.207.657.5078 http://www.maine.com/
Database publishing, electronic commerce, office and internet integration.
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list