Browse Source

work on returns

master
olwen 22 years ago
parent
commit
78c203fb1d
  1. 2
      C4/Circulation/Issues.pm
  2. 33
      C4/Circulation/Returns.pm
  3. 16
      C4/Interface.pm

2
C4/Circulation/Issues.pm

@ -210,7 +210,7 @@ sub calc_charges {
$charge = $data1->{'rentalcharge'};
my $q2 = "select rentaldiscount from borrowers,categoryitem
where (borrowers.borrowernumber = '$bornum')
and (borrower.categorycode = categories.categorycode)
and (borrowers.categorycode = categories.categorycode)
and (categoryitem.itemtype = '$item_type')";
my $sth2=$dbh->prepare($q2);
$sth2->execute;

33
C4/Circulation/Returns.pm

@ -58,8 +58,7 @@ sub Returns {
my ($env)=@_;
my $dbh=&C4Connect;
my @items;
$items[0]="."x50;
my $itcnt=0;
@items[0]=" "x50;
my $reason;
my $item;
my $reason;
@ -73,7 +72,15 @@ sub Returns {
if (($reason ne "Circ") && ($reason ne "Quit")) {
($reason,$bornum,$borrower,$itemno,$itemrec,$amt_owing) = checkissue($env,$dbh,$item);
if (($reason ne "") && ($reason ne "Circ") && ($reason ne "Quit")) {
debug_msg($env,$reason);
if ($reason eq "Returned") {
my $fmtitem = fmtstr($env,$itemrec->{'title'},"L50");
debug_msg($env,$fmtitem);
unshift @items,$fmtitem;
} else {
debug_msg($env,$reason);
}
}
}
}
@ -88,7 +95,8 @@ sub checkissue {
my $borrower;
my $itemno;
my $itemrec;
my $amt_owing;
my $amt_owing;
$item = uc $item;
my $query = "select * from items where barcode = '$item'";
my $sth=$dbh->prepare($query);
$sth->execute;
@ -101,12 +109,14 @@ sub checkissue {
if (my $issuerec=$sth->fetchrow_hashref) {
$sth->finish;
$query = "select * from borrowers where
(borrowernumber = = '$issuerec->{'borrowernumber'}')";
my $sth->prepare($query);
(borrowernumber = '$issuerec->{'borrowernumber'}')";
my $sth= $dbh->prepare($query);
$sth->execute;
$borrower = $sth->fetchrow_hashref;
$amt_owing = returnrecord($env,$dbh,$bornum,$itemno);
$reason = "Returned";
$bornum = $issuerec->{'borrowernumber'};
$itemno = $issuerec->{'itemnumber'};
$amt_owing = returnrecord($env,$dbh,$bornum,$itemno);
$reason = "Returned";
} else {
$sth->finish;
$reason = "Item not issued";
@ -125,9 +135,10 @@ sub returnrecord {
my $amt_owing = calc_odues($env,$dbh,$bornum,$itemno);
my @datearr = localtime(time);
my $dateret = (1900+$datearr[5])."-".$datearr[4]."-".$datearr[3];
debug_msg($env,"before return");
my $query = "update issues set returndate = '$dateret', branchcode ='$env->{'branchcode'}' where (borrowernumber = '$bornum') and (itemnumber = '$itemno')
and (returndate is null)";
debug_msg($env,"before return $itemno $bornum");
my $query = "update issues set returndate = '$dateret', branchcode ='$env->{'branchcode'}' where
(borrowernumber = '$bornum') and (itemnumber = '$itemno')
and (returndate is null)";
my $sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;

16
C4/Interface.pm

@ -204,21 +204,23 @@ sub returnwindow {
$li1->Add($items->[$i]);
$i++;
}
$panel->Add(0,0,$entry,NEWT_ANCHOR_TOP);
$panel->Add(0,1,$accchk,NEWT_ANCHOR_TOP);
$panel->Add(1,0,$la1);
$panel->Add(2,0,$fee);
$panel->Add(1,1,$l1);
$panel->Add(2,1,$li1);
$panel->Add(0,0,$entry,NEWT_ANCHOR_LEFT);
$panel->Add(1,0,$accchk,NEWT_ANCHOR_LEFT);
$panel->Add(2,0,$la1,NEWT_ANCHOR_RIGHT);
$panel->Add(2,1,$fee,NEWT_ANCHOR_RIGHT);
$panel->Add(0,2,$l1,NEWT_ANCHOR_LEFT);
$panel->Add(0,3,$li1,NEWT_ANCHOR_LEFT);
$panel->AddHotKey(NEWT_KEY_F11);
$panel->AddHotKey(NEWT_KEY_F10);
my ($reason,$data)=$panel->Run();
if ($reason eq NEWT_EXIT_HOTKEY) {
if ($data eq NEWT_KEY_F11) {
$reason="Circ";
$panel->Hide;
}
if ($data eq NEWT_KEY_F12){
$reason="Quit"
$reason="Quit";
$panel->Hide;
}
}
my $stuff=$entry->Get();

Loading…
Cancel
Save