Revision 1216d52e
Von Jan Büren vor mehr als 2 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
return undef unless ref $self->payment_terms;
|
||
return undef unless $self->payment_terms->terms_skonto > 0;
|
||
return DateTime->from_object(object => $self->transdate)->add(days => $self->payment_terms->terms_skonto);
|
||
};
|
||
}
|
||
|
||
sub reference_account {
|
||
my $self = shift;
|
||
... | ... | |
my $reference_account = SL::DB::Manager::Chart->find_by(id => $acc_trans->chart_id);
|
||
|
||
return $reference_account;
|
||
};
|
||
}
|
||
|
||
sub open_amount {
|
||
my $self = shift;
|
||
... | ... | |
# numerically, so round this value when checking for cent threshold >= 0.01
|
||
|
||
return ($self->amount // 0) - ($self->paid // 0);
|
||
};
|
||
}
|
||
|
||
sub skonto_amount {
|
||
my $self = shift;
|
||
|
||
return $self->amount - $self->amount_less_skonto;
|
||
};
|
||
}
|
||
|
||
sub percent_skonto {
|
||
my $self = shift;
|
||
... | ... | |
$percent_skonto = $self->payment_terms->percent_skonto;
|
||
|
||
return $percent_skonto;
|
||
};
|
||
}
|
||
|
||
sub amount_less_skonto {
|
||
# amount that has to be paid if skonto applies, always return positive rounded values
|
||
... | ... | |
|
||
return _round($self->amount - ( $self->amount * $percent_skonto) );
|
||
|
||
};
|
||
}
|
||
|
||
# dead method, used to be called in get_payment_select_options_for_bank_transaction
|
||
# error handling is now in _skonto_charts_and_tax_correction that dies with a user info
|
||
# and not silently disables the option for the user
|
||
sub check_skonto_configuration {
|
||
my $self = shift;
|
||
|
||
... | ... | |
|
||
# does this work for other currencies?
|
||
return ($self->amount*$max_skonto_percent) > $amount;
|
||
};
|
||
}
|
||
|
||
sub get_payment_select_options_for_bank_transaction {
|
||
my ($self, $bt_id, %params) = @_;
|
||
... | ... | |
sub forex {
|
||
my ($self) = @_;
|
||
$self->currency_id == $::instance_conf->get_currency_id ? return 0 : return 1;
|
||
};
|
||
}
|
||
|
||
sub _round {
|
||
my $value = shift;
|
Auch abrufbar als: Unified diff
S/D/H/Payment Kosmetik