Make Calc Add-In function RECEIVED behave like Excel and Gnumeric.

EXcel and Gnumeric demand that Maturity > Settlement, Calc now does too.

Change-Id: Id02918153d5c07f438c9160330b0dc09fdf13f6c
Reviewed-on: https://gerrit.libreoffice.org/27619
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
This commit is contained in:
Winfried Donkers
2016-07-28 12:45:08 +02:00
committed by Eike Rathke
parent bedae6b06c
commit 5c78a453bc

View File

@@ -79,7 +79,7 @@ double SAL_CALL AnalysisAddIn::getAccrintm( const css::uno::Reference< css::bean
double SAL_CALL AnalysisAddIn::getReceived( const css::uno::Reference< css::beans::XPropertySet >& xOpt,
sal_Int32 nSettle, sal_Int32 nMat, double fInvest, double fDisc, const css::uno::Any& rOB ) throw( css::uno::RuntimeException, css::lang::IllegalArgumentException, std::exception )
{
if( fInvest <= 0.0 || fDisc <= 0.0 )
if( fInvest <= 0.0 || fDisc <= 0.0 || nSettle >= nMat )
throw css::lang::IllegalArgumentException();
double fRet = fInvest / ( 1.0 - ( fDisc * GetYearDiff( GetNullDate( xOpt ), nSettle, nMat, getDateMode( xOpt, rOB ) ) ) );