View | Details | Raw Unified | Return to bug 26172
Collapse All | Expand All

(-)a/Koha/Cash/Register/Action.pm (-17 / +11 lines)
Lines 98-112 sub cashup_summary { Link Here
98
98
99
    my $outgoing_transactions = $self->register->accountlines->search(
99
    my $outgoing_transactions = $self->register->accountlines->search(
100
        { %{$conditions}, credit_type_code => undef },
100
        { %{$conditions}, credit_type_code => undef },
101
        { select => 'accountlines_id' } );
101
    );
102
    my $income_transactions = $self->register->accountlines->search(
102
    my $income_transactions = $self->register->accountlines->search(
103
        { %{$conditions}, debit_type_code => undef },
103
        { %{$conditions}, debit_type_code => undef },
104
        { select => 'accountlines_id' } );
104
    );
105
105
106
    my $income_summary = Koha::Account::Offsets->search(
106
    my $income_summary = Koha::Account::Offsets->search(
107
        {
107
        {
108
            'me.credit_id' =>
108
            'me.credit_id' =>
109
              { '-in' => $income_transactions->_resultset->as_query },
109
              { '-in' => $income_transactions->_resultset->get_column('accountlines_id')->as_query },
110
            'me.debit_id' => { '!=' => undef }
110
            'me.debit_id' => { '!=' => undef }
111
        },
111
        },
112
        {
112
        {
Lines 120-126 sub cashup_summary { Link Here
120
    my $outgoing_summary = Koha::Account::Offsets->search(
120
    my $outgoing_summary = Koha::Account::Offsets->search(
121
        {
121
        {
122
            'me.debit_id' =>
122
            'me.debit_id' =>
123
              { '-in' => $outgoing_transactions->_resultset->as_query },
123
              { '-in' => $outgoing_transactions->_resultset->get_column('accountlines_id')->as_query },
124
            'me.credit_id' => { '!=' => undef }
124
            'me.credit_id' => { '!=' => undef }
125
        },
125
        },
126
        {
126
        {
Lines 145-164 sub cashup_summary { Link Here
145
            credit_type      => { description => $_->get_column('credit_description') }
145
            credit_type      => { description => $_->get_column('credit_description') }
146
        }
146
        }
147
    } $outgoing_summary->as_list;
147
    } $outgoing_summary->as_list;
148
148
    $summary = {
149
    $summary = {
149
        from_date => $previous ? $previous->timestamp : undef,
150
        from_date             => $previous ? $previous->timestamp : undef,
150
        to_date   => $self->timestamp,
151
        to_date               => $self->timestamp,
151
        income    => \@income,
152
        income                => \@income,
152
        outgoing  => \@outgoing,
153
        outgoing              => \@outgoing,
153
        total     => ( $outgoing_transactions->total * -1 ) +
154
        income_transactions   => $income_transactions,
154
          ( $income_transactions->total * -1 ),
155
        outgoing_transactions => $outgoing_transactions,
155
        bankable => (
156
            $outgoing_transactions->search( { payment_type => 'CASH' } )
157
              ->total * -1
158
        ) + (
159
            $income_transactions->search( { payment_type => 'CASH' } )->total *
160
              -1
161
        )
162
    };
156
    };
163
157
164
    return $summary;
158
    return $summary;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (-4 / +5 lines)
Lines 330-341 Link Here
330
                        <tfoot>
330
                        <tfoot>
331
                            <tr>
331
                            <tr>
332
                                <td>Total</td>
332
                                <td>Total</td>
333
                                <td>[% register.last_cashup.cashup_summary.total | $Price %]</td>
333
                                <td>[% ( register.last_cashup.cashup_summary.outgoing_transactions.total + register.last_cashup.cashup_summary.income_transactions.total) * -1 | $Price %]</td>
334
                            </tr>
334
                            </tr>
335
                            [% FOREACH pt IN payment_types %]
335
                            <tr>
336
                            <tr>
336
                                <td>Bankable</td>
337
                                <td>[% pt.lib %]</td>
337
                                <td>[% register.last_cashup.cashup_summary.bankable | $Price %]</td>
338
                                <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>
338
                            </tr>
339
                            </tr>
340
                            [% END %]
339
341
340
                        </tfoot>
342
                        </tfoot>
341
                    </table>
343
                    </table>
342
- 

Return to bug 26172