]> wagnertech.de Git - mfinanz.git/blob - templates/design40_webpages/part/_assembly.html
date error in mapping
[mfinanz.git] / templates / design40_webpages / part / _assembly.html
1 [% USE T8 %]
2 [% USE HTML %]
3 [% USE LxERP %]
4 [% USE L %]
5 [% USE P %]
6
7 <div id="assembly">
8
9 [% L.hidden_tag('assembly_id', SELF.part.id) %]
10
11
12 <div class="wrapper" style="overflow-y: auto; height:65vh;">
13 <table id="assembly_items" class="tbl-list">
14   <caption>[% 'Assembly items' | $T8 %]</caption>
15   <thead>
16     <tr>
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>
20       [% END %]
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>
24       [% END %]
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>
36     </tr>
37   </thead>
38   <tbody id="assembly_rows">
39     [% assembly_html %]
40   </tbody>
41   <tfoot id="assembly_input">
42     <tr>
43       [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
44         <td></td>
45         <td></td>
46         <th>[% 'Part' | $T8 %]</th>
47         <td colspan="4">
48           [% P.part.picker(
49               'add_items[+].parts_id',
50               '',
51               class='wi-lightwide',
52               multiple='1',
53               id='assembly_picker',
54               action={set_multi_items='kivi.Part.set_multi_assembly_items', commit_one='kivi.Part.add_assembly_item'}
55           ) %]
56           [% L.button_tag("kivi.Part.add_assembly_item()", LxERP.t8("Add")) %]
57           [% L.hidden_tag('add_items[].qty_as_number', 1) %]
58         </td>
59       [% ELSE %]
60         <td></td>
61         <td></td>
62         <td colspan="3"></td>
63       [% END %]
64       <td></td>
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>
68       <td></td>
69     </tr>
70     <tr>
71       [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
72       <td colspan="9"></td>
73       [% ELSE %]
74       <td colspan="7"></td>
75       [% END %]
76       <td align="right">[% 'Margepercent' | $T8 %]:</td>
77       <td></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) %]
81       [% END %]
82       </td>
83       <td colspan="3"></td>
84     </tr>
85     <tr>
86     <tr>
87       [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
88       <td colspan="9"></td>
89       [% ELSE %]
90       <td colspan="7"></td>
91       [% END %]
92       <td align="right">[% 'Margetotal' | $T8 %]:</td>
93       <td></td>
94       <td id="items_sum_diff"      class="numeric">[%- LxERP.format_amount(items_sum_diff,      2, 0) %]</td>
95       <td colspan="3"></td>
96     </tr>
97     <tr>
98     </tr>
99     <tr class="blank">
100       [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %]
101         <td></td>
102         <td></td>
103       [% END %]
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> -->
106       <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>
109     </tr>
110   </tfoot>
111 </table>
112 </div>
113
114 [% L.sortable_element('#assembly_rows') %]
115
116 <script type="text/javascript">
117   $(function() {
118     $("#assembly").on( "focusout", ".recalc", function( event )  {
119       kivi.Part.assembly_recalc();
120     });
121
122     $('#assembly_rows').on('sortstop', function(event, ui) {
123       $('#assembly thead a img').remove();
124       kivi.Part.renumber_positions();
125     });
126   })
127 </script>
128
129 </div>