--- /dev/null
+[%- USE HTML %][%- USE L -%][%- USE P -%][%- USE LxERP -%][%- USE T8 -%]
+
+[%- SET dec = 2 %]
+[%- SET show_warehouse_subtotals = 1 %]
+
+<div id="stock_levels">
+
+<h3>[% 'Stock levels' | $T8 %]</h3>
+
+[%- IF SELF.stock_amounts.size %]
+<a href="wh.pl?action=report&partnumber=[% HTML.escape(SELF.part.partnumber) %]">[% 'Stock levels' | $T8 %]</a>:
+<table>
+ <thead>
+ <tr class='listheading'>
+ <th>[% 'Warehouse' | $T8 %]</th>
+ <th>[% 'Bin' | $T8 %]</th>
+ <th>[% 'Qty' | $T8 %]</th>
+ <th>[% 'Unit' | $T8 %]</th>
+ <th>[% 'Stock value' | $T8 %]</th>
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH stock = SELF.stock_amounts %]
+ <tr class='listrow'>
+ <td >[% HTML.escape(stock.warehouse_description) %]</td>
+ <td >[% IF stock.order_link %]<a target="_blank" href="[% stock.order_link %]">[% END %]
+ [% HTML.escape(stock.bin_description) %]
+ [% IF stock.order_link %]</a>[% END %]
+ </td>
+ <td class='numeric'>[% LxERP.format_amount(stock.qty, dec) %]</td>
+ <td >[% HTML.escape(stock.unit) %]</td>
+ <td class='numeric'>[% LxERP.format_amount(stock.stock_value, 2) %]</td>
+ </tr>
+ [% IF show_warehouse_subtotals AND stock.wh_lead != stock.warehouse_description %]
+ <tr class='listheading'>
+ <th >[% HTML.escape(stock.warehouse_description) %]</th>
+ <td></td>
+ <td class='numeric bold'>[% LxERP.format_amount(stock.wh_run_qty, dec) %]</td>
+ <td></td>
+ <td class='numeric bold'>[% LxERP.format_amount(stock.wh_run_stock_value, dec) %]</td>
+ </tr>
+ [% END %]
+ [% IF loop.last %]
+ <tr class='listheading'>
+ <th>[% 'Total' | $T8 %]</th>
+ <td></td>
+ <td class='numeric bold'>[% LxERP.format_amount(stock.run_qty, dec) %]</td>
+ <td></td>
+ <td class='numeric bold'>[% LxERP.format_amount(stock.run_stock_value, dec) %]</td>
+ </tr>
+ [% END %]
+ [% END %]
+ </tbody>
+</table>
+[% ELSE %]
+ <p>[% 'No transactions yet.' | $T8 %]</p>
+[% END %]
+</div>
+
+[% IF AUTH.assert('warehouse_management', 1) %]
+<div>
+<h3>[% 'Journal of Last 10 Transfers' | $T8 %]</h3>
+<a href="wh.pl?action=journal&partnumber=[% HTML.escape(SELF.part.partnumber) %]">[% 'WHJournal' | $T8 %]</a>:
+[%- IF SELF.journal.size %]
+<table>
+ <tr class='listheading'>
+ <th>[% 'Date' | $T8 %]</th>
+ <th>[% 'Trans Type' | $T8 %]</th>
+ <th>[% 'Warehouse From' | $T8 %]</th>
+ <th>[% 'Qty' | $T8 %]</th>
+ <th>[% 'Unit' | $T8 %]</th>
+ <th>[% 'Warehouse To' | $T8 %]</th>
+ <th>[% 'Charge Number' | $T8 %]</th>
+ <th>[% 'Comment' | $T8 %]</th>
+ </tr>
+[% FOREACH row = SELF.journal %]
+ <tr class='listrow'>
+ <td>[% row.base.itime_as_date %]</td>
+ <td>[% row.base.trans_type.description | $T8 %]</td>
+ <td>[% row.out ? row.out.bin.full_description : '-' | html %]</td>
+ <td class='numeric'>[% row.in ? row.in.qty_as_number : LxERP.format_amount(-1 * row.out.qty, 2) %]</td>
+ <td>[% row.base.part.unit | html %]</td>
+ <td>[% row.in ? row.in.bin.full_description : '-' | html %]</td>
+ <td>[% row.base.chargenumber | html %]</td>
+ <td>[% row.base.comment | html %]</td>
+ </tr>
+[% END %]
+</table>
+[%- ELSE %]
+<p>[% 'No transactions yet.' | $T8 %]</p>
+[%- END %]
+</div>
+[% END # assert warehouse_management %]