Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bfd0d5d3

Von G. Richardson vor mehr als 13 Jahren hinzugefügt

  • ID bfd0d5d3e231909c396be894778670df3118ccf4
  • Vorgänger 63e61ef5
  • Nachfolger 099be99d

Addition to bugfix 1666: correcting rounding errors for negative values

make sure rounding error is caught if invoicediff and expensediff both have negative values

see also commit cc47124952e133ee4edbc116d927b90040dc8a05

Unterschiede anzeigen:

SL/IR.pm
400 400
    # shall receive the total rounding error, and the next time it is rounded
401 401
    # the 1 cent correction will be introduced.
402 402

  
403
    my $total_rounding_diff = $invoicediff+$expensediff;
404

  
405 403
    $form->{amount}{ $form->{id} }{$lastinventoryaccno} -= $invoicediff if $lastinventoryaccno;
406 404
    $form->{amount}{ $form->{id} }{$lastexpenseaccno}   -= $expensediff if $lastexpenseaccno;
407 405

  
408
    if ( ($expensediff+$invoicediff) >= 0.005 and $expensediff < 0.005 and $invoicediff < 0.005 ) {
406
    if ( (abs($expensediff)+abs($invoicediff)) >= 0.005 and abs($expensediff) < 0.005 and abs($invoicediff) < 0.005 ) {
409 407

  
410 408
      # in total the rounding error adds up to 1 cent effectively, correct the
411 409
      # larger of the two numbers

Auch abrufbar als: Unified diff