Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fb742b35

Von Sven Schöling vor etwa 10 Jahren hinzugefügt

  • ID fb742b355ca83bb1d7d9318faa500265f27fde3b
  • Vorgänger 560d7292
  • Nachfolger b98b8e3f

FlattenToForm: Rabatte richtig formatieren

Unterschiede anzeigen:

SL/DB/Helper/FlattenToForm.pm
54 54
  my $idx = 0;
55 55
  my $format_amounts = $params{format_amounts} ? 1 : 0;
56 56
  my $format_notnull = $params{format_amounts} ? 2 : 0;
57
  my $format_percent = $params{format_amounts} ? 3 : 0;
57 58
  foreach my $item (@{ $self->items_sorted }) {
58 59
    next if _has($item, 'assemblyitem');
59 60

  
......
65 66
    _copy($item,          $form, '',        "_${idx}", 0,               qw(description project_id ship serialnumber pricegroup_id ordnumber donumber cusordnumber unit
66 67
                                                                           subtotal longdescription price_factor_id marge_price_factor approved_sellprice reqdate transdate));
67 68
    _copy($item,          $form, '',        "_${idx}", $format_amounts, qw(qty sellprice marge_total marge_percent lastcost));
68
    _copy($item,          $form, '',        "_${idx}", $format_notnull, qw(discount));
69
    _copy($item,          $form, '',        "_${idx}", $format_percent, qw(discount));
69 70
    _copy($item->project, $form, 'project', "_${idx}", 0,               qw(number description)) if _has($item, 'project_id');
70 71

  
71 72
    _copy_custom_variables($item, $form, 'ic_cvar_', "_${idx}");
......
86 87

  
87 88
  @columns = grep { $src->can($_) } @columns;
88 89

  
89
  map { $form->{"${prefix}${_}${postfix}"} = ref($src->$_) eq 'DateTime' ? $src->$_->to_lxoffice : $src->$_            } @columns if !$format_amounts;
90
  map { $form->{"${prefix}${_}${postfix}"} =                $::form->format_amount(\%::myconfig, $src->$_ * 1, 2)      } @columns if  $format_amounts == 1;
91
  map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) : 0  } @columns if  $format_amounts == 2;
90
  map { $form->{"${prefix}${_}${postfix}"} = ref($src->$_) eq 'DateTime' ? $src->$_->to_lxoffice : $src->$_             } @columns if !$format_amounts;
91
  map { $form->{"${prefix}${_}${postfix}"} =                $::form->format_amount(\%::myconfig, $src->$_ * 1, 2)       } @columns if  $format_amounts == 1;
92
  map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) : 0   } @columns if  $format_amounts == 2;
93
  map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 100, 2) : 0 } @columns if  $format_amounts == 3;
92 94

  
93 95
  return $src;
94 96
}

Auch abrufbar als: Unified diff