36b57b85c955da4c625956f676255bcdefa95ad1
[kivitendo-erp.git] / templates / webpages / order / tabs / basic_data.html
1 [%- USE T8 %]
2 [%- USE HTML %]
3 [%- USE LxERP %]
4 [%- USE L %]
5
6 <div id="ui-tabs-basic-data">
7   <table width="100%">
8     <tr valign="top">
9       <td>
10         <table width="100%">
11           <tr>
12             <th align="right">[% SELF.cv | $T8 %]</th>
13             [% SET cv_id = SELF.cv _ '_id' %]
14             <td>[% L.customer_vendor_picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]</td>
15           </tr>
16
17           <tr id='cp_row' [%- IF !SELF.order.${SELF.cv}.contacts.size %]style='display:none;'[%- END %]>
18             <th align="right">[% 'Contact Person' | $T8 %]</th>
19             <td>[% L.select_tag('order.cp_id',
20                                 SELF.order.${SELF.cv}.contacts,
21                                 default=SELF.order.cp_id,
22                                 title_key='full_name_dep',
23                                 value_key='cp_id',
24                                 with_empty=1,
25                                 style='width: 300px') %]</td>
26           </tr>
27
28           <tr id='shipto_row' [%- IF !SELF.order.${SELF.cv}.shipto.size %]style='display:none;'[%- END %]>
29             <th align="right">[% 'Shipping Address' | $T8 %]</th>
30             <td>[% L.select_tag('order.shipto_id',
31                                 SELF.order.${SELF.cv}.shipto,
32                                 default=SELF.order.shipto_id,
33                                 title_key='displayable_id',
34                                 value_key='shipto_id',
35                                 with_empty=1,
36                                 style='width: 300px') %]</td>
37           </tr>
38
39           <tr>
40             <th align="right">[% 'Steuersatz' | $T8 %]</th>
41             <td>[% L.select_tag('order.taxzone_id', SELF.all_taxzones, default=SELF.order.taxzone_id, title_key='description', style='width: 300px') %]</td>
42           </tr>
43
44           <tr>
45             <th align="right">[% 'Shipping Point' | $T8 %]</th>
46             <td>[% L.input_tag('order.shippingpoint', SELF.order.shippingpoint, style='width: 300px') %]</td>
47           </tr>
48
49           <tr>
50             <th align="right">[% 'Ship via' | $T8 %]</th>
51             <td>[% L.input_tag('order.shipvia', SELF.order.shipvia, style='width: 300px') %]</td>
52           </tr>
53
54           <tr>
55             <th align="right">[% 'Transaction description' | $T8 %]</th>
56             <td>[% L.input_tag('order.transaction_description', SELF.order.transaction_description, style='width: 300px') %]</td>
57           </tr>
58
59         </table>
60       </td>
61
62       <td align="right">
63         <table>
64
65           <tr>
66             <td colspan="2" align="center">
67               [%- IF SELF.order.closed %] [% 'Closed' | $T8 %] [%- ELSE %] [% 'Open' | $T8 %] [%- END %]
68             </td>
69           </tr>
70
71           <tr>
72             <th align="right">[% 'Employee' | $T8 %]</th>
73             <td>[% L.select_tag('order.employee_id',
74               SELF.all_employees,
75               default=(SELF.order.employee_id ? SELF.order.employee_id : SELF.current_employee_id),
76               title_key='safe_name') %]</td>
77           </tr>
78
79           <tr>
80             <th width="70%" align="right" nowrap>[% 'Order Number' | $T8 %]</th>
81             <td>[% L.input_tag('order.ordnumber', SELF.order.ordnumber, size = 11) %]</td>
82           </tr>
83
84           <tr>
85             <th width="70%" align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th>
86             <td>[% L.input_tag('order.cusordnumber', SELF.order.cusordnumber, size = 11) %]</td>
87           </tr>
88
89           <tr>
90             <th width="70%" align="right" nowrap>[% 'Order Date' | $T8 %]</th>
91             <td>[% L.date_tag('order.transdate', SELF.order.transdate) %]</td>
92           </tr>
93
94           <tr>
95             <th width="70%" align="right" nowrap>[% 'Project Number' | $T8 %]</th>
96             <td>[%- L.select_tag('order.globalproject_id', SELF.all_projects, default=SELF.order.globalproject_id, title_key='projectnumber', with_empty = 1) %]</td>
97           </tr>
98
99         </table>
100
101       </td>
102     </tr>
103   </table>
104
105   [%- PROCESS order/tabs/_item_input.html %]
106
107   <table width="100%">
108     <tr>
109       <td>
110
111         <div id="row_table_scroll_id" style="overflow-y: scroll; height: 500px;">
112           <table id="row_table_id" width="100%">
113             <thead>
114               <tr class="listheading">
115                 <th class="listheading" style='display:none'></th>
116                 <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
117                 <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
118                 <th class="listheading" nowrap width="15">[%- 'Partnumber'  | $T8 %] </th>
119                 <th class="listheading" nowrap           >[%- 'Description'  | $T8 %] </th>
120                 <th class="listheading" nowrap width="5" >[%- 'Qty'          | $T8 %] </th>
121                 <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
122                 <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
123                 <th class="listheading" nowrap width="15">[%- 'Price'        | $T8 %] </th>
124                 <th class="listheading" nowrap width="5" >[%- 'Discount'     | $T8 %] </th>
125                 <th class="listheading" nowrap width="10">[%- 'Extended'     | $T8 %] </th>
126               </tr>
127             </thead>
128
129             <tbody>
130               [%- FOREACH item = SELF.order.items_sorted %]
131                 [%- PROCESS order/tabs/_row.html ITEM=item %]
132               [%- END %]
133             </tbody>
134
135           </table>
136         </div>
137
138       </td>
139     </tr>
140
141     <tr>
142     </tr>
143
144     <tr>
145       <td align="right">
146         <table>
147           [%- IF NOT taxincluded %]
148           <tr>
149             <th align="right">[%- 'Subtotal' | $T8 %]</th>
150             <td align="right">
151               [%- L.div_tag(SELF.order.netamount_as_number, id='netamount_id') %]
152             </td>
153           </tr>
154           [%- END %]
155           [%- FOREACH tax = SELF.taxes %]
156             [%- PROCESS order/tabs/_tax_row.html TAX=tax %]
157           [%- END %]
158           <tr id="amount_row_id">
159             <th align="right">[%- 'Total' | $T8 %]</th>
160             <td align="right">
161               [%- L.div_tag(SELF.order.amount_as_number, id='amount_id') %]
162           </tr>
163         </table>
164       </td>
165     </tr>
166
167     <tr>
168       <td><hl></td>
169     </tr>
170
171   </table>
172
173 </div>
174
175
176 [% L.sortable_element('#row_table_id tbody') %]
177
178 <script type='text/javascript'>
179 function reload_cv_dependend_selections() {
180   $.post("controller.pl", { 'action': 'Order/customer_vendor_changed',
181                             'cv_id':  function(){ return $('#order_[%- cv_id%]').val() },
182                             'type':   function(){ return $('#type').val() },
183                           }, kivi.eval_json_result);
184 }
185
186 function add_item() {
187   var data = $('#order_form').serialize();
188   data += '&action=Order/add_item';
189   data += '&type=' + $('#type').val();
190
191   $.post("controller.pl", data, kivi.eval_json_result);
192 }
193
194 function delete_order_item_row(clicked) {
195   var row = $(clicked).parents("tr").first();
196   $(row).remove();
197
198   recalc_amounts_and_taxes()
199 }
200
201 function recalc_amounts_and_taxes() {
202   var data = $('#order_form').serialize();
203   data += '&action=Order/recalc_amounts_and_taxes';
204   data += '&type=' + $('#type').val();
205
206   $.post("controller.pl", data, kivi.eval_json_result);
207 }
208
209 function row_table_scroll_down() {
210   $('#row_table_scroll_id').scrollTop($('#row_table_scroll_id')[0].scrollHeight);
211 }
212
213 $(function(){
214   $('#order_[%- cv_id %]').change(reload_cv_dependend_selections);
215   $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) });
216   $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_description').val(o.description) });
217   $('.add_item_input').keydown(function(event) {
218     if(event.keyCode == 13) {
219       event.preventDefault();
220       add_item();
221       return false;
222     }
223   });
224 });
225
226 </script>