Commit 6c1365db authored by Alexander.Trofimov's avatar Alexander.Trofimov

cell/model/FormulaObjects/dateandtimeFunctions to function-closure

parent e80e7a7a
/*
*
* (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!"
......
......@@ -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);
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