|
Line 0
Link Here
|
|
|
1 |
use Modern::Perl; |
| 2 |
|
| 3 |
return { |
| 4 |
bug_number => "31713", |
| 5 |
description => "Add FEE_SUMMARY slip notice", |
| 6 |
up => sub { |
| 7 |
my ($args) = @_; |
| 8 |
my ($dbh, $out) = @$args{qw(dbh out)}; |
| 9 |
|
| 10 |
my $slip_content = <<~'END_CONTENT'; |
| 11 |
[% USE Koha %] |
| 12 |
[% USE Branches %] |
| 13 |
[% USE Price %] |
| 14 |
[% PROCESS 'accounts.inc' %] |
| 15 |
<table> |
| 16 |
[% IF ( Koha.Preference('LibraryName') ) %] |
| 17 |
<tr> |
| 18 |
<th colspan='4' class='centerednames'> |
| 19 |
<h1>[% Koha.Preference('LibraryName') | html %]</h1> |
| 20 |
</th> |
| 21 |
</tr> |
| 22 |
[% END %] |
| 23 |
|
| 24 |
<tr> |
| 25 |
<th colspan='4' class='centerednames'> |
| 26 |
<h2>[% Branches.GetName( borrower.branchcode ) | html %]</h2> |
| 27 |
</th> |
| 28 |
</tr> |
| 29 |
|
| 30 |
<tr> |
| 31 |
<th colspan='4' class='centerednames'> |
| 32 |
<h3>Outstanding accounts</h3> |
| 33 |
</th> |
| 34 |
</tr> |
| 35 |
|
| 36 |
[% IF borrower.account.outstanding_debits.total_outstanding %] |
| 37 |
<tr> |
| 38 |
<th colspan='4' class='centerednames'> |
| 39 |
<h4>Debts</h4> |
| 40 |
</th> |
| 41 |
</tr> |
| 42 |
<tr> |
| 43 |
<th>Date</th> |
| 44 |
<th>Charge</th> |
| 45 |
<th>Amount</th> |
| 46 |
<th>Outstanding</th> |
| 47 |
</tr> |
| 48 |
[% FOREACH debit IN borrower.account.outstanding_debits %] |
| 49 |
<tr> |
| 50 |
<td>[% debit.date | $KohaDates %]</td> |
| 51 |
<td> |
| 52 |
[% PROCESS account_type_description account=debit %] |
| 53 |
[%- IF debit.description %], [% debit.description | html %][% END %] |
| 54 |
</td> |
| 55 |
<td class='debit'>[% debit.amount | $Price %]</td> |
| 56 |
<td class='debit'>[% debit.amountoutstanding | $Price %]</td> |
| 57 |
</tr> |
| 58 |
[% END %] |
| 59 |
[% END %] |
| 60 |
|
| 61 |
[% IF borrower.account.outstanding_credits.total_outstanding %] |
| 62 |
<tr> |
| 63 |
<th colspan='4' class='centerednames'> |
| 64 |
<h4>Credits</h4> |
| 65 |
</th> |
| 66 |
</tr> |
| 67 |
<tr> |
| 68 |
<th>Date</th> |
| 69 |
<th>Credit</th> |
| 70 |
<th>Amount</th> |
| 71 |
<th>Outstanding</th> |
| 72 |
</tr> |
| 73 |
[% FOREACH credit IN borrower.account.outstanding_credits %] |
| 74 |
<tr> |
| 75 |
<td>[% credit.date | $KohaDates %]</td> |
| 76 |
<td> |
| 77 |
[% PROCESS account_type_description account=credit %] |
| 78 |
[%- IF credit.description %], [% credit.description | html %][% END %] |
| 79 |
</td> |
| 80 |
<td class='credit'>[% credit.amount | $Price %]</td> |
| 81 |
<td class='credit'>[% credit.amountoutstanding | $Price %]</td> |
| 82 |
</tr> |
| 83 |
[% END %] |
| 84 |
[% END %] |
| 85 |
|
| 86 |
<tfoot> |
| 87 |
<tr> |
| 88 |
<td colspan='3'>Total outstanding dues as on date: </td> |
| 89 |
[% IF ( borrower.account.balance <= 0 ) %]<td class='credit'>[% ELSE %]<td class='debit'>[% END %][% borrower.account.balance | $Price %]</td> |
| 90 |
</tr> |
| 91 |
</tfoot> |
| 92 |
</table> |
| 93 |
END_CONTENT |
| 94 |
|
| 95 |
$dbh->do(qq{ |
| 96 |
INSERT IGNORE INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type, lang) |
| 97 |
VALUES ( 'members', 'FEE_SUMMARY', '', 'Fee Summary Slip', 1, 'Fee Summary for [% borrower.firstname %] [% borrower.surname %]', "$slip_content", 'print', 'default' ) |
| 98 |
}); |
| 99 |
say $out "Notice added"; |
| 100 |
}, |
| 101 |
}; |