Kaydet (Commit) 76c2e3ef authored tarafından Winfried Donkers's avatar Winfried Donkers Kaydeden (comit) Eike Rathke

tdf#113768 Fix opposite argument description for Calc function VDB.

Also, use self-explaining variable name for argument NoSwitch.
Added use of argument NoSwitch to unit test document.

Change-Id: I801d4dbd489898b28543e0eb46f74717671ea03a
Reviewed-on: https://gerrit.libreoffice.org/44647Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
üst 3dee7948
......@@ -624,8 +624,8 @@ const char* SC_OPCODE_VBD_ARY[] =
NC_("SC_OPCODE_VBD", "End. The last period of the depreciation using the same time unit as for the useful life."),
NC_("SC_OPCODE_VBD", "Factor"),
NC_("SC_OPCODE_VBD", "Factor. The factor for the reduction of the depreciation. Factor = 2 denotes double rate depreciation."),
NC_("SC_OPCODE_VBD", "Type"),
NC_("SC_OPCODE_VBD", "Do not alter. Type = 1 denotes switch to linear depreciation, type = 0 do not switch.")
NC_("SC_OPCODE_VBD", "NoSwitch"),
NC_("SC_OPCODE_VBD", "NoSwitch = 0 denotes switch to linear depreciation, NoSwitch = 1 do not switch.")
};
// -=*# Resource for function EFFECT #*=-
......
......@@ -3665,6 +3665,57 @@
<table:table-cell table:style-name="ce32"/>
<table:table-cell table:number-columns-repeated="9"/>
</table:table-row>
<table:table-row table:style-name="ro6">
<table:table-cell table:formula="of:=VDB(100000;20000;10;4;5;1;0)" office:value-type="float" office:value="7557.14285714286" calcext:value-type="float">
<text:p>7557.14285714286</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="7557.14285714286" calcext:value-type="float">
<text:p>7557.14285714286</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce19" table:formula="of:=ROUND([.A72];12)=ROUND([.B72];12)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce21" table:formula="of:=FORMULA([.A72])" office:value-type="string" office:string-value="=VDB(100000;20000;10;4;5;1;0)" calcext:value-type="string">
<text:p>=VDB(100000;20000;10;4;5;1;0)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="6"/>
<table:table-cell table:style-name="ce32"/>
<table:table-cell table:number-columns-repeated="9"/>
</table:table-row>
<table:table-row table:style-name="ro6">
<table:table-cell table:formula="of:=VDB(100000;20000;10;4;5;1;1)" office:value-type="float" office:value="6560.99999999999" calcext:value-type="float">
<text:p>6560.99999999999</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="6560.99999999999" calcext:value-type="float">
<text:p>6560.99999999999</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce19" table:formula="of:=ROUND([.A73];12)=ROUND([.B73];12)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce21" table:formula="of:=FORMULA([.A73])" office:value-type="string" office:string-value="=VDB(100000;20000;10;4;5;1;1)" calcext:value-type="string">
<text:p>=VDB(100000;20000;10;4;5;1;1)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="6"/>
<table:table-cell table:style-name="ce32"/>
<table:table-cell table:number-columns-repeated="9"/>
</table:table-row>
<table:table-row table:style-name="ro6">
<table:table-cell table:formula="of:=VDB(100000;20000;10;4;5;1)" office:value-type="float" office:value="7557.14285714286" calcext:value-type="float">
<text:p>7557.14285714286</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="7557.14285714286" calcext:value-type="float">
<text:p>7557.14285714286</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce19" table:formula="of:=ROUND([.A74];12)=ROUND([.B74];12)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce21" table:formula="of:=FORMULA([.A74])" office:value-type="string" office:string-value="=VDB(100000;20000;10;4;5;1)" calcext:value-type="string">
<text:p>=VDB(100000;20000;10;4;5;1)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="6"/>
<table:table-cell table:style-name="ce32"/>
<table:table-cell table:number-columns-repeated="9"/>
</table:table-row>
<table:table-row table:style-name="ro6" table:number-rows-repeated="164">
<table:table-cell table:style-name="ce15" table:number-columns-repeated="2"/>
<table:table-cell table:style-name="ce20"/>
......@@ -3753,4 +3804,4 @@
</table:named-expressions>
</office:spreadsheet>
</office:body>
</office:document>
\ No newline at end of file
</office:document>
......@@ -1532,18 +1532,18 @@ std::string ScInterVDB=
std::string VDBImplementDecl=
"double VDBImplement(double fCost, double fSalvage, double fLife, double fStart"
", double fEnd, double fFactor, int nType);\n";
", double fEnd, double fFactor, bool bNoSwitch);\n";
std::string VDBImplement=
"double VDBImplement(double fCost, double fSalvage, double fLife, double fStart"
", double fEnd, double fFactor, int nType)\n"
", double fEnd, double fFactor, bool bNoSwitch)\n"
"{\n"
" double result=0;\n"
" double fIntStart = floor(fStart);\n"
" double fIntEnd = ceil(fEnd);\n"
" int nLoopStart = (int) fIntStart;\n"
" int nLoopEnd = (int) fIntEnd;\n"
" if (nType)\n"
" if (bNoSwitch)\n"
" {\n"
" for (int i = nLoopStart + 1; i <= nLoopEnd; i++)\n"
" {\n"
......
......@@ -1795,11 +1795,11 @@ void ScInterpreter::ScVDB()
if ( MustHaveParamCount( nParamCount, 5, 7 ) )
{
double fCost, fSalvage, fLife, fStart, fEnd, fFactor, fVdb = 0.0;
bool bType;
bool bNoSwitch;
if (nParamCount == 7)
bType = GetBool();
bNoSwitch = GetBool();
else
bType = false;
bNoSwitch = false;
if (nParamCount >= 6)
fFactor = GetDouble();
else
......@@ -1820,7 +1820,7 @@ void ScInterpreter::ScVDB()
sal_uLong nLoopEnd = (sal_uLong) fIntEnd;
fVdb = 0.0;
if (bType)
if (bNoSwitch)
{
for (sal_uLong i = nLoopStart + 1; i <= nLoopEnd; i++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment