Bug 3498 [ENH] Allow Partial Payment of Fines
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / pay.tt
index ddc3d41..6dfd8f9 100644 (file)
@@ -1,12 +1,12 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% firstname %] [% surname %]</title>
+<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname %] [% borrower.surname %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
 <body>
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Pay Fines for [% firstname %] [% surname %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Pay Fines for [% borrower.firstname %] [% borrower.surname %]</div>
 
 <div id="doc3" class="yui-t2">
    
 <!-- The manual invoice and credit buttons -->
 <div class="toptabs">
 <ul class="ui-tabs-nav">
-       <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Account</a></li>
-       <li class="ui-tabs-selected"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a></li>
-       <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrowernumber %]" >Create Manual Invoice</a></li>
-       <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrowernumber %]" >Create Manual Credit</a></li>
+       <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a></li>
+       <li class="ui-tabs-selected"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a></li>
+       <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrower.borrowernumber %]" >Create Manual Invoice</a></li>
+       <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create Manual Credit</a></li>
 </ul>
 <div class="tabs-container">
 
-[% IF ( allfile ) %]<form action="/cgi-bin/koha/members/pay.pl" method="post">
-       <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
+[% IF ( accounts ) %]
+    <form action="/cgi-bin/koha/members/pay.pl" method="post">
+       <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
 
 <table>
 <tr>
        <th>Fines &amp; Charges</th>
+    <th>Sel</th>
        <th>Description</th>
-    <th>Note</th>
        <th>Account Type</th>
        <th>Notify id</th>
        <th>Level</th>
        <th>Amount</th>
        <th>Amount Outstanding</th>
 </tr>
-       
-[% FOREACH allfil IN allfile %]
-       [% FOREACH loop_pa IN allfil.loop_pay %]
+
+[% FOREACH account_grp IN accounts %]
+    [% FOREACH line IN account_grp.accountlines %]
 <tr>
-       <td>
-       [% IF ( loop_pa.net_balance ) %]
-       <select name="payfine[% loop_pa.i %]">
-       <option value="no">Unpaid</option>
-       <option value="yes">Paid</option>
-       <option value="wo">Writeoff</option>
-       </select>
-       [% END %]
-       <input type="hidden" name="itemnumber[% loop_pa.i %]" value="[% loop_pa.itemnumber %]" />
-       <input type="hidden" name="accounttype[% loop_pa.i %]" value="[% loop_pa.accounttype %]" />
-       <input type="hidden" name="amount[% loop_pa.i %]" value="[% loop_pa.amount %]" />
-       <input type="hidden" name="out[% loop_pa.i %]" value="[% loop_pa.amountoutstanding %]" />
-       <input type="hidden" name="borrowernumber[% loop_pa.i %]" value="[% loop_pa.borrowernumber %]" />
-       <input type="hidden" name="accountno[% loop_pa.i %]" value="[% loop_pa.accountno %]" />
-       <input type="hidden" name="notify_id[% loop_pa.i %]" value="[% loop_pa.notify_id %]" />
-       <input type="hidden" name="notify_level[% loop_pa.i %]" value="[% loop_pa.notify_level %]" />
-       <input type="hidden" name="totals[% loop_pa.i %]" value="[% loop_pa.totals %]" />
-       </td>
-       <td>[% loop_pa.description %] [% loop_pa.title |html %]</td>
     <td>
-        [% IF ( loop_pa.net_balance ) %]
-            <input type="text" name="note[% loop_pa.i %]" value="[% loop_pa.note %]" />
-        [% ELSE %]
-            [% loop_pa.note %]
-        [% END %]
+    [% IF ( line.amountoutstanding > 0 ) %]
+        <input type="submit" name="pay_indiv_[% line.accountno %]" value="Pay" />
+        <input type="submit" name="wo_indiv_[% line.accountno %]" value="Writeoff" />
+    [% END %]
+    <input type="hidden" name="itemnumber[% line.accountno %]" value="[% line.itemnumber %]" />
+    <input type="hidden" name="description[% line.accountno %]" value="[% line.description %]" />
+    <input type="hidden" name="accounttype[% line.accountno %]" value="[% line.accounttype %]" />
+    <input type="hidden" name="amount[% line.accountno %]" value="[% line.amount %]" />
+    <input type="hidden" name="amountoutstanding[% line.accountno %]" value="[% line.amountoutstanding %]" />
+    <input type="hidden" name="borrowernumber[% line.accountno %]" value="[% line.borrowernumber %]" />
+    <input type="hidden" name="accountno[% line.accountno %]" value="[% line.accountno %]" />
+    <input type="hidden" name="notify_id[% line.accountno %]" value="[% line.notify_id %]" />
+    <input type="hidden" name="notify_level[% line.accountno %]" value="[% line.notify_level %]" />
+    <input type="hidden" name="totals[% line.accountno %]" value="[% line.totals %]" />
+    </td>
+    <td>
+    [% IF ( line.amountoutstanding > 0 ) %]
+        <input type="checkbox" checked="checked" name="incl_par_[% line.accountno %]" />
+    [% END %]
     </td>
-       <td>[% loop_pa.accounttype %]</td>
-       <td>[% loop_pa.notify_id %]</td>
-       <td>[% loop_pa.notify_level %]</td>
-       <td class="debit">[% loop_pa.amount %]</td>
-       <td class="debit">[% loop_pa.amountoutstanding %]</td>
+    <td>[% line.description %] [% line.title |html_entity %]</td>
+    <td>[% line.accounttype %]</td>
+    <td>[% line.notify_id %]</td>
+    <td>[% line.notify_level %]</td>
+    <td class="debit">[% line.amount | format('%.2f') %]</td>
+    <td class="debit">[% line.amountoutstanding | format('%.2f') %]</td>
 </tr>
 [% END %]
-[% IF ( allfil.total ) %]
+[% IF ( account_grp.total ) %]
 <tr>
 
-       <td colspan="7">Sub Total</td>
-       <td>[% allfil.total %]</td>
+    <td class="total" colspan="7">Sub Total:</td>
+    <td>[% account_grp.total | format('%.2f') %]</td>
 </tr>
 [% END %]
 [% END %]
 <tr>
-       <td colspan="7">Total Due</td>
-       <td>[% total %]</td>
+    <td class="total" colspan="7">Total Due:</td>
+    <td>[% total | format('%.2f') %]</td>
 </tr>
 </table>
-<fieldset class="action"><input type="submit" name="submit"  value="Make Payment" class="submit" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset></form>[% ELSE %]<p>[% firstname %] [% surname %] has no outstanding fines.</p>[% END %]
+<fieldset class="action">
+<input type="submit" name="paycollect"  value="Pay Amount" class="submit" />
+<input type="submit" name="woall"  value="Writeoff All" class="submit" />
+<input type="submit" name="payselected"  value="Pay Selected" class="submit" />
+<a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
+</fieldset>
+</form>
+[% ELSE %]
+    <p>[% borrower.firstname %] [% borrower.surname %] has no outstanding fines.</p>
+[% END %]
 </div></div>
 
 </div>
 </div>
 
 <div class="yui-b">
-[% INCLUDE 'circ-menu.inc' %]
+[% INCLUDE 'circ-menu.tt' %]
 </div>
 </div>
 [% INCLUDE 'intranet-bottom.inc' %]