Browse Source

Recording payments now working

master
chris 25 years ago
parent
commit
fd7c4e8291
  1. 11
      C4/Accounts.pm
  2. 3
      C4/Circulation.pm

11
C4/Accounts.pm

@ -49,26 +49,29 @@ my $priv_func = sub {
# make all your functions, whether exported or not;
sub displayaccounts{
}
sub checkaccount {
#take borrower number
#check accounts and list amounts owing
my ($bornumber,$dbh)=@_;
my $sth=$dbh->prepare("Select * from accountlines where
my $sth=$dbh->prepare("Select sum(amount) from accountlines where
borrowernumber=$bornumber");
$sth->execute;
my $total=0;
while (my $data=$sth->fetchrow_hashref){
$total=$total+$data->{'amount'};
$total=$total+$data->{'sum'};
}
$sth->finish;
# output(1,2,"borrower owes $total");
if ($total > 0){
output(1,2,"borrower owes $total");
if ($total > 5){
reconcileaccount($dbh,$bornumber,$total);
}
}
# pause();
return($total);
}
@ -103,7 +106,7 @@ sub reconcileaccount {
&recordpayment($bornumber,$dbh,$data);
#Check if the boorower still owes
# pause();
# $total=&checkaccount($bornumber,$dbh);
$total=&checkaccount($bornumber,$dbh);
return($total);

3
C4/Circulation.pm

@ -121,8 +121,9 @@ sub Issue {
#check if borrower has any items waiting
&checkwaiting;
#deal with any money still owing
# output(30,1,$amount);
if ($amount > 0){
&reconcileaccount($dbh,$bornum);
&reconcileaccount($dbh,$bornum,$amount);
}
#deal with alternative loans
#now check items

Loading…
Cancel
Save