Revision bbfe8b79
Von Jan Büren vor mehr als 2 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
391 | 391 |
return undef unless ref $self->payment_terms; |
392 | 392 |
return undef unless $self->payment_terms->terms_skonto > 0; |
393 | 393 |
return DateTime->from_object(object => $self->transdate)->add(days => $self->payment_terms->terms_skonto); |
394 |
};
|
|
394 |
} |
|
395 | 395 |
|
396 | 396 |
sub reference_account { |
397 | 397 |
my $self = shift; |
... | ... | |
413 | 413 |
my $reference_account = SL::DB::Manager::Chart->find_by(id => $acc_trans->chart_id); |
414 | 414 |
|
415 | 415 |
return $reference_account; |
416 |
};
|
|
416 |
} |
|
417 | 417 |
|
418 | 418 |
sub open_amount { |
419 | 419 |
my $self = shift; |
... | ... | |
424 | 424 |
# numerically, so round this value when checking for cent threshold >= 0.01 |
425 | 425 |
|
426 | 426 |
return ($self->amount // 0) - ($self->paid // 0); |
427 |
};
|
|
427 |
} |
|
428 | 428 |
|
429 | 429 |
sub skonto_amount { |
430 | 430 |
my $self = shift; |
431 | 431 |
|
432 | 432 |
return $self->amount - $self->amount_less_skonto; |
433 |
};
|
|
433 |
} |
|
434 | 434 |
|
435 | 435 |
sub percent_skonto { |
436 | 436 |
my $self = shift; |
... | ... | |
442 | 442 |
$percent_skonto = $self->payment_terms->percent_skonto; |
443 | 443 |
|
444 | 444 |
return $percent_skonto; |
445 |
};
|
|
445 |
} |
|
446 | 446 |
|
447 | 447 |
sub amount_less_skonto { |
448 | 448 |
# amount that has to be paid if skonto applies, always return positive rounded values |
... | ... | |
455 | 455 |
|
456 | 456 |
return _round($self->amount - ( $self->amount * $percent_skonto) ); |
457 | 457 |
|
458 |
};
|
|
458 |
} |
|
459 | 459 |
|
460 |
# dead method, used to be called in get_payment_select_options_for_bank_transaction |
|
461 |
# error handling is now in _skonto_charts_and_tax_correction that dies with a user info |
|
462 |
# and not silently disables the option for the user |
|
460 | 463 |
sub check_skonto_configuration { |
461 | 464 |
my $self = shift; |
462 | 465 |
|
... | ... | |
637 | 640 |
|
638 | 641 |
# does this work for other currencies? |
639 | 642 |
return ($self->amount*$max_skonto_percent) > $amount; |
640 |
};
|
|
643 |
} |
|
641 | 644 |
|
642 | 645 |
sub get_payment_select_options_for_bank_transaction { |
643 | 646 |
my ($self, $bt_id, %params) = @_; |
... | ... | |
699 | 702 |
sub forex { |
700 | 703 |
my ($self) = @_; |
701 | 704 |
$self->currency_id == $::instance_conf->get_currency_id ? return 0 : return 1; |
702 |
};
|
|
705 |
} |
|
703 | 706 |
|
704 | 707 |
sub _round { |
705 | 708 |
my $value = shift; |
Auch abrufbar als: Unified diff
S/D/H/Payment Kosmetik