Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c4c4a4e4

Von Jan Büren vor mehr als 1 Jahr hinzugefügt

  • ID c4c4a4e4bda857f0ece10d15a8938d6edddd8127
  • Vorgänger 3974dbaa
  • Nachfolger d5ab2f7d

Payment-Helper: pay_invoice with skonto akzeptiert auch Teilzahlungen

S.a. Commits davor. Die Vorbedingung das es noch gar keine Zahlungen
gegen die Rechnung geben darf, damit das Skonto richtig berechnet wird, entfällt

Unterschiede anzeigen:

SL/DB/Helper/Payment.pm
66 66
    # amount, but if amount is passed, make sure it matches the expected value
67 67
    # note: the parameter isn't used at all - amount_less_skonto will always be used
68 68
    # partial skonto payments are therefore impossible to book
69
    croak "amount $params{amount} doesn't match amount less skonto: " . $self->amount_less_skonto . "\n" if $params{amount} && abs($self->amount_less_skonto - $params{amount} ) > 0.0000001;
70
    croak "payment type with_skonto_pt can't be used if payments have already been made" if $self->paid != 0;
69
    croak "amount $params{amount} doesn't match open amount less skonto: "
70
          . $self->open_amount_less_skonto . "\n" if $params{amount}
71
                                                  && abs($self->open_amount_less_skonto - $params{amount} ) > 0.0000001;
72
    # croak "payment type with_skonto_pt can't be used if payments have already been made" if $self->paid != 0;
71 73
  }
72 74

  
73 75
  my $transdate_obj;
......
157 159
      # stage because we don't use $params{amount} ?!
158 160

  
159 161
      my $pay_amount = $rounded_params_amount;
160
      $pay_amount = $self->amount_less_skonto if $params{payment_type} eq 'with_skonto_pt';
162
      $pay_amount = $self->open_amount_less_skonto if $params{payment_type} eq 'with_skonto_pt';
161 163

  
162 164
      # bank account and AR/AP
163 165
      $paid_amount += $pay_amount;

Auch abrufbar als: Unified diff