Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 96f6aa8d

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID 96f6aa8d0faf231db82411407e5b0dea3f5698cb
  • Vorgänger 725a341d
  • Nachfolger 33db5e13

PurchaseInvoice: Auswahl der Warenbuchungsmethode pro Warenzeile

Bei Artikeln(type=parts) kann der Nutzer auswählen welche
Warenbuchungsmethode dieser haben will.

Unterschiede anzeigen:

SL/IR.pm
148 148
    $form->{"qty_$i"}  = $form->parse_amount($myconfig, $form->{"qty_$i"});
149 149
    $form->{"qty_$i"} *= -1 if $form->{storno};
150 150

  
151
    if ( $::instance_conf->get_inventory_system eq 'periodic') {
151
    if ( ($form->{"tax_chart_type_$i"} eq 'expense')
152
      || ($form->{"tax_chart_type_$i"} eq ''
153
          && $::instance_conf->get_inventory_system eq 'periodic')
154
    ) {
152 155
      # inventory account number is overwritten with expense account number, so
153 156
      # never book incoming to inventory account but always to expense account
154 157
      $form->{"inventory_accno_$i"} = $form->{"expense_accno_$i"}
bin/mozilla/io.pl
173 173
    bin stock_in_out
174 174
  );
175 175
  my @row2_sort   = qw(
176
    expense_chart tax inventory_chart serialnr projectnr reqdate subtotal recurring_billing_mode marge listprice lastcost onhand
176
    tax_chart tax serialnr projectnr reqdate subtotal recurring_billing_mode marge listprice lastcost onhand
177 177
  );
178 178
  # serialnr is important for delivery_orders
179 179
  if ($form->{type} eq 'sales_delivery_order') {
......
209 209
    lastcost      => {                 value => $locale->text('EK'),                   display => $show_marge, },
210 210
    onhand        => {                 value => $locale->text('On Hand'),              display => 1, },
211 211
    vendor_partnumber => { width => 8, value => $locale->text('Vendor Part Number'),   display => $is_delivery_order && $is_purchase, },
212
    expense_chart => {                 value => $locale->text('Expense Account'),      display => $is_purchase && $is_invoice },
212
    tax_chart     => {                 value => "",                                    display => $is_purchase && $is_invoice },
213 213
    tax           => {                 value => $locale->text('Tax'),                  display => $is_purchase && $is_invoice },
214
    inventory_chart => {               value => "",                                    display => $is_purchase && $is_invoice }, # only disply for type='part'
215 214
  );
216 215
  my @HEADER = map { $column_def{$_} } @header_sort;
217 216

  
......
403 402
      $column_data{stock_in_out} =  calculate_stock_in_out($i);
404 403
    }
405 404

  
406
    $column_data{expense_chart} = SL::Presenter::Chart::chart_picker(
407
      "expense_chart_id_$i", $form->{"expense_chart_id_$i"},
408
      type => "AP_amount", style => "width: 150px") .
409
      '<script type="text/javascript">
405
    # tax_chart
406
    my ($tax_chart_id, $chart_title, $chart_picker);
407
    if ($record_item && $record_item->part && ($record_item->part->type eq 'part')) {
408
      my $tax_chart_type = $form->{"tax_chart_type_$i"};
409
      $tax_chart_type ||=
410
        $::instance_conf->get_inventory_system eq 'periodic' ? 'expense'
411
                                                             : 'inventory';
412
      $tax_chart_id = $form->{"${tax_chart_type}_chart_id_$i"};
413

  
414
      $chart_title = SL::Presenter::Tag::select_tag("tax_chart_type_$i", [
415
          {value => 'expense',   title => $locale->text('Expense Account')},
416
          {value => 'inventory', title => $locale->text('Inventory Account')},
417
        ],
418
        value_key => 'value', title_key => 'title',
419
        default  => $tax_chart_type,
420
        onchange => "kivi.io.update_tax_chart_picker(this.value, $i)",
421
      );
422

  
423
      $chart_picker =
424
        SL::Presenter::Tag::html_tag('span',
425
          SL::Presenter::Chart::chart_picker(
426
            "expense_chart_id_$i", $form->{"expense_chart_id_$i"},
427
            type => "AP_amount", style => "width: 150px"),
428
          id => "expense_chart_span_$i",
429
          style => $tax_chart_type eq 'expense' ? '' : 'display:none',
430
        )
431
        .
432
        SL::Presenter::Tag::html_tag('span',
433
          SL::Presenter::Chart::chart_picker(
434
            "inventory_chart_id_$i", $form->{"inventory_chart_id_$i"},
435
            type => "IC", style => "width: 150px"),
436
          id => "inventory_chart_span_$i",
437
          style => $tax_chart_type eq 'inventory' ? '' : 'display:none',
438
        );
439
    } else {
440
      $tax_chart_id = $form->{"expense_chart_id_$i"};
441
      $chart_title = $locale->text('Expense Account');
442
      $chart_picker = SL::Presenter::Chart::chart_picker(
443
        "expense_chart_id_$i", $form->{"expense_chart_id_$i"},
444
        type => "AP_amount", style => "width: 150px");
445
    }
446
    # change tax dropdown after change
447
    my $js_set_on_select_item = '<script type="text/javascript">
410 448
      <!--
411 449
      $(document).ready(function() {
412
        $("#expense_chart_id_' . $i . q'").on("set_item:ChartPicker", function(e, item) {
450
        $("#expense_chart_id_' . $i . '").on("set_item:ChartPicker", function(e, item) {
451
          kivi.io.update_tax_ids(this);
452
        });
453
        $("#inventory_chart_id_' . $i . '").on("set_item:ChartPicker", function(e, item) {
413 454
          kivi.io.update_tax_ids(this);
414 455
        });
415 456
      });
416 457
      -->
417 458
      </script>
418
      '; # change tax dropdown after change
459
      ';
460
    $column_data{tax_chart} = SL::Presenter::Tag::html_tag('span',
461
      $chart_title . $chart_picker . $js_set_on_select_item);
419 462

  
420 463
    my $tax_value_title_sub = sub {
421 464
      my $item = shift;
......
427 470

  
428 471
    my @taxes = ();
429 472
    if ($form->{"expense_chart_id_$i"}) {
430
      @taxes = IO->get_active_taxes_for_chart($form->{"expense_chart_id_$i"},
473
      @taxes = IO->get_active_taxes_for_chart($tax_chart_id,
431 474
        $form->{"reqdate_$i"} // $form->{deliverydate} // $form->{transdate});
432 475
    }
433 476
    # tax_id_ is used in io.js->update_tax_ids
......
436 479
      value_title_sub => $tax_value_title_sub,
437 480
      style => "width: 100px");
438 481

  
439
    if ($record_item && $record_item->part && ($record_item->part->type eq 'part')) {
440
      $column_data{inventory_chart} =
441
      '<b>' . $locale->text('Inventory Account') . '<b> ' .
442
      SL::Presenter::Chart::chart_picker(
443
        "inventory_chart_id_$i", $form->{"inventory_chart_id_$i"},
444
        type => "IC", style => "width: 150px");
445
    }
446

  
447 482
    $column_data{serialnr}  = qq|<input name="serialnumber_$i" size="15" value="$form->{"serialnumber_$i"}">|;
448 483
    $column_data{projectnr} = NTI($cgi->popup_menu(
449 484
      '-name' => "project_id_$i",
......
887 922
                invoice_id converted_from_orderitems_id
888 923
                converted_from_delivery_order_items_id converted_from_invoice_id
889 924
                converted_from_reclamation_items_id recurring_billing_mode
890
                expense_chart_id tax_id inventory_chart_id
925
                expense_chart_id inventory_chart_id tax_id tax_chart_type
891 926
              );
892 927

  
893 928
  my $ic_cvar_configs = CVar->get_configs(module => 'IC');
js/kivi.io.js
66 66
    $('#update_button').click();
67 67
  }
68 68

  
69
  ns.update_tax_chart_picker = function(tax_chart_type, row_i) {
70
    $('#expense_chart_span_'   + row_i)[0].style.display = 'none';
71
    $('#inventory_chart_span_' + row_i)[0].style.display = 'none';
72

  
73
    let current_chart_picker_span = $('#' + tax_chart_type + '_chart_span_' + row_i)[0];
74
    current_chart_picker_span.style.display = 'inline';
75

  
76
    kivi.io.update_tax_ids($('#' + tax_chart_type + '_chart_id_' + row_i)[0]);
77
  }
78

  
69 79
  ns.update_tax_ids = function(obj) {
70 80
    var row = $(obj).attr('name').replace(/.*_/, '');
71 81

  

Auch abrufbar als: Unified diff