8233a7dc807162d9ad5104a3e6ae644a9cb61957
[kivitendo-erp.git] / templates / webpages / do / stock_in_form_master.html
1 [% USE HTML %][% USE LxERP %][% USE JavaScript %]<body[% UNLESS closed %] onload="on_load();"[% END %]>
2
3  [%- UNLESS closed %]
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 align="right" class="listheading"><translate>Qty</translate></th>
96      <th align="right" class="listheading"><translate>Unit</translate></th>
97     </tr>
98
99     [%- FOREACH row = STOCK_INFO %]
100     <tr [% IF row.stock_error %] class="tr_error"[% ELSE %]class="listrow[% loop.count % 2 %]"[% END %]>
101      <td>[% loop.count %]</td>
102
103      [%- IF closed %]
104
105      <td>[% HTML.escape(row.warehouse_description) %]</td>
106      <td>[% HTML.escape(row.bin_description) %]</td>
107      <td>[% HTML.escape(row.chargenumber) %]</td>
108      <td>[% HTML.escape(LxERP.format_amount(row.qty)) %]</td>
109      <td>[% HTML.escape(row.unit) %]</td>
110
111      [%- ELSE %]
112
113      <td>
114       <select name="warehouse_id_[% loop.count %]" onchange="warehouse_selected([% loop.count %], this.selectedIndex)">
115        [%- FOREACH wh = WAREHOUSES %]
116        <option value="[% HTML.escape(wh.id) %]"[% IF wh.id == row.warehouse_id %] selected[% END %]>[% HTML.escape(wh.description) %]</option>
117        [%- END %]
118       </select>
119      </td>
120
121      <td><select name="bin_id_[% loop.count %]" id="bin_id_[% loop.count %]"></select></td>
122      <td><input name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]"></td>
123      <td><input name="qty_[% loop.count %]" size="12" value="[% HTML.escape(LxERP.format_amount(row.qty)) %]"></td>
124
125      <td>
126       <select name="unit_[% loop.count %]">
127        [%- FOREACH unit = UNITS %]
128        <option[% IF unit.name == row.unit %] selected[% END %]>[% HTML.escape(unit.name) %]</option>
129        [%- END %]
130       </select>
131      </td>
132
133      [%- END %]
134     </tr>
135
136     [%- END %]
137    </table>
138   </p>
139
140   <hr size="3" noshade>
141
142   <p>
143    [%- IF closed %]
144    <button type="button" class="submit" name="action" onclick="window.close()"><translate>Close Window</translate></button>
145    [%- ELSE %]
146    <input class="submit" type="submit" name="action" value="<translate>Update</translate>">
147    <input class="submit" type="submit" name="action" value="<translate>Continue</translate>">
148    [%- END %]
149   </p>
150  </form>
151
152 </body>
153 </html>
154