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