Revision 1216d52e
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
399 | 399 |
return undef unless ref $self->payment_terms; |
400 | 400 |
return undef unless $self->payment_terms->terms_skonto > 0; |
401 | 401 |
return DateTime->from_object(object => $self->transdate)->add(days => $self->payment_terms->terms_skonto); |
402 |
};
|
|
402 |
} |
|
403 | 403 |
|
404 | 404 |
sub reference_account { |
405 | 405 |
my $self = shift; |
... | ... | |
421 | 421 |
my $reference_account = SL::DB::Manager::Chart->find_by(id => $acc_trans->chart_id); |
422 | 422 |
|
423 | 423 |
return $reference_account; |
424 |
};
|
|
424 |
} |
|
425 | 425 |
|
426 | 426 |
sub open_amount { |
427 | 427 |
my $self = shift; |
... | ... | |
432 | 432 |
# numerically, so round this value when checking for cent threshold >= 0.01 |
433 | 433 |
|
434 | 434 |
return ($self->amount // 0) - ($self->paid // 0); |
435 |
};
|
|
435 |
} |
|
436 | 436 |
|
437 | 437 |
sub skonto_amount { |
438 | 438 |
my $self = shift; |
439 | 439 |
|
440 | 440 |
return $self->amount - $self->amount_less_skonto; |
441 |
};
|
|
441 |
} |
|
442 | 442 |
|
443 | 443 |
sub percent_skonto { |
444 | 444 |
my $self = shift; |
... | ... | |
450 | 450 |
$percent_skonto = $self->payment_terms->percent_skonto; |
451 | 451 |
|
452 | 452 |
return $percent_skonto; |
453 |
};
|
|
453 |
} |
|
454 | 454 |
|
455 | 455 |
sub amount_less_skonto { |
456 | 456 |
# amount that has to be paid if skonto applies, always return positive rounded values |
... | ... | |
463 | 463 |
|
464 | 464 |
return _round($self->amount - ( $self->amount * $percent_skonto) ); |
465 | 465 |
|
466 |
};
|
|
466 |
} |
|
467 | 467 |
|
468 |
# dead method, used to be called in get_payment_select_options_for_bank_transaction |
|
469 |
# error handling is now in _skonto_charts_and_tax_correction that dies with a user info |
|
470 |
# and not silently disables the option for the user |
|
468 | 471 |
sub check_skonto_configuration { |
469 | 472 |
my $self = shift; |
470 | 473 |
|
... | ... | |
645 | 648 |
|
646 | 649 |
# does this work for other currencies? |
647 | 650 |
return ($self->amount*$max_skonto_percent) > $amount; |
648 |
};
|
|
651 |
} |
|
649 | 652 |
|
650 | 653 |
sub get_payment_select_options_for_bank_transaction { |
651 | 654 |
my ($self, $bt_id, %params) = @_; |
... | ... | |
707 | 710 |
sub forex { |
708 | 711 |
my ($self) = @_; |
709 | 712 |
$self->currency_id == $::instance_conf->get_currency_id ? return 0 : return 1; |
710 |
};
|
|
713 |
} |
|
711 | 714 |
|
712 | 715 |
sub _round { |
713 | 716 |
my $value = shift; |
Auch abrufbar als: Unified diff
S/D/H/Payment Kosmetik