trying to fix fine calcs

This commit is contained in:
chris 2000-01-04 23:14:04 +00:00
parent a1e6bd0ba9
commit 02ad0362ed
5 changed files with 67 additions and 30 deletions

View file

@ -98,21 +98,22 @@ sub UpdateFine {
my ($itemnum,$bornum,$amount)=@_;
my $dbh=C4Connect;
my $query="Select * from accountlines where itemnumber=$itemnum and
borrowernumber=$bornum and accounttype='FU'";
borrowernumber=$bornum and (accounttype='FU' or accounttype='O' or
accounttype='F')";
my $sth=$dbh->prepare($query);
# print "$query\n";
$sth->execute;
if (my $data=$sth->fetchrow_hashref){
print "in accounts ...";
if ($data->{'amount'} != $amount){
if ($data->{'amount'} != $amount && ($data->{'accounttype'} ne 'F'){
print "updating";
my $diff=$amount - $data->{'amount'};
my $out=$data->{'amountoutstanding'}+$diff;
my $query2="update accountlines set date=now(), amount=$amount,
amountoutstanding=$out where accountno=$data->{'accountno'}";
amountoutstanding=$out,accounttype='FU' where accountno=$data->{'accountno'}";
my $sth2=$dbh->prepare($query2);
$sth2->execute;
$sth2->finish;
$sth2->finish;
} else {
print "no update needed $data->{'amount'}"
}

View file

@ -66,13 +66,13 @@ sub gotopage{
sub startmenu{
my ($type)=@_;
if ($type eq 'issue') {
open (FILE,'/usr/local/www/hdl/htdocs/includes/issues-top.inc');
open (FILE,'/usr/local/www/koha/htdocs/includes/issues-top.inc');
} elsif ($type eq 'opac') {
open (FILE,'/usr/local/www/hdl/htdocs/includes/opac-top.inc');
open (FILE,'/usr/local/www/koha/htdocs/includes/opac-top.inc');
} elsif ($type eq 'member') {
open (FILE,'/usr/local/www/hdl/htdocs/includes/members-top.inc');
open (FILE,'/usr/local/www/koha/htdocs/includes/members-top.inc');
} else {
open (FILE,'/usr/local/www/hdl/htdocs/includes/cat-top.inc');
open (FILE,'/usr/local/www/koha/htdocs/includes/cat-top.inc');
}
my @string=<FILE>;
close FILE;
@ -85,13 +85,13 @@ sub startmenu{
sub endmenu{
my ($type)=@_;
if ($type eq 'issue'){
open (FILE,'/usr/local/www/hdl/htdocs/includes/issues-bottom.inc');
open (FILE,'/usr/local/www/koha/htdocs/includes/issues-bottom.inc');
} elsif ($type eq 'opac') {
open (FILE,'/usr/local/www/hdl/htdocs/includes/opac-bottom.inc');
open (FILE,'/usr/local/www/koha/htdocs/includes/opac-bottom.inc');
} elsif ($type eq 'member') {
open (FILE,'/usr/local/www/hdl/htdocs/includes/members-bottom.inc');
open (FILE,'/usr/local/www/koha/htdocs/includes/members-bottom.inc');
} else {
open (FILE,'/usr/local/www/hdl/htdocs/includes/cat-bottom.inc');
open (FILE,'/usr/local/www/koha/htdocs/includes/cat-bottom.inc');
}
my @string=<FILE>;
close FILE;

View file

@ -17,7 +17,7 @@ $VERSION = 0.01;
@EXPORT = qw(&CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
&itemdata &bibdata &GetItems &borrdata &getacctlist &itemnodata &itemcount
&OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
&getboracctrecord);
&getboracctrecord &ItemType);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -365,10 +365,12 @@ sub ItemInfo {
my $class = $data->{'classification'};
my $dewey = $data->{'dewey'};
$dewey =~ s/0+$//;
if ($dewey eq "000.") { $dewey = "";};
if ($dewey < 10){$dewey='00'.$dewey;}
if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}
if ($dewey eq "000.") { $dewey = "";};
if ($dewey <= 0){
$dewey='';
}
$class = $class.$dewey;
$class = $class.$data->{'subclass'};
# $results[$i]="$data->{'title'}\t$data->{'barcode'}\t$datedue\t$data->{'branchname'}\t$data->{'dewey'}";
@ -439,12 +441,12 @@ sub itemdata {
}
sub bibdata {
my ($bibnum)=@_;
my ($bibnum,$type)=@_;
my $dbh=C4Connect;
my $query="Select * from biblio,biblioitems,bibliosubject,bibliosubtitle where biblio.biblionumber=$bibnum
and biblioitems.biblionumber=$bibnum and
(bibliosubject.biblionumber=$bibnum or bibliosubject.biblionumber=1) and
(bibliosubtitle.biblionumber=$bibnum or bibliosubtitle.biblionumber=1)";
(bibliosubject.biblionumber=$bibnum or bibliosubject.biblionumber=1) and
(bibliosubtitle.biblionumber=$bibnum)";
# print $query;
my $sth=$dbh->prepare($query);
$sth->execute;
@ -671,8 +673,18 @@ sub itemcount {
$sth->finish;
$dbh->disconnect;
return ($count,$lcount,$nacount,$fcount,$scount);
}
sub ItemType {
my ($type)=@_;
my $dbh=C4Connect;
my $query="select description from itemtypes where itemtype='$type'";
my $sth=$dbh->prepare($query);
$sth->execute;
my $dat=$sth->fetchrow_hashref;
$sth->finish;
$dbh->disconnect;
return ($dat->{'description'});
}
END { } # module clean-up code here (global destructor)

View file

@ -28,14 +28,16 @@ print startmenu($type);
my $blah;
my $bib=$input->param('bib');
my $title=$input->param('title');
print "<a href=request.pl?bib=$bib><img height=42 WIDTH=120 BORDER=0 src=\"/images/requests.gif\" align=right border=0></a>";
if ($type ne 'opac'){
print "<a href=request.pl?bib=$bib><img height=42 WIDTH=120 BORDER=0 src=\"/images/requests.gif\" align=right border=0></a>";
}
my @items=ItemInfo(\$blah,$bib,$title);
my $dat=bibdata($bib);
my $count=@items;
print mkheadr(3,$dat->{'title'});
my @temp=split('\t',$items[0]);
print mkheadr(3,"$title ($dat->{'author'}) $temp[4]");
print <<printend
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width="220">
@ -46,7 +48,14 @@ print <<printend
<TR VALIGN=TOP>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>BIBLIO RECORD $bib</TD></TR>
<td bgcolor="$main"
printend
;
if ($type ne 'opac'){
print "background=\"/images/background-mem.gif\"";
}
print <<printend
><B>BIBLIO RECORD $bib</TD></TR>
<tr VALIGN=TOP >
@ -66,7 +75,12 @@ Analytical Title: <br>
Serial: $dat->{'serial'}<br>
Total Number of Items: $count
<p>
<INPUT TYPE="image" name="submit" VALUE="modify" height=42 WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
printend
;
if ($type ne 'opac'){
print "<INPUT TYPE=\"image\" name=\"submit\" VALUE=\"modify\" height=42 WIDTH=93 BORDER=0 src=\"/images/modify-mem.gif\">";
}
print <<printend
</font></TD>
</TR>
@ -83,7 +97,7 @@ my $i=0;
print center();
print mktablehdr;
if ($type eq 'opac'){
print mktablerow(6,$main,'Itemtype','Class','Location','DateDue','Lastseen','Barcode');
print mktablerow(5,$main,'Itemtype','Class','Branch','DateDue','Lastseen');
} else {
print mktablerow(6,$main,'Itemtype','Class','Location','DateDue','Lastseen','Barcode',"/images/background-mem.gif");
}
@ -96,11 +110,21 @@ while ($i < $count){
if ($results[2] eq ''){
$results[2]='Available';
}
if ($colour == 1){
print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
if ($colour == 1){
if ($type ne 'opac'){
print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
} else {
$results[6]=ItemType($results[6]);
print mktablerow(5,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7]);
}
$colour=0;
} else{
print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
if ($type ne 'opac'){
print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
} else {
$results[6]=ItemType($results[6]);
print mktablerow(5,'white',$results[6],$results[4],$results[3],$results[2],$results[7]);
}
$colour=1;
}
$i++;

View file

@ -26,7 +26,7 @@ print <<printend
<form action=/cgi-bin/koha/wmemberentry.pl method=post>
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left>
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width=270>
<TR VALIGN=TOP>