Bugzilla – Attachment 92956 Details for
Bug 23442
Add a 'refund' process to accounts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23445: Add previous transactions option
Bug-23445-Add-previous-transactions-option.patch (text/plain), 10.67 KB, created by
Martin Renvoize
on 2019-09-18 15:00:37 UTC
(
hide
)
Description:
Bug 23445: Add previous transactions option
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2019-09-18 15:00:37 UTC
Size:
10.67 KB
patch
obsolete
>From 8d962bbcf53e664e4d83c6e0f92bf6313b8a4595 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 18 Sep 2019 15:22:39 +0100 >Subject: [PATCH] Bug 23445: Add previous transactions option > >https://bugs.koha-community.org/show_bug.cgi?id=23442 >--- > .../prog/en/modules/pos/register.tt | 148 ++++++++++++++++++ > pos/register.pl | 27 ++++ > 2 files changed, 175 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 5bd3a9dee6..49bd50b840 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -123,6 +123,117 @@ > </tfoot> > </table> > [% END %] >+ >+ [% IF trange_f %] >+ <h2>Older transactions</h2> >+ <table id="past_sales" class="past_sales_table"> >+ <thead> >+ <th> >+ Receipt ID >+ </th> >+ <th> >+ Transaction >+ </th> >+ <th> >+ Account type >+ </th> >+ <th> >+ Description of charges >+ </th> >+ <th> >+ Item >+ </th> >+ <th> >+ Transaction >+ </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>[%- PROCESS account_type_description account=credit.debit -%]</td> >+ <td>[%- 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 ) %] >+ <button type="button" 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-plus"></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>[%- 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> >+ <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> >+ >+ <table> >+ <thead> >+ <th>Cashup date</th> >+ <th>Banked</th> >+ <th>Actions</th> >+ </thead> >+ <tbody> >+ [% FOREACH cashup IN register.cashups %] >+ <tr> >+ <td>[% cashup.timestamp | $KohaDates with_hours => 1 %]</td> >+ <td>[% cashup.amount | $Price %]</td> >+ <td>View transactions</td> >+ </tr> >+ [% END %] >+ </tbody> >+ </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"> >@@ -186,6 +297,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'], >@@ -206,6 +318,25 @@ > } > })); > >+ 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 colspan="3">'+group+' '+details.description+'</td>' ) >+ .append( '<td>'+details.amount+'</td>' ) >+ .append( '<td><button class="printReceipt" 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'); >@@ -224,6 +355,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 67864bbb36..e9133ce5ce 100755 >--- a/pos/register.pl >+++ b/pos/register.pl >@@ -27,6 +27,7 @@ use C4::Context; > use Koha::Account::Lines; > use Koha::Cash::Registers; > use Koha::Database; >+use Koha::DateUtils; > > my $q = CGI->new(); > >@@ -71,6 +72,32 @@ $template->param( > accountlines => $accountlines > ); > >+my $transactions_range_from = $q->param('trange_f'); >+my $last_cashup = $cash_register->last_cashup; >+my $transactions_range_to = >+ $q->param('trange_t') ? $q->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 = Koha::Database->new->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 = $q->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 23442
:
92954
|
92955
|
92956
|
95674
|
95675
|
95676
|
95677
|
96400
|
96401
|
96402
|
96403
|
96414
|
96415
|
96416
|
96417
|
97008
|
97009
|
97010
|
97011
|
97012
|
97062
|
97063
|
97064
|
97065
|
97066
|
97067
|
97151
|
97152
|
97153
|
97154
|
97155
|
97156