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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/payments.inc (-29 lines)
Lines 1-29 Link Here
1
[% USE AuthorisedValues %]
2
[%- BLOCK account_payment_types -%]
3
    [% SET payment_types = [] %]
4
    [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
5
        [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %]
6
        [% payment_types.push(pt) %]
7
    [% END %]
8
    [% IF payment_types.size > 0 %]
9
        <li>
10
            [% IF Koha.Preference('UseCashRegisters') %]
11
                <label for="payment_type" class="required">Payment type: </label>
12
                <select name="payment_type" id="payment_type" class="required" required="required">
13
                    [% FOREACH pt IN payment_types %]
14
                        <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
15
                    [% END %]
16
                </select>
17
                <span class="required">Required</span>
18
            [%- ELSE -%]
19
                <label for="payment_type">Payment type: </label>
20
                <select name="payment_type" id="payment_type">
21
                    <option value=""></option>
22
                    [% FOREACH pt IN payment_types %]
23
                        <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
24
                    [% END %]
25
                </select>
26
            [%- END -%]
27
        </li>
28
    [% END %]
29
[%- END -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-29 / +11 lines)
Lines 115-121 Link Here
115
          <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue payout</button>
115
          <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue payout</button>
116
        [% END %]
116
        [% END %]
117
        [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
117
        [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
118
          <button type="button" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue refund</button>
118
          <button type="button"  class="btn btn-default btn-xs" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber %]"><i class="fa fa-money"></i> Issue refund</button>
119
        [% END %]
119
        [% END %]
120
        [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') %]
120
        [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') %]
121
          <button type="button" data-toggle="modal" data-target="#applyDiscountModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs">Apply discount</button>
121
          <button type="button" data-toggle="modal" data-target="#applyDiscountModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs">Apply discount</button>
Lines 177-196 Link Here
177
                                    <input type="text" inputmode="numeric" pattern="[0-9]*" id="amount" name="amount" required="required">
177
                                    <input type="text" inputmode="numeric" pattern="[0-9]*" id="amount" name="amount" required="required">
178
                                    <span class="required">Required</span>
178
                                    <span class="required">Required</span>
179
                                </li>
179
                                </li>
180
                                [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
180
181
                                [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %]
181
                                [% INCLUDE 'transaction_types.inc' type="payout" %]
182
                                [% IF payment_types > 3 %]
183
                                <li>
184
                                    <label for="transaction_type">Transaction type: </label>
185
                                    <select name="transaction_type" id="payout_transaction_type">
186
                                        [% FOREACH pt IN payment_types %]
187
                                            [% UNLESS excluded.grep("^$pt.authorised_value\$").size %]
188
                                            <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
189
                                            [% END %]
190
                                        [% END %]
191
                                    </select>
192
                                </li>
193
                                [% END %]
194
182
195
                                [% IF Koha.Preference('UseCashRegisters') %]
183
                                [% IF Koha.Preference('UseCashRegisters') %]
196
                                <li>
184
                                <li>
Lines 246-263 Link Here
246
                                    <input type="text" inputmode="numeric" pattern="[0-9]*" id="returned" name="amount" required="required">
234
                                    <input type="text" inputmode="numeric" pattern="[0-9]*" id="returned" name="amount" required="required">
247
                                    <span class="required">Required</span>
235
                                    <span class="required">Required</span>
248
                                </li>
236
                                </li>
249
                                [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
237
250
                                <li>
238
                                [% INCLUDE 'transaction_types.inc' type="refund" %]
251
                                    <label for="transaction_type">Transaction type: </label>
252
                                    <select name="transaction_type" id="refund_transaction_type">
253
                                        <option value="AC">Account credit</option>
254
                                        [% IF payment_types %]
255
                                        [% FOREACH pt IN payment_types %]
256
                                        <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
257
                                        [% END %]
258
                                        [% END %]
259
                                    </select>
260
                                </li>
261
239
262
                                [% IF Koha.Preference('UseCashRegisters') %]
240
                                [% IF Koha.Preference('UseCashRegisters') %]
263
                                <li>
241
                                <li>
Lines 379-389 Link Here
379
                var accountline = button.data('accountline');
357
                var accountline = button.data('accountline');
380
                $('#refundline').val(accountline);
358
                $('#refundline').val(accountline);
381
                var amount = button.data('amount');
359
                var amount = button.data('amount');
382
                var amountoutstanding = button.data('amountoutstanding');
360
                var amountoutstanding = button.data('amountoutstanding') || 0;
383
                var paid = amount - amountoutstanding;
361
                var paid = amount - amountoutstanding;
384
                $("#paid + span").replaceWith(paid);
362
                $("#paid + span").replaceWith(paid);
385
                $("#returned").attr({ "value": paid, "max": paid });
363
                $("#returned").attr({ "value": paid, "max": paid });
386
                $("#returned, #refund_transaction_type").focus();
364
                var member = button.data('member');
365
                if ( member === undefined ) {
366
                    $("#refund_type option[value='AC']").remove();                    
367
                }
368
                $("#returned, #refund_type").focus();
387
            });
369
            });
388
370
389
            $("#applyDiscountModal").on("shown.bs.modal", function(e){
371
            $("#applyDiscountModal").on("shown.bs.modal", function(e){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-4 / +3 lines)
Lines 5-11 Link Here
5
[% USE Registers %]
5
[% USE Registers %]
6
[% USE Price %]
6
[% USE Price %]
7
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
8
[% PROCESS 'payments.inc' %]
9
[% PROCESS 'accounts.inc' %]
8
[% PROCESS 'accounts.inc' %]
10
[% INCLUDE 'doc-head-open.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
11
[% BLOCK cash_register_required %]
10
[% BLOCK cash_register_required %]
Lines 149-155 Link Here
149
        <span id="change">0.00</span>
148
        <span id="change">0.00</span>
150
    </li>
149
    </li>
151
150
152
    [% PROCESS account_payment_types %]
151
    [% INCLUDE 'transaction_types.inc' type="payment" %]
153
152
154
    [% IF Koha.Preference('UseCashRegisters') %]
153
    [% IF Koha.Preference('UseCashRegisters') %]
155
    <li>
154
    <li>
Lines 279-286 Link Here
279
            <label>Change to give: </label>
278
            <label>Change to give: </label>
280
            <span id="change">0.00</span>
279
            <span id="change">0.00</span>
281
        </li>
280
        </li>
282
281
 
283
    [% PROCESS account_payment_types %]
282
    [% INCLUDE 'transaction_types.inc' type="payment" %]
284
283
285
    [% IF Koha.Preference('UseCashRegisters') %]
284
    [% IF Koha.Preference('UseCashRegisters') %]
286
    <li>
285
    <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt (-2 / +1 lines)
Lines 6-12 Link Here
6
[% USE TablesSettings %]
6
[% USE TablesSettings %]
7
[% USE Registers %]
7
[% USE Registers %]
8
[% SET footerjs = 1 %]
8
[% SET footerjs = 1 %]
9
[% PROCESS 'payments.inc' %]
10
[% INCLUDE 'doc-head-open.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
11
[% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
10
[% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
12
<title>Koha &rsaquo; Payments</title>
11
<title>Koha &rsaquo; Payments</title>
Lines 125-131 Link Here
125
                                <input type="hidden" name="change" value="[% 0 | $Price %]"/>
124
                                <input type="hidden" name="change" value="[% 0 | $Price %]"/>
126
                            </li>
125
                            </li>
127
126
128
                            [% PROCESS account_payment_types %]
127
                            [% INCLUDE 'transaction_types.inc' type="payment" %]
129
128
130
                            <li>
129
                            <li>
131
                                <label for="registerid" class="required">Cash register: </label>
130
                                <label for="registerid" class="required">Cash register: </label>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (-18 / +12 lines)
Lines 188-195 Link Here
188
                                <td>[% credit.debit.amount | $Price %]</td>
188
                                <td>[% credit.debit.amount | $Price %]</td>
189
                                <td></td>
189
                                <td></td>
190
                                <td>
190
                                <td>
191
                                    [% IF CAN_user_cash_management_refund_cash_registers && !(credit.debit.status == 'REFUNDED' ) %]
191
                                    [% IF CAN_user_cash_management_refund_cash_registers && !(credit.debit.status == 'REFUNDED') && !(credit.debit.debit_type_code == 'PAYOUT') %]
192
                                    <button type="button" class="btn btn-default btn-xs pos_refund" 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-money"></i> Issue refund</button>
192
                                    <button type="button" class="btn btn-default btn-xs pos_refund" 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-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber %]"><i class="fa fa-money"></i> Issue refund</button>
193
                                    [% END %]
193
                                    [% END %]
194
                                </td>
194
                                </td>
195
                            </tr>
195
                            </tr>
Lines 276-294 Link Here
276
                                    <input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required">
276
                                    <input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required">
277
                                    <span class="required">Required</span>
277
                                    <span class="required">Required</span>
278
                                </li>
278
                                </li>
279
                                [% SET payment_types = [] %]
279
                                [% INCLUDE 'transaction_types.inc' type="refund" %]
280
                                [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
281
                                    [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %]
282
                                    [% payment_types.push(pt) %]
283
                                [% END %]
284
                                <li>
285
                                    <label for="transaction_type">Transaction type: </label>
286
                                    <select name="transaction_type" id="transaction_type">
287
                                        [% FOREACH pt IN payment_types %]
288
                                            <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
289
                                        [% END %]
290
                                    </select>
291
                                </li>
292
                            </ol>
280
                            </ol>
293
                        </fieldset> <!-- /.rows -->
281
                        </fieldset> <!-- /.rows -->
294
                    </div> <!-- /.modal-body -->
282
                    </div> <!-- /.modal-body -->
Lines 363-371 Link Here
363
           var accountline = button.data('accountline');
351
           var accountline = button.data('accountline');
364
           $('#refundline').val(accountline);
352
           $('#refundline').val(accountline);
365
           var amount = button.data('amount');
353
           var amount = button.data('amount');
366
           $("#paid + span").replaceWith(amount);
354
           var amountoutstanding = button.data('amountoutstanding') || 0;
367
           $("#returned").attr({ "value": amount, "max": amount });
355
           var paid = amount - amountoutstanding;
368
           $("#returned, #transaction_type").focus();
356
           $("#paid + span").replaceWith(paid);
357
           $("#returned").attr({ "value": paid, "max": paid });
358
           var member = button.data('member');
359
                if ( member === undefined ) {
360
                    $("#refund_type option[value='AC']").remove();                    
361
           }
362
           $("#returned, #refund_type").focus();
369
        });
363
        });
370
364
371
        $(".printReceipt").click(function() {
365
        $(".printReceipt").click(function() {
(-)a/members/boraccount.pl (-5 / +5 lines)
Lines 79-90 if ( $action eq 'payout' ) { Link Here
79
    my $payment_id        = scalar $input->param('accountlines_id');
79
    my $payment_id        = scalar $input->param('accountlines_id');
80
    my $payment           = Koha::Account::Lines->find($payment_id);
80
    my $payment           = Koha::Account::Lines->find($payment_id);
81
    my $amount           = scalar $input->param('amount');
81
    my $amount           = scalar $input->param('amount');
82
    my $transaction_type = scalar $input->param('transaction_type');
82
    my $payout_type = scalar $input->param('payout_type');
83
    $schema->txn_do(
83
    $schema->txn_do(
84
        sub {
84
        sub {
85
            my $payout = $payment->payout(
85
            my $payout = $payment->payout(
86
                {
86
                {
87
                    payout_type   => $transaction_type,
87
                    payout_type   => $payout_type,
88
                    branch        => $library_id,
88
                    branch        => $library_id,
89
                    staff_id      => $logged_in_user->id,
89
                    staff_id      => $logged_in_user->id,
90
                    cash_register => $registerid,
90
                    cash_register => $registerid,
Lines 100-106 if ( $action eq 'refund' ) { Link Here
100
    my $charge_id        = scalar $input->param('accountlines_id');
100
    my $charge_id        = scalar $input->param('accountlines_id');
101
    my $charge           = Koha::Account::Lines->find($charge_id);
101
    my $charge           = Koha::Account::Lines->find($charge_id);
102
    my $amount           = scalar $input->param('amount');
102
    my $amount           = scalar $input->param('amount');
103
    my $transaction_type = scalar $input->param('transaction_type');
103
    my $refund_type = scalar $input->param('refund_type');
104
    $schema->txn_do(
104
    $schema->txn_do(
105
        sub {
105
        sub {
106
106
Lines 113-122 if ( $action eq 'refund' ) { Link Here
113
                    amount         => $amount
113
                    amount         => $amount
114
                }
114
                }
115
            );
115
            );
116
            unless ( $transaction_type eq 'AC' ) {
116
            unless ( $refund_type eq 'AC' ) {
117
                my $payout = $refund->payout(
117
                my $payout = $refund->payout(
118
                    {
118
                    {
119
                        payout_type   => $transaction_type,
119
                        payout_type   => $refund_type,
120
                        branch        => $library_id,
120
                        branch        => $library_id,
121
                        staff_id      => $logged_in_user->id,
121
                        staff_id      => $logged_in_user->id,
122
                        cash_register => $registerid,
122
                        cash_register => $registerid,
(-)a/pos/register.pl (-3 / +2 lines)
Lines 119-125 else { Link Here
119
            my $amount           = $input->param('amount');
119
            my $amount           = $input->param('amount');
120
            my $quantity         = $input->param('quantity');
120
            my $quantity         = $input->param('quantity');
121
            my $accountline_id   = $input->param('accountline');
121
            my $accountline_id   = $input->param('accountline');
122
            my $transaction_type = $input->param('transaction_type');
122
            my $refund_type      = $input->param('refund_type');
123
123
124
            my $accountline = Koha::Account::Lines->find($accountline_id);
124
            my $accountline = Koha::Account::Lines->find($accountline_id);
125
            $schema->txn_do(
125
            $schema->txn_do(
Lines 136-142 else { Link Here
136
                    );
136
                    );
137
                    my $payout = $refund->payout(
137
                    my $payout = $refund->payout(
138
                        {
138
                        {
139
                            payout_type   => $transaction_type,
139
                            payout_type   => $refund_type,
140
                            branch        => $library_id,
140
                            branch        => $library_id,
141
                            staff_id      => $logged_in_user->id,
141
                            staff_id      => $logged_in_user->id,
142
                            cash_register => $cash_register->id,
142
                            cash_register => $cash_register->id,
143
- 

Return to bug 27796