/usr/include/gnucash/gnc-accounting-period.h is in gnucash-common 1:2.4.10-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | /*
* gnc-accounting-period.h --
*
* Copyright (c) 2005 David Hampton <hampton@employees.org>
* All rights reserved.
*
* GnuCash is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Gnucash is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, contact:
*
* Free Software Foundation Voice: +1-617-542-5942
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*/
/** @addtogroup GUI
@{ */
/** @file gnc-accounting-period.h
@brief General utilities for dealing with accounting periods.
@author David Hampton <hampton@employees.org>
These are general utility functions for specifying an accounting
period and converting it to a value usable by the gnucash engine.
The choice of src/app-utils is arbitrary as these utilities don't
fit well anywhere else. They are at a higher level than a GDate,
so they don't fit in src/core-utils/gnc-gdate-utils.c. They don't
operate on engine data structures, so they don't belong in
src/engine/Period.c. Putting them into src/engine/gnc-date.c
would be the best place for them, but then that creates a new
dependancy from the src/engine directory to the src/core-utils
directory that doesn't currently exist. Since that might be a
problem for CashUtils, the app-file directory was chosen.
*/
#ifndef GNC_ACCOUNTING_PERIOD_H
#define GNC_ACCOUNTING_PERIOD_H
#include <glib.h>
#include <time.h>
/**
* This specifies a time interval.
*/
typedef enum
{
GNC_ACCOUNTING_PERIOD_TODAY,
GNC_ACCOUNTING_PERIOD_MONTH,
GNC_ACCOUNTING_PERIOD_MONTH_PREV,
GNC_ACCOUNTING_PERIOD_QUARTER,
GNC_ACCOUNTING_PERIOD_QUARTER_PREV,
GNC_ACCOUNTING_PERIOD_CYEAR,
GNC_ACCOUNTING_PERIOD_CYEAR_PREV,
GNC_ACCOUNTING_PERIOD_CYEAR_LAST,
GNC_ACCOUNTING_PERIOD_FYEAR = GNC_ACCOUNTING_PERIOD_CYEAR_LAST,
GNC_ACCOUNTING_PERIOD_FYEAR_PREV,
GNC_ACCOUNTING_PERIOD_FYEAR_LAST,
GNC_ACCOUNTING_PERIOD_LAST = GNC_ACCOUNTING_PERIOD_FYEAR_LAST,
} GncAccountingPeriod;
/** \name Accounting Periods */
/** @{ */
/** This function returns the starting date for an accounting period.
* The date will be computed based upon the type of accounting
* interval requested, an optional fiscal year end value, and an
* optional time value.
*
* @param which An enum specifying the type of accounting period.
*
* @param fy_end This argument specifies the month and day of the
* fiscal year end. If the accounting period specified in the
* 'which' parameter is not a fiscal accounting period, this variable
* is ignored and may be NULL. Note: the year field of this argument
* is always ignored.
*
* @param contains This argument specifies the origin time value used
* by the calculations in this function. If this value is NULL, the
* origin will be the current time.
*
* @return The starting day of the specified time interval, as a
* GDate. */
GDate *gnc_accounting_period_start_gdate (GncAccountingPeriod which,
const GDate *fy_end,
const GDate *contains);
/** This function returns the starting time for an accounting period.
* The time will be computed based upon the type of accounting
* interval requested, an optional fiscal year end value, and an
* optional time value.
*
* @param which An enum specifying the type of accounting period.
*
* @param fy_end This argument specifies the month and day of the
* fiscal year end. If the accounting period specified in the
* 'which' parameter is not a fiscal accounting period, this variable
* is ignored and may be NULL. Note: the year field of this argument
* is always ignored.
*
* @param contains This argument specifies the origin time value used
* by the calculations in this function. If this value is NULL, the
* origin will be the current time.
*
* @return The starting second of the specified time interval, based
* on a zero value of January 1st, 1970. */
time_t gnc_accounting_period_start_timet (GncAccountingPeriod which,
const GDate *fy_end,
const GDate *contains);
/** This function returns the ending date for an accounting period.
* The date will be computed based upon the type of accounting
* interval requested, an optional fiscal year end value, and an
* optional time value.
*
* @param which An enum specifying the type of accounting period.
*
* @param fy_end This argument specifies the month and day of the
* fiscal year end. If the accounting period specified in the
* 'which' parameter is not a fiscal accounting period, this variable
* is ignored and may be NULL. Note: the year field of this argument
* is always ignored.
*
* @param contains This argument specifies the origin time value used
* by the calculations in this function. If this value is NULL, the
* origin will be the current time.
*
* @return The final day of the specified time interval, as a
* GDate. */
GDate *gnc_accounting_period_end_gdate (GncAccountingPeriod which,
const GDate *fy_end,
const GDate *contains);
/** This function returns the ending time for an accounting period.
* The time will be computed based upon the type of accounting
* interval requested, an optional fiscal year end value, and an
* optional time value.
*
* @param which An enum specifying the type of accounting period.
*
* @param fy_end This argument specifies the month and day of the
* fiscal year end. If the accounting period specified in the
* 'which' parameter is not a fiscal accounting period, this variable
* is ignored and may be NULL. Note: the year field of this argument
* is always ignored.
*
* @param contains This argument specifies the origin time value used
* by the calculations in this function. If this value is NULL, the
* origin will be the current time.
*
* @return The ending second of the specified time interval, based
* on a zero value of January 1st, 1970. */
time_t gnc_accounting_period_end_timet (GncAccountingPeriod which,
const GDate *fy_end,
const GDate *contains);
/* Get the fiscal accounting period from the preferences and return
the start and end times. */
time_t gnc_accounting_period_fiscal_start(void);
time_t gnc_accounting_period_fiscal_end(void);
/** @} */
#endif /* GNC_ACCOUNTING_PERIOD_H */
/** @} */
|