Main Koha release repository https://koha-community.org
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

394 lignes
23 KiB

  1. [% USE raw %]
  2. [% USE Asset %]
  3. [% USE Koha %]
  4. [% USE Branches %]
  5. [% USE KohaDates %]
  6. [% USE TablesSettings %]
  7. [% USE AuthorisedValues %]
  8. [% USE Price %]
  9. [% USE Branches %]
  10. [% USE Registers %]
  11. [% SET footerjs = 1 %]
  12. [% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
  13. [% PROCESS 'accounts.inc' %]
  14. [% INCLUDE 'doc-head-open.inc' %]
  15. <title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
  16. [% INCLUDE 'doc-head-close.inc' %]
  17. </head>
  18. <body id="pat_borraccount" class="pat">
  19. [% INCLUDE 'header.inc' %]
  20. [% INCLUDE 'patron-search.inc' %]
  21. <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; Account for [% INCLUDE 'patron-title.inc' %]</div>
  22. <div class="main container-fluid">
  23. <div class="row">
  24. <div class="col-sm-10 col-sm-push-2">
  25. <main>
  26. [% INCLUDE 'members-toolbar.inc' %]
  27. <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
  28. <!-- The manual invoice and credit buttons -->
  29. <div class="statictabs">
  30. <ul>
  31. <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
  32. <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
  33. <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
  34. <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
  35. </ul>
  36. <div class="tabs-container">
  37. [% INCLUDE 'renew_results.inc' renew_results=renew_results %]
  38. <!-- The table with the account items -->
  39. <table id="table_account_fines">
  40. <thead>
  41. <tr>
  42. <th class="title-string">Date</th>
  43. <th>Credit number</th>
  44. <th>Account type</th>
  45. <th>Description of charges</th>
  46. <th>Barcode</th>
  47. <th>Due date</th>
  48. <th>Checkin date</th>
  49. <th>Checkout date</th>
  50. <th class="checked_out_from">Checked out from</th>
  51. <th>Home library</th>
  52. <th>Note</th>
  53. <th>Amount</th>
  54. <th>Outstanding</th>
  55. <th class="NoSort">Actions</th>
  56. </tr>
  57. </thead>
  58. <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
  59. [% FOREACH account IN accounts %]
  60. <tr>
  61. <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
  62. <td>[% account.credit_number | html %]</td>
  63. <td>[% PROCESS account_type_description account=account %]</td>
  64. <td>
  65. [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
  66. [%- IF account.description %][% account.description | html %][% END %]
  67. &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&amp;itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
  68. <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&amp;biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
  69. <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
  70. <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
  71. <td>[% IF ( account.issue_id ) %][% account.checkout.issuedate | $KohaDates %][% END %]</td>
  72. <td class="checked_out_from">
  73. [% IF account.issue_id && account.checkout.library %]
  74. [% account.checkout.library.branchname | html %]
  75. [% END %]
  76. </td>
  77. <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
  78. <td>[% account.note | html_line_break %]</td>
  79. [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
  80. [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
  81. <td class="actions">
  82. [% IF ( account.is_credit ) %]
  83. <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
  84. [% ELSE %]
  85. <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
  86. [% END %]
  87. <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
  88. [% IF account.is_debit && account.amountoutstanding > 0 %]
  89. <a class="btn btn-default btn-xs" href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% account.borrowernumber | html %]&pay_individual=1&debit_type_code=[% account.debit_type_code | html %]&amount=[% account.amount | html %]&amountoutstanding=[% account.amountoutstanding | html %]&description=[% account.description | html %]&itemnumber=[% account.itemnumber | html %]&accountlines_id=[% account.accountlines_id | html %]">Pay</a>
  90. [% END %]
  91. [% IF account.is_credit %]
  92. <a href="boraccount.pl?action=void&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
  93. [% END %]
  94. [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
  95. <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue payout</button>
  96. [% END %]
  97. [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
  98. <button type="button" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue refund</button>
  99. [% END %]
  100. [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') %]
  101. <button type="button" data-toggle="modal" data-target="#applyDiscountModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs">Apply discount</button>
  102. [% END %]
  103. </td>
  104. </tr>
  105. [% END %]
  106. <tfoot>
  107. <tr>
  108. <td colspan="12">Total due</td>
  109. [% IF ( totalcredit ) %]
  110. <td class="credit" style="text-align: right;">[% total | $Price %]</td>
  111. [% ELSE %]
  112. <td class="debit"style="text-align: right;">[% total | $Price %]</td>
  113. [% END %]
  114. <td></td>
  115. </tr>
  116. </tfoot>
  117. </table>
  118. </div>
  119. </div>
  120. </main>
  121. </div> <!-- /.col-sm-10.col-sm-push-2 -->
  122. <div class="col-sm-2 col-sm-pull-10">
  123. <aside>
  124. [% INCLUDE 'circ-menu.inc' %]
  125. </aside>
  126. </div> <!-- /.col-sm-2.col-sm-pull-10 -->
  127. </div> <!-- /.row -->
  128. <!-- Issue payout modal -->
  129. <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
  130. <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
  131. <input type="hidden" name="accountlines_id" value="" id="payoutline">
  132. <input type="hidden" name="action" value="payout">
  133. <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
  134. <div class="modal-dialog" role="document">
  135. <div class="modal-content">
  136. <div class="modal-header">
  137. <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  138. <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
  139. </div>
  140. <div class="modal-body">
  141. [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
  142. <div id="payout_error" class="dialog alert">
  143. You must have at least one cash register associated with this branch before you can record cash payouts.
  144. </div>
  145. [% END %]
  146. <fieldset class="rows">
  147. <ol>
  148. <li>
  149. <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
  150. </li>
  151. <li>
  152. <label class="required" for="amount">Returned to patron: </label>
  153. <input type="number" step="0.01" id="amount" name="amount" min="0.00" required="required">
  154. <span class="required">Required</span>
  155. </li>
  156. [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
  157. [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %]
  158. [% IF payment_types > 3 %]
  159. <li>
  160. <label for="transaction_type">Transaction type: </label>
  161. <select name="transaction_type" id="payout_transaction_type">
  162. [% FOREACH pt IN payment_types %]
  163. [% UNLESS excluded.grep("^$pt.authorised_value\$").size %]
  164. <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
  165. [% END %]
  166. [% END %]
  167. </select>
  168. </li>
  169. [% END %]
  170. [% IF Koha.Preference('UseCashRegisters') %]
  171. <li>
  172. <label for="registerid">Cash register: </label>
  173. <select name="registerid" id="payout_registerid">
  174. <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
  175. [% PROCESS options_for_registers %]
  176. </select>
  177. </li>
  178. [% END %]
  179. </ol>
  180. </fieldset> <!-- /.rows -->
  181. </div> <!-- /.modal-body -->
  182. <div class="modal-footer">
  183. <input type="hidden" name="op" value="payout">
  184. <button type="submit" class="btn btn-default" id="borr_payout_confirm">Confirm</button>
  185. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  186. </div> <!-- /.modal-footer -->
  187. </div> <!-- /.modal-content -->
  188. </div> <!-- /.modal-dialog -->
  189. </form> <!-- /#payout_form -->
  190. </div> <!-- /#issuePayoutModal -->
  191. <!-- Issue refund modal -->
  192. <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
  193. <form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
  194. <input type="hidden" name="accountlines_id" value="" id="refundline">
  195. <input type="hidden" name="action" value="refund">
  196. <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
  197. <div class="modal-dialog" role="document">
  198. <div class="modal-content">
  199. <div class="modal-header">
  200. <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  201. <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
  202. </div>
  203. <div class="modal-body">
  204. [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
  205. <div id="refund_error" class="dialog alert">
  206. You must have at least one cash register associated with this branch before you can record cash refunds.
  207. </div>
  208. [% END %]
  209. <fieldset class="rows">
  210. <ol>
  211. <li>
  212. <span id="item" class="label">Account: </span><span></span>
  213. </li>
  214. <li>
  215. <span id="paid" class="label">Amount paid: </span><span></span>
  216. </li>
  217. <li>
  218. <label class="required" for="amount">Returned to patron: </label>
  219. <input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required">
  220. <span class="required">Required</span>
  221. </li>
  222. [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
  223. <li>
  224. <label for="transaction_type">Transaction type: </label>
  225. <select name="transaction_type" id="refund_transaction_type">
  226. <option value="AC">Account credit</option>
  227. [% IF payment_types %]
  228. [% FOREACH pt IN payment_types %]
  229. <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
  230. [% END %]
  231. [% END %]
  232. </select>
  233. </li>
  234. [% IF Koha.Preference('UseCashRegisters') %]
  235. <li>
  236. <label for="registerid">Cash register: </label>
  237. <select name="registerid" id="refund_registerid">
  238. <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
  239. [% PROCESS options_for_registers %]
  240. </select>
  241. </li>
  242. [% END %]
  243. </ol>
  244. </fieldset> <!-- /.rows -->
  245. </div> <!-- /.modal-body -->
  246. <div class="modal-footer">
  247. <input type="hidden" name="op" value="refund">
  248. <button type="submit" class="btn btn-default" id="borr_refund_confirm">Confirm</button>
  249. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  250. </div> <!-- /.modal-footer -->
  251. </div> <!-- /.modal-content -->
  252. </div> <!-- /.modal-dialog -->
  253. </form> <!-- /#refund_form -->
  254. </div> <!-- /#issueRefundModal -->
  255. <!-- Apply discount modal -->
  256. <div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel">
  257. <form id="discount_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
  258. <input type="hidden" name="accountlines_id" value="" id="discountline">
  259. <input type="hidden" name="action" value="discount">
  260. <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
  261. <div class="modal-dialog" role="document">
  262. <div class="modal-content">
  263. <div class="modal-header">
  264. <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  265. <h4 class="modal-title" id="applyDiscountLabel">Apply discount</h4>
  266. </div>
  267. <div class="modal-body">
  268. <fieldset class="rows">
  269. <ol>
  270. <li>
  271. <span id="item" class="label">Account type: </span><span></span>
  272. </li>
  273. <li>
  274. <span id="charged" class="label">Amount charged: </span><span></span>
  275. </li>
  276. <li>
  277. <label class="required" for="amount">Discount to apply: </label>
  278. <input type="number" step="0.01" id="discount" name="amount" min="0.00" required="required">
  279. <span class="required">Required</span>
  280. </li>
  281. </ol>
  282. </fieldset> <!-- /.rows -->
  283. </div> <!-- /.modal-body -->
  284. <div class="modal-footer">
  285. <input type="hidden" name="op" value="discount">
  286. <button type="submit" class="btn btn-default">Confirm</button>
  287. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  288. </div> <!-- /.modal-footer -->
  289. </div> <!-- /.modal-content -->
  290. </div> <!-- /.modal-dialog -->
  291. </form> <!-- /#discount_form -->
  292. </div> <!-- /#applyDiscountModal -->
  293. [% MACRO jsinclude BLOCK %]
  294. [% INCLUDE 'datatables.inc' %]
  295. [% INCLUDE 'columns_settings.inc' %]
  296. [% INCLUDE 'str/members-menu.inc' %]
  297. [% Asset.js("js/members-menu.js") | $raw %]
  298. <script>
  299. $(document).ready(function() {
  300. [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
  301. window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
  302. [% END %]
  303. var txtActivefilter = _("Filter paid transactions");
  304. var txtInactivefilter = _("Show all transactions");
  305. var columns_settings = [% TablesSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
  306. var table_account_fines = KohaTable("table_account_fines", {
  307. "sPaginationType": "full",
  308. 'aaSorting': [[0, 'desc']],
  309. "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
  310. }, columns_settings);
  311. $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
  312. $('#filter_transacs').click(function(e) {
  313. e.preventDefault();
  314. if ($(this).hasClass('filtered')) {
  315. var filteredValue = '';
  316. $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
  317. } else { //Not filtered. Let's do it!
  318. var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
  319. $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
  320. }
  321. table_account_fines.fnFilter(filteredValue, 10, true, false);
  322. $(this).toggleClass('filtered');
  323. });
  324. $(".void").on("click",function(e){
  325. if( confirm( _("Are you sure you want to void this credit?") ) ) {
  326. return true;
  327. } else {
  328. e.preventDefault();
  329. }
  330. });
  331. $("#issuePayoutModal").on("shown.bs.modal", function(e){
  332. var button = $(e.relatedTarget);
  333. var accountline = button.data('accountline');
  334. $('#payoutline').val(accountline);
  335. var amount = button.data('amount') * -1;
  336. $("#paid + span").replaceWith(amount);
  337. $("#amount").attr({ "value": amount, "max": amount });
  338. $("#amount, #payout_transaction_type").focus();
  339. });
  340. $("#issueRefundModal").on("shown.bs.modal", function(e){
  341. var button = $(e.relatedTarget);
  342. var item = button.data('item');
  343. $("#item + span").replaceWith(item);
  344. var accountline = button.data('accountline');
  345. $('#refundline').val(accountline);
  346. var amount = button.data('amount');
  347. var amountoutstanding = button.data('amountoutstanding');
  348. var paid = amount - amountoutstanding;
  349. $("#paid + span").replaceWith(paid);
  350. $("#returned").attr({ "value": paid, "max": paid });
  351. $("#returned, #refund_transaction_type").focus();
  352. });
  353. $("#applyDiscountModal").on("shown.bs.modal", function(e){
  354. var button = $(e.relatedTarget);
  355. var item = button.data('item');
  356. $("#item + span").replaceWith(item);
  357. var accountline = button.data('accountline');
  358. $('#discountline').val(accountline);
  359. var amount = button.data('amount');
  360. $("#charged + span").replaceWith(amount);
  361. $("#discount").attr({ "max": amount });
  362. $("#discount").focus();
  363. });
  364. });
  365. </script>
  366. [% END %]
  367. [% INCLUDE 'intranet-bottom.inc' %]