Line 0
Link Here
|
0 |
- |
1 |
$DBversion = 'XXX'; # will be replaced by the RM |
|
|
2 |
if ( CheckVersion($DBversion) ) { |
3 |
|
4 |
# ACCOUNT_CREDIT |
5 |
my $account_credit = q{ |
6 |
[% PROCESS "accounts.inc" %] |
7 |
<table> |
8 |
[% IF ( LibraryName ) %] |
9 |
<tr> |
10 |
<th colspan="2" class="centerednames"> |
11 |
<h3>[% LibraryName | html %]</h3> |
12 |
</th> |
13 |
</tr> |
14 |
[% END %] |
15 |
[% IF credit.library %] |
16 |
<tr> |
17 |
<th colspan="2" class="centerednames"> |
18 |
<h2>[% credit.library.branchname | html %]</h2> |
19 |
</th> |
20 |
</tr> |
21 |
[% END %] |
22 |
<tr> |
23 |
<th colspan="2" class="centerednames"> |
24 |
<h3>[% credit.date | $KohaDates %]</h3> |
25 |
</th> |
26 |
</tr> |
27 |
<tr> |
28 |
<td>Transaction ID: </td> |
29 |
<td>[% credit.accountlines_id %]</td> |
30 |
</tr> |
31 |
<tr> |
32 |
<td>Operator ID: </td> |
33 |
<td>[% credit.manager_id %]</td> |
34 |
</tr> |
35 |
<tr> |
36 |
<td>Payment type: </td> |
37 |
<td>[% credit.payment_type %]</td> |
38 |
</tr> |
39 |
<tr> |
40 |
<th colspan="2" class="centerednames"> |
41 |
<h2><u>Payment receipt</u></h2> |
42 |
</th> |
43 |
</tr> |
44 |
<tr> |
45 |
<th colspan="2"> |
46 |
Received with thanks from [% credit.patron.firstname | html %] [% credit.patron.surname | html %] <br /> |
47 |
Card number: [% credit.patron.cardnumber | html %]<br /> |
48 |
</th> |
49 |
</tr> |
50 |
<tr> |
51 |
<th>Description of charges</th> |
52 |
<th>Amount</th> |
53 |
</tr> |
54 |
[% FOREACH offset IN credit.credit_offsets %] |
55 |
<tr> |
56 |
<td>[% PROCESS account_type_description account=offset.debit %]</td> |
57 |
<td>[% offset.amount * -1 | $Price %]</td> |
58 |
</tr> |
59 |
[% END %] |
60 |
<tfoot> |
61 |
<tr class="highlight"> |
62 |
<td>Total:</td> |
63 |
<td>[% credit.amount * -1 | $Price %]</td> |
64 |
</tr> |
65 |
<tr> |
66 |
<td>Change given: </td> |
67 |
<td>[% change | $Price %]</td> |
68 |
</tr> |
69 |
<tr> |
70 |
<td colspan="2"></td> |
71 |
</tr> |
72 |
<tr> |
73 |
<td>Account balance as on date:</td> |
74 |
<td>[% credit.patron.account.balance * -1 | $Price %]</td> |
75 |
</tr> |
76 |
</tfoot> |
77 |
</table> |
78 |
}; |
79 |
|
80 |
my $account_credit_old = q{<table>[%IF(LibraryName)%]<tr><thcolspan="4"class="centerednames"><h3>[%LibraryName|html%]</h3></th></tr>[%END%]<tr><thcolspan="4"class="centerednames"><h2><u>Feereceipt</u></h2></th></tr><tr><thcolspan="4"class="centerednames"><h2>[%Branches.GetName(patron.branchcode)|html%]</h2></th></tr><tr><thcolspan="4">Receivedwiththanksfrom[%patron.firstname|html%][%patron.surname|html%]<br/>Cardnumber:[%patron.cardnumber|html%]<br/></th></tr><tr><th>Date</th><th>Descriptionofcharges</th><th>Note</th><th>Amount</th></tr>[%FOREACHaccountINaccounts%]<trclass="highlight"><td>[%account.date|$KohaDates%]</td><td>[%PROCESSaccount_type_descriptionaccount=account%][%-IFaccount.description%],[%account.description|html%][%END%]</td><td>[%account.note|html%]</td>[%IF(account.amountcredit)%]<tdclass="credit">[%ELSE%]<tdclass="debit">[%END%][%account.amount|$Price%]</td></tr>[%END%]<tfoot><tr><tdcolspan="3">Totaloutstandingduesasondate:</td>[%IF(totalcredit)%]<tdclass="credit">[%ELSE%]<tdclass="debit">[%END%][%total|$Price%]</td></tr></tfoot></table>}; |
81 |
|
82 |
my $sth = $dbh->prepare( |
83 |
q{UPDATE letter SET content = ? WHERE code = 'ACCOUNT_CREDIT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = ?} |
84 |
); |
85 |
$sth->execute( $account_credit, $account_credit_old ); |
86 |
|
87 |
|
88 |
# ACCOUNT_DEBIT |
89 |
my $account_debit = q{ |
90 |
[% PROCESS "accounts.inc" %] |
91 |
<table> |
92 |
[% IF ( LibraryName ) %] |
93 |
<tr> |
94 |
<th colspan="3" class="centerednames"> |
95 |
<h3>[% LibraryName | html %]</h3> |
96 |
</th> |
97 |
</tr> |
98 |
[% END %] |
99 |
[% IF debit.library %] |
100 |
<tr> |
101 |
<th colspan="3" class="centerednames"> |
102 |
<h2>[% debit.library.branchname | html %]</h2> |
103 |
</th> |
104 |
</tr> |
105 |
[% END %] |
106 |
<tr> |
107 |
<th colspan="3" class="centerednames"> |
108 |
<h3>[% debit.date | $KohaDates %]</h3> |
109 |
</th> |
110 |
</tr> |
111 |
<tr> |
112 |
<td colspan="2" style="text-align:right;">Fee ID: </td> |
113 |
<td>[% debit.accountlines_id %]</td> |
114 |
</tr> |
115 |
[% IF credit.manager_id %] |
116 |
<tr> |
117 |
<td colspan="2" style="text-align:right;">Operator ID: </td> |
118 |
<td>[% credit.manager_id %]</td> |
119 |
</tr> |
120 |
[% END %] |
121 |
<tr> |
122 |
<th colspan="3" class="centerednames"> |
123 |
<h2><u>Invoice</u></h2> |
124 |
</th> |
125 |
</tr> |
126 |
<tr> |
127 |
<th colspan="3" > |
128 |
Bill to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %] <br /> |
129 |
Card number: [% debit.patron.cardnumber | html %]<br /> |
130 |
</th> |
131 |
</tr> |
132 |
[% IF debit.amount != debit.amountoutstanding %] |
133 |
<tr> |
134 |
<th>Date</th> |
135 |
<th>Description of payments</th> |
136 |
<th>Amount</th> |
137 |
</tr> |
138 |
[% FOREACH offset IN debit.debit_offsets %] |
139 |
<tr> |
140 |
<td>[% offset.credit.date | $KohaDates %]</td> |
141 |
<td>[% PROCESS account_type_description account=offset.credit %]</td> |
142 |
<td>[% offset.amount * -1 | $Price %]</td> |
143 |
</tr> |
144 |
[% END %] |
145 |
<tr class="highlight"> |
146 |
<td colspan="2" style="text-align:right;">Total paid:</td> |
147 |
<td>[% debit.amount - debit.amountoutstanding | $Price %]</td> |
148 |
</tr> |
149 |
[% END %] |
150 |
</tr> |
151 |
<td colspan="3"></td> |
152 |
<tr> |
153 |
<tfoot> |
154 |
<tr> |
155 |
<td colspan="2" style="text-align:right;">Total owed:</td> |
156 |
<td>[% debit.amount | $Price %]</td> |
157 |
</tr> |
158 |
<tr> |
159 |
<td colspan="2" style="text-align:right;">Total outstanding:</td> |
160 |
<td>[% debit.amountoutstanding | $Price %]</td> |
161 |
</tr> |
162 |
</tfoot> |
163 |
</table> |
164 |
}; |
165 |
|
166 |
my $account_debit_old = q{<table>[%IF(LibraryName)%]<tr><thcolspan="5"class="centerednames"><h3>[%LibraryName|html%]</h3></th></tr>[%END%]<tr><thcolspan="5"class="centerednames"><h2><u>INVOICE</u></h2></th></tr><tr><thcolspan="5"class="centerednames"><h2>[%Branches.GetName(patron.branchcode)|html%]</h2></th></tr><tr><thcolspan="5">Billto:[%patron.firstname|html%][%patron.surname|html%]<br/>Cardnumber:[%patron.cardnumber|html%]<br/></th></tr><tr><th>Date</th><th>Descriptionofcharges</th><th>Note</th><thstyle="text-align:right;">Amount</th><thstyle="text-align:right;">Amountoutstanding</th></tr>[%FOREACHaccountINaccounts%]<trclass="highlight"><td>[%account.date|$KohaDates%]</td><td>[%PROCESSaccount_type_descriptionaccount=account%][%-IFaccount.description%],[%account.description|html%][%END%]</td><td>[%account.note|html%]</td>[%IF(account.amountcredit)%]<tdclass="credit">[%ELSE%]<tdclass="debit">[%END%][%account.amount|$Price%]</td>[%IF(account.amountoutstandingcredit)%]<tdclass="credit">[%ELSE%]<tdclass="debit">[%END%][%account.amountoutstanding|$Price%]</td></tr>[%END%]<tfoot><tr><tdcolspan="4">Totaloutstandingduesasondate:</td>[%IF(totalcredit)%]<tdclass="credit">[%ELSE%]<tdclass="debit">[%END%][%total|$Price%]</td></tr></tfoot></table>}; |
167 |
|
168 |
$sth = $dbh->prepare( |
169 |
q{UPDATE letter SET content = ? WHERE code = 'ACCOUNT_DEBIT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = ?} |
170 |
); |
171 |
$sth->execute($account_debit, $account_debit_old); |
172 |
|
173 |
# RECEIPT |
174 |
my $receipt = q{ |
175 |
[% PROCESS "accounts.inc" %] |
176 |
<table> |
177 |
[% IF ( LibraryName ) %] |
178 |
<tr> |
179 |
<th colspan="2" class="centerednames"> |
180 |
<h3>[% LibraryName | html %]</h3> |
181 |
</th> |
182 |
</tr> |
183 |
[% END %] |
184 |
[% IF credit.library %] |
185 |
<tr> |
186 |
<th colspan="2" class="centerednames"> |
187 |
<h2>[% payment.library.branchname ) | html %]</h2> |
188 |
</th> |
189 |
</tr> |
190 |
[% END %] |
191 |
<tr> |
192 |
<th colspan="2" class="centerednames"> |
193 |
<h3>[% payment.date | $KohaDates %]</h3> |
194 |
</th> |
195 |
</tr> |
196 |
<tr> |
197 |
<td>Transaction ID: </td> |
198 |
<td>[% payment.accountlines_id %]</td> |
199 |
</tr> |
200 |
<tr> |
201 |
<td>Operator ID: </td> |
202 |
<td>[% payment.manager_id %]</td> |
203 |
</tr> |
204 |
<tr> |
205 |
<td>Payment type: </td> |
206 |
<td>[% payment.payment_type %]</td> |
207 |
</tr> |
208 |
<tr> |
209 |
<th colspan="2" class="centerednames"> |
210 |
<h2><u>Payment receipt</u></h2> |
211 |
</th> |
212 |
</tr> |
213 |
<tr> |
214 |
<th>Description of charges</th> |
215 |
<th>Amount</th> |
216 |
</tr> |
217 |
[% FOREACH offset IN payment.credit_offsets %] |
218 |
<tr> |
219 |
<td>[% PROCESS account_type_description account=offset.debit %]</td> |
220 |
<td>[% offset.amount * -1 | $Price %]</td> |
221 |
</tr> |
222 |
[% END %] |
223 |
<tfoot> |
224 |
<tr class="highlight"> |
225 |
<td>Total:</td> |
226 |
<td>[% payment.amount * -1 | $Price %]</td> |
227 |
</tr> |
228 |
<tr> |
229 |
<td>Tendered: </td> |
230 |
<td>[% tendered | $Price %]</td> |
231 |
</tr> |
232 |
<tr> |
233 |
<td>Change given:</td> |
234 |
<td>[% change | $Price %]</td> |
235 |
</tr> |
236 |
</tfoot> |
237 |
</table> |
238 |
}; |
239 |
|
240 |
my $receipt_old = q{[%PROCESS"accounts.inc"%]<table>[%IF(LibraryName)%]<tr><thcolspan="2"class="centerednames"><h3>[%LibraryName|html%]</h3></th></tr>[%END%]<tr><thcolspan="2"class="centerednames"><h2>[%Branches.GetName(payment.branchcode)|html%]</h2></th></tr><tr><thcolspan="2"class="centerednames"><h3>[%payment.date|$KohaDates%]</h3></tr><tr><td>TransactionID:</td><td>[%payment.accountlines_id%]</td></tr><tr><td>OperatorID:</td><td>[%payment.manager_id%]</td></tr><tr><td>Paymenttype:</td><td>[%payment.payment_type%]</td></tr><tr></tr><tr><thcolspan="2"class="centerednames"><h2><u>Feereceipt</u></h2></th></tr><tr></tr><tr><th>Descriptionofcharges</th><th>Amount</th></tr>[%FOREACHoffsetINoffsets%]<tr><td>[%PROCESSaccount_type_descriptionaccount=offset.debit%]</td><td>[%offset.amount*-1|$Price%]</td></tr>[%END%]<tfoot><trclass="highlight"><td>Total:</td><td>[%payment.amount*-1|$Price%]</td></tr><tr><td>Tendered:</td><td>[%collected|$Price%]</td></tr><tr><td>Change:</td><td>[%change|$Price%]</td></tr></tfoot></table>}; |
241 |
|
242 |
$sth = $dbh->prepare( |
243 |
q{UPDATE letter SET content = ? WHERE code = 'RECEIPT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = ? } |
244 |
); |
245 |
$sth->execute($receipt,$receipt_old); |
246 |
|
247 |
NewVersion( $DBversion, 24381, "Update accounts notices" ); |
248 |
} |