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

(-)a/Koha/Cash/Register/Cashup.pm (-9 / +36 lines)
Lines 109-115 sub summary { Link Here
109
                { sum => 'me.amount' }, 'debit.debit_type_code',
109
                { sum => 'me.amount' }, 'debit.debit_type_code',
110
                'debit_type_code.description'
110
                'debit_type_code.description'
111
            ],
111
            ],
112
            'as' => [ 'total', 'debit_type_code', 'debit_description' ],
112
            'as'     => [ 'total', 'debit_type_code', 'debit_description' ],
113
            order_by => { '-asc' => 'debit_type_code.description' },
113
            order_by => { '-asc' => 'debit_type_code.description' },
114
        }
114
        }
115
    );
115
    );
Lines 120-137 sub summary { Link Here
120
                '-in' => $payout_transactions->_resultset->get_column(
120
                '-in' => $payout_transactions->_resultset->get_column(
121
                    'accountlines_id')->as_query
121
                    'accountlines_id')->as_query
122
            },
122
            },
123
            'me.credit_id' => { '!=' => undef }
123
            'me.credit_id'                     => { '!=' => undef },
124
            'account_offsets_credits.debit_id' => {
125
                '-not_in' => $payout_transactions->_resultset->get_column(
126
                    'accountlines_id')->as_query
127
            }
124
        },
128
        },
125
        {
129
        {
126
            join => { 'credit' => 'credit_type_code' },
130
            join => {
127
            group_by =>
131
                'credit' => [
128
              [ 'credit.credit_type_code', 'credit_type_code.description' ],
132
                    'credit_type_code',
133
                    {
134
                        'account_offsets_credits' =>
135
                          { 'debit' => 'debit_type_code' }
136
                    }
137
                ]
138
            },
139
            group_by => [
140
                'credit.credit_type_code', 'credit_type_code.description',
141
                'debit.debit_type_code',   'debit_type_code.description'
142
            ],
129
            'select' => [
143
            'select' => [
130
                { sum => 'me.amount' }, 'credit.credit_type_code',
144
                { sum => 'me.amount' }, 'credit.credit_type_code',
131
                'credit_type_code.description'
145
                'credit_type_code.description', 'debit.debit_type_code',
146
                'debit_type_code.description'
147
            ],
148
            'as' => [
149
                'total',              'credit_type_code',
150
                'credit_description', 'debit_type_code',
151
                'debit_description'
132
            ],
152
            ],
133
            'as' => [ 'total', 'credit_type_code', 'credit_description' ],
153
            order_by => {
134
            order_by => { '-asc' => 'credit_type_code.description' },
154
                '-asc' =>
155
                  [ 'credit_type_code.description', 'debit_type_code.description' ]
156
            },
135
        }
157
        }
136
    );
158
    );
137
159
Lines 147-153 sub summary { Link Here
147
            total            => $_->get_column('total') * -1,
169
            total            => $_->get_column('total') * -1,
148
            credit_type_code => $_->get_column('credit_type_code'),
170
            credit_type_code => $_->get_column('credit_type_code'),
149
            credit_type =>
171
            credit_type =>
150
              { description => $_->get_column('credit_description') }
172
              { description => $_->get_column('credit_description') },
173
            related_debit => {
174
                debit_type_code => $_->get_column('debit_type_code'),
175
                debit_type =>
176
                  { description => $_->get_column('debit_description') }
177
            }
151
        }
178
        }
152
    } $payout_summary->as_list;
179
    } $payout_summary->as_list;
153
180
(-)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