772d9d5434f5b315072d2ab1c1ad9ed29417e291
[kivitendo-erp.git] / templates / webpages / 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   <h2>[% 'Prices' | $T8 %]</h2>
15
16   <table>
17    <tr class='listheading'>
18     <th></th>
19     <th>[% 'Price Source' | $T8 %]</th>
20     <th>[% 'Price' | $T8 %]</th>
21     <th>[% 'Best Price' | $T8 %]</th>
22     <th>[% 'Details' | $T8 %]</th>
23    </tr>
24    <tr class='listrow'>
25 [%- IF price_source.record_item.active_price_source %]
26     <td>[% L.button_tag('kivi.Order.update_price_source(\'' _ FORM.item_id _ '\', \'\', \'' _ LxERP.t8('None (PriceSource)') _ '\', \'\', ' _ price_editable _ ')', LxERP.t8('Select')) %]</td>
27 [%- ELSE %]
28     <td><b>[% 'Selected' | $T8 %]</b></td>
29 [%- END %]
30     <td>[% 'None (PriceSource)' | $T8 %]</td>
31     <td>-</td>
32     <td></td>
33     <td></td>
34    </tr>
35    [%- FOREACH price IN price_source.available_prices %]
36     <tr class='listrow'>
37 [%- IF price_source.record_item.active_price_source != price.source %]
38      <td>[% L.button_tag('kivi.Order.update_price_source(\'' _ FORM.item_id _ '\', \'' _ price.source _ '\', \'' _ price.source_description _ '\', \'' _ LxERP.format_amount(price.price, -2) _ '\', ' _ price_editable _ ')', LxERP.t8('Select')) %]</td>
39 [%- ELSIF price_source.record_item.sellprice * 1 != price.price * 1 %]
40      <td>[% L.button_tag('kivi.Order.update_price_source(\'' _ FORM.item_id _ '\', \'' _ price.source _ '\', \'' _ price.source_description _ '\', \'' _ LxERP.format_amount(price.price, -2) _ '\', ' _ price_editable _ ')', LxERP.t8('Update Price')) %]</td>
41 [%- ELSE %]
42     <td><b>[% 'Selected' | $T8 %]</b></td>
43 [% END %]
44      <td>[% price.source_description | html %]</td>
45      <td>[% price.price_as_number %]</td>
46 [% IF price.source == best_price.source %]
47      <td align='center'>&#x2022;</td>
48 [% ELSE %]
49      <td></td>
50 [% END %]
51      <td>[% price.description | html %]</td>
52     </tr>
53    [%- END %]
54   </table>
55
56   <h2>[% 'Discounts' | $T8 %]</h2>
57
58   <table>
59    <tr class='listheading'>
60     <th></th>
61     <th>[% 'Price Source' | $T8 %]</th>
62     <th>[% 'Discount' | $T8 %]</th>
63     <th>[% 'Best Discount' | $T8 %]</th>
64     <th>[% 'Details' | $T8 %]</th>
65    </tr>
66    <tr class='listrow'>
67 [%- IF price_source.record_item.active_discount_source %]
68     <td>[% L.button_tag('kivi.Order.update_discount_source(\'' _ FORM.item_id _ '\', \'\', \'' _ LxERP.t8('None (PriceSource Discount)') _ '\', \'\', ' _ price_editable _ ')', LxERP.t8('Select')) %]</td>
69 [%- ELSE %]
70     <td><b>[% 'Selected' | $T8 %]</b></td>
71 [%- END %]
72     <td>[% 'None (PriceSource Discount)' | $T8 %]</td>
73     <td>-</td>
74     <td></td>
75     <td></td>
76    </tr>
77    [%- FOREACH price IN price_source.available_discounts %]
78     <tr class='listrow'>
79 [%- IF price_source.record_item.active_discount_source != price.source %]
80      <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>
81 [%- ELSIF price_source.record_item.discount * 1 != price.discount * 1 %]
82      <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>
83 [%- ELSE %]
84     <td><b>[% 'Selected' | $T8 %]</b></td>
85 [% END %]
86      <td>[% price.source_description | html %]</td>
87      <td>[% price.discount_as_percent %] %</td>
88 [% IF price.source == best_discount.source %]
89      <td align='center'>&#x2022;</td>
90 [% ELSE %]
91      <td></td>
92 [% END %]
93      <td>[% price.description | html %]</td>
94     </tr>
95    [%- END %]
96   </table>