Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f275cac9

Von Bernd Bleßmann vor etwa 8 Jahren hinzugefügt

  • ID f275cac9ddfb00d05435e73fc85f0a6c016095b8
  • Vorgänger 7c0f439c
  • Nachfolger 419fa9c6

Auftrags-Controller: PriceSources

Unterschiede anzeigen:

templates/webpages/order/tabs/basic_data.html
145 145
                <th class="listheading" nowrap width="5" >[%- 'Qty'          | $T8 %] </th>
146 146
                <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
147 147
                <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
148
                <th class="listheading" nowrap width="5" >[%- 'Price Source' | $T8 %] </th>
148 149
                <th class="listheading" nowrap width="15">[%- 'Price'        | $T8 %] </th>
149 150
                <th class="listheading" nowrap width="5" >[%- 'Discount'     | $T8 %] </th>
150 151
                <th class="listheading" nowrap width="10">[%- 'Extended'     | $T8 %] </th>
......
272 273
  recalc_amounts_and_taxes();
273 274
}
274 275

  
276
function price_chooser_item_row(clicked) {
277
  var row = $(clicked).parents("tbody").first();
278
  var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
279

  
280
  var data = $('#order_form').serialize();
281
  data += '&action=Order/price_popup';
282
  data += '&item_id=' + item_id_dom.val();
283

  
284
  $.post("controller.pl", data, kivi.eval_json_result);
285
}
286

  
287
function update_price_source(item_id, source, descr, price_str) {
288
  var row = $('#item_' + item_id).parents("tbody").first();
289
  var source_elt = $(row).find('[name="order.orderitems[].active_price_source"]');
290
  var button_elt = $(row).find('[name="price_chooser_button"]');
291

  
292
  button_elt.val(button_elt.val().replace(/.*\|/, descr + " |"));
293
  source_elt.val(source);
294

  
295
  var editable_div_elt = $(row).find('[name="editable_price"]');
296
  var not_editable_div_elt = $(row).find('[name="not_editable_price"]');
297
  if ([%- AUTH.assert('edit_prices', 1) %] == 1 && source == '') {
298
    // editable
299
    $(editable_div_elt).show();
300
    $(not_editable_div_elt).hide();
301
    $(editable_div_elt).find(':input').prop("disabled", false);
302
    $(not_editable_div_elt).find(':input').prop("disabled", true);
303
  } else {
304
    // not editable
305
    $(editable_div_elt).hide();
306
    $(not_editable_div_elt).show();
307
    $(editable_div_elt).find(':input').prop("disabled", true);
308
    $(not_editable_div_elt).find(':input').prop("disabled", false);
309
  }
310

  
311
  if (price_str) {
312
    var price_elt = $(row).find('[name="order.orderitems[].sellprice_as_number"]');
313
    var html_elt  = $(row).find('[name="sellprice_text"]');
314
    price_elt.val(price_str);
315
    html_elt.html(price_str);
316
    recalc_amounts_and_taxes();
317
  }
318

  
319
  kivi.io.close_dialog();
320
}
321

  
322
function update_discount_source(item_id, source, descr, discount_str) {
323
  var row = $('#item_' + item_id).parents("tbody").first();
324
  var source_elt = $(row).find('[name="order.orderitems[].active_discount_source"]');
325
  var button_elt = $(row).find('[name="price_chooser_button"]');
326

  
327
  button_elt.val(button_elt.val().replace(/\|.*/, "| " + descr));
328
  source_elt.val(source);
329

  
330
  var editable_div_elt = $(row).find('[name="editable_discount"]');
331
  var not_editable_div_elt = $(row).find('[name="not_editable_discount"]');
332
  if ([%- AUTH.assert('edit_prices', 1) %] == 1 && source == '') {
333
    // editable
334
    $(editable_div_elt).show();
335
    $(not_editable_div_elt).hide();
336
    $(editable_div_elt).find(':input').prop("disabled", false);
337
    $(not_editable_div_elt).find(':input').prop("disabled", true);
338
  } else {
339
    // not editable
340
    $(editable_div_elt).hide();
341
    $(not_editable_div_elt).show();
342
    $(editable_div_elt).find(':input').prop("disabled", true);
343
    $(not_editable_div_elt).find(':input').prop("disabled", false);
344
  }
345

  
346
  if (discount_str) {
347
    var discount_elt = $(row).find('[name="order.orderitems[].discount_as_percent"]');
348
    var html_elt     = $(row).find('[name="discount_text"]');
349
    discount_elt.val(discount_str);
350
    html_elt.html(discount_str);
351
    recalc_amounts_and_taxes();
352
  }
353

  
354
  kivi.io.close_dialog();
355
}
356

  
275 357
function reformat_number(event) {
276 358
  $(event.target).val(kivi.format_amount(kivi.parse_amount($(event.target).val()), -2));
277 359
}
......
357 439

  
358 440
$(function(){
359 441
  $('#order_[%- cv_id %]').change(reload_cv_dependend_selections);
360
  $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) });
442
  [%- IF SELF.cv == 'customer' %]
443
    $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) });
444
  [%- ELSE %]
445
    $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.lastcost, -2)) });
446
  [%- END %]
361 447
  $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_description').val(o.description) });
448
  $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_unit').val(o.unit) });
362 449
  $('.add_item_input').keydown(function(event) {
363 450
    if(event.keyCode == 13) {
364 451
      event.preventDefault();

Auch abrufbar als: Unified diff