Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6a41eac6

Von Sven Schöling vor fast 15 Jahren hinzugefügt

  • ID 6a41eac6bb67939252f80f2a4ccb95609e7cdbdc
  • Vorgänger 98ee21ed
  • Nachfolger e9e28dd2

Margenberechnung angepasst.

Dank an Uwe Konrad für den Patch.
Im Gegensatz zur Vorlage wird hier der Preisfaktor aus den Stammdaten
nicht ignoriert, ergo dürften immernoch Seiteneffekte mit Preisgruppen
auftreten. Die werden gleich separat gefixt.

Partieller Fix für Bug 1252.

Unterschiede anzeigen:

bin/mozilla/io.pl
317 317
                   $locale->text('Subtotal'), $form->{"subtotal_$i"} ? 'checked' : '' };
318 318

  
319 319
# begin marge calculations
320
    my $marge_color;
321
    my $real_sellprice     = ($form->{"sellprice_$i"} - $discount) / $price_factor;
322
    my $marge_price_factor = $form->{"marge_price_factor_$i"} * 1 || 1;
323

  
324
    $form->{"lastcost_$i"} *= 1;
320
    $form->{"lastcost_$i"}     *= 1;
325 321
    $form->{"marge_percent_$i"} = 0;
326 322

  
327
    if ($real_sellprice && ($form->{"qty_$i"} * 1)) {
328
      $form->{"marge_percent_$i"}     = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * 100 / $real_sellprice;
329
      $myconfig{marge_percent_warn} ||= 15;
330
      $marge_color                    = 'color="#ff0000"' if $form->{"id_$i"} && ($form->{"marge_percent_$i"} < (1 * $myconfig{marge_percent_warn}));
323
    my $marge_color;
324
    my $real_sellprice           = $linetotal;
325
    my $real_lastcost            = $form->{"lastcost_$i"} * $form->{"qty_$i"} / ( $form->{"marge_price_factor_$i"} || 1 );
326
    my $marge_percent_warn       = $myconfig{marge_percent_warn} * 1 || 15;
327
    my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
328

  
329
    if ($real_sellprice * 1 && ($form->{"qty_$i"} * 1)) {
330
      $form->{"marge_percent_$i"} = ($real_sellprice - $real_lastcost) * 100 / $real_sellprice;
331
      $marge_color                = 'color="#ff0000"' if $form->{"id_$i"} && $form->{"marge_percent_$i"} < $marge_percent_warn;
331 332
    }
332 333

  
333
    my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
334
    $form->{"marge_absolut_$i"}  = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * $form->{"qty_$i"} * $marge_adjust_credit_note;
334
    $form->{"marge_absolut_$i"}  = ($real_sellprice - $real_lastcost) * $marge_adjust_credit_note;
335 335
    $form->{"marge_total"}      += $form->{"marge_absolut_$i"};
336
    $form->{"lastcost_total"}   += $form->{"lastcost_$i"} * $form->{"qty_$i"} / $marge_price_factor;
337
    $form->{"sellprice_total"}  += $real_sellprice * $form->{"qty_$i"};
336
    $form->{"lastcost_total"}   += $real_lastcost;
337
    $form->{"sellprice_total"}  += $real_sellprice;
338 338

  
339 339
    map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent);
340 340

  

Auch abrufbar als: Unified diff