Browse Source
This patch adds a small enhancement to allow printing of Fees / Fines receipts from the Fines page. Patch adds print links to the Fines page next to Fines or Receipts transactions. Clicking on the link will pop a new window and will print that with total outstanding as on date. You can edit koha-tmpl/intranet-tmpl/prog/en/css/printreceiptinvoice.css to better control printing this type of material. 18-Oct-2010 Changed template and script names to match. Corrected invalid markup in the templates. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Frédéric Demians <f.demians@tamil.fr> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>3.6.x-rmaint/testing
Koustubha Kale
14 years ago
committed by
Chris Cormack
6 changed files with 766 additions and 2 deletions
@ -0,0 +1,353 @@ |
|||
a:link { |
|||
color : #000066; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
a:visited { |
|||
color : #000066; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
a:hover { |
|||
color : #993300; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
body { |
|||
background-color : #FFF; |
|||
color : #333333; |
|||
font-family : arial, geneva, sans-serif; |
|||
font-size : 14px; |
|||
margin : 0px 0px 0px 0px; |
|||
} |
|||
|
|||
caption { |
|||
color : #000066; |
|||
font-size : 18px; |
|||
font-weight : bold; |
|||
margin-top : 5px; |
|||
text-align : left; |
|||
} |
|||
|
|||
form { |
|||
margin : 0px; |
|||
padding : 0px; |
|||
} |
|||
|
|||
h1 |
|||
{ |
|||
color : #000066; |
|||
font-size : 22px; |
|||
font-weight : bold; |
|||
margin-bottom : 3px; |
|||
margin-top : 3px; |
|||
} |
|||
|
|||
h1#logo { |
|||
display: none; |
|||
} |
|||
|
|||
h2 { |
|||
color : #000066; |
|||
font-size : 20px; |
|||
font-weight : bold; |
|||
margin-bottom : 3px; |
|||
margin-top : 3px; |
|||
} |
|||
|
|||
h3 { |
|||
color : #000066; |
|||
font-size : 18px; |
|||
font-weight : bold; |
|||
margin-bottom : 3px; |
|||
margin-top : 3px; |
|||
} |
|||
|
|||
h4 { |
|||
color : #000066; |
|||
font-size : 16px; |
|||
font-weight : bold; |
|||
margin-bottom : 3px; |
|||
margin-top : 3px; |
|||
} |
|||
|
|||
h5 { |
|||
color : #000066; |
|||
font-size : 15px; |
|||
font-weight : bold; |
|||
margin-bottom : 1px; |
|||
margin-top : 1px; |
|||
} |
|||
|
|||
h6 { |
|||
color : #000066; |
|||
font-size : 14px; |
|||
font-weight : bold; |
|||
margin-bottom : 1px; |
|||
margin-top : 1px; |
|||
} |
|||
|
|||
table { |
|||
background-color : #FFFFFF; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-collapse : collapse; |
|||
border-left : 1px solid #CCCCCC; |
|||
margin : 3px 0px 5px 0px; |
|||
padding : 0px; |
|||
width : 99%; |
|||
} |
|||
|
|||
table.list { |
|||
background-color : #FFFFFF; |
|||
border : 0; |
|||
border-collapse : collapse; |
|||
margin : 3px 0px 5px 0px; |
|||
padding : 0px; |
|||
width : 99%; |
|||
} |
|||
|
|||
td { |
|||
background-color : #FFF; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-right : 1px solid #CCCCCC; |
|||
border-top : 0; |
|||
border-left : 0; |
|||
font-size : 12px; |
|||
padding : 5px 5px 5px 5px; |
|||
} |
|||
|
|||
td:last-child { |
|||
background-color : #FFF; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-right : 0px solid #CCCCCC; |
|||
border-top : 0; |
|||
border-left : 0; |
|||
font-size : 12px; |
|||
padding : 5px 5px 5px 5px; |
|||
} |
|||
|
|||
table.list th { |
|||
background-color : #FFFFFF; |
|||
border-top : 0; |
|||
border-left : 0; |
|||
text-align: left; |
|||
font-size: 12px; |
|||
font-weight: bold; |
|||
padding: 5px; |
|||
width : 25%; |
|||
} |
|||
|
|||
th { |
|||
background-color : #E9E9E9; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-right : 1px solid #CCCCCC; |
|||
border-top : 0; |
|||
border-left : 0; |
|||
font-size : 14px; |
|||
font-weight : bold; |
|||
padding : 5px 5px 5px 5px; |
|||
} |
|||
|
|||
th:last-child { |
|||
background-color : #E9E9E9; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-right : 0px solid #CCCCCC; |
|||
border-top : 0; |
|||
border-left : 0; |
|||
font-size : 14px; |
|||
font-weight : bold; |
|||
padding : 5px 5px 5px 5px; |
|||
} |
|||
|
|||
td.input, div.form td, div.details td { |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-left : 1px solid #CCCCCC; |
|||
border-right : 1px solid #CCCCCC; |
|||
border-top : 1px solid #CCCCCC; |
|||
color : #000000; |
|||
line-height : 1.5em; |
|||
padding : 4px; |
|||
text-align : left; |
|||
} |
|||
|
|||
td.label, div.form th, div.details th { |
|||
background-color : #FFF; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-left : 1px solid #CCCCCC; |
|||
border-right : 0px; |
|||
border-top : 0px; |
|||
color : #000088; |
|||
font-weight : bold; |
|||
line-height : 1.5em; |
|||
padding : 4px; |
|||
text-align : right; |
|||
vertical-align : top; |
|||
} |
|||
|
|||
tr.highlight { |
|||
background-color: #CCCCCC; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-left : 1px solid #CCCCCC; |
|||
border-right : 1px solid #CCCCCC; |
|||
border-top : 1px solid #CCCCCC; |
|||
} |
|||
|
|||
.error { |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.ex { |
|||
font-family : "Courier New", Courier, monospace; |
|||
} |
|||
.inline { |
|||
display : inline; |
|||
} |
|||
|
|||
tr.overdue { |
|||
font-weight : bold; |
|||
} |
|||
|
|||
tfoot { |
|||
font-weight : bold; |
|||
} |
|||
|
|||
tfoot td, tfoot td:last-child { |
|||
background-color : #EEEEEE; |
|||
border-right : 1px solid #666666; |
|||
border-bottom : 1px solid #666666; |
|||
} |
|||
|
|||
td.credit, td.debit, td.sum { |
|||
font-family : "Courier New", Courier, monospace; |
|||
text-align : right; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-left : 1px solid #CCCCCC; |
|||
border-right : 1px solid #CCCCCC; |
|||
border-top : 1px solid #CCCCCC; |
|||
} |
|||
|
|||
td.debit { |
|||
color : #990000; |
|||
border-bottom : 1px solid #CCCCCC; |
|||
border-left : 1px solid #CCCCCC; |
|||
border-right : 1px solid #CCCCCC; |
|||
border-top : 1px solid #CCCCCC; |
|||
} |
|||
|
|||
#receipt { |
|||
background-color : #FFFFFF; |
|||
font-family : serif; |
|||
font-size : .9em; |
|||
margin : 0 0px 0px 0; |
|||
padding : 0px; |
|||
position : relative; |
|||
} |
|||
|
|||
#receipt a:link { |
|||
color : #000066; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
#receipt a:visited { |
|||
color : #000066; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
#receipt a:hover { |
|||
color : #993300; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
#receipt caption { |
|||
color : #000000; |
|||
font-weight : bold; |
|||
margin-top : 5px; |
|||
text-align : left; |
|||
} |
|||
|
|||
#receipt div.table { |
|||
background-color : transparent; |
|||
font-weight: normal; |
|||
} |
|||
|
|||
#receipt h3, #receipt caption, #receipt h4 { |
|||
background-color : transparent; |
|||
color : #000000; |
|||
font-size : 1em; |
|||
font-weight : bold; |
|||
margin-bottom : 3px; |
|||
margin-top : 3px; |
|||
} |
|||
|
|||
#receipt h2 { |
|||
background-color : transparent; |
|||
color : #000000; |
|||
font-weight : bold; |
|||
margin-bottom : 3px; |
|||
margin-top : 3px; |
|||
} |
|||
|
|||
#receipt table { |
|||
background-color : transparent; |
|||
border : 0; |
|||
border-collapse : collapse; |
|||
width : auto; |
|||
} |
|||
|
|||
#receipt td, #receipt th { |
|||
background-color : transparent; |
|||
border : 0; |
|||
font-size : 1em; |
|||
font-weight : normal; |
|||
padding : 1px; |
|||
border-bottom : 1px solid #000000; |
|||
border-left : 1px solid #000000; |
|||
border-right : 1px solid #000000; |
|||
border-top : 1px solid #000000; |
|||
} |
|||
|
|||
#receipt th { |
|||
font-weight : bold; |
|||
text-align : left; |
|||
} |
|||
|
|||
#receipt th.centerednames { |
|||
font-weight : bold; |
|||
text-align: center; |
|||
color: red; |
|||
border-top : 0px; |
|||
border-bottom : 0px; |
|||
} |
|||
|
|||
div#breadcrumbs, |
|||
div#toplevelnav, |
|||
div#login, |
|||
div#header_search, |
|||
div#toolbar, |
|||
div#changelanguage, |
|||
div#menu, |
|||
div.yui-b, |
|||
.noprint, |
|||
form#sortbyform, |
|||
#cartDetails, |
|||
fieldset.action, |
|||
.list-actions, |
|||
.print { |
|||
display: none; |
|||
} |
|||
|
|||
div#yui-main div.yui-b { |
|||
display : block; |
|||
} |
|||
|
|||
.yui-t1 #yui-main div.yui-b, |
|||
.yui-t2 #yui-main div.yui-b, |
|||
.yui-t7 #yui-main div.yui-b { |
|||
margin-left : 0; |
|||
} |
|||
fieldset { |
|||
border : 0; |
|||
} |
|||
#cataloguing_additem_itemlist { |
|||
overflow : visible !important; |
|||
} |
@ -0,0 +1,59 @@ |
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --> |
|||
<title>Print Receipt for <!-- TMPL_VAR NAME="cardnumber" --></title> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|||
<link rel="shortcut icon" href="<!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico" type="image/x-icon" /> |
|||
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/printreceiptinvoice.css" /> |
|||
<script language="javascript"> |
|||
window.print(); |
|||
window.close(); |
|||
</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id="receipt"> |
|||
<!-- The table with the account items --> |
|||
<table> |
|||
<tr> |
|||
<th colspan=3 class="centerednames"> |
|||
<h3><!-- TMPL_VAR name="LibraryName" --></h3> |
|||
</th> |
|||
</tr> |
|||
<tr> |
|||
<th colspan=3 class="centerednames"> |
|||
<h2><u>Fee Receipt</u></h2> |
|||
</th> |
|||
</tr> |
|||
<tr> |
|||
<th colspan=3 class="centerednames"> |
|||
<!-- TMPL_IF NAME="branchname" --><h2><!-- TMPL_VAR NAME="branchname" --></h2><!-- /TMPL_IF --> |
|||
</th> |
|||
</tr> |
|||
<tr> |
|||
<th colspan=3 > |
|||
Received with thanks from <!-- TMPL_VAR NAME="firstname"> <!-- TMPL_VAR NAME="surname"> <br /> |
|||
Card Number : <!-- TMPL_VAR NAME="cardnumber" --><br /> |
|||
</th> |
|||
</tr> |
|||
<tr> |
|||
<th>Date</th> |
|||
<th>Description of charges</th> |
|||
<th>Amount</th> |
|||
</tr> |
|||
|
|||
<!-- TMPL_LOOP NAME="accounts" --> |
|||
<tr class="highlight"> |
|||
<td><!-- TMPL_VAR NAME="date" --></td> |
|||
<td><!-- TMPL_VAR NAME="description" --></td> |
|||
<!-- TMPL_IF NAME="amountcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amount" --></td> |
|||
</tr> |
|||
|
|||
<!-- /TMPL_LOOP --> |
|||
<tfoot> |
|||
<tr> |
|||
<td colspan="2">Total outstanding dues as on date : </td> |
|||
<!-- TMPL_IF NAME="totalcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="total" --></td> |
|||
</tr> |
|||
</tfoot> |
|||
</table> |
|||
</div> |
|||
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" --> |
@ -0,0 +1,59 @@ |
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --> |
|||
<title>Print Receipt for <!-- TMPL_VAR NAME="cardnumber" --></title> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|||
<link rel="shortcut icon" href="<!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico" type="image/x-icon" /> |
|||
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/printreceiptinvoice.css" /> |
|||
<script language="javascript"> |
|||
window.print(); |
|||
window.close(); |
|||
</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id="receipt"> |
|||
<!-- The table with the account items --> |
|||
<table> |
|||
<tr> |
|||
<th colspan=3 class="centerednames"> |
|||
<h3><!-- TMPL_VAR name="LibraryName" --></h3> |
|||
</th> |
|||
</tr> |
|||
<tr> |
|||
<th colspan=3 class="centerednames"> |
|||
<h2><u>INVOICE</u></h2> |
|||
</th> |
|||
</tr> |
|||
<tr> |
|||
<th colspan=3 class="centerednames"> |
|||
<!-- TMPL_IF NAME="branchname" --><h2><!-- TMPL_VAR NAME="branchname" --></h2><!-- /TMPL_IF --> |
|||
</th> |
|||
</tr> |
|||
<tr> |
|||
<th colspan=3 > |
|||
To,<br /> <!-- TMPL_VAR NAME="firstname"> <!-- TMPL_VAR NAME="surname"> <br /> |
|||
Card Number : <!-- TMPL_VAR NAME="cardnumber" --><br /> |
|||
</th> |
|||
</tr> |
|||
<tr> |
|||
<th>Date</th> |
|||
<th>Description of charges</th> |
|||
<th>Amount</th> |
|||
</tr> |
|||
|
|||
<!-- TMPL_LOOP NAME="accounts" --> |
|||
<tr class="highlight"> |
|||
<td><!-- TMPL_VAR NAME="date" --></td> |
|||
<td><!-- TMPL_VAR NAME="description" --></td> |
|||
<!-- TMPL_IF NAME="amountcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amount" --></td> |
|||
</tr> |
|||
|
|||
<!-- /TMPL_LOOP --> |
|||
<tfoot> |
|||
<tr> |
|||
<td colspan="2">Total outstanding dues as on date : </td> |
|||
<!-- TMPL_IF NAME="totalcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="total" --></td> |
|||
</tr> |
|||
</tfoot> |
|||
</table> |
|||
</div> |
|||
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" --> |
@ -0,0 +1,143 @@ |
|||
#!/usr/bin/perl |
|||
|
|||
|
|||
#writen 3rd May 2010 by kmkale@anantcorp.com adapted from boraccount.pl by chris@katipo.oc.nz |
|||
#script to print fee receipts |
|||
|
|||
|
|||
# Copyright Koustubha Kale |
|||
# |
|||
# 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 2 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 strict; |
|||
use warnings; |
|||
|
|||
use C4::Auth; |
|||
use C4::Output; |
|||
use C4::Dates qw/format_date/; |
|||
use CGI; |
|||
use C4::Members; |
|||
use C4::Branch; |
|||
use C4::Accounts; |
|||
|
|||
my $input=new CGI; |
|||
|
|||
|
|||
my ($template, $loggedinuser, $cookie) |
|||
= get_template_and_user({template_name => "members/printfeercpt.tmpl", |
|||
query => $input, |
|||
type => "intranet", |
|||
authnotrequired => 0, |
|||
flagsrequired => {borrowers => 1, updatecharges => 1}, |
|||
debug => 1, |
|||
}); |
|||
|
|||
my $borrowernumber=$input->param('borrowernumber'); |
|||
my $action = $input->param('action') || ''; |
|||
my $accountno = $input->param('accountno'); |
|||
|
|||
#get borrower details |
|||
my $data=GetMember('borrowernumber' => $borrowernumber); |
|||
|
|||
if ( $action eq 'print' ) { |
|||
# ReversePayment( $borrowernumber, $input->param('accountno') ); |
|||
} |
|||
|
|||
if ( $data->{'category_type'} eq 'C') { |
|||
my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); |
|||
my $cnt = scalar(@$catcodes); |
|||
$template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; |
|||
$template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; |
|||
} |
|||
|
|||
#get account details |
|||
my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber); |
|||
my $totalcredit; |
|||
if($total <= 0){ |
|||
$totalcredit = 1; |
|||
} |
|||
my @accountrows; # this is for the tmpl-loop |
|||
|
|||
my $toggle; |
|||
for (my $i=0;$i<$numaccts;$i++){ |
|||
next if ($accts->[$i]{'accountno'} ne $accountno); |
|||
if($i%2){ |
|||
$toggle = 0; |
|||
} else { |
|||
$toggle = 1; |
|||
} |
|||
$accts->[$i]{'toggle'} = $toggle; |
|||
$accts->[$i]{'amount'}+=0.00; |
|||
if($accts->[$i]{'amount'} <= 0){ |
|||
$accts->[$i]{'amountcredit'} = 1; |
|||
$accts->[$i]{'amount'}*=-1.00; |
|||
} |
|||
$accts->[$i]{'amountoutstanding'}+=0.00; |
|||
if($accts->[$i]{'amountoutstanding'} <= 0){ |
|||
$accts->[$i]{'amountoutstandingcredit'} = 1; |
|||
} |
|||
my %row = ( 'date' => format_date($accts->[$i]{'date'}), |
|||
'amountcredit' => $accts->[$i]{'amountcredit'}, |
|||
'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'}, |
|||
'toggle' => $accts->[$i]{'toggle'}, |
|||
'description' => $accts->[$i]{'description'}, |
|||
'itemnumber' => $accts->[$i]{'itemnumber'}, |
|||
'biblionumber' => $accts->[$i]{'biblionumber'}, |
|||
'amount' => sprintf("%.2f",$accts->[$i]{'amount'}), |
|||
'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}), |
|||
'accountno' => $accts->[$i]{'accountno'}, |
|||
'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ), |
|||
|
|||
); |
|||
|
|||
if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){ |
|||
$row{'printtitle'}=1; |
|||
$row{'title'} = $accts->[$i]{'title'}; |
|||
} |
|||
|
|||
push(@accountrows, \%row); |
|||
} |
|||
|
|||
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); |
|||
|
|||
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); |
|||
$template->param( picture => 1 ) if $picture; |
|||
|
|||
$template->param( |
|||
finesview => 1, |
|||
firstname => $data->{'firstname'}, |
|||
surname => $data->{'surname'}, |
|||
borrowernumber => $borrowernumber, |
|||
cardnumber => $data->{'cardnumber'}, |
|||
categorycode => $data->{'categorycode'}, |
|||
category_type => $data->{'category_type'}, |
|||
# category_description => $data->{'description'}, |
|||
categoryname => $data->{'description'}, |
|||
address => $data->{'address'}, |
|||
address2 => $data->{'address2'}, |
|||
city => $data->{'city'}, |
|||
zipcode => $data->{'zipcode'}, |
|||
country => $data->{'country'}, |
|||
phone => $data->{'phone'}, |
|||
email => $data->{'email'}, |
|||
branchcode => $data->{'branchcode'}, |
|||
branchname => GetBranchName($data->{'branchcode'}), |
|||
total => sprintf("%.2f",$total), |
|||
totalcredit => $totalcredit, |
|||
is_child => ($data->{'category_type'} eq 'C'), |
|||
accounts => \@accountrows ); |
|||
|
|||
output_html_with_http_headers $input, $cookie, $template->output; |
@ -0,0 +1,142 @@ |
|||
#!/usr/bin/perl |
|||
|
|||
|
|||
#writen 3rd May 2010 by kmkale@anantcorp.com adapted from boraccount.pl by chris@katipo.oc.nz |
|||
#script to print fee receipts |
|||
|
|||
|
|||
# Copyright Koustubha Kale |
|||
# |
|||
# 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 2 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 strict; |
|||
use warnings; |
|||
|
|||
use C4::Auth; |
|||
use C4::Output; |
|||
use C4::Dates qw/format_date/; |
|||
use CGI; |
|||
use C4::Members; |
|||
use C4::Branch; |
|||
use C4::Accounts; |
|||
|
|||
my $input=new CGI; |
|||
|
|||
|
|||
my ($template, $loggedinuser, $cookie) |
|||
= get_template_and_user({template_name => "members/printinvoice.tmpl", |
|||
query => $input, |
|||
type => "intranet", |
|||
authnotrequired => 0, |
|||
flagsrequired => {borrowers => 1, updatecharges => 1}, |
|||
debug => 1, |
|||
}); |
|||
|
|||
my $borrowernumber=$input->param('borrowernumber'); |
|||
my $action = $input->param('action') || ''; |
|||
my $accountno = $input->param('accountno'); |
|||
|
|||
#get borrower details |
|||
my $data=GetMember('borrowernumber' => $borrowernumber); |
|||
|
|||
if ( $action eq 'print' ) { |
|||
# ReversePayment( $borrowernumber, $input->param('accountno') ); |
|||
} |
|||
|
|||
if ( $data->{'category_type'} eq 'C') { |
|||
my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); |
|||
my $cnt = scalar(@$catcodes); |
|||
$template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; |
|||
$template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; |
|||
} |
|||
|
|||
#get account details |
|||
my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber); |
|||
my $totalcredit; |
|||
if($total <= 0){ |
|||
$totalcredit = 1; |
|||
} |
|||
my @accountrows; # this is for the tmpl-loop |
|||
|
|||
my $toggle; |
|||
for (my $i=0;$i<$numaccts;$i++){ |
|||
next if ($accts->[$i]{'accountno'} ne $accountno); |
|||
if($i%2){ |
|||
$toggle = 0; |
|||
} else { |
|||
$toggle = 1; |
|||
} |
|||
$accts->[$i]{'toggle'} = $toggle; |
|||
$accts->[$i]{'amount'}+=0.00; |
|||
if($accts->[$i]{'amount'} <= 0){ |
|||
$accts->[$i]{'amountcredit'} = 1; |
|||
} |
|||
$accts->[$i]{'amountoutstanding'}+=0.00; |
|||
if($accts->[$i]{'amountoutstanding'} <= 0){ |
|||
$accts->[$i]{'amountoutstandingcredit'} = 1; |
|||
} |
|||
my %row = ( 'date' => format_date($accts->[$i]{'date'}), |
|||
'amountcredit' => $accts->[$i]{'amountcredit'}, |
|||
'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'}, |
|||
'toggle' => $accts->[$i]{'toggle'}, |
|||
'description' => $accts->[$i]{'description'}, |
|||
'itemnumber' => $accts->[$i]{'itemnumber'}, |
|||
'biblionumber' => $accts->[$i]{'biblionumber'}, |
|||
'amount' => sprintf("%.2f",$accts->[$i]{'amount'}), |
|||
'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}), |
|||
'accountno' => $accts->[$i]{'accountno'}, |
|||
'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ), |
|||
|
|||
); |
|||
|
|||
if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){ |
|||
$row{'printtitle'}=1; |
|||
$row{'title'} = $accts->[$i]{'title'}; |
|||
} |
|||
|
|||
push(@accountrows, \%row); |
|||
} |
|||
|
|||
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); |
|||
|
|||
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); |
|||
$template->param( picture => 1 ) if $picture; |
|||
|
|||
$template->param( |
|||
finesview => 1, |
|||
firstname => $data->{'firstname'}, |
|||
surname => $data->{'surname'}, |
|||
borrowernumber => $borrowernumber, |
|||
cardnumber => $data->{'cardnumber'}, |
|||
categorycode => $data->{'categorycode'}, |
|||
category_type => $data->{'category_type'}, |
|||
# category_description => $data->{'description'}, |
|||
categoryname => $data->{'description'}, |
|||
address => $data->{'address'}, |
|||
address2 => $data->{'address2'}, |
|||
city => $data->{'city'}, |
|||
zipcode => $data->{'zipcode'}, |
|||
country => $data->{'country'}, |
|||
phone => $data->{'phone'}, |
|||
email => $data->{'email'}, |
|||
branchcode => $data->{'branchcode'}, |
|||
branchname => GetBranchName($data->{'branchcode'}), |
|||
total => sprintf("%.2f",$total), |
|||
totalcredit => $totalcredit, |
|||
is_child => ($data->{'category_type'} eq 'C'), |
|||
accounts => \@accountrows ); |
|||
|
|||
output_html_with_http_headers $input, $cookie, $template->output; |
Loading…
Reference in new issue