getting write offs going
This commit is contained in:
parent
d61b574e88
commit
f34bf2b861
2 changed files with 60 additions and 2 deletions
7
pay.pl
7
pay.pl
|
@ -54,8 +54,10 @@ print <<printend
|
||||||
<TD><input type=radio name=payfine$i value=no checked>Unpaid
|
<TD><input type=radio name=payfine$i value=no checked>Unpaid
|
||||||
<input type=radio name=payfine$i value=yes>Pay
|
<input type=radio name=payfine$i value=yes>Pay
|
||||||
<input type=radio name=payfine$i value=wo>Writeoff
|
<input type=radio name=payfine$i value=wo>Writeoff
|
||||||
|
<input type=hidden name=itemnumber$i value=$accts->[$i]{'itemnumber'}>
|
||||||
|
<input type=hidden name=accounttype$i value=$accts->[$i]{'accounttype'}>
|
||||||
<input type=hidden name=bornum value=$bornum>
|
<input type=hidden name=bornum value=$bornum>
|
||||||
|
<input type=hidden name=accountno$i value=$accts->[$i]{'accountno'}>
|
||||||
</td>
|
</td>
|
||||||
<TD>$accts->[$i]{'description'}</td>
|
<TD>$accts->[$i]{'description'}</td>
|
||||||
<TD>$accts->[$i]{'accounttype'}</td>
|
<TD>$accts->[$i]{'accounttype'}</td>
|
||||||
|
@ -103,5 +105,6 @@ print endmenu('member');
|
||||||
print endpage();
|
print endpage();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
print $input->redirect("/cgi-bin/koha/sec/writeoff.pl");
|
my $quety=$input->query_string;
|
||||||
|
print $input->redirect("/cgi-bin/koha/sec/writeoff.pl?$quety");
|
||||||
}
|
}
|
||||||
|
|
55
sec/writeoff.pl
Executable file
55
sec/writeoff.pl
Executable file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
#written 11/1/2000 by chris@katipo.co.nz
|
||||||
|
#script to write off accounts
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use CGI;
|
||||||
|
use C4::Database;
|
||||||
|
my $input=new CGI;
|
||||||
|
|
||||||
|
#print $input->header;
|
||||||
|
#print $input->dump;
|
||||||
|
|
||||||
|
my%inp;
|
||||||
|
|
||||||
|
my @name=$input->param;
|
||||||
|
for (my $i=0;$i<@name;$i++){
|
||||||
|
my $test=$input->param($name[$i]);
|
||||||
|
if ($test eq 'wo'){
|
||||||
|
my $temp=$name[$i];
|
||||||
|
$temp=~ s/payfine//;
|
||||||
|
$inp{$name[$i]}=$temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my $bornum=$input->param('bornum');
|
||||||
|
while ( my ($key, $value) = each %inp){
|
||||||
|
# print $key,$value;
|
||||||
|
my $accounttype=$input->param("accounttype$value");
|
||||||
|
my $itemno=$input->param("itemnumber$value");
|
||||||
|
if ($accounttype eq 'Res'){
|
||||||
|
my $accountno=$input->param("accountno$value");
|
||||||
|
writeoff($bornum,$accountno,$itemno,$accounttype);
|
||||||
|
} else {
|
||||||
|
writeoff($bornum,'',$itemno,$accounttype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print $input->redirect("/cgi-bin/koha/pay.pl?bornum=$bornum");
|
||||||
|
|
||||||
|
#needs to be shifted to a module when time permits
|
||||||
|
sub writeoff{
|
||||||
|
my ($bornum,$accountnum,$itemnum,$accounttype)=@_;
|
||||||
|
my $dbh=C4Connect;
|
||||||
|
my $query="Update accountlines set amountoutstanding=0 where ";
|
||||||
|
if ($accounttype eq 'Res'){
|
||||||
|
$query.="accounttype='Res' and accountno='$accountnum' and borrowernumber='$bornum'";
|
||||||
|
} else {
|
||||||
|
$query.="accounttype='$accounttype' and itemnumber='$itemnum' and borrowernumber='$bornum'";
|
||||||
|
}
|
||||||
|
my $sth=$dbh->prepare($query);
|
||||||
|
# print $query;
|
||||||
|
$sth->execute;
|
||||||
|
$sth->finish;
|
||||||
|
$dbh->disconnect;
|
||||||
|
}
|
Loading…
Reference in a new issue