[%- USE STOCK_INFO_it = Iterator(STOCK_INFO) %][%- FOREACH si = STOCK_INFO_it %]
// new si for wh [% si.warehouse_id %] bin [% si.bin_id %]
[%- SET warehouse_selected = '0' %]
[%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH wh = WAREHOUSES_it %]
// wh [% wh.id %]
[%- USE STOCK_INFO_it = Iterator(STOCK_INFO) %][%- FOREACH si = STOCK_INFO_it %]
// new si for wh [% si.warehouse_id %] bin [% si.bin_id %]
[%- SET warehouse_selected = '0' %]
[%- USE WAREHOUSES_it = Iterator(WAREHOUSES) %][%- FOREACH wh = WAREHOUSES_it %]
// wh [% wh.id %]
[%- IF bin.id == si.bin_id %]
warehouse_selected([% STOCK_INFO_it.count %], [% WAREHOUSES_it.count - 1 %], [% BINS_it.count - 1%]);
[%- SET warehouse_selected = '1' %]
[%- IF bin.id == si.bin_id %]
warehouse_selected([% STOCK_INFO_it.count %], [% WAREHOUSES_it.count - 1 %], [% BINS_it.count - 1%]);
[%- SET warehouse_selected = '1' %]
<th class="listheading">[% 'Warehouse' | $T8 %]</th>
<th class="listheading">[% 'Bin' | $T8 %]</th>
<th class="listheading">[% 'Charge Number' | $T8 %]</th>
<th class="listheading">[% 'Warehouse' | $T8 %]</th>
<th class="listheading">[% 'Bin' | $T8 %]</th>
<th class="listheading">[% 'Charge Number' | $T8 %]</th>
<th class="listheading">[% 'Best Before' | $T8 %]</th>
[% END %]
<th align="right" class="listheading">[% 'Qty' | $T8 %]</th>
<th class="listheading">[% 'Best Before' | $T8 %]</th>
[% END %]
<th align="right" class="listheading">[% 'Qty' | $T8 %]</th>
<td>[% HTML.escape(row.warehouse_description) %]</td>
<td>[% HTML.escape(row.bin_description) %]</td>
<td>[% HTML.escape(row.chargenumber) %]</td>
<td>[% HTML.escape(row.warehouse_description) %]</td>
<td>[% HTML.escape(row.bin_description) %]</td>
<td>[% HTML.escape(row.chargenumber) %]</td>
<td>
<select name="warehouse_id_[% loop.count %]" onchange="warehouse_selected([% loop.count %], this.selectedIndex)">
[%- FOREACH wh = WAREHOUSES %]
<td>
<select name="warehouse_id_[% loop.count %]" onchange="warehouse_selected([% loop.count %], this.selectedIndex)">
[%- FOREACH wh = WAREHOUSES %]
[%- END %]
</select>
</td>
<td><select name="bin_id_[% loop.count %]" id="bin_id_[% loop.count %]"></select></td>
<td><input name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]"></td>
[%- END %]
</select>
</td>
<td><select name="bin_id_[% loop.count %]" id="bin_id_[% loop.count %]"></select></td>
<td><input name="chargenumber_[% loop.count %]" value="[% HTML.escape(row.chargenumber) %]"></td>