Revision 598383b3
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
js/kivi.Order.js | ||
---|---|---|
174 | 174 |
$(event.target).val(kivi.format_amount(kivi.parse_amount($(event.target).val()), -2)); |
175 | 175 |
}; |
176 | 176 |
|
177 |
ns.reformat_number_as_null_number = function(event) { |
|
178 |
if ($(event.target).val() === '') { |
|
179 |
return; |
|
180 |
} |
|
181 |
ns.reformat_number(event); |
|
182 |
}; |
|
183 |
|
|
177 | 184 |
ns.update_exchangerate = function(event) { |
178 | 185 |
if (!ns.check_cv()) { |
179 | 186 |
$('#order_currency_id').val($('#old_currency_id').val()); |
... | ... | |
181 | 188 |
} |
182 | 189 |
|
183 | 190 |
var rate_input = $('#order_exchangerate_as_null_number'); |
184 |
rate_input.prop('disabled', true); |
|
191 |
// unset exchangerate if currency changed |
|
192 |
if ($('#order_currency_id').val() !== $('#old_currency_id').val()) { |
|
193 |
rate_input.val(''); |
|
194 |
} |
|
195 |
|
|
196 |
// only set exchangerate if unset |
|
197 |
if (rate_input.val() !== '') { |
|
198 |
return; |
|
199 |
} |
|
185 | 200 |
|
186 | 201 |
var data = $('#order_form').serializeArray(); |
187 | 202 |
data.push({ name: 'action', value: 'Order/update_exchangerate' }); |
... | ... | |
194 | 209 |
success: function(data){ |
195 | 210 |
if (!data.is_standard) { |
196 | 211 |
$('#currency_name').text(data.currency_name); |
197 |
var rate_text = $('#exchangerate_text'); |
|
198 | 212 |
if (data.exchangerate) { |
199 |
rate_text.text(data.exchangerate); |
|
200 |
rate_input.hide(); |
|
213 |
rate_input.val(data.exchangerate); |
|
201 | 214 |
} else { |
202 |
rate_text.text(''); |
|
203 |
rate_input.prop('disabled', false); |
|
204 |
rate_input.show().val(''); |
|
215 |
rate_input.val(''); |
|
205 | 216 |
} |
206 | 217 |
$('#exchangerate_settings').show(); |
207 | 218 |
} else { |
219 |
rate_input.val(''); |
|
208 | 220 |
$('#exchangerate_settings').hide(); |
209 | 221 |
} |
210 | 222 |
if ($('#order_currency_id').val() != $('#old_currency_id').val() || |
... | ... | |
892 | 904 |
return false; |
893 | 905 |
}); |
894 | 906 |
|
907 |
$('.reformat_number_as_null_number').change(kivi.Order.reformat_number_as_null_number); |
|
908 |
|
|
895 | 909 |
}); |
Auch abrufbar als: Unified diff
Auftrags-Controller: Wechselkurs pro Beleg …
- Wechselkurs wird pro Beleg gespeichert
- Wechselkurs ist immer änderbar
- vorausgefüllt aus "alter" Tages-Wechselkurstabelle
Bezieht sich auch auf #135
Refs #135