Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f63524fc

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

  • ID f63524fc2b3f1a66d5d3d95bf52e2408651343e3
  • Vorgänger 971b5980
  • Nachfolger dbeb72ed

Payment-Helper: neue Methode open_amount_less_skonto inkl. POD

Unterschiede anzeigen:

SL/DB/Helper/Payment.pm
4 4

  
5 5
use parent qw(Exporter);
6 6
our @EXPORT = qw(pay_invoice);
7
our @EXPORT_OK = qw(skonto_date amount_less_skonto within_skonto_period percent_skonto reference_account open_amount skonto_amount valid_skonto_amount validate_payment_type get_payment_select_options_for_bank_transaction forex _skonto_charts_and_tax_correction get_exchangerate_for_bank_transaction get_exchangerate _add_bank_fx_fees open_amount_fx);
7
our @EXPORT_OK = qw(skonto_date amount_less_skonto within_skonto_period percent_skonto reference_account open_amount skonto_amount valid_skonto_amount validate_payment_type get_payment_select_options_for_bank_transaction forex _skonto_charts_and_tax_correction get_exchangerate_for_bank_transaction get_exchangerate _add_bank_fx_fees open_amount_fx open_amount_less_skonto);
8 8
our %EXPORT_TAGS = (
9 9
  "ALL" => [@EXPORT, @EXPORT_OK],
10 10
);
......
494 494

  
495 495
  return _round($self->amount - ( $self->amount * $percent_skonto) );
496 496

  
497
}
498
sub open_amount_less_skonto {
499
  # amount that has to be paid if skonto applies, always return positive rounded values
500
  # no, rare case, but credit_notes and negative ap have negative amounts
501
  # and therefore this comment may be misguiding
502
  # the result is rounded so we can directly compare it with the user input
503
  my $self = shift;
504

  
505
  my $percent_skonto = $self->percent_skonto || 0;
506

  
507
  my $open_amount = ($self->amount // 0) - ($self->paid // 0);
508
  return _round($open_amount - ( $self->amount * $percent_skonto) );
509

  
497 510
}
498 511
sub _add_bank_fx_fees {
499 512
  my ($self, %params)   = @_;
......
978 991

  
979 992
The returned value is rounded to two decimals.
980 993

  
994
=item C<open_amount_less_skonto>
995

  
996
The same as amount_less_skonto but calculates skonto against the current
997
open amount, i.e. some amount of the invoice is reduced because of a linked
998
credit note.
999

  
1000
The returned value is rounded to two decimals.
1001

  
1002

  
981 1003
=item C<skonto_date>
982 1004

  
983 1005
The date up to which skonto may be taken. This is calculated from the invoice

Auch abrufbar als: Unified diff