File indexing completed on 2024-05-12 16:35:31

0001 /* This file is part of the KDE project
0002    Copyright (C) 1998-2002 The KSpread Team <calligra-devel@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; only
0007    version 2 of the License.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 #ifndef kspread_functions_helper_h_
0020 #define kspread_functions_helper_h_
0021 // helper functions for other functions
0022 
0023 #include "sheets_common_export.h"
0024 
0025 class QDate;
0026 
0027 namespace Calligra
0028 {
0029 namespace Sheets
0030 {
0031 
0032 /* 0: US 30 / 360
0033  * 1: real days
0034  * 2: real days / 360
0035  * 3: real days / 365
0036  * 4: European 30 / 360
0037  */
0038 CALLIGRA_SHEETS_COMMON_EXPORT int daysPerYear(QDate const & date, int basis);
0039 
0040 /* 0: US 30 / 360
0041  * 1: real days
0042  * 2: real days / 360
0043  * 3: real days / 365
0044  * 4: European 30 / 360
0045  */
0046 CALLIGRA_SHEETS_COMMON_EXPORT int daysBetweenDates(QDate const & date1, QDate const & date2, int basis);
0047 
0048 
0049 // ODF
0050 CALLIGRA_SHEETS_COMMON_EXPORT int days360(const QDate& _date1, const QDate& _date2, bool european);
0051 CALLIGRA_SHEETS_COMMON_EXPORT int days360(int day1, int month1, int year1, bool leapYear1, int  day2, int month2, int year2, bool leapYear2, bool usa);
0052 CALLIGRA_SHEETS_COMMON_EXPORT long double yearFrac(const QDate& refDate, const QDate& startDate, const QDate& endDate, int basis);
0053 CALLIGRA_SHEETS_COMMON_EXPORT long double duration(const QDate& refDate, const QDate& settlement, const QDate& maturity, const long double& coup_, const long double& yield_, const int& freq, const int& basis, const long double& numOfCoups);
0054 CALLIGRA_SHEETS_COMMON_EXPORT long double pow1p(const long double& x, const long double& y);
0055 CALLIGRA_SHEETS_COMMON_EXPORT long double pow1pm1(const long double& x, const long double& y);
0056 } // namespace Sheets
0057 } // namespace Calligra
0058 
0059 #endif