02f1fd396ce28745c1378b3262056ed9e9dadca0
[kivitendo-erp.git] / 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'>&#x2022;</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'>&#x2022;</td>
100 [% ELSE %]
101      <td></td>
102 [% END %]
103      <td>[% price.description | html %]</td>
104     </tr>
105    [%- END %]
106   </table>