2 # WARNING: Not enough context to figure out the correct tabstop size
3 # WARNING: Assume that this file uses 4-character tabs
7 #written 11/1/2000 by chris@katipo.oc.nz
8 #part of the koha library system, script to facilitate paying off fines
11 # Copyright 2000-2002 Katipo Communications
13 # This file is part of Koha.
15 # Koha is free software; you can redistribute it and/or modify it under the
16 # terms of the GNU General Public License as published by the Free Software
17 # Foundation; either version 2 of the License, or (at your option) any later
20 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
21 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
22 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License along with
25 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
26 # Suite 330, Boston, MA 02111-1307 USA
31 use C4::Interface::CGI::Output;
39 my ($template, $loggedinuser, $cookie)
40 = get_template_and_user ({ template_name => "members/pay.tmpl",
44 flagsrequired => {borrowers => 1},
48 my $bornum=$input->param('bornum');
50 $bornum=$input->param('bornum0');
53 my $data=borrdata('',$bornum);
54 my $user=C4::Context->preference('defaultBranch');
55 my $me=borrdata('',$loggedinuser);
56 my $accountant=$me->{'firstname'}.' '.$me->{'surname'};
59 $bor{'borrowernumber'}=$bornum;
61 my @names=$input->param;
69 for (my $i=0;$i<@names;$i++){
70 my$temp=$input->param($names[$i]);
79 if ($temp eq 'yes' || $temp eq 'wo'){
81 my $desc=$input->param($names[$i+7]);
82 my $accounttype=$input->param($names[$i+2]);
83 my $amount=$input->param($names[$i+4]);
84 my $bornum=$input->param($names[$i+5]);
85 my $accountno=$input->param($names[$i+6]);
86 my $amounttopay=$input->param($names[$i+8]);
88 makepayment($bornum,$accountno,$amounttopay,$accountant, $type);
89 $totalamount=$totalamount+$amounttopay;
90 $totaldesc .="<br> ".$desc."- Fee:".$amounttopay;
91 $totalaccounttype .="<br> ".$accounttype;
95 if ($type eq "Pay" || $type eq "W"){
96 print $input->redirect("/cgi-bin/koha/members/payprint.pl?bornum=$bornum&accounttype=$totalaccounttype&amount=$totalamount&desc=$totaldesc");
101 $env{'branchcode'}=C4::Context->preference('defaultBranch');
102 my $total=$input->param('total');
106 recordpayment(\%env,$bornum,$total);
108 my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
111 for (my $i=0;$i<$numaccts;$i++){
112 if ($accts->[$i]{'amountoutstanding'} > 0){
113 $accts->[$i]{'amount'}+=0.00;
114 $accts->[$i]{'amountoutstanding'}+=0.00;
117 $line{itemnumber} = $accts->[$i]{'itemnumber'};
118 $line{accounttype} = $accts->[$i]{'accounttype'};
119 $line{amount} = sprintf("%.2f",$accts->[$i]{'amount'});
120 $line{amountoutstanding} = sprintf("%.2f",$accts->[$i]{'amountoutstanding'});
121 $line{bornum} = $bornum;
122 $line{accountno} = $accts->[$i]{'accountno'};
123 $line{description} = $accts->[$i]{'description'};
124 $line{title} = $accts->[$i]{'title'};
125 push(@loop_pay, \%line);
128 $template->param(firstname => $data->{'firstname'},
129 surname => $data->{'surname'},
131 loop_pay => \@loop_pay,
132 total => sprintf("%.2f",$total),
133 totalamountopay => sprintf("%.2f",$total));
134 output_html_with_http_headers $input, $cookie, $template->output;
138 my @name=$input->param;
139 for (my $i=0;$i<@name;$i++){
140 my $test=$input->param($name[$i]);
144 $inp{$name[$i]}=$temp;
148 while ( my ($key, $value) = each %inp){
150 my $accounttype=$input->param("accounttype$value");
151 $bornum=$input->param("bornum$value");
152 my $itemno=$input->param("itemnumber$value");
153 my $amount=$input->param("amount$value");
156 $bornum=$input->param('bornum');
157 print $input->redirect("/cgi-bin/koha/members/pay.pl?bornum=$bornum");