Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 92e904d1

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 92e904d14909312a8e218cb61cf846b93a32e91e
  • Vorgänger ab7b0097
  • Nachfolger 35efaa4a

InvoiceItem: Hinzufügen der Felder für Konten und Steuer

Es werden die Wert von relink_accounts als Default genommen und der
Nutzer kann dies ändern. Es werden alle nötigen Steuerdaten in die Form
geschrieben.

Unterschiede anzeigen:

bin/mozilla/io.pl
54 54
use SL::File;
55 55
use SL::PriceSource;
56 56
use SL::Presenter::Part;
57
use SL::Presenter::Chart;
58
use SL::Presenter::Tag;
57 59
use SL::Util qw(trim);
58 60

  
59 61
use SL::DB::AuthUser;
......
171 173
    bin stock_in_out
172 174
  );
173 175
  my @row2_sort   = qw(
174
    serialnr projectnr reqdate subtotal recurring_billing_mode marge listprice lastcost onhand
176
    expense_chart tax inventory_chart serialnr projectnr reqdate subtotal recurring_billing_mode marge listprice lastcost onhand
175 177
  );
176 178
  # serialnr is important for delivery_orders
177 179
  if ($form->{type} eq 'sales_delivery_order') {
......
207 209
    lastcost      => {                 value => $locale->text('EK'),                   display => $show_marge, },
208 210
    onhand        => {                 value => $locale->text('On Hand'),              display => 1, },
209 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 },
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'
210 215
  );
211 216
  my @HEADER = map { $column_def{$_} } @header_sort;
212 217

  
......
398 403
      $column_data{stock_in_out} =  calculate_stock_in_out($i);
399 404
    }
400 405

  
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">
410
      <!--
411
      $(document).ready(function() {
412
        $("#expense_chart_id_' . $i . q'").on("set_item:ChartPicker", function(e, item) {
413
          kivi.io.update_tax_ids(this);
414
        });
415
      });
416
      -->
417
      </script>
418
      '; # change tax dropdown after change
419

  
420
    my $tax_value_title_sub = sub {
421
      my $item = shift;
422
      return [
423
        $item->{id},
424
        $item->{taxkey} . ' - ' . $item->{taxdescription} .' '. ($item->{rate} * 100) .' %',
425
      ];
426
    };
427

  
428
    my @taxes = ();
429
    if ($form->{"expense_chart_id_$i"}) {
430
      @taxes = IO->get_active_taxes_for_chart($form->{"expense_chart_id_$i"},
431
        $form->{"reqdate_$i"} // $form->{deliverydate} // $form->{transdate});
432
    }
433
    # tax_id_ is used in io.js->update_tax_ids
434
    $column_data{tax} = SL::Presenter::Tag::select_tag(
435
      "tax_id_$i", \@taxes, default => $form->{"tax_id_$i"},
436
      value_title_sub => $tax_value_title_sub,
437
      style => "width: 100px");
438

  
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

  
401 447
    $column_data{serialnr}  = qq|<input name="serialnumber_$i" size="15" value="$form->{"serialnumber_$i"}">|;
402 448
    $column_data{projectnr} = NTI($cgi->popup_menu(
403 449
      '-name' => "project_id_$i",
......
2291 2337

  
2292 2338
  $::locale->with_raw_io(\*STDOUT, sub { print $xml_content });
2293 2339
}
2340

  
2341
sub get_taxes_dropdown {
2342
  my $transdate         = $::form->{transdate}    ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;
2343
  my $deliverydate      = $::form->{deliverydate} ? DateTime->from_kivitendo($::form->{deliverydate}) : undef;
2344
  my $item_deliverydate = $::form->{item_deliverydate} ? DateTime->from_kivitendo($::form->{item_deliverydate}) : undef;
2345

  
2346
  my @taxes = IO->get_active_taxes_for_chart($::form->{chart_id},
2347
    $item_deliverydate // $deliverydate // $transdate);
2348
  my $html  = $::form->parse_html_template("ir/update_taxes", { TAXES => \@taxes });
2349

  
2350
  print $::form->ajax_response_header, $html;
2351
}
2352

  
2353
1;

Auch abrufbar als: Unified diff