Revision 65940d66
Von Sven Schöling vor etwa 3 Jahren hinzugefügt
js/kivi.DeliveryOrder.js | ||
---|---|---|
516 | 516 |
$.post("controller.pl", data, kivi.eval_json_result); |
517 | 517 |
}; |
518 | 518 |
|
519 |
ns.update_price_source = function(item_id, source, descr, price_str, price_editable) { |
|
520 |
var row = $('#item_' + item_id).parents("tbody").first(); |
|
521 |
var source_elt = $(row).find('[name="order.orderitems[].active_price_source"]'); |
|
522 |
var button_elt = $(row).find('[name="price_chooser_button"]'); |
|
523 |
|
|
524 |
button_elt.val(button_elt.val().replace(/.*\|/, descr + " |")); |
|
525 |
source_elt.val(source); |
|
526 |
|
|
527 |
var editable_div_elt = $(row).find('[name="editable_price"]'); |
|
528 |
var not_editable_div_elt = $(row).find('[name="not_editable_price"]'); |
|
529 |
if (price_editable == 1 && source === '') { |
|
530 |
// editable |
|
531 |
$(editable_div_elt).show(); |
|
532 |
$(not_editable_div_elt).hide(); |
|
533 |
$(editable_div_elt).find(':input').prop("disabled", false); |
|
534 |
$(not_editable_div_elt).find(':input').prop("disabled", true); |
|
535 |
} else { |
|
536 |
// not editable |
|
537 |
$(editable_div_elt).hide(); |
|
538 |
$(not_editable_div_elt).show(); |
|
539 |
$(editable_div_elt).find(':input').prop("disabled", true); |
|
540 |
$(not_editable_div_elt).find(':input').prop("disabled", false); |
|
541 |
} |
|
542 |
|
|
543 |
if (price_str) { |
|
544 |
var price_elt = $(row).find('[name="order.orderitems[].sellprice_as_number"]'); |
|
545 |
var html_elt = $(row).find('[name="sellprice_text"]'); |
|
546 |
price_elt.val(price_str); |
|
547 |
html_elt.html(price_str); |
|
548 |
} |
|
549 |
|
|
550 |
kivi.io.close_dialog(); |
|
551 |
}; |
|
552 |
|
|
553 |
ns.update_discount_source = function(item_id, source, descr, discount_str, price_editable) { |
|
554 |
var row = $('#item_' + item_id).parents("tbody").first(); |
|
555 |
var source_elt = $(row).find('[name="order.orderitems[].active_discount_source"]'); |
|
556 |
var button_elt = $(row).find('[name="price_chooser_button"]'); |
|
557 |
|
|
558 |
button_elt.val(button_elt.val().replace(/\|.*/, "| " + descr)); |
|
559 |
source_elt.val(source); |
|
560 |
|
|
561 |
var editable_div_elt = $(row).find('[name="editable_discount"]'); |
|
562 |
var not_editable_div_elt = $(row).find('[name="not_editable_discount"]'); |
|
563 |
if (price_editable == 1 && source === '') { |
|
564 |
// editable |
|
565 |
$(editable_div_elt).show(); |
|
566 |
$(not_editable_div_elt).hide(); |
|
567 |
$(editable_div_elt).find(':input').prop("disabled", false); |
|
568 |
$(not_editable_div_elt).find(':input').prop("disabled", true); |
|
569 |
} else { |
|
570 |
// not editable |
|
571 |
$(editable_div_elt).hide(); |
|
572 |
$(not_editable_div_elt).show(); |
|
573 |
$(editable_div_elt).find(':input').prop("disabled", true); |
|
574 |
$(not_editable_div_elt).find(':input').prop("disabled", false); |
|
575 |
} |
|
576 |
|
|
577 |
if (discount_str) { |
|
578 |
var discount_elt = $(row).find('[name="order.orderitems[].discount_as_percent"]'); |
|
579 |
var html_elt = $(row).find('[name="discount_text"]'); |
|
580 |
discount_elt.val(discount_str); |
|
581 |
html_elt.html(discount_str); |
|
582 |
} |
|
583 |
|
|
584 |
kivi.io.close_dialog(); |
|
585 |
}; |
|
586 |
|
|
587 | 519 |
ns.show_vc_details_dialog = function() { |
588 | 520 |
if (!ns.check_cv()) return; |
589 | 521 |
var vc; |
templates/webpages/delivery_order/tabs/_price_sources_dialog.html | ||
---|---|---|
1 |
[%- USE T8 %] |
|
2 |
[%- USE HTML %] |
|
3 |
[%- USE L %] |
|
4 |
[%- USE LxERP %] |
|
5 |
[% SET best_price = price_source.best_price %] |
|
6 |
[% SET best_discount = price_source.best_discount %] |
|
7 |
[% SET price_editable = 0 %] |
|
8 |
[% IF (FORM.type == "sales_order" || FORM.type == "sales_quotation") %] |
|
9 |
[% SET price_editable = AUTH.assert('sales_edit_prices', 1) %] |
|
10 |
[% END %] |
|
11 |
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation") %] |
|
12 |
[% SET price_editable = AUTH.assert('purchase_edit_prices', 1) %] |
|
13 |
[% END %] |
|
14 |
[% SET exfactor = price_source.record.exchangerate ? 1 / price_source.record.exchangerate : 1 %] |
|
15 |
[% SET exnoshow = price_source.record.currency_id==INSTANCE_CONF.get_currency_id %] |
|
16 |
[% SET places = exnoshow ? -2 : 5 %] |
|
17 |
<h2>[% 'Prices' | $T8 %]</h2> |
|
18 |
|
|
19 |
<table> |
|
20 |
<tr class='listheading'> |
|
21 |
<th></th> |
|
22 |
<th>[% 'Price Source' | $T8 %]</th> |
|
23 |
<th>[% 'Price' | $T8 %]</th> |
|
24 |
<th [%- IF exnoshow -%]style='display:none'[%- END %]> |
|
25 |
[% 'Price' | $T8 -%]/[%- price_source.record.currency.name %] |
|
26 |
</th> |
|
27 |
<th>[% 'Best Price' | $T8 %]</th> |
|
28 |
<th>[% 'Details' | $T8 %]</th> |
|
29 |
</tr> |
|
30 |
<tr class='listrow'> |
|
31 |
[%- IF price_source.record_item.active_price_source %] |
|
32 |
<td>[% L.button_tag('kivi.Order.update_price_source(\'' _ FORM.item_id _ '\', \'\', \'' _ LxERP.t8('None (PriceSource)') _ '\', \'\', ' _ price_editable _ ')', LxERP.t8('Select')) %]</td> |
|
33 |
[%- ELSE %] |
|
34 |
<td><b>[% 'Selected' | $T8 %]</b></td> |
|
35 |
[%- END %] |
|
36 |
<td>[% 'None (PriceSource)' | $T8 %]</td> |
|
37 |
<td>-</td> |
|
38 |
<td [%- IF exnoshow -%]style='display:none'[%- END %]>-</td> |
|
39 |
<td></td> |
|
40 |
<td></td> |
|
41 |
</tr> |
|
42 |
[%- FOREACH price IN price_source.available_prices %] |
|
43 |
<tr class='listrow'> |
|
44 |
[%- IF price_source.record_item.active_price_source != price.source %] |
|
45 |
<td>[% L.button_tag('kivi.Order.update_price_source(\'' _ FORM.item_id _ '\', \'' _ price.source _ '\', \'' _ price.source_description _ '\', \'' _ LxERP.format_amount(price.price * exfactor, places) _ '\', ' _ price_editable _ ')', LxERP.t8('Select')) %]</td> |
|
46 |
[%- ELSIF price_source.record_item.sellprice * 1 != price.price * 1 %] |
|
47 |
<td>[% L.button_tag('kivi.Order.update_price_source(\'' _ FORM.item_id _ '\', \'' _ price.source _ '\', \'' _ price.source_description _ '\', \'' _ LxERP.format_amount(price.price * exfactor, places) _ '\', ' _ price_editable _ ')', LxERP.t8('Update Price')) %]</td> |
|
48 |
[%- ELSE %] |
|
49 |
<td><b>[% 'Selected' | $T8 %]</b></td> |
|
50 |
[% END %] |
|
51 |
<td>[% price.source_description | html %]</td> |
|
52 |
<td>[% price.price_as_number %]</td> |
|
53 |
<td [%- IF exnoshow -%]style='display:none'[%- END %]> |
|
54 |
[% LxERP.format_amount(price.price * exfactor, places) %] |
|
55 |
</td> |
|
56 |
[% IF price.source == best_price.source %] |
|
57 |
<td align='center'>•</td> |
|
58 |
[% ELSE %] |
|
59 |
<td></td> |
|
60 |
[% END %] |
|
61 |
<td>[% price.description | html %]</td> |
|
62 |
</tr> |
|
63 |
[%- END %] |
|
64 |
</table> |
|
65 |
|
|
66 |
<h2>[% 'Discounts' | $T8 %]</h2> |
|
67 |
|
|
68 |
<table> |
|
69 |
<tr class='listheading'> |
|
70 |
<th></th> |
|
71 |
<th>[% 'Price Source' | $T8 %]</th> |
|
72 |
<th>[% 'Discount' | $T8 %]</th> |
|
73 |
<th>[% 'Best Discount' | $T8 %]</th> |
|
74 |
<th>[% 'Details' | $T8 %]</th> |
|
75 |
</tr> |
|
76 |
<tr class='listrow'> |
|
77 |
[%- IF price_source.record_item.active_discount_source %] |
|
78 |
<td>[% L.button_tag('kivi.Order.update_discount_source(\'' _ FORM.item_id _ '\', \'\', \'' _ LxERP.t8('None (PriceSource Discount)') _ '\', \'\', ' _ price_editable _ ')', LxERP.t8('Select')) %]</td> |
|
79 |
[%- ELSE %] |
|
80 |
<td><b>[% 'Selected' | $T8 %]</b></td> |
|
81 |
[%- END %] |
|
82 |
<td>[% 'None (PriceSource Discount)' | $T8 %]</td> |
|
83 |
<td>-</td> |
|
84 |
<td></td> |
|
85 |
<td></td> |
|
86 |
</tr> |
|
87 |
[%- FOREACH price IN price_source.available_discounts %] |
|
88 |
<tr class='listrow'> |
|
89 |
[%- IF price_source.record_item.active_discount_source != price.source %] |
|
90 |
<td>[% L.button_tag('kivi.Order.update_discount_source(\'' _ FORM.item_id _ '\', \'' _ price.source _ '\', \'' _ price.source_description _ '\', \'' _ price.discount_as_percent _ '\', ' _ price_editable _ ')', LxERP.t8('Select')) %]</td> |
|
91 |
[%- ELSIF price_source.record_item.discount * 1 != price.discount * 1 %] |
|
92 |
<td>[% L.button_tag('kivi.Order.update_discount_source(\'' _ FORM.item_id _ '\', \'' _ price.source _ '\', \'' _ price.source_description _ '\', \'' _ price.discount_as_percent _ '\', ' _ price_editable _ ')', LxERP.t8('Update Discount')) %]</td> |
|
93 |
[%- ELSE %] |
|
94 |
<td><b>[% 'Selected' | $T8 %]</b></td> |
|
95 |
[% END %] |
|
96 |
<td>[% price.source_description | html %]</td> |
|
97 |
<td>[% price.discount_as_percent %] %</td> |
|
98 |
[% IF price.source == best_discount.source %] |
|
99 |
<td align='center'>•</td> |
|
100 |
[% ELSE %] |
|
101 |
<td></td> |
|
102 |
[% END %] |
|
103 |
<td>[% price.description | html %]</td> |
|
104 |
</tr> |
|
105 |
[%- END %] |
|
106 |
</table> |
templates/webpages/delivery_order/tabs/_row.html | ||
---|---|---|
92 | 92 |
value_key = 'name', |
93 | 93 |
class = 'unitselect') %] |
94 | 94 |
</td> |
95 |
<td> |
|
96 |
[%- L.button_tag("kivi.Order.price_chooser_item_row(this)", |
|
97 |
ITEM.active_price_source.source_description _ ' | ' _ ITEM.active_discount_source.source_description, |
|
98 |
name = "price_chooser_button") %] |
|
99 |
</td> |
|
100 | 95 |
[% SET RIGHT_TO_EDIT_PRICES = 0 %] |
101 | 96 |
[% IF (SELF.type == "sales_order" || SELF.type == "sales_quotation") %] |
102 | 97 |
[% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('sales_edit_prices', 1) %] |
... | ... | |
105 | 100 |
[% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('purchase_edit_prices', 1) %] |
106 | 101 |
[% END %] |
107 | 102 |
<td> |
108 |
[%- L.hidden_tag("order.orderitems[].active_price_source", ITEM.active_price_source.source) %] |
|
109 |
[%- SET EDIT_PRICE = (RIGHT_TO_EDIT_PRICES && ITEM.active_price_source.source == '') %] |
|
103 |
[%- SET EDIT_PRICE = (RIGHT_TO_EDIT_PRICES) %] |
|
110 | 104 |
<div name="editable_price" [%- IF !EDIT_PRICE %]style="display:none"[%- END %] class="numeric"> |
111 | 105 |
[%- L.input_tag("order.orderitems[].sellprice_as_number", |
112 | 106 |
ITEM.sellprice_as_number, |
... | ... | |
122 | 116 |
</div> |
123 | 117 |
</td> |
124 | 118 |
<td> |
125 |
[%- L.hidden_tag("order.orderitems[].active_discount_source", ITEM.active_discount_source.source) %] |
|
126 |
[%- SET EDIT_DISCOUNT = (RIGHT_TO_EDIT_PRICES && ITEM.active_discount_source.source == '') %] |
|
119 |
[%- SET EDIT_DISCOUNT = (RIGHT_TO_EDIT_PRICES) %] |
|
127 | 120 |
<div name="editable_discount" [%- IF !EDIT_DISCOUNT %]style="display:none"[%- END %] class="numeric"> |
128 | 121 |
[%- L.input_tag("order.orderitems[].discount_as_percent", |
129 | 122 |
ITEM.discount_as_percent, |
Auch abrufbar als: Unified diff
DeliveryOrder: price_source feature entfernt