</html> entfernen
[kivitendo-erp.git] / templates / webpages / do / stock_in_form.html
1 [%- USE T8 %]
2 [%- USE L %]
3 [%- USE HTML %][%- USE LxERP %][%- USE JavaScript %]
4 <body[%- UNLESS delivered %] onload="on_load();"[%- END %]>
5
6  [%- UNLESS delivered %]
7  <script type="text/javascript">
8   <!--
9       warehouses = new Array();
10       [% USE WAREHOUSES_it = Iterator(WAREHOUSES) %][% FOREACH wh = WAREHOUSES_it %]
11       warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
12       [% USE BINS_it = Iterator(wh.BINS) %][% FOREACH bin = BINS_it %]warehouses[[% WAREHOUSES_it.count - 1 %]][[% BINS_it.count - 1 %]] = ["[% JavaScript.escape(bin.description) %]", "[% JavaScript.escape(bin.id) %]"];
13       [% END %]
14       [% END %]
15
16       function warehouse_selected(row, index, initial_bin_index) {
17         var cname = "bin_id_" + row;
18         var control = document.getElementById(cname);
19
20         for (var i = control.options.length - 1; i >= 0; i--) {
21           control.options[i] = null;
22         }
23
24         for (i = 0; i < warehouses[index].length; i++) {
25           control.options[i] = new Option(warehouses[index][i][0], warehouses[index][i][1]);
26         }
27
28         if (!initial_bin_index)
29           initial_bin_index = 0;
30         control.options[initial_bin_index].selected = true;
31       }
32
33       function on_load() {
34         [%- USE STOCK_INFO_it = Iterator(STOCK_INFO) %][%- FOREACH si = STOCK_INFO_it %]
35           // new si for wh [% si.warehouse_id %] bin [% si.bin_id %]
36           [%- SET warehouse_selected = '0' %]
37           [%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH wh = WAREHOUSES_it %]
38             // wh [% wh.id %]
39             [%- USE BINS_it = Iterator(wh.BINS) %][%- FOREACH bin = BINS_it %]
40               // bin [% bin.id %]
41               [%- IF bin.id == si.bin_id %]
42                 warehouse_selected([% STOCK_INFO_it.count %], [% WAREHOUSES_it.count - 1 %], [% BINS_it.count - 1%]);
43                 [%- SET warehouse_selected = '1' %]
44               [%- END %]
45             [%- END %]
46           [%- END %]
47           [%- UNLESS warehouse_selected %]
48           warehouse_selected([% STOCK_INFO_it.count %], 0);
49           [%- END %]
50         [%- END %]
51       }
52     -->
53  </script>
54  [%- END %]
55
56  <form method="post" action="do.pl" name="Form">
57
58   <div class="listtop">[% title %]</div>
59
60   [%- IF ERRORS && ERRORS.size %]
61   <p><font color="#ff0000">[% ERRORS.join('<br>') %]</font></p>
62   [%- END %]
63
64   <p>
65    <table>
66     <tr>
67      <td>[% 'Part Number' | $T8 %]</td>
68      <td>[% HTML.escape(PART_INFO.partnumber) %]</td>
69     </tr>
70     <tr>
71      <td>[% 'Description' | $T8 %]</td>
72      <td>[% HTML.escape(PART_INFO.description) %]</td>
73     </tr>
74     <tr>
75      <td>[% 'Qty according to delivery order' | $T8 %]</td>
76      <td>[% HTML.escape(do_qty) %] [% HTML.escape(do_unit) %]</td>
77     </tr>
78    </table>
79   </p>
80
81   <input type="hidden" name="nextsub"        value="set_stock_in">
82   <input type="hidden" name="update_nextsub" value="update_stock_in">
83   <input type="hidden" name="rowcount"       value="[% HTML.escape(STOCK_INFO.size) %]">
84   <input type="hidden" name="in_out"         value="in">
85   <input type="hidden" name="parts_id"       value="[% HTML.escape(parts_id) %]">
86   <input type="hidden" name="partunit"       value="[% HTML.escape(PART_INFO.unit) %]">
87   <input type="hidden" name="do_qty"         value="[% HTML.escape(do_qty) %]">
88   <input type="hidden" name="do_unit"        value="[% HTML.escape(do_unit) %]">
89   <input type="hidden" name="row"            value="[% HTML.escape(row) %]">
90
91   <p>
92    <table>
93     <tr class="listheading">
94      <th class="listheading">&nbsp;</th>
95      <th class="listheading">[% 'Warehouse' | $T8 %]</th>
96      <th class="listheading">[% 'Bin' | $T8 %]</th>
97      <th class="listheading">[% 'Charge Number' | $T8 %]</th>
98      [% IF conf_show_best_before %]
99      <th class="listheading">[% 'Best Before' | $T8 %]</th>
100      [% END %]
101      <th align="right" class="listheading">[% 'Qty' | $T8 %]</th>
102      <th align="right" class="listheading">[% 'Unit' | $T8 %]</th>
103     </tr>
104
105     [%- FOREACH row = STOCK_INFO %]
106     <tr [% IF row.stock_error %] class="tr_error"[% ELSE %]class="listrow[% loop.count % 2 %]"[% END %]>
107      <td>[% loop.count %]</td>
108
109      [%- IF delivered %]
110
111      <td>[% HTML.escape(row.warehouse_description) %]</td>
112      <td>[% HTML.escape(row.bin_description) %]</td>
113      <td>[% HTML.escape(row.chargenumber) %]</td>
114      [% IF conf_show_best_before %]
115      <td>[% HTML.escape(row.bestbefore) %]</td>
116      [% END %]
117      <td>[% HTML.escape(LxERP.format_amount(row.qty)) %]</td>
118      <td>[% HTML.escape(row.unit) %]</td>
119
120      [%- ELSE %]
121
122      <td>
123       <select name="warehouse_id_[% loop.count %]" onchange="warehouse_selected([% loop.count %], this.selectedIndex)">
124        [%- FOREACH wh = WAREHOUSES %]
125        <option value="[% HTML.escape(wh.id) %]"[% IF wh.id == row.warehouse_id %] selected[% END %]>[% HTML.escape(wh.description) %]</option>
126        [%- END %]
127       </select>
128      </td>
129
130      <td><select name="bin_id_[% loop.count %]" id="bin_id_[% loop.count %]"></select></td>
131      <td><input name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]"></td>
132      [% IF conf_show_best_before %]
133      <td>
134        [% L.date_tag('bestbefore_'_ loop.count, row.bestbefore) %]
135      </td>
136      [% END %]
137      <td><input name="qty_[% loop.count %]" size="12" value="[% HTML.escape(LxERP.format_amount(row.qty)) %]"></td>
138
139      <td>
140       <select name="unit_[% loop.count %]">
141        [%- FOREACH unit = UNITS %]
142        <option[% IF unit.selected %] selected[% END %]>[% HTML.escape(unit.name) %]</option>
143        [%- END %]
144       </select>
145      </td>
146
147      [%- END %]
148     </tr>
149
150     [%- END %]
151    </table>
152   </p>
153
154   <hr size="3" noshade>
155
156   <p>
157    [%- IF delivered %]
158    <button type="button" class="submit" name="action" onclick="window.close()">[% 'Close Window' | $T8 %]</button>
159    [%- ELSE %]
160    <input class="submit" type="submit" name="action" value="[% 'Update' | $T8 %]">
161    <input class="submit" type="submit" name="action" value="[% 'Continue' | $T8 %]">
162    [%- END %]
163   </p>
164  </form>
165 </body>
166