Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 612d23d1

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

  • ID 612d23d1bf4615b77a18c3f9e791e3f8ff75c38e
  • Vorgänger 148723c3
  • Nachfolger 682e6d14

PTC: zur Margenberechnung die Nettozeilensumme nehmen.

So ist der Verhalten in den anderen (alten) Masken. Sonst ergeben sich
unterschiedliche Werte in den verschiedenen Masken, wenn
"Steuer im Preis inbegriffen" gewählt ist.

Unterschiede anzeigen:

SL/DB/Helper/PriceTaxCalculator.pm
109 109

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

  
112
  my $linetotal_cost = 0;
113

  
114
  if (!$linetotal) {
115
    $item->marge_total(  0);
116
    $item->marge_percent(0);
117

  
118
  } else {
119
    my $lastcost       = !(($item->lastcost // 0) * 1) ? ($part->lastcost || 0) : $item->lastcost;
120
    $linetotal_cost    = _round($lastcost * $item->qty / $item->marge_price_factor, 2);
121

  
122
    $item->marge_total(  $linetotal - $linetotal_cost);
123
    $item->marge_percent($item->marge_total * 100 / $linetotal);
124

  
125
    $self->marge_total(  $self->marge_total + $item->marge_total);
126
    $data->{lastcost_total} += $linetotal_cost;
127
  }
128

  
129 112
  my $taxkey     = $part->get_taxkey(date => $self->transdate, is_sales => $data->{is_sales}, taxzone => $self->taxzone_id);
130 113
  my $tax_rate   = $taxkey->tax->rate;
131 114
  my $tax_amount = undef;
......
150 133
  $data->{amounts}->{ $chart->id }->{amount}  += $linetotal;
151 134
  $data->{amounts}->{ $chart->id }->{amount}  -= $tax_amount if $self->taxincluded;
152 135

  
136
  my $linetotal_cost = 0;
137

  
138
  if (!$linetotal) {
139
    $item->marge_total(  0);
140
    $item->marge_percent(0);
141

  
142
  } else {
143
    my $lastcost       = !(($item->lastcost // 0) * 1) ? ($part->lastcost || 0) : $item->lastcost;
144
    $linetotal_cost    = _round($lastcost * $item->qty / $item->marge_price_factor, 2);
145
    my $linetotal_net  = $self->taxincluded ? $linetotal - $tax_amount : $linetotal;
146

  
147
    $item->marge_total(  $linetotal_net - $linetotal_cost);
148
    $item->marge_percent($item->marge_total * 100 / $linetotal_net);
149

  
150
    $self->marge_total(  $self->marge_total + $item->marge_total);
151
    $data->{lastcost_total} += $linetotal_cost;
152
  }
153

  
153 154
  push @{ $data->{assembly_items} }, [];
154 155
  if ($part->is_assembly) {
155 156
    _calculate_assembly_item($self, $data, $part, $item->base_qty, $item_unit->convert_to(1, $part_unit));

Auch abrufbar als: Unified diff