3 # wrriten 15/10/2002 by finlay@katipo.oc.nz
4 # script to display borrowers account details in the opac
10 use C4::Circulation::Circ2;
12 use C4::Interface::CGI::Output;
17 my ($template, $borrowernumber, $cookie)
18 = get_template_and_user({template_name => "opac-account.tmpl",
22 flagsrequired => {borrow => 1},
26 # get borrower information ....
27 my ($borr, $flags) = getpatroninformation(undef, $borrowernumber);
32 $template->param( BORROWER_INFO => \@bordat );
36 my ($numaccts,$accts,$total) = getboracctrecord(undef,$borr);
38 for (my $i=0;$i<$numaccts;$i++){
39 $accts->[$i]{'date'} = format_date($accts->[$i]{'date'});
40 $accts->[$i]{'amount'} = sprintf("%.2f", $accts->[$i]{'amount'});
41 if($accts->[$i]{'amount'} >= 0){
42 $accts->[$i]{'amountcredit'} = 1;
44 $accts->[$i]{'amountoutstanding'} =sprintf("%.2f", $accts->[$i]{'amountoutstanding'});
45 if($accts->[$i]{'amountoutstanding'} >= 0){
46 $accts->[$i]{'amountoutstandingcredit'} = 1;
48 if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
49 $accts->[$i]{'print_title'};
55 foreach my $row (@$accts) {
56 $row->{'even'} = 1 if $num % 2 == 0;
57 $row->{'odd'} = 1 if $num % 2 == 1;
62 $template->param( ACCOUNT_LINES => $accts,
65 $template->param( total => sprintf("%.2f",$total) );
67 #$template->param(loggeninuser => $loggedinuser);
68 output_html_with_http_headers $query, $cookie, $template->output;