Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fa5d2a24

Von Bernd Bleßmann vor mehr als 5 Jahren hinzugefügt

  • ID fa5d2a24fc338e4c50951bbf3946b2b9a9f99ec2
  • Vorgänger dd75973a
  • Nachfolger 36bdd487

PTC: Kosmetik/Kommentare

Unterschiede anzeigen:

SL/DB/Helper/PriceTaxCalculator.pm
89 89
  my $item_unit  = $data->{units_by_name}->{ $item->unit };
90 90

  
91 91
  croak("Undefined unit " . $part->unit) if !$part_unit;
92
  croak("Undefined unit " . $item->unit)       if !$item_unit;
92
  croak("Undefined unit " . $item->unit) if !$item_unit;
93 93

  
94 94
  $item->base_qty($item_unit->convert_to($item->qty, $part_unit));
95 95
  $item->fxsellprice($item->sellprice) if $data->{is_invoice};
96 96

  
97 97
  my $num_dec   = max 2, _num_decimal_places($item->sellprice);
98
  # my $discount  = _round($item->sellprice * ($item->discount || 0), $num_dec);
99
  # my $sellprice; # = _round($item->sellprice - $discount,           $num_dec);
100
  my $sellprice = $item->sellprice; # don't include rounded discount into sellprice
98

  
99
  # don't include rounded discount into sellprice
101 100
  # any time the sellprice is multiplied with qty discount has to be considered as part of the multiplication
101
  my $sellprice = $item->sellprice;
102 102

  
103 103
  $item->price_factor(      ! $item->price_factor_obj   ? 1 : ($item->price_factor_obj->factor   || 1));
104 104
  $item->marge_price_factor(! $part->price_factor ? 1 : ($part->price_factor->factor || 1));
105
  my $linetotal = _round($sellprice * (1-$item->discount) * $item->qty / $item->price_factor, 2) * $data->{exchangerate};
106
  $linetotal    = _round($linetotal,                                    2);
105
  my $linetotal = _round($sellprice * (1 - $item->discount) * $item->qty / $item->price_factor, 2) * $data->{exchangerate};
106
  $linetotal    = _round($linetotal,                                                            2);
107 107

  
108
  $data->{invoicediff} += $sellprice * (1-$item->discount) * $item->qty * $data->{exchangerate} / $item->price_factor - $linetotal if $self->taxincluded;
108
  $data->{invoicediff} += $sellprice * (1 - $item->discount) * $item->qty * $data->{exchangerate} / $item->price_factor - $linetotal if $self->taxincluded;
109 109

  
110 110
  my $linetotal_cost = 0;
111 111

  
......
143 143
    die "tax_amount != 0 but no chart_id for taxkey " . $taxkey->id . " tax " . $taxkey->tax->id;
144 144
  }
145 145

  
146
  $self->netamount($self->netamount + $sellprice * (1-$item->discount) * $item->qty / $item->price_factor);
146
  $self->netamount($self->netamount + $sellprice * (1 - $item->discount) * $item->qty / $item->price_factor);
147 147

  
148 148
  my $chart = $part->get_chart(type => $data->{is_sales} ? 'income' : 'expense', taxzone => $self->taxzone_id);
149 149
  $data->{amounts}->{ $chart->id }           ||= { taxkey => $taxkey->taxkey_id, tax_id => $taxkey->tax_id, amount => 0 };
......
246 246

  
247 247
    next unless $qty;
248 248

  
249
    my $linetotal = _round(($entry->sellprice * (1-$entry->discount) * $qty) / $base_factor, 2);
249
    my $linetotal = _round(($entry->sellprice * (1 - $entry->discount) * $qty) / $base_factor, 2);
250 250

  
251 251
    $data->{amounts_cogs}->{ $expense_income_chart->id } -= $linetotal;
252 252
    $data->{amounts_cogs}->{ $inventory_chart->id      } += $linetotal;

Auch abrufbar als: Unified diff