bc32cf8999ee1914b99ab2ed5c78a2c099174573
[kivitendo-erp.git] / templates / webpages / part / _assembly.html
1 [%- USE T8 %]
2 [%- USE HTML %]
3 [%- USE LxERP %]
4 [%- USE L %]
5 [%- USE P %]
6
7 <div id="assembly" name="assembly">
8
9 <h2>[% 'Assembly items' | $T8 %]</h2>
10
11 [% L.hidden_tag('assembly_id', SELF.part.id) %]
12
13 <table id="assembly_items">
14  <thead>
15    <tr class="listheading">
16      <th class="listheading" style='display:none'></th>
17      [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
18      <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
19      [% END %]
20      <th class="listheading" nowrap width="3" >[%- 'position'     | $T8 %] </th>
21      [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
22      <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
23      [% END %]
24      <th id="partnumber_header_id"  class="listheading" nowrap width="5"><a href='#' onClick='javascript:kivi.Part.reorder_items("partnumber")' >[%- 'Partnumber'  | $T8 %]</a></th>
25      <th class="listheading" nowrap width="5">[% 'Type' | $T8 %]</th>
26      <th id="partdescription_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Part.reorder_items("description")' >[%- 'Description' | $T8 %]</a></th>
27      <th id="qty_header_id"         class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Part.reorder_items("qty")'        >[%- 'Qty'         | $T8 %]</a></th>
28      <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
29      <th class="listheading" nowrap width="5" >[%- 'BOM'          | $T8 %] </th>
30      <th class="listheading" nowrap width="5" >[%- 'Line Total'   | $T8 %] </th>
31      <th id="sellprice_header_id"   class="listheading" nowrap width="10" ><a href='#' onClick='javascript:kivi.Part.reorder_items("sellprice")' >[%- 'Sellprice'       | $T8 %]</a></th>
32      <th id="lastcost_header_id"   class="listheading" nowrap width="10" ><a href='#' onClick='javascript:kivi.Part.reorder_items("lastcost")'   >[%- 'Lastcost'       | $T8 %]</a></th>
33      <th id="_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Part.reorder_items("partsgroup")'         >[%- 'Partsgroup'       | $T8 %]</a></th>
34    </tr>
35  </thead>
36 <tbody id="assembly_rows">
37   [% assembly_html %]
38 </tbody>
39 <tbody id="assembly_input">
40 <tr>
41  [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
42  <td></td>
43  <td></td>
44  <td align="right">[% 'Part' | $T8 %]:</td>
45  <td>[% P.part.picker('add_items[+].parts_id', '', style='width: 300px', multiple=1, id='assembly_picker', action={set_multi_items='kivi.Part.set_multi_assembly_items', commit_one='kivi.Part.add_assembly_item'}) %]</td>
46  <td>[%- L.button_tag("kivi.Part.add_assembly_item()", LxERP.t8("Add")) %]</td>
47  <td>[% L.button_tag('$("#assembly_picker").data("part_picker").open_dialog()', LxERP.t8('Add multiple items')) %]</td>
48  <td>[% L.hidden_tag('add_items[].qty_as_number', 1) %]</td>
49  [% ELSE %]
50  <td></td>
51  <td></td>
52  <td></td>
53  <td></td>
54  <td></td>
55  [% END %]
56  <td></td>
57  <td align="right">[% 'Totals' | $T8 %]:</td>
58  <td></td>
59  <td id="items_sellprice_sum" class="numeric">[%- LxERP.format_amount(items_sellprice_sum, 2, 0) %]</td>
60  <td id="items_lastcost_sum"  class="numeric">[%- LxERP.format_amount(items_lastcost_sum,  2, 0) %]</td>
61  <td></td>
62 </tr>
63 <tr>
64  <td></td>
65  <td></td>
66  <td></td>
67  <td></td>
68  <td></td>
69  <td></td>
70  <td></td>
71  <td></td>
72  <td align="right">[% 'Margepercent' | $T8 %]:</td>
73  <td></td>
74  <td class="numeric">
75  [% IF items_sellprice_sum > 0 %]
76    [%- LxERP.format_amount(100 - (items_lastcost_sum / items_sellprice_sum * 100), 2, 0) %]
77  [% END %]
78  </td>
79 </tr>
80 <tr>
81  <td></td>
82  <td></td>
83  <td></td>
84  <td></td>
85  <td></td>
86  <td></td>
87  <td></td>
88  <td></td>
89  <td align="right">[% 'Margetotal' | $T8 %]:</td>
90  <td></td>
91  <td id="items_sum_diff"      class="numeric">[%- LxERP.format_amount(items_sum_diff,      2, 0) %]</td>
92 </tr>
93 <tr>
94  [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
95  <td></td>
96  <td></td>
97  [% END %]
98  <td></td>
99  <td></td>
100  <td></td>
101  <td></td>
102  <td></td>
103  <td></td>
104  <td></td>
105  <td></td>
106  <td align="right">[% L.button_tag("kivi.Part.set_assembly_sellprice()", LxERP.t8("Set sellprice")) %]</td>
107  <td></td>
108 </tr>
109 </tbody>
110 </table>
111
112 [% L.sortable_element('#assembly_rows') %]
113
114 <div>
115 <p>
116 </p>
117 </div>
118
119
120 </div>
121
122 <script type="text/javascript">
123   $(function() {
124     $("#assembly").on( "focusout", ".recalc", function( event )  {
125       kivi.Part.assembly_recalc();
126     });
127
128     $('#assembly_rows').on('sortstop', function(event, ui) {
129       $('#assembly thead a img').remove();
130       kivi.Part.renumber_positions();
131     });
132   })
133 </script>