@@ -, +, @@ --- .../prog/en/includes/members-toolbar.inc | 2 +- .../prog/en/modules/members/moremember-print.tt | 196 +++++++++----------- members/summary-print.pl | 101 ++++++++++ 3 files changed, 191 insertions(+), 108 deletions(-) create mode 100755 members/summary-print.pl --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -77,7 +77,7 @@ function export_barcodes() { } var slip_re = /slip/; function printx_window(print_type) { - var handler = print_type.match(slip_re) ? "printslip" : "moremember"; + var handler = print_type.match(slip_re) ? "printslip" : "summary-print"; window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&print=" + print_type, "printwindow"); return false; } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt @@ -1,121 +1,103 @@ [% USE Koha %] +[% USE Branches %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] -Summary for [% firstname %] [% surname %] ([% cardnumber %]) - - - -[% INCLUDE 'slip-print.inc' #printThenClose %] - - + Summary for [% firstname %] [% surname %] ([% cardnumber %]) + + + + [% INCLUDE 'slip-print.inc' #printThenClose %] - + +
+

Account summary: [% firstname %] [% surname %] ([% cardnumber %])

-
+ -

Account summary: [% firstname %] [% surname %] ([% cardnumber %])

+ [% IF ( issues ) %] + + + + + + + + + + + + + - + [% FOREACH issueloo IN issues %] + [% IF ( issueloo.red ) %][% ELSE %][% END %] + + + + + + + + + + + [% END %] -[% IF ( issueloop ) %] -
Items checked out
TitleAuthorCall noItem typeDate dueBarcodeChargePriceStatus
+ [% issueloo.title |html %] + + [% issueloo.author %][% issueloo.itemcallnumber %][% issueloo.itemtype_description %][% issueloo.date_due %][% issueloo.barcode %][% issueloo.charge %][% issueloo.replacementprice %][% IF ( issueloo.red ) %]Overdue![% ELSE %] [% END %]
- - - - - - - - - - - - + + + + + + +
Items checked out
TitleAuthorCall noItem typeDate dueBarcodeChargePriceStatus
Totals:[% totaldue %][% totalprice %] 
+ [% END %] - [% FOREACH issueloo IN issueloop %] - [% IF ( issueloo.red ) %][% ELSE %][% END %] - - [% issueloo.title |html %] - - - - [% issueloo.author %] - [% issueloo.itemcallnumber %] - [% issueloo.itemtype_description %] - [% issueloo.date_due %] - [% issueloo.barcode %] - [% issueloo.charge %] - [% issueloo.replacementprice %] - [% IF ( issueloo.red ) %]Overdue![% ELSE %] [% END %] - - [% END %] - - Totals: - [% totaldue %] - [% totalprice %] -   - - - [% END %] - -[% IF ( reserveloop ) %] - - - - - - - - + [% IF ( accounts && ( totaldue != '0.00' ) ) %] +
Items on Reserve
TitleAuthorFormatRequested
+ + + + + + + -[% FOREACH reserveloo IN reserveloop %] - - - - - - - [% END %] -
Account fines and payments
Description of chargesDateAmountOutstanding
[% reserveloo.btitle %][% reserveloo.author %][% reserveloo.description %][% reserveloo.reservedate2 %]
-[% END %] + [% FOREACH account IN accounts %] + [% NEXT IF account.amountoutstanding == '0.00' %] + + + [% IF ( account.itemnumber ) %][% END %] + [% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %] + [% IF ( account.itemnumber ) %][% END %] + + [% account.date | $KohaDates %] + [% account.amount %] + [% account.amountoutstanding %] + + [% END %] -[% IF ( accounts && ( totaldue != '0.00' ) ) %] - - - - - - - - - [% FOREACH account IN accounts %] - [% NEXT IF account.amountoutstanding == '0.00' %] - - - - - - + + + + + + +
Account fines and payments
Description of chargesDateAmountOutstanding
- [% IF ( account.itemnumber ) %][% END %] - [% account.description %] [% IF ( account.printtitle ) %] [% account.title |html %][% END %] - [% IF ( account.itemnumber ) %][% END %] - [% account.date | $KohaDates %][% account.amount %][% account.amountoutstanding %]
Total due[% totaldue %]
[% END %] - - - Total due - [% totaldue %] - - - -[% END %] [% INCLUDE 'intranet-bottom.inc' %] --- a/members/summary-print.pl +++ a/members/summary-print.pl @@ -0,0 +1,101 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use CGI; + +use C4::Auth; +use C4::Output; +use C4::Members; +use C4::Koha qw( getitemtypeinfo ); +use C4::Circulation qw( GetIssuingCharges ); + +my $input = CGI->new; +my $borrowernumber = $input->param('borrowernumber'); + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "members/moremember-print.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + debug => 1, + } +); + +my $data = GetMember( 'borrowernumber' => $borrowernumber ); + +my ( $total, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber); +foreach my $accountline (@$accts) { + $accountline->{amount} = sprintf '%.2f', $accountline->{amount}; + $accountline->{amountoutstanding} = sprintf '%.2f', + $accountline->{amountoutstanding}; + + if ( $accountline->{accounttype} ne 'F' + && $accountline->{accounttype} ne 'FU' ) + { + $accountline->{printtitle} = 1; + } +} + +my $roadtype = + C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); + +our $totalprice = 0; +$template->param( + %$data, + + borrowernumber => $borrowernumber, + address => $data->{'streetnumber'} . " $roadtype " . $data->{'address'}, + + accounts => $accts, + totaldue => sprintf( "%.2f", $total ), + + issues => build_issue_data( GetPendingIssues($borrowernumber) ), + totalprice => $totalprice, +); + +output_html_with_http_headers $input, $cookie, $template->output; + +sub build_issue_data { + my $issues = shift; + + my $return; + + my $today = DateTime->now( time_zone => C4::Context->tz ); + $today->truncate( to => 'day' ); + + foreach my $issue ( @{$issues} ) { + + my %row = %{$issue}; + $totalprice += $issue->{replacementprice}; + + #find the charge for an item + my ( $charge, $itemtype ) = + GetIssuingCharges( $issue->{itemnumber}, $borrowernumber ); + + my $itemtypeinfo = getitemtypeinfo($itemtype); + $row{'itemtype_description'} = $itemtypeinfo->{description}; + + $row{'charge'} = sprintf( "%.2f", $charge ); + + push( @{$return}, \%row ); + } + return $return; +} --