6 <div id="ui-tabs-basic-data">
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>
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',
25 style='width: 300px') %]</td>
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',
36 style='width: 300px') %]</td>
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', class='recalc') %]</td>
45 <th align="right">[% 'Shipping Point' | $T8 %]</th>
46 <td>[% L.input_tag('order.shippingpoint', SELF.order.shippingpoint, style='width: 300px') %]</td>
50 <th align="right">[% 'Ship via' | $T8 %]</th>
51 <td>[% L.input_tag('order.shipvia', SELF.order.shipvia, style='width: 300px') %]</td>
55 <th align="right">[% 'Transaction description' | $T8 %]</th>
56 <td>[% L.input_tag('order.transaction_description', SELF.order.transaction_description, style='width: 300px') %]</td>
60 <th align="right">[% 'Project Number' | $T8 %]</th>
61 <td>[% L.project_picker('order.globalproject_id', SELF.order.globalproject_id, style='width: 300px') %]</td>
71 <td colspan="2" align="center">
72 [%- IF SELF.order.id %]
73 <label for="order.delivered">[% 'Delivery Order(s) for full qty created' | $T8 %]</label>
74 [% L.yes_no_tag('order.delivered', SELF.order.delivered) %]
75 <label for="order.closed">[% 'Closed' | $T8 %]</label>
76 [% L.yes_no_tag('order.closed', SELF.order.closed) %]
82 <th align="right">[% 'Employee' | $T8 %]</th>
83 <td>[% L.select_tag('order.employee_id',
85 default=(SELF.order.employee_id ? SELF.order.employee_id : SELF.current_employee_id),
86 title_key='safe_name') %]</td>
89 [% IF SELF.cv == 'customer' %]
91 <th align="right">[% 'Salesman' | $T8 %]</th>
92 <td>[% L.select_tag('order.salesman_id',
94 default=(SELF.order.salesman_id ? SELF.order.salesman_id : SELF.current_employee_id),
95 title_key='safe_name') %]</td>
100 <th width="70%" align="right" nowrap>[% 'Order Number' | $T8 %]</th>
101 <td>[% L.input_tag('order.ordnumber', SELF.order.ordnumber, size = 11) %]</td>
105 <th width="70%" align="right" nowrap>[% 'Quotation Number' | $T8 %]</th>
106 <td>[% L.input_tag('order.quonumber', SELF.order.quonumber, size = 11) %]</td>
110 <th width="70%" align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th>
111 <td>[% L.input_tag('order.cusordnumber', SELF.order.cusordnumber, size = 11) %]</td>
115 <th width="70%" align="right" nowrap>[% 'Order Date' | $T8 %]</th>
116 <td>[% L.date_tag('order.transdate', SELF.order.transdate) %]</td>
120 <th width="70%" align="right" nowrap>[% 'Reqdate' | $T8 %]</th>
121 <td>[% L.date_tag('order.reqdate', SELF.order.reqdate) %]</td>
125 <th width="70%" align="right" nowrap>[% 'Insert Date' | $T8 %]</th>
126 <td>[% SELF.order.itime_as_date %]</td>
135 [%- PROCESS order/tabs/_item_input.html %]
141 <div id="row_table_scroll_id" style="overflow-y: auto; height: 25vh">
142 <table id="row_table_id" width="100%">
144 <tr class="listheading">
145 <th class="listheading" style='display:none'></th>
146 <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
147 <th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
148 <th class="listheading" nowrap width="15">[%- 'Partnumber' | $T8 %] </th>
149 <th class="listheading" nowrap >[%- 'Description' | $T8 %] </th>
150 <th class="listheading" nowrap width="5" >[%- 'Qty' | $T8 %] </th>
151 <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
152 <th class="listheading" nowrap width="5" >[%- 'Unit' | $T8 %] </th>
153 <th class="listheading" nowrap width="5" >[%- 'Price Source' | $T8 %] </th>
154 <th class="listheading" nowrap width="15">[%- 'Price' | $T8 %] </th>
155 <th class="listheading" nowrap width="5" >[%- 'Discount' | $T8 %] </th>
156 <th class="listheading" nowrap width="10">[%- 'Extended' | $T8 %] </th>
160 [%- FOREACH item = SELF.order.items_sorted %]
161 [%- PROCESS order/tabs/_row.html ITEM=item ID=item.id %]
174 <td colspan="100%" width="100%">
180 <th align="left">[% 'Notes' | $T8 %]</th>
181 <th align="left">[% 'Internal Notes' | $T8 %]</th>
185 [% L.textarea_tag('order.notes', SELF.order.notes, wrap="soft", style="width: 350px; height: 150px", class="texteditor") %]
188 [% L.textarea_tag('order.intnotes', SELF.order.intnotes, wrap="soft", style="width: 350px; height: 150px") %]
197 <th align="right">[% 'Payment Terms' | $T8 %]</th>
198 <td>[% L.select_tag('order.payment_id',
199 SELF.all_payment_terms,
200 default = SELF.order.payment_id,
202 title_key = 'description',
203 style = 'width: 250px') %]</td>
206 <th align="right">[% 'Delivery Terms' | $T8 %]</th>
207 <td>[% L.select_tag('order.delivery_term_id',
208 SELF.all_delivery_terms,
209 default = SELF.order.delivery_term_id,
211 title_key = 'description',
212 style = 'width: 250px') %]</td>
219 <tr id="taxincluded_row_id" [%- IF !SELF.taxes.size %]style="display:none"[%- END %]>
220 <td align=right colspan="2">
221 <label for="order.taxincluded"><b>[% 'Tax Included' | $T8 %]</b></label>
222 [% L.yes_no_tag('order.taxincluded', SELF.order.taxincluded, class='recalc') %]
226 <tr id="subtotal_row_id" [%- IF SELF.order.taxincluded %]style="display:none"[%- END %]>
227 <th align="right">[%- 'Subtotal' | $T8 %]</th>
229 [%- L.div_tag(SELF.order.netamount_as_number, id='netamount_id') %]
232 [%- FOREACH tax = SELF.taxes %]
233 [%- PROCESS order/tabs/_tax_row.html TAX=tax TAXINCLUDED=SELF.order.taxincluded %]
235 <tr id="amount_row_id">
236 <th align="right">[%- 'Total' | $T8 %]</th>
238 [%- L.div_tag(SELF.order.amount_as_number, id='amount_id') %]
254 [% L.sortable_element('#row_table_id') %]
256 <script type='text/javascript'>
257 function reload_cv_dependend_selections() {
258 var data = $('#order_form').serialize();
259 data += '&action=Order/customer_vendor_changed';
261 $.post("controller.pl", data, kivi.eval_json_result);
264 function add_item() {
265 if ($('#add_item_parts_id').val() == '') return;
266 if (!check_cv()) return;
268 var data = $('#order_form').serialize();
269 data += '&action=Order/add_item';
271 $.post("controller.pl", data, kivi.eval_json_result);
274 function delete_order_item_row(clicked) {
275 var row = $(clicked).parents("tbody").first();
278 recalc_amounts_and_taxes();
281 function price_chooser_item_row(clicked) {
282 var row = $(clicked).parents("tbody").first();
283 var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
285 var data = $('#order_form').serialize();
286 data += '&action=Order/price_popup';
287 data += '&item_id=' + item_id_dom.val();
289 $.post("controller.pl", data, kivi.eval_json_result);
292 function update_price_source(item_id, source, descr, price_str) {
293 var row = $('#item_' + item_id).parents("tbody").first();
294 var source_elt = $(row).find('[name="order.orderitems[].active_price_source"]');
295 var button_elt = $(row).find('[name="price_chooser_button"]');
297 button_elt.val(button_elt.val().replace(/.*\|/, descr + " |"));
298 source_elt.val(source);
300 var editable_div_elt = $(row).find('[name="editable_price"]');
301 var not_editable_div_elt = $(row).find('[name="not_editable_price"]');
302 if ([%- AUTH.assert('edit_prices', 1) %] == 1 && source == '') {
304 $(editable_div_elt).show();
305 $(not_editable_div_elt).hide();
306 $(editable_div_elt).find(':input').prop("disabled", false);
307 $(not_editable_div_elt).find(':input').prop("disabled", true);
310 $(editable_div_elt).hide();
311 $(not_editable_div_elt).show();
312 $(editable_div_elt).find(':input').prop("disabled", true);
313 $(not_editable_div_elt).find(':input').prop("disabled", false);
317 var price_elt = $(row).find('[name="order.orderitems[].sellprice_as_number"]');
318 var html_elt = $(row).find('[name="sellprice_text"]');
319 price_elt.val(price_str);
320 html_elt.html(price_str);
321 recalc_amounts_and_taxes();
324 kivi.io.close_dialog();
327 function update_discount_source(item_id, source, descr, discount_str) {
328 var row = $('#item_' + item_id).parents("tbody").first();
329 var source_elt = $(row).find('[name="order.orderitems[].active_discount_source"]');
330 var button_elt = $(row).find('[name="price_chooser_button"]');
332 button_elt.val(button_elt.val().replace(/\|.*/, "| " + descr));
333 source_elt.val(source);
335 var editable_div_elt = $(row).find('[name="editable_discount"]');
336 var not_editable_div_elt = $(row).find('[name="not_editable_discount"]');
337 if ([%- AUTH.assert('edit_prices', 1) %] == 1 && source == '') {
339 $(editable_div_elt).show();
340 $(not_editable_div_elt).hide();
341 $(editable_div_elt).find(':input').prop("disabled", false);
342 $(not_editable_div_elt).find(':input').prop("disabled", true);
345 $(editable_div_elt).hide();
346 $(not_editable_div_elt).show();
347 $(editable_div_elt).find(':input').prop("disabled", true);
348 $(not_editable_div_elt).find(':input').prop("disabled", false);
352 var discount_elt = $(row).find('[name="order.orderitems[].discount_as_percent"]');
353 var html_elt = $(row).find('[name="discount_text"]');
354 discount_elt.val(discount_str);
355 html_elt.html(discount_str);
356 recalc_amounts_and_taxes();
359 kivi.io.close_dialog();
362 function reformat_number(event) {
363 $(event.target).val(kivi.format_amount(kivi.parse_amount($(event.target).val()), -2));
366 function recalc_amounts_and_taxes() {
367 var data = $('#order_form').serialize();
368 data += '&action=Order/recalc_amounts_and_taxes';
370 $.post("controller.pl", data, kivi.eval_json_result);
373 function redisplay_linetotals(data) {
374 $('.row_entry [name="linetotal"]').each(function(idx, elt) {
375 $(elt).html(data[idx]);
379 function row_table_scroll_down() {
380 $('#row_table_scroll_id').scrollTop($('#row_table_scroll_id')[0].scrollHeight);
383 function row_set_keyboard_events_by_id(item_id) {
384 var row = $('#item_' + item_id).parents("tbody").first();
386 row_set_keyboard_events(row);
389 function row_set_keyboard_events(rows) {
390 $(rows).keydown(function(event) {
391 if(event.keyCode == 40 && event.shiftKey == true) {
393 event.preventDefault();
394 var row = $(event.target).parents(".row_entry").first();
395 $(row).children().not(':first').show();
398 if(event.keyCode == 38 && event.shiftKey == true) {
400 event.preventDefault();
401 var row = $(event.target).parents(".row_entry").first();
402 $(row).children().not(':first').hide();
407 $(rows).dblclick(function(event) {
408 event.preventDefault();
409 var row = $(event.target).parents(".row_entry").first();
410 $(row).children().not(':first').toggle();
417 function show_email_dialog(html) {
418 var id = 'jqueryui_popup_dialog';
419 var dialog_params = {
424 close: function(event, ui) {
425 email_dialog.remove();
429 $('#' + id).remove();
431 email_dialog = $('<div style="display:none" id="' + id + '"></div>').appendTo('body');
432 email_dialog.html(html);
433 email_dialog.dialog(dialog_params);
435 $('.cancel').click(close_email_dialog);
440 close_email_dialog = function() {
441 email_dialog.dialog("close");
446 $('#order_[%- cv_id %]').change(reload_cv_dependend_selections);
447 [%- IF SELF.cv == 'customer' %]
448 $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) });
450 $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.lastcost, -2)) });
452 $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_description').val(o.description) });
453 $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_unit').val(o.unit) });
454 $('.add_item_input').keydown(function(event) {
455 if(event.keyCode == 13) {
456 event.preventDefault();
461 row_set_keyboard_events($('.row_entry'));
462 $('.recalc').change(recalc_amounts_and_taxes);
463 $('.reformat_number').change(reformat_number);