+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE JavaScript %]
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/parts_language_selection.js"></script>
+ <script type="text/javascript">
+ <!--
+ warehouses = new Array();
+ [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH warehouse = WAREHOUSES_it %]
+ warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
+ warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
+ warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
+ [% USE BINS_it = Iterator(warehouse.BINS) %][% FOREACH bin = BINS_it %]
+ warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]] = new Array();
+ warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['description'] = "[% JavaScript.escape(bin.description) %]";
+ warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['id'] = [% bin.id %];
+ [% END %]
+ [% END %]
+ //var rowcount = [% rowcount %];
+ //var rowcount = 3; //[% rowcount %];
+ function warehouse_selected(warehouse_id, bin_id, loop) {
+ var control = document.getElementById("bin_id_" + loop);
+
+ for (var i = control.options.length - 1; i >= 0; i--) {
+ control.options[i] = null;
+ }
+
+ var warehouse_index = 0;
+
+ for (i = 0; i < warehouses.length; i++)
+ if (warehouses[i]['id'] == warehouse_id) {
+ warehouse_index = i;
+ break;
+ }
+
+ var warehouse = warehouses[warehouse_index];
+ var bin_index = 0;
+
+ for (i = 0; i < warehouse['bins'].length; i++)
+ if (warehouse['bins'][i]['id'] == bin_id) {
+ bin_index = i;
+ break;
+ }
+
+ for (i = 0; i < warehouse['bins'].length; i++) {
+ control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
+ }
+
+
+ control.options[bin_index].selected = true;
+ }
+ function bin_match(rowcount) {
+ for (i = 1; i < rowcount + 1; i++) { // über alle parts_id
+ var lagerplatz = document.getElementById("bin_" + i).value;
+ var control = document.getElementById("bin_id_" + i);
+ var bin_index = 0;
+ //alert(lagerplatz);
+ for (j = 0; j < warehouses.length; j++) { // über alle lager
+ var warehouse = warehouses[j];
+
+ for (k = 0; k < warehouse['bins'].length; k++) { // über alle lagerplätze
+
+ if (lagerplatz == warehouse['bins'][k]['description']) {
+ //alert('ware ' + warehouse['bins'][k]['description']);
+ var lager = document.getElementById("warehouse_id_" + i);
+ lager.selectedIndex = j;
+ bin_index = k;
+ break;
+ /*var lagerplatz = document.getElementById("bin_id_" + i);
+ alert('lagerplatz ' + lagerplatz.value);
+ lagerplatz.selectedIndex = k; */
+ }
+
+ }
+ }
+ }
+ for (i = 0; i < warehouse['bins'].length; i++) {
+ control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
+ }
+ control.options[bin_index].selected = true;
+
+
+ }
+
+
+ $(function() {
+ warehouse_selected([% warehouse_id %], [% bin_id %]);
+ })
+ -->
+ </script>
+
+
+
+<div class="listtop">[% '<b>Default Bins Migration !READ CAREFULLY!</b>' | $T8 %]</div>
+<form name="Form" method="post" action="login.pl">
+<input type="hidden" name="action" value="login">
+<input type="hidden" name="continued" value="1">
+
+
+
+<p>[% 'There are Bins defined in your Inventory.' | $T8 %]</p>
+<p>[% 'The Bins in Inventory were only a information text field.' | $T8 %]</p>
+<p>[% 'This has been changed in this version, therefore please change the "old" bins to some real warehouse bins.' | $T8 %]</p>
+<p>[% 'If your old bins match exactly Bins in the Warehouse CLICK on <b>AUTOMATICALLY MATCH BINS</b>.' | $T8 %]</p>
+<p>[% 'Otherwise you can simply check create warehouse and bins and define a name for the warehouse (Bins will be created automatically) and then continue' | $T8 %]</p>
+
+<p>[% 'Please change the partnumber of the following parts and run the update again:' | $T8 %]</p>
+<table>
+ <tr>
+ <th class="listheading">[% 'Partnumber' | $T8 %]</th>
+ <th class="listheading">[% 'Description' | $T8 %]</th>
+ <th class="listheading">[% 'Bin' | $T8 %]</th>
+ <th class="listheading">[% 'Default Warehouse' | $T8 %]</th>
+ <th class="listheading">[% 'Default Bin' | $T8 %]</th>
+ </tr>
+
+ [% SET row_odd = '1' %][% FOREACH row = PARTS %]
+ <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
+ <td align="left"> [% HTML.escape(row.partnumber) %]</a></td>
+ <td align="left"> [% HTML.escape(row.description) %]</a></td>
+ <td align="right">[% HTML.escape(row.bin) %]
+ <input type="hidden" id="bin_[% loop.count %]" name="bin_[% loop.count %]" value="[% HTML.escape(row.bin) %]">
+ </td>
+ <td>
+ <input type="hidden" name='partid_[% loop.count %]' value='[% HTML.escape(row.id) %]'>
+ <select id="warehouse_id_[% loop.count %]" name="warehouse_id_[% loop.count %]" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0, [% loop.count %])">
+ [%- FOREACH warehouse = WAREHOUSES %]
+ <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
+ [%- END %]
+ <option value="" [% IF warehouse_id == 0 %] selected[% END %] ></option>
+ </select>
+ </td>
+ <td><select id="bin_id_[% loop.count %]" name="bin_id_[% loop.count %]"></select></td>
+ </tr>
+ [% SET rowcount = loop.count %]
+ [% END %]
+ <input type="hidden" name="rowcount" value="[% rowcount %]">
+ <tr><td colspan="5"><hr/></td></tr>
+ <tr><td colspan="5">
+ <input type="checkbox" name="create_new_bins"> [% '<b>Automatically create new bins</b> in the following warehouse if not selected in the list above' | $T8 %]
+ <select id="warehouse_id_default" name="warehouse_id_default">
+ [%- FOREACH warehouse = WAREHOUSES %]
+ <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
+ [%- END %]
+ <option value="" [% IF warehouse_id == 0 %] selected[% END %] ></option>
+ </select>
+ </td>
+ </tr>
+
+ <tr><td colspan="5"><hr/></td></tr>
+ <tr><td><input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]"> </td><td colspan="3" align="center"><b><input style="background-color:#FFEE66" type="button" value="[% 'AUTOMATICALLY MATCH BINS' | $T8 %]" onclick="bin_match([% rowcount %])"></b> </td><td><input type="submit" value="[% 'Continue' | $T8 %]"></td></tr>
+</table>
+</form>