|
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 |
$dbh->do( |
| 83 |
qq{UPDATE letter SET content = $account_credit_new WHERE code = 'ACCOUNT_CREDIT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = $account_credit_old;} |
| 84 |
); |
| 85 |
|
| 86 |
# ACCOUNT_DEBIT |
| 87 |
my $account_debit = q{ |
| 88 |
[% PROCESS "accounts.inc" %] |
| 89 |
<table> |
| 90 |
[% IF ( LibraryName ) %] |
| 91 |
<tr> |
| 92 |
<th colspan="3" class="centerednames"> |
| 93 |
<h3>[% LibraryName | html %]</h3> |
| 94 |
</th> |
| 95 |
</tr> |
| 96 |
[% END %] |
| 97 |
[% IF debit.library %] |
| 98 |
<tr> |
| 99 |
<th colspan="3" class="centerednames"> |
| 100 |
<h2>[% debit.library.branchname | html %]</h2> |
| 101 |
</th> |
| 102 |
</tr> |
| 103 |
[% END %] |
| 104 |
<tr> |
| 105 |
<th colspan="3" class="centerednames"> |
| 106 |
<h3>[% debit.date | $KohaDates %]</h3> |
| 107 |
</th> |
| 108 |
</tr> |
| 109 |
<tr> |
| 110 |
<td colspan="2" style="text-align:right;">Fee ID: </td> |
| 111 |
<td>[% debit.accountlines_id %]</td> |
| 112 |
</tr> |
| 113 |
[% IF credit.manager_id %] |
| 114 |
<tr> |
| 115 |
<td colspan="2" style="text-align:right;">Operator ID: </td> |
| 116 |
<td>[% credit.manager_id %]</td> |
| 117 |
</tr> |
| 118 |
[% END %] |
| 119 |
<tr> |
| 120 |
<th colspan="3" class="centerednames"> |
| 121 |
<h2><u>Invoice</u></h2> |
| 122 |
</th> |
| 123 |
</tr> |
| 124 |
<tr> |
| 125 |
<th colspan="3" > |
| 126 |
Bill to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %] <br /> |
| 127 |
Card number: [% debit.patron.cardnumber | html %]<br /> |
| 128 |
</th> |
| 129 |
</tr> |
| 130 |
[% IF debit.amount != debit.amountoutstanding %] |
| 131 |
<tr> |
| 132 |
<th>Date</th> |
| 133 |
<th>Description of payments</th> |
| 134 |
<th>Amount</th> |
| 135 |
</tr> |
| 136 |
[% FOREACH offset IN debit.debit_offsets %] |
| 137 |
<tr> |
| 138 |
<td>[% offset.credit.date | $KohaDates %]</td> |
| 139 |
<td>[% PROCESS account_type_description account=offset.credit %]</td> |
| 140 |
<td>[% offset.amount * -1 | $Price %]</td> |
| 141 |
</tr> |
| 142 |
[% END %] |
| 143 |
<tr class="highlight"> |
| 144 |
<td colspan="2" style="text-align:right;">Total paid:</td> |
| 145 |
<td>[% debit.amount - debit.amountoutstanding | $Price %]</td> |
| 146 |
</tr> |
| 147 |
[% END %] |
| 148 |
</tr> |
| 149 |
<td colspan="3"></td> |
| 150 |
<tr> |
| 151 |
<tfoot> |
| 152 |
<tr> |
| 153 |
<td colspan="2" style="text-align:right;">Total owed:</td> |
| 154 |
<td>[% debit.amount | $Price %]</td> |
| 155 |
</tr> |
| 156 |
<tr> |
| 157 |
<td colspan="2" style="text-align:right;">Total outstanding:</td> |
| 158 |
<td>[% debit.amountoutstanding | $Price %]</td> |
| 159 |
</tr> |
| 160 |
</tfoot> |
| 161 |
</table> |
| 162 |
}; |
| 163 |
|
| 164 |
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>}; |
| 165 |
|
| 166 |
$dbh->do( |
| 167 |
qq{UPDATE letter SET content = $account_debit_new WHERE code = 'ACCOUNT_DEBIT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = $account_debit_old;} |
| 168 |
); |
| 169 |
|
| 170 |
# RECEIPT |
| 171 |
my $receipt = q{ |
| 172 |
[% PROCESS "accounts.inc" %] |
| 173 |
<table> |
| 174 |
[% IF ( LibraryName ) %] |
| 175 |
<tr> |
| 176 |
<th colspan="2" class="centerednames"> |
| 177 |
<h3>[% LibraryName | html %]</h3> |
| 178 |
</th> |
| 179 |
</tr> |
| 180 |
[% END %] |
| 181 |
[% IF credit.library %] |
| 182 |
<tr> |
| 183 |
<th colspan="2" class="centerednames"> |
| 184 |
<h2>[% payment.library.branchname ) | html %]</h2> |
| 185 |
</th> |
| 186 |
</tr> |
| 187 |
[% END %] |
| 188 |
<tr> |
| 189 |
<th colspan="2" class="centerednames"> |
| 190 |
<h3>[% payment.date | $KohaDates %]</h3> |
| 191 |
</th> |
| 192 |
</tr> |
| 193 |
<tr> |
| 194 |
<td>Transaction ID: </td> |
| 195 |
<td>[% payment.accountlines_id %]</td> |
| 196 |
</tr> |
| 197 |
<tr> |
| 198 |
<td>Operator ID: </td> |
| 199 |
<td>[% payment.manager_id %]</td> |
| 200 |
</tr> |
| 201 |
<tr> |
| 202 |
<td>Payment type: </td> |
| 203 |
<td>[% payment.payment_type %]</td> |
| 204 |
</tr> |
| 205 |
<tr> |
| 206 |
<th colspan="2" class="centerednames"> |
| 207 |
<h2><u>Payment receipt</u></h2> |
| 208 |
</th> |
| 209 |
</tr> |
| 210 |
<tr> |
| 211 |
<th>Description of charges</th> |
| 212 |
<th>Amount</th> |
| 213 |
</tr> |
| 214 |
[% FOREACH offset IN payment.credit_offsets %] |
| 215 |
<tr> |
| 216 |
<td>[% PROCESS account_type_description account=offset.debit %]</td> |
| 217 |
<td>[% offset.amount * -1 | $Price %]</td> |
| 218 |
</tr> |
| 219 |
[% END %] |
| 220 |
<tfoot> |
| 221 |
<tr class="highlight"> |
| 222 |
<td>Total:</td> |
| 223 |
<td>[% payment.amount * -1 | $Price %]</td> |
| 224 |
</tr> |
| 225 |
<tr> |
| 226 |
<td>Tendered: </td> |
| 227 |
<td>[% tendered | $Price %]</td> |
| 228 |
</tr> |
| 229 |
<tr> |
| 230 |
<td>Change given:</td> |
| 231 |
<td>[% change | $Price %]</td> |
| 232 |
</tr> |
| 233 |
</tfoot> |
| 234 |
</table> |
| 235 |
}; |
| 236 |
|
| 237 |
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>}; |
| 238 |
|
| 239 |
$dbh->do( |
| 240 |
qq{UPDATE letter SET content = $receipt WHERE code = 'RECEIPT' AND REPLACE(REPLACE(content, ' ', ''), '\n','') = $receipt_old;} |
| 241 |
); |
| 242 |
|
| 243 |
NewVersion( $DBversion, 24381, "Update accounts notices" ); |
| 244 |
} |