Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
6c1365db
Commit
6c1365db
authored
Apr 12, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cell/model/FormulaObjects/dateandtimeFunctions to function-closure
parent
e80e7a7a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
68 deletions
+82
-68
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+28
-28
cell/model/FormulaObjects/dateandtimeFunctions.js
cell/model/FormulaObjects/dateandtimeFunctions.js
+16
-2
cell/model/FormulaObjects/financialFunctions.js
cell/model/FormulaObjects/financialFunctions.js
+38
-38
No files found.
cell/.unit-tests/FormulaTests.js
View file @
6c1365db
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
$
(
function
()
{
function
toFixed
(
n
)
{
...
...
@@ -3888,7 +3888,7 @@ $( function () {
if
(
settlement
>=
maturity
||
pr
<=
0
||
redemption
<=
0
||
basis
<
0
||
basis
>
4
)
return
"
#NUM!
"
return
(
1.0
-
pr
/
redemption
)
/
yearFrac
(
settlement
,
maturity
,
basis
);
return
(
1.0
-
pr
/
redemption
)
/
AscCommonExcel
.
yearFrac
(
settlement
,
maturity
,
basis
);
}
...
...
@@ -3967,7 +3967,7 @@ $( function () {
if
(
settlement
>=
maturity
||
investment
<=
0
||
discount
<=
0
||
basis
<
0
||
basis
>
4
)
return
"
#NUM!
"
return
investment
/
(
1
-
(
discount
*
yearFrac
(
settlement
,
maturity
,
basis
)
)
)
return
investment
/
(
1
-
(
discount
*
AscCommonExcel
.
yearFrac
(
settlement
,
maturity
,
basis
)
)
)
}
...
...
@@ -4084,7 +4084,7 @@ $( function () {
if
(
settlement
>=
maturity
||
investment
<=
0
||
redemption
<=
0
||
basis
<
0
||
basis
>
4
)
return
"
#NUM!
"
return
(
(
redemption
/
investment
)
-
1
)
/
yearFrac
(
settlement
,
maturity
,
basis
)
return
(
(
redemption
/
investment
)
-
1
)
/
AscCommonExcel
.
yearFrac
(
settlement
,
maturity
,
basis
)
}
...
...
@@ -4128,7 +4128,7 @@ $( function () {
var
d1
=
settlement
var
d2
=
maturity
var
fFraction
=
yearFrac
(
d1
,
d2
,
0
);
var
fFraction
=
AscCommonExcel
.
yearFrac
(
d1
,
d2
,
0
);
if
(
fFraction
-
Math
.
floor
(
fFraction
)
==
0
)
return
"
#NUM!
"
...
...
cell/model/FormulaObjects/dateandtimeFunctions.js
View file @
6c1365db
...
...
@@ -23,7 +23,12 @@
*
*/
"
use strict
"
;
(
/**
* @param {Window} window
* @param {undefined} undefined
*/
function
(
window
,
undefined
)
{
var
DayCountBasis
=
{
// US 30/360
UsPsa30_360
:
0
,
...
...
@@ -1909,4 +1914,13 @@ cYEARFRAC.prototype.getInfo = function () {
name
:
this
.
name
,
args
:
"
( start-date , end-date [ , basis ] )
"
};
}
\ No newline at end of file
}
//----------------------------------------------------------export----------------------------------------------------
window
[
'
AscCommonExcel
'
]
=
window
[
'
AscCommonExcel
'
]
||
{};
window
[
'
AscCommonExcel
'
].
DayCountBasis
=
DayCountBasis
;
window
[
'
AscCommonExcel
'
].
yearFrac
=
yearFrac
;
window
[
'
AscCommonExcel
'
].
diffDate
=
diffDate
;
window
[
'
AscCommonExcel
'
].
days360
=
days360
;
window
[
'
AscCommonExcel
'
].
daysInYear
=
daysInYear
;
})(
window
);
cell/model/FormulaObjects/financialFunctions.js
View file @
6c1365db
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment