Browse Source

Bug 26172: (follow-up) Summary by payment_type

This patch alters the modal so that the totals are broken down by
payment type's available on the system.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Martin Renvoize 4 years ago
committed by Jonathan Druart
parent
commit
d12c1f6a25
  1. 28
      Koha/Cash/Register/Action.pm
  2. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt

28
Koha/Cash/Register/Action.pm

@ -98,15 +98,15 @@ sub cashup_summary {
my $outgoing_transactions = $self->register->accountlines->search(
{ %{$conditions}, credit_type_code => undef },
{ select => 'accountlines_id' } );
);
my $income_transactions = $self->register->accountlines->search(
{ %{$conditions}, debit_type_code => undef },
{ select => 'accountlines_id' } );
);
my $income_summary = Koha::Account::Offsets->search(
{
'me.credit_id' =>
{ '-in' => $income_transactions->_resultset->as_query },
{ '-in' => $income_transactions->_resultset->get_column('accountlines_id')->as_query },
'me.debit_id' => { '!=' => undef }
},
{
@ -120,7 +120,7 @@ sub cashup_summary {
my $outgoing_summary = Koha::Account::Offsets->search(
{
'me.debit_id' =>
{ '-in' => $outgoing_transactions->_resultset->as_query },
{ '-in' => $outgoing_transactions->_resultset->get_column('accountlines_id')->as_query },
'me.credit_id' => { '!=' => undef }
},
{
@ -145,20 +145,14 @@ sub cashup_summary {
credit_type => { description => $_->get_column('credit_description') }
}
} $outgoing_summary->as_list;
$summary = {
from_date => $previous ? $previous->timestamp : undef,
to_date => $self->timestamp,
income => \@income,
outgoing => \@outgoing,
total => ( $outgoing_transactions->total * -1 ) +
( $income_transactions->total * -1 ),
bankable => (
$outgoing_transactions->search( { payment_type => 'CASH' } )
->total * -1
) + (
$income_transactions->search( { payment_type => 'CASH' } )->total *
-1
)
from_date => $previous ? $previous->timestamp : undef,
to_date => $self->timestamp,
income => \@income,
outgoing => \@outgoing,
income_transactions => $income_transactions,
outgoing_transactions => $outgoing_transactions,
};
return $summary;

8
koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt

@ -342,12 +342,14 @@
<tfoot>
<tr>
<td>Total</td>
<td>[% register.last_cashup.cashup_summary.total | $Price %]</td>
<td>[% ( register.last_cashup.cashup_summary.outgoing_transactions.total + register.last_cashup.cashup_summary.income_transactions.total) * -1 | $Price %]</td>
</tr>
[% FOREACH pt IN payment_types %]
<tr>
<td>Bankable</td>
<td>[% register.last_cashup.cashup_summary.bankable | $Price %]</td>
<td>[% pt.lib %]</td>
<td>[% ( register.last_cashup.cashup_summary.outgoing_transactions.total( payment_type => pt.authorised_value ) + register.last_cashup.cashup_summary.income_transactions.total( payment_type => pt.authorised_value )) * -1 | $Price %]</td>
</tr>
[% END %]
</tfoot>
</table>

Loading…
Cancel
Save