Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 798aed39

Von Jan Büren vor mehr als 5 Jahren hinzugefügt

  • ID 798aed3910f163ca86feb909e43dd9747615b4bf
  • Vorgänger 5027341d
  • Nachfolger 31f4ab2d

Kontoauszug verbuchen: Zugewiesen abzgl. Skonto berechnen

Oberflächen-Kosmetik, damit der Benutzer klarer sieht,
was am Ende der Bankbewegung auf Skonto und von der Bankbewegung abgezogen wird.

Unterschiede anzeigen:

js/kivi.BankTransaction.js
82 82
    var amount     = $container.data('invoice-amount') * 1;
83 83

  
84 84
    $('[id^="' + bank_transaction_id + '."]').each(function(idx, elt) {
85
      amount += $(elt).data('invoice-amount');
85
      if ($("input[name='skonto_pt." + elt.id + "']").val() == 1) {
86
        // skonto payment term
87
        amount += $(elt).data('invoice-amount-less-skonto');
88
      } else {
89
        // normal amount
90
        amount += $(elt).data('invoice-amount');
91
        //subtract free skonto if checked (no check for number!)
92
        if ($("input[name='skonto_pt." + elt.id + "']").val() == 'free_skonto') {
93
          amount -= $("input[name='free_skonto_amount." + elt.id + "']").val();
94
        }
95
      }
86 96
    });
87 97

  
88 98
    $container.html(kivi.format_amount(amount, 2));
......
141 151
    });
142 152
  };
143 153
  ns.update_skonto = function(caller, bt_id, prop_id, formatted_amount_with_skonto_pt) {
154

  
144 155
    if (caller.value === 'free_skonto') {
145 156
      $('#free_skonto_amount_' + bt_id + '_' + prop_id).val("");
146 157
      $('#free_skonto_amount_' + bt_id + '_' + prop_id).prop('disabled', false);
158
      $("input[name='skonto_pt." + bt_id + '.' + prop_id + "']").val('free_skonto');
147 159
      $('#free_skonto_amount_' + bt_id + '_' + prop_id).focus();
148 160
    }
149 161
    if (caller.value === 'without_skonto') {
150 162
      $('#free_skonto_amount_' + bt_id + '_' + prop_id).val(kivi.format_amount(0,2));
151 163
      $('#free_skonto_amount_' + bt_id + '_' + prop_id).prop('disabled', true);
164
      $("input[name='skonto_pt." + bt_id + '.' + prop_id + "']").val(0);
152 165
    }
153 166
    if (caller.value === 'with_skonto_pt') {
154 167
      $('#free_skonto_amount_' + bt_id + '_' + prop_id).val(formatted_amount_with_skonto_pt);
155 168
      $('#free_skonto_amount_' + bt_id + '_' + prop_id).prop('disabled', true);
169
      $("input[name='skonto_pt." + bt_id + '.' + prop_id + "']").val(1);
156 170
    }
171
    // recalc assigned amount
172
    ns.update_invoice_amount(bt_id);
157 173
  };
158 174

  
159 175
});
templates/webpages/bank_transactions/_payment_suggestion.html
1 1
[%- USE P -%][%- USE HTML -%][%- USE LxERP -%]
2
<span id="[% HTML.escape(bt_id) %].[% HTML.escape(invoice.id) %]" data-invoice-amount="[% HTML.escape(invoice.open_amount * 1) %]">
2
[% SELECT_OPTIONS = invoice.get_payment_select_options_for_bank_transaction(bt_id) %]
3
[% is_skonto_pt   = SELECT_OPTIONS.1.selected %]
4
[% formatted_skonto_amount          = LxERP.format_amount(invoice.skonto_amount, 2) %]
5
[% formatted_skonto_amount_selected = is_skonto_pt ? $formatted_skonto_amount : LxERP.format_amount(0, 2) %]
6
<span id="[% HTML.escape(bt_id) %].[% HTML.escape(invoice.id) %]"
7
  data-invoice-amount="[% HTML.escape(invoice.open_amount * 1) %]"
8
  data-invoice-amount-less-skonto="[% HTML.escape(invoice.amount_less_skonto * 1) %]">
3 9
 [% P.hidden_tag("invoice_ids." _ bt_id _ "[]", invoice.id) %]
4
 [% SELECT_OPTIONS = invoice.get_payment_select_options_for_bank_transaction(bt_id) %]
5
 [% formatted_skonto_amount_selected = SELECT_OPTIONS.1.selected ? LxERP.format_amount(invoice.skonto_amount, 2) : LxERP.format_amount(0, 2) %]
6
 [% formatted_skonto_amount          = LxERP.format_amount(invoice.skonto_amount, 2) %]
10
 [% P.hidden_tag("skonto_pt." _ bt_id _ "." _ invoice.id _ "", is_skonto_pt) %]
7 11
 [% LxERP.t8("Invno.") %]: [% HTML.escape(invoice.invnumber) %]</br>
8 12
 [% LxERP.t8("Open amount") %]: [% LxERP.format_amount(invoice.open_amount, 2) %]</br>
9 13
 [% P.select_tag("invoice_skontos." _ bt_id _ "[]", SELECT_OPTIONS, value_key="payment_type", title_key="display", onChange="kivi.BankTransaction.update_skonto(this, " _ bt_id _ ", " _ invoice.id _ ", '$formatted_skonto_amount')"  ) %]</br>
10
 [% LxERP.t8("Skonto amount") %]: [% P.input_tag("free_skonto_amount." _ bt_id _ "." _ invoice.id _ "", "$formatted_skonto_amount_selected", default=0, style=style, disabled=1, size=4, class='numeric') %]
14
 [% LxERP.t8("Skonto amount") %]: [% P.input_tag("free_skonto_amount." _ bt_id _ "." _ invoice.id _ "", "$formatted_skonto_amount_selected", default=0, style=style, disabled=1, size=4, class='numeric', onblur="kivi.BankTransaction.update_invoice_amount(" _ bt_id _ ", 0, this)") %]
11 15
 [% P.link_tag("#", "x", onclick="kivi.BankTransaction.delete_invoice(" _ bt_id _ "," _ invoice.id _ ")") %]
12 16
</span>

Auch abrufbar als: Unified diff