My knowlege of Perl is rudimentary, so I'm having a hard time trying to figure out how to base the value of a field on the entered values of 3 other fields. Below is my attempt at the sub, but I'm not even sure whether it should be incorporated in db.cgi or html.pl
(I have the commented variables, listed here at the end, declared in my db.cfg file)
sub balance {
#----------------------------------
#Calculate the balance based on single-day fee, weekend-fee, and
#member status.
while($rec{'USAF_mem'} eq ('yes')) {
($sat_fee - $rec{'Paid') if $rec{'Attend_Sat'} eq ('Yes') && $rec{'Attend_Sun'} eq ('') ;
($sun_fee - $rec{'Paid') if $rec{'Attend_Sun'} eq ('Yes') && $rec{'Attend_Sat'} eq ('') ;
($both_fee - $rec{'Paid') if $rec{'Attend_Sat'} eq ('Yes') && $rec{'Attend_Sun'} eq ('Yes') ;
{last}}
while($rec{'USAF_mem'} eq ('No')) {
($sat_Non_fee - $rec{'Paid') if $rec{'Attend_Sat'} eq ('Yes') && $rec{'Attend_Sun'} eq ('') ;
($sun_Non_fee - $rec{'Paid') if $rec{'Attend_Sun'} eq ('Yes') && $rec{'Attend_Sat'} eq ('') ;
($both_Non_fee - $rec{'Paid') if $rec{'Attend_Sat'} eq ('Yes') && $rec{'Attend_Sun'} eq ('Yes') ;
{last}}
}
# $sat_fee = 60.00;
# $sun_fee = 40.00;
# $both_fee = 80.00;
# $sat_Non_fee = 75.00;
# $sun_Non_fee = 55.00;
# $both_Non_fee = 100.00;
I'd appreciate any help.
Thanks.
-Brian
(I have the commented variables, listed here at the end, declared in my db.cfg file)
sub balance {
#----------------------------------
#Calculate the balance based on single-day fee, weekend-fee, and
#member status.
while($rec{'USAF_mem'} eq ('yes')) {
($sat_fee - $rec{'Paid') if $rec{'Attend_Sat'} eq ('Yes') && $rec{'Attend_Sun'} eq ('') ;
($sun_fee - $rec{'Paid') if $rec{'Attend_Sun'} eq ('Yes') && $rec{'Attend_Sat'} eq ('') ;
($both_fee - $rec{'Paid') if $rec{'Attend_Sat'} eq ('Yes') && $rec{'Attend_Sun'} eq ('Yes') ;
{last}}
while($rec{'USAF_mem'} eq ('No')) {
($sat_Non_fee - $rec{'Paid') if $rec{'Attend_Sat'} eq ('Yes') && $rec{'Attend_Sun'} eq ('') ;
($sun_Non_fee - $rec{'Paid') if $rec{'Attend_Sun'} eq ('Yes') && $rec{'Attend_Sat'} eq ('') ;
($both_Non_fee - $rec{'Paid') if $rec{'Attend_Sat'} eq ('Yes') && $rec{'Attend_Sun'} eq ('Yes') ;
{last}}
}
# $sat_fee = 60.00;
# $sun_fee = 40.00;
# $both_fee = 80.00;
# $sat_Non_fee = 75.00;
# $sun_Non_fee = 55.00;
# $both_Non_fee = 100.00;
I'd appreciate any help.
Thanks.
-Brian