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

(-)a/Koha/Cash/Register/Cashup.pm (-9 / +36 lines)
Lines 108-114 sub summary { Link Here
108
                { sum => 'me.amount' }, 'debit.debit_type_code',
108
                { sum => 'me.amount' }, 'debit.debit_type_code',
109
                'debit_type_code.description'
109
                'debit_type_code.description'
110
            ],
110
            ],
111
            'as' => [ 'total', 'debit_type_code', 'debit_description' ],
111
            'as'     => [ 'total', 'debit_type_code', 'debit_description' ],
112
            order_by => { '-asc' => 'debit_type_code.description' },
112
            order_by => { '-asc' => 'debit_type_code.description' },
113
        }
113
        }
114
    );
114
    );
Lines 119-136 sub summary { Link Here
119
                '-in' => $payout_transactions->_resultset->get_column(
119
                '-in' => $payout_transactions->_resultset->get_column(
120
                    'accountlines_id')->as_query
120
                    'accountlines_id')->as_query
121
            },
121
            },
122
            'me.credit_id' => { '!=' => undef }
122
            'me.credit_id'                     => { '!=' => undef },
123
            'account_offsets_credits.debit_id' => {
124
                '-not_in' => $payout_transactions->_resultset->get_column(
125
                    'accountlines_id')->as_query
126
            }
123
        },
127
        },
124
        {
128
        {
125
            join => { 'credit' => 'credit_type_code' },
129
            join => {
126
            group_by =>
130
                'credit' => [
127
              [ 'credit.credit_type_code', 'credit_type_code.description' ],
131
                    'credit_type_code',
132
                    {
133
                        'account_offsets_credits' =>
134
                          { 'debit' => 'debit_type_code' }
135
                    }
136
                ]
137
            },
138
            group_by => [
139
                'credit.credit_type_code', 'credit_type_code.description',
140
                'debit.debit_type_code',   'debit_type_code.description'
141
            ],
128
            'select' => [
142
            'select' => [
129
                { sum => 'me.amount' }, 'credit.credit_type_code',
143
                { sum => 'me.amount' }, 'credit.credit_type_code',
130
                'credit_type_code.description'
144
                'credit_type_code.description', 'debit.debit_type_code',
145
                'debit_type_code.description'
146
            ],
147
            'as' => [
148
                'total',              'credit_type_code',
149
                'credit_description', 'debit_type_code',
150
                'debit_description'
131
            ],
151
            ],
132
            'as' => [ 'total', 'credit_type_code', 'credit_description' ],
152
            order_by => {
133
            order_by => { '-asc' => 'credit_type_code.description' },
153
                '-asc' =>
154
                  [ 'credit_type_code.description', 'debit_type_code.description' ]
155
            },
134
        }
156
        }
135
    );
157
    );
136
158
Lines 146-152 sub summary { Link Here
146
            total            => $_->get_column('total') * -1,
168
            total            => $_->get_column('total') * -1,
147
            credit_type_code => $_->get_column('credit_type_code'),
169
            credit_type_code => $_->get_column('credit_type_code'),
148
            credit_type =>
170
            credit_type =>
149
              { description => $_->get_column('credit_description') }
171
              { description => $_->get_column('credit_description') },
172
            related_debit => {
173
                debit_type_code => $_->get_column('debit_type_code'),
174
                debit_type =>
175
                  { description => $_->get_column('debit_description') }
176
            }
150
        }
177
        }
151
    } $payout_summary->as_list;
178
    } $payout_summary->as_list;
152
179
(-)a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js (-2 / +5 lines)
Lines 16-22 $('#cashupSummaryModal').on('show.bs.modal', function(e) { Link Here
16
            var tbody = summary_modal.find('tbody')
16
            var tbody = summary_modal.find('tbody')
17
            tbody.empty();
17
            tbody.empty();
18
            for (out of data.summary.payout_grouped) {
18
            for (out of data.summary.payout_grouped) {
19
                tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total + '</td></tr>');
19
                if ( out.credit_type_code == 'REFUND' ) {
20
                    tbody.append('<tr><td>' + out.credit_type.description + ' against ' + out.related_debit.debit_type.description + '</td><td>- ' + out.total + '</td></tr>');
21
                } else {
22
                    tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total + '</td></tr>');
23
                }
20
            }
24
            }
21
25
22
            for (income of data.summary.income_grouped) {
26
            for (income of data.summary.income_grouped) {
23
- 

Return to bug 27779