View | Details | Raw Unified | Return to bug 4440
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/css/printreceiptinvoice.css (+353 lines)
Line 0 Link Here
1
a:link {
2
	color : #000066;
3
	text-decoration: none;
4
}
5
6
a:visited {
7
	color : #000066;
8
	text-decoration: none;
9
}
10
11
a:hover {
12
	color : #993300;
13
	text-decoration: none;
14
}
15
16
body {
17
	background-color : #FFF;
18
	color : #333333;
19
	font-family : arial, geneva, sans-serif;
20
	font-size : 14px;
21
	margin : 0px 0px 0px 0px;
22
}
23
24
caption {
25
	color : #000066;
26
	font-size : 18px;
27
	font-weight : bold;
28
	margin-top : 5px;
29
	text-align : left;
30
}
31
32
form {
33
	margin : 0px;
34
	padding : 0px;
35
}
36
37
h1
38
	{
39
	color : #000066;
40
	font-size : 22px;
41
	font-weight : bold;
42
	margin-bottom : 3px;
43
	margin-top : 3px;
44
}
45
46
h1#logo {
47
	display: none;
48
}
49
50
h2 {
51
	color : #000066;
52
	font-size : 20px;
53
	font-weight : bold;
54
	margin-bottom : 3px;
55
	margin-top : 3px;
56
}
57
58
h3 {
59
	color : #000066;
60
	font-size : 18px;
61
	font-weight : bold;
62
	margin-bottom : 3px;
63
	margin-top : 3px;
64
}
65
66
h4 {
67
	color : #000066;
68
	font-size : 16px;
69
	font-weight : bold;
70
	margin-bottom : 3px;
71
	margin-top : 3px;
72
}
73
74
h5 {
75
	color : #000066;
76
	font-size : 15px;
77
	font-weight : bold;
78
	margin-bottom : 1px;
79
	margin-top : 1px;
80
}
81
82
h6 {
83
	color : #000066;
84
	font-size : 14px;
85
	font-weight : bold;
86
	margin-bottom : 1px;
87
	margin-top : 1px;
88
}
89
90
table {
91
	background-color : #FFFFFF;
92
	border-bottom : 1px solid #CCCCCC;
93
	border-collapse : collapse;
94
	border-left : 1px solid #CCCCCC;
95
	margin : 3px 0px 5px 0px;
96
	padding : 0px;
97
	width : 99%;
98
}
99
100
table.list {
101
	background-color : #FFFFFF;
102
	border : 0;
103
	border-collapse : collapse;
104
	margin : 3px 0px 5px 0px;
105
	padding : 0px;
106
	width : 99%;
107
}
108
109
td {
110
	background-color : #FFF;
111
	border-bottom : 1px solid #CCCCCC;
112
	border-right : 1px solid #CCCCCC;
113
	border-top : 0;
114
	border-left : 0;
115
	font-size : 12px;
116
	padding : 5px 5px 5px 5px;
117
}
118
119
td:last-child {
120
	background-color : #FFF;
121
	border-bottom : 1px solid #CCCCCC;
122
	border-right : 0px solid #CCCCCC;
123
	border-top : 0;
124
	border-left : 0;
125
	font-size : 12px;
126
	padding : 5px 5px 5px 5px;
127
}
128
129
table.list th {
130
	background-color : #FFFFFF;
131
	border-top : 0;
132
	border-left : 0;
133
	text-align: left;
134
	font-size: 12px;
135
	font-weight: bold;
136
	padding: 5px;
137
	width : 25%;
138
}
139
140
th {
141
	background-color : #E9E9E9;
142
	border-bottom : 1px solid #CCCCCC;
143
	border-right : 1px solid #CCCCCC;
144
	border-top : 0;
145
	border-left : 0;
146
	font-size : 14px;
147
	font-weight : bold;
148
	padding : 5px 5px 5px 5px;
149
}
150
151
th:last-child {
152
	background-color : #E9E9E9;
153
	border-bottom : 1px solid #CCCCCC;
154
	border-right : 0px solid #CCCCCC;
155
	border-top : 0;
156
	border-left : 0;
157
	font-size : 14px;
158
	font-weight : bold;
159
	padding : 5px 5px 5px 5px;
160
}
161
162
td.input, div.form td, div.details td {
163
	border-bottom : 1px solid #CCCCCC;
164
	border-left : 1px solid #CCCCCC;
165
	border-right : 1px solid #CCCCCC;
166
	border-top : 1px solid #CCCCCC;
167
	color : #000000;
168
	line-height : 1.5em;
169
	padding : 4px;
170
	text-align : left;
171
}
172
173
td.label, div.form th, div.details th {
174
	background-color : #FFF;
175
	border-bottom : 1px solid #CCCCCC;
176
	border-left : 1px solid #CCCCCC;
177
	border-right : 0px;
178
	border-top : 0px;
179
	color : #000088;
180
	font-weight : bold;
181
	line-height : 1.5em;
182
	padding : 4px;
183
	text-align : right;
184
	vertical-align : top;
185
}
186
187
tr.highlight {
188
	background-color: #CCCCCC;
189
	border-bottom : 1px solid #CCCCCC;
190
	border-left : 1px solid #CCCCCC;
191
	border-right : 1px solid #CCCCCC;
192
	border-top : 1px solid #CCCCCC;
193
}
194
195
.error {
196
	font-weight: bold;
197
}
198
199
.ex {
200
	font-family : "Courier New", Courier, monospace;
201
}
202
.inline {
203
	display : inline;
204
}
205
206
tr.overdue {
207
	font-weight : bold;
208
}
209
210
tfoot {
211
	font-weight : bold;
212
}
213
214
tfoot td, tfoot td:last-child {
215
	background-color : #EEEEEE;
216
	border-right : 1px solid #666666;
217
	border-bottom : 1px solid #666666;
218
}
219
220
td.credit, td.debit, td.sum {
221
	font-family : "Courier New", Courier, monospace;
222
	text-align : right;
223
	border-bottom : 1px solid #CCCCCC;
224
	border-left : 1px solid #CCCCCC;
225
	border-right : 1px solid #CCCCCC;
226
	border-top : 1px solid #CCCCCC;
227
}
228
229
td.debit {
230
	color : #990000;
231
	border-bottom : 1px solid #CCCCCC;
232
	border-left : 1px solid #CCCCCC;
233
	border-right : 1px solid #CCCCCC;
234
	border-top : 1px solid #CCCCCC;
235
}
236
237
#receipt {
238
	background-color : #FFFFFF;
239
	font-family : serif;
240
	font-size : .9em;
241
	margin : 0 0px 0px 0;
242
	padding : 0px;
243
	position : relative;
244
}
245
246
#receipt a:link {
247
	color : #000066;
248
	text-decoration: none;
249
}
250
251
#receipt a:visited {
252
	color : #000066;
253
	text-decoration: none;
254
}
255
256
#receipt a:hover {
257
	color : #993300;
258
	text-decoration: none;
259
}
260
261
#receipt caption {
262
	color : #000000;
263
	font-weight : bold;
264
	margin-top : 5px;
265
	text-align : left;
266
}
267
268
#receipt div.table {
269
	background-color : transparent;
270
	font-weight: normal;
271
}
272
273
#receipt h3, #receipt caption, #receipt h4 {
274
	background-color : transparent;
275
	color : #000000;
276
	font-size : 1em;
277
	font-weight : bold;
278
	margin-bottom : 3px;
279
	margin-top : 3px;
280
}
281
282
#receipt h2 {
283
	background-color : transparent;
284
	color : #000000;
285
	font-weight : bold;
286
	margin-bottom : 3px;
287
	margin-top : 3px;
288
}
289
290
#receipt table {
291
	background-color : transparent;
292
	border : 0;
293
	border-collapse : collapse;
294
	width : auto;
295
}
296
297
#receipt td, #receipt th {
298
	background-color : transparent;
299
	border : 0;
300
	font-size : 1em;
301
	font-weight : normal;
302
	padding : 1px;
303
	border-bottom : 1px solid #000000;
304
	border-left : 1px solid #000000;
305
	border-right : 1px solid #000000;
306
	border-top : 1px solid #000000;
307
	}
308
309
#receipt th {
310
	font-weight : bold;
311
	text-align : left;
312
	}
313
314
#receipt th.centerednames {
315
	font-weight : bold;
316
	text-align: center;
317
	color: red;
318
	border-top : 0px;
319
	border-bottom : 0px;
320
}
321
322
div#breadcrumbs,
323
div#toplevelnav,
324
div#login,
325
div#header_search,
326
div#toolbar,
327
div#changelanguage,
328
div#menu,
329
div.yui-b,
330
.noprint,
331
form#sortbyform,
332
#cartDetails,
333
fieldset.action,
334
.list-actions,
335
.print {
336
    display: none;
337
}
338
339
div#yui-main div.yui-b {
340
	display : block;
341
}
342
343
.yui-t1 #yui-main div.yui-b,
344
.yui-t2 #yui-main div.yui-b,
345
.yui-t7 #yui-main div.yui-b {
346
	margin-left : 0;
347
}
348
fieldset {
349
	border : 0;
350
}
351
#cataloguing_additem_itemlist {
352
	overflow : visible !important;
353
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl (-2 / +10 lines)
Lines 35-40 Link Here
35
    <!-- TMPL_IF NAME="reverse_col" -->
35
    <!-- TMPL_IF NAME="reverse_col" -->
36
    <th>&nbsp;</th>
36
    <th>&nbsp;</th>
37
    <!-- /TMPL_IF -->
37
    <!-- /TMPL_IF -->
38
    <th>Print</th>
38
  </tr>
39
  </tr>
39
40
40
	<!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
41
	<!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
Lines 48-65 Link Here
48
    <!-- TMPL_IF NAME="reverse_col" -->
49
    <!-- TMPL_IF NAME="reverse_col" -->
49
      <td>
50
      <td>
50
	<!-- TMPL_IF NAME="payment" -->
51
	<!-- TMPL_IF NAME="payment" -->
51
		<a href="boraccount.pl?action=reverse&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&accountno=<!-- TMPL_VAR NAME="accountno" -->">Reverse</a>
52
		<a href="boraccount.pl?action=reverse&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;accountno=<!-- TMPL_VAR NAME="accountno" -->">Reverse</a>
52
	<!-- TMPL_ELSE -->
53
	<!-- TMPL_ELSE -->
53
		&nbsp;
54
		&nbsp;
54
	<!-- /TMPL_IF -->
55
	<!-- /TMPL_IF -->
55
      </td>
56
      </td>
56
	<!-- /TMPL_IF -->
57
	<!-- /TMPL_IF -->
58
<td>
59
	<!-- TMPL_IF NAME="payment" -->
60
		<a target="_blank" href="printfeercpt.pl?action=print&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;accountno=<!-- TMPL_VAR NAME="accountno" -->">Print</a>
61
	<!-- TMPL_ELSE -->
62
		<a target="_blank" href="printinvoice.pl?action=print&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;accountno=<!-- TMPL_VAR NAME="accountno" -->">Print</a>
63
	<!-- /TMPL_IF -->
64
      </td>
57
    </tr>
65
    </tr>
58
66
59
  <!-- /TMPL_LOOP -->
67
  <!-- /TMPL_LOOP -->
60
<tfoot>
68
<tfoot>
61
  <tr>
69
  <tr>
62
    <td colspan="3">Total due</td>
70
    <td colspan="4">Total due</td>
63
    <!-- TMPL_IF NAME="totalcredit" --><td colspan="2" class="credit"><!-- TMPL_ELSE --><td colspan="2" class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="total" --></td>
71
    <!-- TMPL_IF NAME="totalcredit" --><td colspan="2" class="credit"><!-- TMPL_ELSE --><td colspan="2" class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="total" --></td>
64
  </tr>
72
  </tr>
65
  </tfoot>
73
  </tfoot>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tmpl (+59 lines)
Line 0 Link Here
1
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2
<title>Print Receipt for <!-- TMPL_VAR NAME="cardnumber" --></title>
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
<link rel="shortcut icon" href="<!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico" type="image/x-icon" />
5
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/printreceiptinvoice.css" />
6
<script language="javascript">
7
        window.print();
8
        window.close();
9
</script>
10
</head>
11
<body>
12
13
<div id="receipt">
14
<!-- The table with the account items -->
15
<table>
16
 <tr>
17
	<th colspan=3 class="centerednames">
18
		<h3><!-- TMPL_VAR name="LibraryName" --></h3>
19
	</th>
20
 </tr>
21
 <tr>
22
	<th colspan=3 class="centerednames">
23
		<h2><u>Fee Receipt</u></h2>
24
	</th>
25
 </tr>
26
 <tr>
27
	<th colspan=3 class="centerednames">
28
		<!-- TMPL_IF NAME="branchname" --><h2><!-- TMPL_VAR NAME="branchname" --></h2><!-- /TMPL_IF -->
29
	</th>
30
 </tr>
31
 <tr>
32
	<th colspan=3 >
33
		Received with thanks from  <!-- TMPL_VAR NAME="firstname"> <!-- TMPL_VAR NAME="surname"> <br />
34
		Card Number : <!-- TMPL_VAR NAME="cardnumber" --><br />
35
	</th>
36
 </tr>
37
  <tr>
38
	<th>Date</th>
39
    <th>Description of charges</th>
40
    <th>Amount</th>
41
 </tr>
42
43
  <!-- TMPL_LOOP NAME="accounts" -->
44
<tr class="highlight">
45
      <td><!-- TMPL_VAR NAME="date" --></td>
46
      <td><!-- TMPL_VAR NAME="description" --></td>
47
      <!-- TMPL_IF NAME="amountcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amount" --></td>
48
    </tr>
49
50
  <!-- /TMPL_LOOP -->
51
<tfoot>
52
  <tr>
53
    <td colspan="2">Total outstanding dues as on date : </td>
54
    <!-- TMPL_IF NAME="totalcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="total" --></td>
55
  </tr>
56
  </tfoot>
57
</table>
58
</div>
59
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tmpl (+59 lines)
Line 0 Link Here
1
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2
<title>Print Receipt for <!-- TMPL_VAR NAME="cardnumber" --></title>
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
<link rel="shortcut icon" href="<!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico" type="image/x-icon" />
5
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/printreceiptinvoice.css" />
6
<script language="javascript">
7
        window.print();
8
        window.close();
9
</script>
10
</head>
11
<body>
12
13
<div id="receipt">
14
<!-- The table with the account items -->
15
<table>
16
  <tr>
17
	<th colspan=3 class="centerednames">
18
		<h3><!-- TMPL_VAR name="LibraryName" --></h3>
19
	</th>
20
  </tr>
21
  <tr>
22
	<th colspan=3 class="centerednames">
23
		<h2><u>INVOICE</u></h2>
24
	</th>
25
  </tr>
26
  <tr>
27
	<th colspan=3 class="centerednames">
28
		<!-- TMPL_IF NAME="branchname" --><h2><!-- TMPL_VAR NAME="branchname" --></h2><!-- /TMPL_IF -->
29
	</th>
30
  </tr>
31
  <tr>
32
	<th colspan=3 >
33
		To,<br />  <!-- TMPL_VAR NAME="firstname"> <!-- TMPL_VAR NAME="surname"> <br />
34
		Card Number : <!-- TMPL_VAR NAME="cardnumber" --><br />
35
	</th>
36
  </tr>
37
  <tr>
38
	<th>Date</th>
39
    <th>Description of charges</th>
40
    <th>Amount</th>
41
 </tr>
42
43
  <!-- TMPL_LOOP NAME="accounts" -->
44
<tr class="highlight">
45
      <td><!-- TMPL_VAR NAME="date" --></td>
46
      <td><!-- TMPL_VAR NAME="description" --></td>
47
      <!-- TMPL_IF NAME="amountcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amount" --></td>
48
    </tr>
49
50
  <!-- /TMPL_LOOP -->
51
<tfoot>
52
  <tr>
53
    <td colspan="2">Total outstanding dues as on date : </td>
54
    <!-- TMPL_IF NAME="totalcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="total" --></td>
55
  </tr>
56
  </tfoot>
57
</table>
58
</div>
59
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
(-)a/members/printfeercpt.pl (+143 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
4
#writen 3rd May 2010 by kmkale@anantcorp.com adapted from boraccount.pl by chris@katipo.oc.nz
5
#script to print fee receipts
6
7
8
# Copyright Koustubha Kale
9
#
10
# This file is part of Koha.
11
#
12
# Koha is free software; you can redistribute it and/or modify it under the
13
# terms of the GNU General Public License as published by the Free Software
14
# Foundation; either version 2 of the License, or (at your option) any later
15
# version.
16
#
17
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
20
#
21
# You should have received a copy of the GNU General Public License along
22
# with Koha; if not, write to the Free Software Foundation, Inc.,
23
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25
use strict;
26
use warnings;
27
28
use C4::Auth;
29
use C4::Output;
30
use C4::Dates qw/format_date/;
31
use CGI;
32
use C4::Members;
33
use C4::Branch;
34
use C4::Accounts;
35
36
my $input=new CGI;
37
38
39
my ($template, $loggedinuser, $cookie)
40
    = get_template_and_user({template_name => "members/printfeercpt.tmpl",
41
                            query => $input,
42
                            type => "intranet",
43
                            authnotrequired => 0,
44
                            flagsrequired => {borrowers => 1, updatecharges => 1},
45
                            debug => 1,
46
                            });
47
48
my $borrowernumber=$input->param('borrowernumber');
49
my $action = $input->param('action') || '';
50
my $accountno = $input->param('accountno');
51
52
#get borrower details
53
my $data=GetMember('borrowernumber' => $borrowernumber);
54
55
if ( $action eq 'print' ) {
56
#  ReversePayment( $borrowernumber, $input->param('accountno') );
57
}
58
59
if ( $data->{'category_type'} eq 'C') {
60
   my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
61
   my $cnt = scalar(@$catcodes);
62
   $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
63
   $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
64
}
65
66
#get account details
67
my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber);
68
my $totalcredit;
69
if($total <= 0){
70
        $totalcredit = 1;
71
}
72
my @accountrows; # this is for the tmpl-loop
73
74
my $toggle;
75
for (my $i=0;$i<$numaccts;$i++){
76
   next if ($accts->[$i]{'accountno'} ne $accountno);
77
    if($i%2){
78
            $toggle = 0;
79
    } else {
80
            $toggle = 1;
81
    }
82
    $accts->[$i]{'toggle'} = $toggle;
83
    $accts->[$i]{'amount'}+=0.00;
84
    if($accts->[$i]{'amount'} <= 0){
85
        $accts->[$i]{'amountcredit'} = 1;
86
	$accts->[$i]{'amount'}*=-1.00;
87
    }
88
    $accts->[$i]{'amountoutstanding'}+=0.00;
89
    if($accts->[$i]{'amountoutstanding'} <= 0){
90
        $accts->[$i]{'amountoutstandingcredit'} = 1;
91
    }
92
    my %row = ( 'date'              => format_date($accts->[$i]{'date'}),
93
                'amountcredit' => $accts->[$i]{'amountcredit'},
94
                'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'},
95
                'toggle' => $accts->[$i]{'toggle'},
96
                'description'       => $accts->[$i]{'description'},
97
				'itemnumber'       => $accts->[$i]{'itemnumber'},
98
				'biblionumber'       => $accts->[$i]{'biblionumber'},
99
                'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
100
                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
101
                'accountno' => $accts->[$i]{'accountno'},
102
                'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ),
103
104
                );
105
106
    if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
107
        $row{'printtitle'}=1;
108
        $row{'title'} = $accts->[$i]{'title'};
109
    }
110
111
    push(@accountrows, \%row);
112
}
113
114
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
115
116
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
117
$template->param( picture => 1 ) if $picture;
118
119
$template->param(
120
    finesview           => 1,
121
    firstname           => $data->{'firstname'},
122
    surname             => $data->{'surname'},
123
    borrowernumber      => $borrowernumber,
124
    cardnumber          => $data->{'cardnumber'},
125
    categorycode        => $data->{'categorycode'},
126
    category_type       => $data->{'category_type'},
127
 #   category_description => $data->{'description'},
128
    categoryname		 => $data->{'description'},
129
    address             => $data->{'address'},
130
    address2            => $data->{'address2'},
131
    city                => $data->{'city'},
132
    zipcode             => $data->{'zipcode'},
133
    country             => $data->{'country'},
134
    phone               => $data->{'phone'},
135
    email               => $data->{'email'},
136
    branchcode          => $data->{'branchcode'},
137
	branchname			=> GetBranchName($data->{'branchcode'}),
138
    total               => sprintf("%.2f",$total),
139
    totalcredit         => $totalcredit,
140
	is_child        => ($data->{'category_type'} eq 'C'),
141
    accounts            => \@accountrows );
142
143
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/printinvoice.pl (-1 / +142 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
4
#writen 3rd May 2010 by kmkale@anantcorp.com adapted from boraccount.pl by chris@katipo.oc.nz
5
#script to print fee receipts
6
7
8
# Copyright Koustubha Kale
9
#
10
# This file is part of Koha.
11
#
12
# Koha is free software; you can redistribute it and/or modify it under the
13
# terms of the GNU General Public License as published by the Free Software
14
# Foundation; either version 2 of the License, or (at your option) any later
15
# version.
16
#
17
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
20
#
21
# You should have received a copy of the GNU General Public License along
22
# with Koha; if not, write to the Free Software Foundation, Inc.,
23
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25
use strict;
26
use warnings;
27
28
use C4::Auth;
29
use C4::Output;
30
use C4::Dates qw/format_date/;
31
use CGI;
32
use C4::Members;
33
use C4::Branch;
34
use C4::Accounts;
35
36
my $input=new CGI;
37
38
39
my ($template, $loggedinuser, $cookie)
40
    = get_template_and_user({template_name => "members/printinvoice.tmpl",
41
                            query => $input,
42
                            type => "intranet",
43
                            authnotrequired => 0,
44
                            flagsrequired => {borrowers => 1, updatecharges => 1},
45
                            debug => 1,
46
                            });
47
48
my $borrowernumber=$input->param('borrowernumber');
49
my $action = $input->param('action') || '';
50
my $accountno = $input->param('accountno');
51
52
#get borrower details
53
my $data=GetMember('borrowernumber' => $borrowernumber);
54
55
if ( $action eq 'print' ) {
56
#  ReversePayment( $borrowernumber, $input->param('accountno') );
57
}
58
59
if ( $data->{'category_type'} eq 'C') {
60
   my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
61
   my $cnt = scalar(@$catcodes);
62
   $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
63
   $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
64
}
65
66
#get account details
67
my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber);
68
my $totalcredit;
69
if($total <= 0){
70
        $totalcredit = 1;
71
}
72
my @accountrows; # this is for the tmpl-loop
73
74
my $toggle;
75
for (my $i=0;$i<$numaccts;$i++){
76
   next if ($accts->[$i]{'accountno'} ne $accountno);
77
    if($i%2){
78
            $toggle = 0;
79
    } else {
80
            $toggle = 1;
81
    }
82
    $accts->[$i]{'toggle'} = $toggle;
83
    $accts->[$i]{'amount'}+=0.00;
84
    if($accts->[$i]{'amount'} <= 0){
85
        $accts->[$i]{'amountcredit'} = 1;
86
    }
87
    $accts->[$i]{'amountoutstanding'}+=0.00;
88
    if($accts->[$i]{'amountoutstanding'} <= 0){
89
        $accts->[$i]{'amountoutstandingcredit'} = 1;
90
    }
91
    my %row = ( 'date'              => format_date($accts->[$i]{'date'}),
92
                'amountcredit' => $accts->[$i]{'amountcredit'},
93
                'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'},
94
                'toggle' => $accts->[$i]{'toggle'},
95
                'description'       => $accts->[$i]{'description'},
96
				'itemnumber'       => $accts->[$i]{'itemnumber'},
97
				'biblionumber'       => $accts->[$i]{'biblionumber'},
98
                'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
99
                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
100
                'accountno' => $accts->[$i]{'accountno'},
101
                'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ),
102
103
                );
104
105
    if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
106
        $row{'printtitle'}=1;
107
        $row{'title'} = $accts->[$i]{'title'};
108
    }
109
110
    push(@accountrows, \%row);
111
}
112
113
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
114
115
my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
116
$template->param( picture => 1 ) if $picture;
117
118
$template->param(
119
    finesview           => 1,
120
    firstname           => $data->{'firstname'},
121
    surname             => $data->{'surname'},
122
    borrowernumber      => $borrowernumber,
123
    cardnumber          => $data->{'cardnumber'},
124
    categorycode        => $data->{'categorycode'},
125
    category_type       => $data->{'category_type'},
126
 #   category_description => $data->{'description'},
127
    categoryname		 => $data->{'description'},
128
    address             => $data->{'address'},
129
    address2            => $data->{'address2'},
130
    city                => $data->{'city'},
131
    zipcode             => $data->{'zipcode'},
132
    country             => $data->{'country'},
133
    phone               => $data->{'phone'},
134
    email               => $data->{'email'},
135
    branchcode          => $data->{'branchcode'},
136
	branchname			=> GetBranchName($data->{'branchcode'}),
137
    total               => sprintf("%.2f",$total),
138
    totalcredit         => $totalcredit,
139
	is_child        => ($data->{'category_type'} eq 'C'),
140
    accounts            => \@accountrows );
141
142
output_html_with_http_headers $input, $cookie, $template->output;

Return to bug 4440