Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] Prorate discount script bug



******    message to minivend-users from Sydney Urshan <urshan@nethollywood.net>     ******

The following discount script works perfect until the last day of the 
month at which time the result is 0.  Can someone help me out on this 
one?

[loop list='2001 2002 3001 3002']
[discount [loop-code]]
my $bit = $Tag->time('', {}, '%m %d');
my ($month, $n) = split /\s+/, $bit;
$n =~ s/^0//;
my %mon = (
	'01' => 31,
	'02' => 29,
	'03' => 31,
	'04' => 30,
	'05' => 31,
	'06' => 30,
	'07' => 31,
	'08' => 31,
	'09' => 30,
	'10' => 31,
	'11' => 30,
	'12' => 31,
);
if ($mon{$month} and $n > 1) {
           return ($s - ($s / $mon{$month} * $n));
}
return $s;
[/discount]
[/loop]

Thanks,

Sydney Urshan

please cc responses to me directly at urshan@nethollywood.net.
-
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


Search for: Match: Format: Sort by: