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) %]
 
  11 [% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation") %]
 
  12   [% SET price_editable = AUTH.assert('purchase_edit_prices', 1) %]
 
  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>
 
  20    <tr class='listheading'>
 
  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 %]
 
  27     <th>[% 'Best Price' | $T8 %]</th>
 
  28     <th>[% 'Details' | $T8 %]</th>
 
  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>
 
  34     <td><b>[% 'Selected' | $T8 %]</b></td>
 
  36     <td>[% 'None (PriceSource)' | $T8 %]</td>
 
  38     <td [%- IF exnoshow -%]style='display:none'[%- END %]>-</td>
 
  42    [%- FOREACH price IN price_source.available_prices %]
 
  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>
 
  49     <td><b>[% 'Selected' | $T8 %]</b></td>
 
  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) %]
 
  56 [% IF price.source == best_price.source %]
 
  57      <td align='center'>•</td>
 
  61      <td>[% price.description | html %]</td>
 
  66   <h2>[% 'Discounts' | $T8 %]</h2>
 
  69    <tr class='listheading'>
 
  71     <th>[% 'Price Source' | $T8 %]</th>
 
  72     <th>[% 'Discount' | $T8 %]</th>
 
  73     <th>[% 'Best Discount' | $T8 %]</th>
 
  74     <th>[% 'Details' | $T8 %]</th>
 
  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>
 
  80     <td><b>[% 'Selected' | $T8 %]</b></td>
 
  82     <td>[% 'None (PriceSource Discount)' | $T8 %]</td>
 
  87    [%- FOREACH price IN price_source.available_discounts %]
 
  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>
 
  94     <td><b>[% 'Selected' | $T8 %]</b></td>
 
  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>
 
 103      <td>[% price.description | html %]</td>