1324188cf6a61454e99a1134d45b2f867b184056
[kivitendo-erp.git] / templates / webpages / wh / warehouse_selection_stock.html
1 [%- USE T8 %]
2 [%- USE L %]
3 [%- USE HTML %][%- USE JavaScript %][%- USE LxERP %]
4 <body onload="on_load(); [%- onload %]">
5
6  <script type="text/javascript" src="js/common.js"></script>
7  <script type="text/javascript" src="js/part_selection.js"></script>
8  <script type="text/javascript">
9   <!--
10       warehouses = new Array();
11       [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH warehouse = WAREHOUSES_it %]
12       warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
13       warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
14       warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
15       [% USE BINS_it = Iterator(warehouse.BINS) %][% FOREACH bin = BINS_it %]
16       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]] = new Array();
17       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['description'] = "[% JavaScript.escape(bin.description) %]";
18       warehouses[[% WAREHOUSES_it.count - 1%]]['bins'][[% BINS_it.count - 1 %]]['id'] = [% bin.id %];
19       [% END %]
20       [% END %]
21
22       function warehouse_selected(warehouse_id, bin_id) {
23         var control = document.getElementById("bin_id");
24
25         for (var i = control.options.length - 1; i >= 0; i--) {
26           control.options[i] = null;
27         }
28
29         var warehouse_index = 0;
30
31         for (i = 0; i < warehouses.length; i++)
32           if (warehouses[i]['id'] == warehouse_id) {
33             warehouse_index = i;
34             break;
35           }
36
37         var warehouse = warehouses[warehouse_index];
38         var bin_index = 0;
39
40         for (i = 0; i < warehouse['bins'].length; i++)
41           if (warehouse['bins'][i]['id'] == bin_id) {
42             bin_index = i;
43             break;
44           }
45
46         for (i = 0; i < warehouse['bins'].length; i++) {
47           control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
48         }
49
50
51         control.options[bin_index].selected = true;
52       }
53
54       function on_load() {
55         warehouse_selected([% warehouse_id %], [% bin_id %]);
56       }
57     -->
58  </script>
59
60  <form name="Form" method="post" action="wh.pl">
61
62   <input type="hidden" name="nextsub" value="transfer_stock">
63   <input type="hidden" name="update_nextsub" value="transfer_stock_update_part">
64
65   [% IF saved_message %]
66   <p>[% saved_message %]</p>
67   [% END %]
68
69   <div class="listtop">[% title %]</div>
70
71   <p>
72    <table>
73     <tr>
74      <th align="right" nowrap>[% 'Destination warehouse' | $T8 %]</th>
75      <td>
76       <select name="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)">
77        [%- FOREACH warehouse = WAREHOUSES %]
78        <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
79        [%- END %]
80       </select>
81      </td>
82     </tr>
83
84     <tr>
85      <th align="right" nowrap>[% 'Destination bin' | $T8 %]:</th>
86      <td><select id="bin_id" name="bin_id"></select></td>
87     </tr>
88
89     <tr>
90      <th align="right" nowrap>[% 'Part Number' | $T8 %]</th>
91      <td>
92       <input type="hidden" name="parts_id" id="parts_id" value="[% HTML.escape(parts_id) %]">
93       <input type="hidden" name="old_partnumber" id="old_partnumber" value="[% HTML.escape(partnumber) %]">
94       <input name="partnumber" size="30" value="[% HTML.escape(partnumber) %]">
95      </td>
96     </tr>
97
98     <tr>
99      <th align="right" nowrap>[% 'Part Description' | $T8 %]</th>
100      <td>
101       <input name="description" size="30" value="[% HTML.escape(description) %]">
102       <input type="button" onclick="part_selection_window('partnumber', 'description', 'parts_id', 0, 'Form', 'click_button=update_button')" value="?">
103      </td>
104     </tr>
105
106     <tr>
107      <th align="right" nowrap>[% 'Charge number' | $T8 %]</th>
108      <td><input name="chargenumber" size="30" value="[% HTML.escape(chargenumber) %]"></td>
109     </tr>
110
111     [% IF conf_show_best_before %]
112     <tr>
113      <th align="right" nowrap>[% 'Best Before' | $T8 %]</th>
114      <td>
115        [% L.date_tag('bestbefore', bestbefore) %]
116      </td>
117     </tr>
118     [% END %]
119
120     <tr>
121      <th align="right" nowrap>[% 'EAN' | $T8 %]</th>
122      <td><input name="ean" size="30" value="[% HTML.escape(ean) %]"></td>
123     </tr>
124
125     <tr>
126      <th align="right" nowrap>[% 'Quantity' | $T8 %]</th>
127      <td>
128       <input name="qty" size="10" value="[% HTML.escape(LxERP.format_amount(qty)) %]">
129       <select name="unit">
130        [%- FOREACH unit = UNITS %]<option[% IF unit.selected %] selected[% END %]>[% HTML.escape(unit.name) %]</option>[% END %]
131       </select>
132      </td>
133     </tr>
134
135     <tr>
136      <th align="right" nowrap>[% 'Optional comment' | $T8 %]</th>
137      <td><input name="comment" size="60" value="[% HTML.escape(comment) %]"></td>
138     </tr>
139
140    </table>
141   </p>
142
143   <p>
144    <input type="submit" class="submit" name="action" id="update_button" value="[% 'Update' | $T8 %]">
145    [%- IF parts_id %]
146    <input type="submit" class="submit" name="action" value="[% 'Stock' | $T8 %]">
147    [%- END %]
148   </p>
149  </form> 
150  
151 </body>
152 </html>