Langtext-Dialog: Größe prozentual zum Hauptfenster einstellbar pro Benutzer
[kivitendo-erp.git] / templates / webpages / do / stock_in_form.html
index 0d5ea68..f8fa9d8 100644 (file)
@@ -1,5 +1,7 @@
 [%- USE T8 %]
-[% USE HTML %][% USE LxERP %][% USE JavaScript %]<body[% UNLESS delivered %] onload="on_load();"[% END %]>
+[%- USE L %]
+[%- USE HTML %][%- USE LxERP %][%- USE JavaScript %]
+<h1>[% title %]</h1>
 
  [%- UNLESS delivered %]
  <script type="text/javascript">
         control.options[initial_bin_index].selected = true;
       }
 
-      function on_load() {
+      $(function(){
+        var bin_id_index       = 0;
+        var warehouse_id_index = 0;
         [%- USE STOCK_INFO_it = Iterator(STOCK_INFO) %][%- FOREACH si = STOCK_INFO_it %]
           // new si for wh [% si.warehouse_id %] bin [% si.bin_id %]
           [%- SET warehouse_selected = '0' %]
           [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH wh = WAREHOUSES_it %]
             // wh [% wh.id %]
+            [% IF HTML.escape(PART_INFO.warehouse_id) == wh.id %]
+              warehouse_id_index = [% WAREHOUSES_it.count - 1%];
+            [% END %]
             [%- USE BINS_it = Iterator(wh.BINS) %][%- FOREACH bin = BINS_it %]
               // bin [% bin.id %]
+              [% IF HTML.escape(PART_INFO.bin_id) == bin.id %]
+                bin_id_index = [% BINS_it.count - 1%];
+              [% END %]
               [%- IF bin.id == si.bin_id %]
                 warehouse_selected([% STOCK_INFO_it.count %], [% WAREHOUSES_it.count - 1 %], [% BINS_it.count - 1%]);
                 [%- SET warehouse_selected = '1' %]
             [%- END %]
           [%- END %]
           [%- UNLESS warehouse_selected %]
-          warehouse_selected([% STOCK_INFO_it.count %], 0);
+            warehouse_selected([% STOCK_INFO_it.count %], warehouse_id_index, bin_id_index);
           [%- END %]
         [%- END %]
-      }
+      });
     -->
  </script>
  [%- END %]
 
  <form method="post" action="do.pl" name="Form">
 
-  <div class="listtop">[% title %]</div>
-
   [%- IF ERRORS && ERRORS.size %]
   <p><font color="#ff0000">[% ERRORS.join('<br>') %]</font></p>
   [%- END %]
      <th class="listheading">[% 'Warehouse' | $T8 %]</th>
      <th class="listheading">[% 'Bin' | $T8 %]</th>
      <th class="listheading">[% 'Charge Number' | $T8 %]</th>
-     [% IF conf_show_best_before %]
+     [% IF INSTANCE_CONF.get_show_bestbefore %]
      <th class="listheading">[% 'Best Before' | $T8 %]</th>
      [% END %]
      <th align="right" class="listheading">[% 'Qty' | $T8 %]</th>
      <td>[% HTML.escape(row.warehouse_description) %]</td>
      <td>[% HTML.escape(row.bin_description) %]</td>
      <td>[% HTML.escape(row.chargenumber) %]</td>
-     [% IF conf_show_best_before %]
+     [% IF INSTANCE_CONF.get_show_bestbefore %]
      <td>[% HTML.escape(row.bestbefore) %]</td>
      [% END %]
      <td>[% HTML.escape(LxERP.format_amount(row.qty)) %]</td>
      <td>
       <select name="warehouse_id_[% loop.count %]" onchange="warehouse_selected([% loop.count %], this.selectedIndex)">
        [%- FOREACH wh = WAREHOUSES %]
-       <option value="[% HTML.escape(wh.id) %]"[% IF wh.id == row.warehouse_id %] selected[% END %]>[% HTML.escape(wh.description) %]</option>
+     <option value="[% HTML.escape(wh.id) %]"[% IF wh.id == row.warehouse_id %] selected[% END %] [% IF wh.id == PART_INFO.warehouse_id && STOCK_INFO.size == 1  %] selected[% END %]>[% HTML.escape(wh.description) %]</option>
        [%- END %]
       </select>
      </td>
 
      <td><select name="bin_id_[% loop.count %]" id="bin_id_[% loop.count %]"></select></td>
      <td><input name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]"></td>
-     [% IF conf_show_best_before %]
+     [% IF INSTANCE_CONF.get_show_bestbefore %]
      <td>
-       <input name="bestbefore_[% loop.count %]" id="bestbefore_[% loop.count %]" value="[% HTML.escape(row.bestbefore) %]" size="11" title="[% myconfig_dateformat %]">
-       <input type="button" name="b_bestbefore_[% loop.count %]" id="bestbefore_trigger_[% loop.count %]" value="?">
+       [% L.date_tag('bestbefore_'_ loop.count, row.bestbefore) %]
      </td>
      [% END %]
-     <td><input name="qty_[% loop.count %]" size="12" value="[% HTML.escape(LxERP.format_amount(row.qty)) %]"></td>
-
+     <td><input name="qty_[% loop.count %]" size="12"
+     [%- IF (!row.qty) && (loop.count == 1) %]
+       value="[% HTML.escape(do_qty) %]"
+     [%- ELSE %]
+       value="[% HTML.escape(LxERP.format_amount(row.qty)) %]"
+     [% END %]
+     ></td>
      <td>
       <select name="unit_[% loop.count %]">
        [%- FOREACH unit = UNITS %]
        [%- END %]
       </select>
      </td>
-
+     <input type="hidden" name="delivery_order_items_stock_id_[% loop.count %]" value="[% HTML.escape(row.delivery_order_items_stock_id) %]">
      [%- END %]
     </tr>
 
   </p>
  </form>
 
- [%- IF NOT delivered %]
- [% IF conf_show_best_before %]
-  <script type="text/javascript">
-    <!--
-    [%- FOREACH row = STOCK_INFO %]
-    Calendar.setup( {
-      inputField : "bestbefore_[% loop.count %]",
-      ifFormat :"[% myconfig_jsc_dateformat %]",
-      align : "BR",
-      button : "bestbefore_trigger_[% loop.count %]"
-    });
-    [%- END %]
-    //-->
-  </script>
-  [% END %]
-  [%- END %]
-
-</body>
-</html>
-