Revision d6fed9b5
Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
1253 | 1253 |
$price_src->price(0) if !$price_source->best_price; |
1254 | 1254 |
} |
1255 | 1255 |
|
1256 |
my $discount_src; |
|
1257 |
$discount_src = $price_source->best_discount |
|
1258 |
? $price_source->best_discount |
|
1259 |
: $price_source->discount_from_source(""); |
|
1260 |
$discount_src->discount(0) if !$price_source->best_discount; |
|
1256 | 1261 |
|
1257 | 1262 |
$item->sellprice($price_src->price); |
1258 | 1263 |
$item->active_price_source($price_src); |
1264 |
$item->discount($discount_src->discount); |
|
1265 |
$item->active_discount_source($discount_src); |
|
1266 |
|
|
1267 |
my $price_editable = $self->order->is_sales ? $::auth->assert('sales_edit_prices', 1) : $::auth->assert('purchase_edit_prices', 1); |
|
1259 | 1268 |
|
1260 | 1269 |
$self->js |
1261 |
->run('kivi.Order.update_sellprice', $item_id, $item->sellprice_as_number) |
|
1270 |
->run('kivi.Order.set_price_and_source_text', $item_id, $price_src ->source, $price_src ->source_description, $item->sellprice_as_number, $price_editable) |
|
1271 |
->run('kivi.Order.set_discount_and_source_text', $item_id, $discount_src->source, $discount_src->source_description, $item->discount_as_percent, $price_editable) |
|
1262 | 1272 |
->html('.row_entry:has(#item_' . $item_id . ') [name = "partnumber"] a', $item->part->partnumber) |
1263 | 1273 |
->val ('.row_entry:has(#item_' . $item_id . ') [name = "order.orderitems[].description"]', $item->description) |
1264 | 1274 |
->val ('.row_entry:has(#item_' . $item_id . ') [name = "order.orderitems[].longdescription"]', $item->longdescription); |
js/kivi.Order.js | ||
---|---|---|
558 | 558 |
$.post("controller.pl", data, kivi.eval_json_result); |
559 | 559 |
}; |
560 | 560 |
|
561 |
ns.update_price_source = function(item_id, source, descr, price_str, price_editable) {
|
|
561 |
ns.set_price_and_source_text = function(item_id, source, descr, price_str, price_editable) {
|
|
562 | 562 |
var row = $('#item_' + item_id).parents("tbody").first(); |
563 | 563 |
var source_elt = $(row).find('[name="order.orderitems[].active_price_source"]'); |
564 | 564 |
var button_elt = $(row).find('[name="price_chooser_button"]'); |
... | ... | |
587 | 587 |
var html_elt = $(row).find('[name="sellprice_text"]'); |
588 | 588 |
price_elt.val(price_str); |
589 | 589 |
html_elt.html(price_str); |
590 |
ns.recalc_amounts_and_taxes(); |
|
591 | 590 |
} |
591 |
}; |
|
592 |
|
|
593 |
ns.update_price_source = function(item_id, source, descr, price_str, price_editable) { |
|
594 |
ns.set_price_source_text(item_id, source, descr, price_str, price_editable); |
|
592 | 595 |
|
596 |
if (price_str) ns.recalc_amounts_and_taxes(); |
|
593 | 597 |
kivi.io.close_dialog(); |
594 | 598 |
}; |
595 | 599 |
|
596 |
ns.update_discount_source = function(item_id, source, descr, discount_str, price_editable) {
|
|
600 |
ns.set_discount_and_source_text = function(item_id, source, descr, discount_str, price_editable) {
|
|
597 | 601 |
var row = $('#item_' + item_id).parents("tbody").first(); |
598 | 602 |
var source_elt = $(row).find('[name="order.orderitems[].active_discount_source"]'); |
599 | 603 |
var button_elt = $(row).find('[name="price_chooser_button"]'); |
... | ... | |
622 | 626 |
var html_elt = $(row).find('[name="discount_text"]'); |
623 | 627 |
discount_elt.val(discount_str); |
624 | 628 |
html_elt.html(discount_str); |
625 |
ns.recalc_amounts_and_taxes(); |
|
626 | 629 |
} |
630 |
}; |
|
627 | 631 |
|
632 |
ns.update_discount_source = function(item_id, source, descr, discount_str, price_editable) { |
|
633 |
if (discount_str) ns.recalc_amounts_and_taxes(); |
|
628 | 634 |
kivi.io.close_dialog(); |
629 | 635 |
}; |
630 | 636 |
|
Auch abrufbar als: Unified diff
Auftrags-Controller: Preisquellen bei Erneuern von Positionen aus Stammdaten …
… nicht nur berücksichtigen, sondern auch anzeigen.
Und Rabatt-Quellen ebefalls berücksichtigen und anzeigen.