
Fishhead
Novice
Aug 4, 2009, 10:43 AM
Post #9 of 14
(527 views)
|
|
Re: [KevinR] Problem with IF statement
[In reply to]
|
Can't Post
|
|
KevinR and others- Below is the code for the entire subroutine: sub transaction_percentage_closed { my $user = $_[0]; my $trans = $_[1]; my $firstbid = $_[2]; my $lastbid = $_[3]; my $reserve = $_[4]; my ($closedamount, $closednotes, $closedwhatamount); if (($reserve > $lastbid) && ($reserve > 0)) { $closedamount = 0; $closednotes = "Reserve of $config{'currencytype'}$reserve not met, no charges."; $closedwhatamount = "reserve price"; } elsif (($reserve <= $lastbid) && ($reserve > 0)) { $closedamount = $lastbid; $closednotes = "Reserve of $config{'currencytype'}$reserve met, Closing percentage fee based off final bid of $config{'currencytype'}$lastbid."; $closedwhatamount = "final price"; } elsif ($lastbid >= $firstbid) { $closedamount = $lastbid; $closednotes = $closedamount; $closedwhatamount = "final bid"; } else { $closedamount = 0; $closednotes = "No bids received on item, no charges."; $closedwhatamount = "starting bid"; } $closedamount = &parseprice($closedamount); my ($percent, $percentfee, $percentcalcamount, $member, @allclosedrates); $member = "yes"; ### WHEN I CHANGE THIS VALUE TO NO, THE YES BLOCK IS STILL BEING SELECTED ### if ($closedamount != 0) { if (!$percent) { if ($member = "yes") { open (CLOSEDPERCENTS2FILE, $config{'closepercent2file'}); @allclosedrates = <CLOSEDPERCENTS2FILE>; close(CLOSEDPERCENTS2FILE); } else { open (CLOSEDPERCENTSFILE, $config{'closepercentfile'}); @allclosedrates = <CLOSEDPERCENTSFILE>; close(CLOSEDPERCENTSFILE); } my $fielddelimiter = ":::"; my ($closedrangefee, $closedrangelow, $closedrangehigh); my $closedraterecord; foreach $closedraterecord (@allclosedrates) { ($closedrangefee, $closedrangelow, $closedrangehigh) = split /$fielddelimiter/, $closedraterecord; my $showclosedrangefee = $closedrangefee * 100; if (($closedamount >= $closedrangelow) && ($closedrangehigh >= $closedamount)) {$percentcalcamount = &parseprice(-($closedamount * $closedrangefee));} } } else { $percentfee = &parseprice($percentfee); $closednotes = "Closing fee of $config{'currencytype'}$percentfee charged."; $percentcalcamount = $percentfee; } } else { $percentcalcamount = &parseprice($closedamount); } &apply_transaction($user, $trans, $percentcalcamount, $closednotes); }
|