9 [% L.hidden_tag('assembly_id', SELF.part.id) %]
12 <div class="wrapper" style="overflow-y: auto; height:65vh;">
13 <table id="assembly_items" class="tbl-list">
14 <caption>[% 'Assembly items' | $T8 %]</caption>
17 <th style="display:none"></th>
18 [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
19 <th class="img"><img src="image/close.png" alt="[% LxERP.t8('delete item') %]"></th>
21 <th>[% 'position' | $T8 %]</th>
22 [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
23 <th style="img"><img src="image/updown.png" alt="[% LxERP.t8('reorder item') %]"></th>
25 <th id="partnumber_header_id"><a href="#" onclick="kivi.Part.reorder_items('partnumber')">[% 'Partnumber' | $T8 %]</a></th>
26 <th>[% 'Type' | $T8 %]</th>
27 <th id="partdescription_header_id"><a href="#" onclick="kivi.Part.reorder_items('description')">[% 'Description' | $T8 %]</a></th>
28 <th id="qty_header_id"><a href="#" onclick="kivi.Part.reorder_items('qty')">[% 'Qty' | $T8 %]</a></th>
29 <th>[% 'Unit' | $T8 %]</th>
30 <th class="right">[% 'BOM' | $T8 %]</th>
31 <th class="right">[% 'Line Total' | $T8 %]</th>
32 <th class="right">[% 'Price Factor' | $T8 %]</th>
33 <th id="sellprice_header_id"><a href="#" onclick="kivi.Part.reorder_items('sellprice')">[% 'Sellprice'| $T8 %]</a></th>
34 <th id="lastcost_header_id"><a href="#" onclick="kivi.Part.reorder_items('lastcost')">[% 'Lastcost' | $T8 %]</a></th>
35 <th id="_header_id"><a href="#" onclick="kivi.Part.reorder_items('partsgroup')">[% 'Partsgroup' | $T8 %]</a></th>
38 <tbody id="assembly_rows">
41 <tfoot id="assembly_input">
43 [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
46 <th>[% 'Part' | $T8 %]</th>
49 'add_items[+].parts_id',
54 action={set_multi_items='kivi.Part.set_multi_assembly_items', commit_one='kivi.Part.add_assembly_item'}
56 [% L.button_tag("kivi.Part.add_assembly_item()", LxERP.t8("Add")) %]
57 [% L.hidden_tag('add_items[].qty_as_number', 1) %]
65 <td colspan="3" class="right">[% #'Totals' | $T8 %][% #":" %]</td>
66 <td id="items_sellprice_sum" class="numeric">[% LxERP.format_amount(items_sellprice_sum, 2, 0) %]</td>
67 <td id="items_lastcost_sum" class="numeric">[% LxERP.format_amount(items_lastcost_sum, 2, 0) %]</td>
71 [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
76 <td align="right">[% 'Margepercent' | $T8 %]:</td>
78 <td id="items_sum_diff" class="numeric">
79 [% IF items_sellprice_sum > 0 %]
80 [%- LxERP.format_amount(100 - items_lastcost_sum / items_sellprice_sum * 100, 2, 0) %]
87 [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
92 <td align="right">[% 'Margetotal' | $T8 %]:</td>
94 <td id="items_sum_diff" class="numeric">[%- LxERP.format_amount(items_sum_diff, 2, 0) %]</td>
100 [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
104 <td colspan="4">[% L.button_tag('$("#assembly_picker").data("part_picker").open_dialog()', LxERP.t8('Add multiple items'), class="neutral") %]</td>
105 <!--<td></td> <td></td><td></td> -->
107 <td colspan="5" class="right">[% L.button_tag("kivi.Part.set_assembly_sellprice()", LxERP.t8("Set sellprice")) %]</td>
108 <td colspan="3"></td>
114 [% L.sortable_element('#assembly_rows') %]
116 <script type="text/javascript">
118 $("#assembly").on( "focusout", ".recalc", function( event ) {
119 kivi.Part.assembly_recalc();
122 $('#assembly_rows').on('sortstop', function(event, ui) {
123 $('#assembly thead a img').remove();
124 kivi.Part.renumber_positions();