Bugzilla – Attachment 98856 Details for
Bug 24082
Add a 'refund' option to anonymous payments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24082: Add access to historical transactions
Bug-24082-Add-access-to-historical-transactions.patch (text/plain), 10.50 KB, created by
Martin Renvoize (ashimema)
on 2020-02-13 15:02:51 UTC
(
hide
)
Description:
Bug 24082: Add access to historical transactions
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-02-13 15:02:51 UTC
Size:
10.50 KB
patch
obsolete
>From 73f59aad8825aec965db6782bc7bd5e97d207f39 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 23 Jan 2020 16:05:06 +0000 >Subject: [PATCH] Bug 24082: Add access to historical transactions > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../prog/en/modules/pos/register.tt | 134 ++++++++++++++++++ > pos/register.pl | 29 ++++ > 2 files changed, 163 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >index 0f1715c7b6..38b72ad0c1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -145,6 +145,102 @@ > </tfoot> > </table> > [% END %] >+ >+ [% IF trange_f %] >+ <h2>Older transactions</h2> >+ <table id="past_sales" class="past_sales_table"> >+ <thead> >+ <th> >+ ID >+ </th> >+ <th> >+ DATA >+ </th> >+ <th> >+ Transaction >+ </th> >+ <th> >+ Description >+ </th> >+ <th> >+ Price >+ </th> >+ <th> >+ Total >+ </th> >+ <th> >+ Actions >+ </th> >+ </thead> >+ <tbody> >+ [% FOREACH accountline IN past_accountlines %] >+ [% IF accountline.is_credit %] >+ [% FOREACH credit IN accountline.credit_offsets %] >+ [% IF credit.debit %] >+ <tr> >+ <td>[% accountline.accountlines_id %]</td> >+ <td>{ "type": "credit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td> >+ <td></td> >+ <td>[%- PROCESS account_type_description account=credit.debit -%] >+ [%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%] >+ [%- IF ( credit.debit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% credit.debit.item.biblionumber | uri %]&itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>)[%- END -%] >+ </td> >+ <td>[% credit.debit.amount | $Price %]</td> >+ <td></td> >+ <td> >+ [% IF CAN_user_cash_management_refund_cash_registers && !(credit.debit.status == 'REFUNDED' ) %] >+ <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-quantity="[% credit.debit.note | html %]"><i class="fa fa-money"></i> Issue refund</button> >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ [% END %] >+ [% ELSE %] >+ [% FOREACH debit IN accountline.debit_offsets %] >+ [% IF debit.credit %] >+ <tr> >+ <td>[% accountline.accountlines_id %]</td> >+ <td>{ "type": "debit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td> >+ <td></td> >+ <td>[%- PROCESS account_type_description account=debit.credit -%]</td> >+ <td>[%- IF debit.credit.description %][% debit.credit.description | html %][% END %] >+ [% IF ( debit.credit.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% debit.credit.item.biblionumber | uri %]&itemnumber=[% debit.credit.itemnumber | uri %]">[% debit.credit.item.biblio.title | html %]</a>[% END %]</td> >+ <td>[% debit.credit.amount | $Price %]</td> >+ <td></td> >+ </tr> >+ [% END %] >+ [% END %] >+ [% END %] >+ [% END %] >+ </tbody> >+ <tfoot> >+ <tr> >+ <td colspan="5">Total income: </td> >+ <td>[% past_accountlines.total * -1 | $Price %]</td> >+ <td></td> >+ </tr> >+ </tfoot> >+ </table> >+ [% ELSE %] >+ [% IF register.cashups %] >+ <h2>Older transactions</h2> >+ <form method="GET" action="/cgi-bin/koha/pos/register.pl"> >+ <fieldset class="rows"> >+ Please select a date range to display transactions for: >+ <ol> >+ <li> >+ <label for="trange_f">From: </label> >+ <input type="text" size="10" id="from" name="trange_f" /> >+ <label class="inline" for="trange_t">To: </label> >+ <input size="10" id="to" name="trange_t" value="[% trange_t | html %]" type="text" /> >+ <span class="hint">[% INCLUDE 'date-format.inc' %]</span> >+ </li> >+ </ol> >+ </fieldset> >+ <input type="submit" value="Display" /> >+ </form> >+ [% END %] >+ [% END %] > </div> > > <div class="col-sm-2 col-sm-pull-10"> >@@ -208,6 +304,7 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] >+ [% INCLUDE 'calendar.inc' %] > <script> > var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, { > orderFixed: [ 0, 'asc'], >@@ -229,6 +326,26 @@ > } > })); > >+ var past_sales_table = $("#past_sales").dataTable($.extend(true, {}, dataTablesDefaults, { >+ orderFixed: [ 0, 'asc'], >+ columnDefs: [ { >+ targets: [ 0, 1 ], >+ visible: false >+ }], >+ rowGroup: { >+ dataSrc: 0, >+ startRender: function ( rows, group ) { >+ var details = JSON.parse(rows.data().pluck(1).pop()); >+ return $('<tr class="'+details.type+'"/>') >+ .append( '<td>'+group+'</td>' ) >+ .append( '<td colspan="2">'+details.description+'</td>' ) >+ .append( '<td>'+details.amount+'</td>' ) >+ .append( '<td><button class="printReceipt btn btn-default btn-xs" data-accountline="'+group+'"><i class="fa fa-print"></i> Print receipt</button></td>'); >+ }, >+ endRender: null, >+ } >+ })); >+ > $("#issueRefundModal").on("shown.bs.modal", function(e){ > var button = $(e.relatedTarget); > var item = button.data('item'); >@@ -246,6 +363,23 @@ > var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank'); > win.focus(); > }); >+ >+ $(document).ready(function() { >+ // http://jqueryui.com/demos/datepicker/#date-range >+ var dates = $( "#from, #to" ).datepicker({ >+ changeMonth: true, >+ numberOfMonths: 1, >+ onSelect: function( selectedDate ) { >+ var option = this.id == "from" ? "minDate" : "maxDate", >+ instance = $( this ).data( "datepicker" ); >+ date = $.datepicker.parseDate( >+ instance.settings.dateFormat || >+ $.datepicker._defaults.dateFormat, >+ selectedDate, instance.settings ); >+ dates.not( this ).datepicker( "option", option, date ); >+ } >+ }); >+ }); > </script> > [% END %] > >diff --git a/pos/register.pl b/pos/register.pl >index 382aeab44c..e5b2e2b110 100755 >--- a/pos/register.pl >+++ b/pos/register.pl >@@ -24,8 +24,10 @@ use C4::Auth; > use C4::Output; > use C4::Context; > >+use Koha::Account::Lines; > use Koha::Cash::Registers; > use Koha::Database; >+use Koha::DateUtils; > > my $input = CGI->new(); > >@@ -71,6 +73,33 @@ else { > accountlines => $accountlines > ); > >+ my $transactions_range_from = $input->param('trange_f'); >+ my $last_cashup = $cash_register->last_cashup; >+ my $transactions_range_to = >+ $input->param('trange_t') ? $input->param('trange_t') >+ : $last_cashup ? $last_cashup->timestamp >+ : ''; >+ $template->param( trange_t => $transactions_range_to ); >+ if ($transactions_range_from) { >+ $template->param( trange_f => $transactions_range_from ); >+ >+ my $dtf = $schema->storage->datetime_parser; >+ my $start = dt_from_string($transactions_range_from); >+ my $end = dt_from_string($transactions_range_to); >+ my $past_accountlines = Koha::Account::Lines->search( >+ { >+ register_id => $registerid, >+ timestamp => { >+ -between => [ >+ $dtf->format_datetime($start), >+ $dtf->format_datetime($end) >+ ] >+ } >+ } >+ ); >+ $template->param( past_accountlines => $past_accountlines ); >+ } >+ > my $op = $input->param('op') // ''; > if ( $op eq 'cashup' ) { > $cash_register->add_cashup( >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24082
:
97042
|
97826
|
97827
|
97828
|
98849
|
98850
|
98851
|
98854
|
98855
|
98856
|
99983
|
99984
|
99985
|
99991
|
99992
|
99993
|
99995
|
99996
|
99997
|
100031
|
100032
|
100033
|
100070
|
100071
|
100072
|
100073