浏览代码

getting write offs going

master
chris 21 年前
父节点
当前提交
f34bf2b861
共有 2 个文件被更改,包括 60 次插入2 次删除
  1. +5
    -2
      pay.pl
  2. +55
    -0
      sec/writeoff.pl

+ 5
- 2
pay.pl 查看文件

@@ -54,8 +54,10 @@ print <<printend
<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=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=accountno$i value=$accts->[$i]{'accountno'}>
</td>
<TD>$accts->[$i]{'description'}</td>
<TD>$accts->[$i]{'accounttype'}</td>
@@ -103,5 +105,6 @@ print endmenu('member');
print endpage();

} 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
- 0
sec/writeoff.pl 查看文件

@@ -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;
}

正在加载...
取消
保存