Bugzilla – Attachment 98028 Details for
Bug 23355
Add a 'cashup' process to accounts
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-01-28 13:54:06 UTC
(
hide
)
Description:
Bug 24082: Add access to historical transactions
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-01-28 13:54:06 UTC
Size:
10.50 KB
patch
obsolete
>From f9fc8f35a213dfb9dc1224dc7badc507dc0c6356 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 > >https://bugs.koha-community.org/show_bug.cgi?id=23355 >--- > .../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 23355
:
92941
|
92942
|
92943
|
92944
|
92945
|
92946
|
92947
|
92948
|
92949
|
92950
|
92951
|
92952
|
92953
|
97031
|
97032
|
97033
|
97034
|
97035
|
97036
|
97037
|
97038
|
97039
|
97040
|
97041
|
97043
|
97044
|
97045
|
97046
|
97047
|
97048
|
97049
|
97050
|
97051
|
97052
|
97053
|
97054
|
97077
|
97078
|
97079
|
97080
|
97081
|
97082
|
97083
|
97084
|
97085
|
97086
|
97087
|
97088
|
97089
|
97706
|
97707
|
97708
|
97709
|
97710
|
97711
|
97712
|
97713
|
97714
|
97715
|
97716
|
97784
|
97785
|
97786
|
97787
|
97788
|
97789
|
97790
|
97791
|
97792
|
97793
|
97794
|
97816
|
97817
|
97818
|
97819
|
97820
|
97821
|
97822
|
97823
|
98026
|
98027
|
98028
|
98835
|
98836
|
98837
|
98838
|
98839
|
98840
|
98841
|
98842
|
100009
|
100010
|
100011
|
100012
|
100013
|
100014
|
100015
|
100016
|
100017
|
100018
|
100019
|
100020
|
100021
|
100030
|
100090
|
101685