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