Browse Source

changes to returns scrreen

master
olwen 22 years ago
parent
commit
86f9b372a2
  1. 30
      C4/Circulation/Returns.pm
  2. 76
      C4/InterfaceCDK.pm

30
C4/Circulation/Returns.pm

@ -69,11 +69,12 @@ sub Returns {
my $itemrec;
my $bornum;
my $amt_owing;
my $odues;
# until (($reason eq "Circ") || ($reason eq "Quit")) {
until ($reason ne "") {
($reason,$item) =
returnwindow($env,"Enter Returns",
$item,\@items,$borrower,$amt_owing); #C4::Circulation
$item,\@items,$borrower,$amt_owing,$odues,$dbh); #C4::Circulation
#debug_msg($env,"item = $item");
#if (($reason ne "Circ") && ($reason ne "Quit")) {
if ($reason eq "") {
@ -149,7 +150,7 @@ sub checkissue {
sub returnrecord {
# mark items as returned
my ($env,$dbh,$bornum,$itemno)=@_;
my $amt_owing = calc_odues($env,$dbh,$bornum,$itemno);
#my $amt_owing = calc_odues($env,$dbh,$bornum,$itemno);
my @datearr = localtime(time);
my $dateret = (1900+$datearr[5])."-".$datearr[4]."-".$datearr[3];
my $query = "update issues set returndate = '$dateret', branchcode ='$env->{'branchcode'}' where
@ -158,7 +159,28 @@ sub returnrecord {
my $sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
# check for charge made for book
# check for overdue fine
my $oduecharge;
my $query = "select * from accountlines
where (borrowernumber = '$bornum')
and (itemnumber = '$itemno')
and (accounttype = 'F')";
my $sth = $dbh->prepare($query);
$sth->execute;
if (my $data = $sth->fetchrow_hashref) {
# alter fine to show that the book has been returned.
my $uquery = "update accountlines
set accounttype = 'FR'
where (borrowernumber = '$bornum')
and (itemnumber = '$itemno')
and (accountno = '$data->{'accountno'}') ";
my $usth = $dbh->prepare($uquery);
$usth->execute();
$usth->finish();
$oduecharge = $data->{'amountoutstanding'};
}
$sth->finish;
# check for charge made for lost book
my $query = "select * from accountlines
where (borrowernumber = '$bornum')
and (itemnumber = '$itemno')
@ -203,7 +225,7 @@ sub returnrecord {
}
$sth->finish;
UpdateStats($env,'branch','return','0');
return($amt_owing);
return($oduecharge);
}
sub calc_odues {

76
C4/InterfaceCDK.pm

@ -325,22 +325,16 @@ sub actfmenu {
}
sub actscroll1 {
my ($env,$entryBox,$loanlength,$scroll1,$scroll2) = @_;
#$scroll1->preProcess ('Function' =>
# sub{prescroll1(@_,$env,$entryBox,$loanlength,$scroll1,$scroll2);});
$scroll1->activate();
return 1;
}
sub actscroll2 {
my ($env,$entryBox,$loanlength,$scroll1,$scroll2) = @_;
#$scroll2->preProcess ('Function' =>
# sub{prescroll2(@_,$env,$entryBox,$loanlength,$scroll1,$scroll2);});
$scroll2->activate();
return 1;
}
sub actloanlength {
my ($env,$entryBox,$loanlength,$scroll1,$scroll2) = @_;
#$loanlength->preProcess ('Function' =>
# sub{preloanlen(@_,$env,$entryBox,$loanlength,$scroll1,$scroll2);});
my $validdate = "N";
while ($validdate eq "N") {
my $loanlength = $loanlength->activate();
@ -369,36 +363,12 @@ sub prebook {
my ($input,$env,$dbh,$funcmenu,$entryBox,$loanlength,
$scroll1,$scroll2,$borrower,$amountowing,$odues)= @_;
if ($input eq $key_tab) {
# actloanlength($env,$entryBox,$loanlength,$scroll1,$scroll2);
actfmenu ($env,$dbh,$funcmenu,$entryBox,$loanlength,$scroll1,
$scroll2,$borrower,$amountowing,$odues);
return 0;
}
return 1;
}
sub prescroll1 {
my ($input,$env,$entryBox,$loanlength,$scroll1,$scroll2) = @_;
if ($input eq $key_tab) {
actscroll2($env,$entryBox,$loanlength,$scroll1,$scroll2);
return 0;
}
return 1;
}
sub prescroll2 {
my ($input,$env,$entryBox,$loanlength,$scroll1,$scroll2) = @_;
return 1;
}
sub preloanlen {
my ($input,$env,$entryBox,$loanlength,$scroll1,$scroll2) = @_;
if ($input eq $key_tab) {
actscroll1($env,$entryBox,$loanlength,$scroll1,$scroll2);
return 0;
}
return 1;
}
sub borrowerbox {
my ($env,$borrower,$amountowing,$odues) = @_;
@ -437,21 +407,27 @@ sub borrowerbox {
}
sub returnwindow {
my ($env,$title,$item,$items,$borrower,$amountowing)=@_;
my ($env,$title,$item,$items,$borrower,$amountowing,$odues,$dbh)=@_;
#debug_msg($env,$borrower);
my $titlepanel = titlepanel($env,"Returns","Scan book");
my @functs=("Payments","Issues","Renewal");
my $funcmenu = new Cdk::Scroll ('Title'=>"Function",
'List'=>\@functs,'Height'=>5,'Width'=>12,'Ypos'=>3,'Xpos'=>16);
my $returnlist = new Cdk::Scroll ('Title'=>"Items Returned",
'List'=>\@$items,'Height'=> 12,'Width'=>74,'Ypos'=>10,'Xpos'=>1);
$returnlist->draw();
$funcmenu->draw();
my $borrbox;
if ($borrower-{'cardnumber'} ne "") {
if ($borrower->{'cardnumber'} ne "") {
$borrbox = borrowerbox($env,$borrower,$amountowing);
$borrbox->draw();
}
my $bookentry = new Cdk::Entry('Label'=>"Book Barcode: ",
my $bookentry = new Cdk::Entry('Label'=>" ",
'Max'=>"11",'Width'=>"11",
'Xpos'=>"1",'Ypos'=>"4",
'Xpos'=>"2",'Ypos'=>"3",'Title'=>"Book Barcode",
'Type'=>"UMIXED");
$bookentry->preProcess ('Function' =>sub{preretbook(@_,$env,$dbh,
$funcmenu,$bookentry,$borrower,$amountowing,$odues);});
my $barcode = $bookentry->activate();
my $reason;
if (!defined $barcode) {
@ -462,7 +438,37 @@ sub returnwindow {
}
return($reason,$barcode);
}
sub preretbook {
my ($input,$env,$dbh,$funcmenu,$bookentry,$borrower,$amountowing,$odues)= @_;
if ($input eq $key_tab) {
actrfmenu ($env,$dbh,$funcmenu,$bookentry,$borrower,$amountowing,$odues);
return 0;
}
return 1;
}
sub actrfmenu {
my ($env,$dbh,$funcmenu,$bookentry,$borrower,$amountowing,$odues) = @_;
my $funct = $funcmenu->activate();
debug_msg($env,"funtion $funct");
if (!defined $funct) {
} elsif ($funct == 2 ) {
if ($borrower->{'borrowernumber'} ne "") {
C4::Circulation::Renewals::bulkrenew($env,$dbh,
$borrower->{'borrowernumber'},$amountowing,$borrower,$odues);
Cdk::refreshCdkScreen();
}
} elsif ($funct == 0 ) {
if ($borrower->{'borrowernumber'} ne "") {
C4::Accounts::reconcileaccount($env,$dbh,$borrower->{'borrowernumber'},
$amountowing,$borrower,$odues);
Cdk::refreshCdkScreen();
}
}
}
sub act {
my ($obj) = @_;
my $ans = $obj->activate();

Loading…
Cancel
Save