CsvImport Waren: Preisupdate auch bei Erzeugnissen u. Dienstleistungen ermöglichen.
[kivitendo-erp.git] / templates / webpages / dbupgrade / default_bin_parts.html
1 [%- USE T8 %]
2 [%- USE HTML %]
3 [%- USE LxERP %]
4 [%- USE JavaScript %]
5  <script type="text/javascript" src="js/common.js"></script>
6  <script type="text/javascript">
7   <!--
8      warehouses = new Array();
9      [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH warehouse = WAREHOUSES_it %]
10       warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
11       warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
12       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
13       [% USE BINS_it = Iterator(warehouse.BINS) %][% FOREACH bin = BINS_it %]
14       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]] = new Array();
15       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['description'] = "[% JavaScript.escape(bin.description) %]";
16       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['id'] = [% bin.id %];
17       [% END %]
18       [% END %]
19       //var rowcount = [% rowcount %];
20       //var rowcount = 3; //[% rowcount %];
21       function warehouse_selected(warehouse_id, bin_id, loop) {
22         var control = document.getElementById("bin_id_" + loop);
23
24         for (var i = control.options.length - 1; i >= 0; i--) {
25           control.options[i] = null;
26         }
27
28         var warehouse_index = 0;
29
30         for (i = 0; i < warehouses.length; i++)
31           if (warehouses[i]['id'] == warehouse_id) {
32             warehouse_index = i;
33             break;
34           }
35
36         var warehouse = warehouses[warehouse_index];
37         var bin_index = 0;
38
39         for (i = 0; i < warehouse['bins'].length; i++)
40           if (warehouse['bins'][i]['id'] == bin_id) {
41             bin_index = i;
42             break;
43           }
44
45         for (i = 0; i < warehouse['bins'].length; i++) {
46           control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
47         }
48
49
50         control.options[bin_index].selected = true;
51       }
52
53       function bin_match(rowcount) {
54         for (i = 1; i <= rowcount + 1; i++) {              // über alle parts_id
55           var lagerplatz = document.getElementById("bin_" + i).value;
56           var control = document.getElementById("bin_id_" + i);
57           var bin_index = 0;
58           for (j = 0; j < warehouses.length; j++) {       // über alle lager
59             var warehouse = warehouses[j];
60
61             for (k = 0; k < warehouse['bins'].length; k++) {       // über alle lagerplätze
62
63               if (lagerplatz == warehouse['bins'][k]['description']) {
64                 var lager = document.getElementById("warehouse_id_" + i);
65                 lager.selectedIndex = j;
66                 bin_index = k;
67                 for (bin_i = 0; bin_i < warehouse['bins'].length; bin_i++) {
68                   control.options[bin_i] = new Option(warehouse['bins'][bin_i]['description'], warehouse['bins'][bin_i]['id']);
69                 }
70                 control.options[bin_index].selected = true;
71                 break;
72                 /*var lagerplatz = document.getElementById("bin_id_" + i);
73                 alert('lagerplatz ' + lagerplatz.value);
74                 lagerplatz.selectedIndex = k; */
75               }
76
77             }
78           }
79         }
80
81       }
82
83
84       $(function() {
85         warehouse_selected([% warehouse_id %], [% bin_id %]);
86       })
87     -->
88  </script>
89
90
91
92 <div class="listtop">[% '<b>Default Bins Migration !READ CAREFULLY!</b>' | $T8 %]</div>
93 <form name="Form" method="post" action="login.pl">
94 <input type="hidden" name="action" value="login">
95 <input type="hidden" name="continued" value="1">
96
97
98
99 <p>[% 'There are Bins defined in your Inventory.' | $T8 %]</p>
100 <p>[% 'The Bins in Inventory were only a information text field.' | $T8 %]</p>
101 <p>[% 'This has been changed in this version, therefore please change the "old" bins to some real warehouse bins.' | $T8 %]</p>
102 <p>[% 'If your old bins match exactly Bins in the Warehouse CLICK on <b>AUTOMATICALLY MATCH BINS</b>.' | $T8 %]</p>
103 <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>
104 <p>[% 'Empty selection for warehouse will not be added, even if the old bin is still visible (use back and forth to edit again).'  | $T8 %]</p>
105
106 <table>
107   <tr>
108     <th class="listheading">[% 'Partnumber' | $T8 %]</th>
109     <th class="listheading">[% 'Description' | $T8 %]</th>
110     <th class="listheading">[% 'Bin' | $T8 %]</th>
111     <th class="listheading">[% 'Default Warehouse' | $T8 %]</th>
112     <th class="listheading">[% 'Default Bin' | $T8 %]</th>
113   </tr>
114
115   [% SET row_odd = '1' %][% FOREACH row = PARTS %]
116   <tr class="listrow[% IF row_odd %]1[% SET row_odd = '0' %][% ELSE %]0[% SET row_odd = '1' %][% END %]">
117    <td align="left"> [% HTML.escape(row.partnumber) %]</a></td>
118     <td align="left"> [% HTML.escape(row.description) %]</a></td>
119     <td align="right">[% HTML.escape(row.bin) %]
120     <input type="hidden" id="bin_[% loop.count %]" name="bin_[% loop.count %]" value="[% HTML.escape(row.bin) %]">
121     </td>
122     <td>
123     <input type="hidden" name='partid_[% loop.count %]' value='[% HTML.escape(row.id) %]'>
124      <select id="warehouse_id_[% loop.count %]" name="warehouse_id_[% loop.count %]" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0, [% loop.count %])">
125              [%- FOREACH warehouse = WAREHOUSES %]
126                <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id  == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
127              [%- END %]
128                 <option value=""  [% IF warehouse_id  == 0 %] selected[% END %] ></option>
129      </select>
130     </td>
131     <td><select id="bin_id_[% loop.count %]" name="bin_id_[% loop.count %]"></select></td>
132   </tr>
133   [% SET rowcount = loop.count %]
134   [% END %]
135   <input type="hidden" name="rowcount" value="[% rowcount %]">
136   <tr><td colspan="5"><hr/></td></tr>
137   <tr><td colspan="5">
138          <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 %]
139           <select id="warehouse_id_default" name="warehouse_id_default">
140              [%- FOREACH warehouse = WAREHOUSES %]
141                <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id  == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
142              [%- END %]
143                 <option value=""  [% IF warehouse_id  == 0 %] selected[% END %] ></option>
144          </select>
145       </td>
146   </tr>
147
148   <tr><td colspan="5"><hr/></td></tr>
149  <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>
150 </table>
151 </form>