+[% USE HTML %][% USE JavaScript %][% USE LxERP %]<body onload="on_load(); [% onload %]">
+
+ <script type="text/javascript" src="js/common.js"></script>
+ <script type="text/javascript" src="js/part_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 %]
+
+ function warehouse_selected(warehouse_id, bin_id) {
+ var control = document.getElementById("bin_id");
+
+ 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 on_load() {
+ warehouse_selected([% warehouse_id %], [% bin_id %]);
+ }
+ -->
+ </script>
+
+ <form name="Form" method="post" action="wh.pl">
+
+ <input type="hidden" name="nextsub" value="transfer_stock">
+ <input type="hidden" name="update_nextsub" value="transfer_stock_update_part">
+
+ [% IF saved_message %]
+ <p>[% saved_message %]</p>
+ [% END %]
+
+ <div class="listtop">[% title %]</div>
+
+ <p>
+ <table>
+ <tr>
+ <th align="right" nowrap><translate>Destination warehouse</translate></th>
+ <td>
+ <select name="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)">
+ [%- FOREACH warehouse = WAREHOUSES %]
+ <option value="[% HTML.escape(warehouse.id) %]"[% IF warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
+ [%- END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Destination bin</translate>:</th>
+ <td><select id="bin_id" name="bin_id"></select></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Part Number</translate></th>
+ <td>
+ <input type="hidden" name="parts_id" id="parts_id" value="[% HTML.escape(parts_id) %]">
+ <input type="hidden" name="old_partnumber" id="old_partnumber" value="[% HTML.escape(partnumber) %]">
+ <input name="partnumber" size="30" value="[% HTML.escape(partnumber) %]">
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Part Description</translate></th>
+ <td>
+ <input name="description" size="30" value="[% HTML.escape(description) %]">
+ <input type="button" onclick="part_selection_window('partnumber', 'description', 'parts_id', 0, 'Form', 'no_services:click_button=update_button')" value="?">
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Charge number</translate></th>
+ <td><input name="chargenumber" size="30" value="[% HTML.escape(chargenumber) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Quantity</translate></th>
+ <td>
+ <input name="qty" size="10" value="[% HTML.escape(LxERP.format_amount(qty)) %]">
+ <select name="unit">
+ [%- FOREACH unit = UNITS %]<option[% IF unit.selected %] selected[% END %]>[% HTML.escape(unit.name) %]</option>[% END %]
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap><translate>Optional comment</translate></th>
+ <td><input name="comment" size="30" value="[% HTML.escape(comment) %]"></td>
+ </tr>
+
+ </table>
+ </p>
+
+ <p>
+ <input type="submit" class="submit" name="action" id="update_button" value="<translate>Update</translate>">
+ [%- IF parts_id %]
+ <input type="submit" class="submit" name="action" value="<translate>Stock</translate>">
+ [%- END %]
+ </p>
+ </form>
+
+</body>
+</html>