2003-09-16 07:44:01 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* policy.h -- Implement Accounting Policy *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 2 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program 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 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 *
|
2005-11-16 23:35:02 -06:00
|
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
2003-09-16 07:44:01 -05:00
|
|
|
\********************************************************************/
|
2004-05-06 23:44:40 -05:00
|
|
|
/** @addtogroup Engine
|
|
|
|
@{ */
|
2004-05-07 00:20:15 -05:00
|
|
|
/** @addtogroup Policy Accounting Policy (FIFO/LIFO)
|
2010-02-17 23:31:54 -06:00
|
|
|
* This file implements Accounting Policy. The Accounting Policy
|
2004-05-06 23:54:21 -05:00
|
|
|
* determines how Splits are assigned to Lots. The contents
|
|
|
|
* of a Lot determines the Gains on that Lot. The default policy
|
2010-02-17 23:31:54 -06:00
|
|
|
* is the FIFO policy: the first thing bought is also the first
|
|
|
|
* thing sold.
|
2004-05-06 23:54:21 -05:00
|
|
|
@{ */
|
2004-05-06 23:44:40 -05:00
|
|
|
|
|
|
|
/** @file policy.h
|
|
|
|
* @brief Implement Accounting Policy.
|
|
|
|
* @author Created by Linas Vepstas August 2003
|
2004-05-29 13:22:53 -05:00
|
|
|
* @author Copyright (c) 2003,2004 Linas Vepstas <linas@linas.org>
|
2003-09-16 07:44:01 -05:00
|
|
|
*/
|
|
|
|
|
2010-02-17 23:31:54 -06:00
|
|
|
#ifndef XACC_POLICY_H
|
|
|
|
#define XACC_POLICY_H
|
2003-09-16 07:44:01 -05:00
|
|
|
|
2003-09-22 22:25:37 -05:00
|
|
|
typedef struct gncpolicy_s GNCPolicy;
|
|
|
|
|
2015-06-27 18:06:56 -05:00
|
|
|
/** Valid Policy List
|
|
|
|
* Provides a glist of glists for implemented policies. For each implemented
|
|
|
|
* policy, this glist contains: name, description, hint, as follows:
|
|
|
|
* glist(
|
|
|
|
* glist("fifo", "First In First Out", "Use oldest lots first.")
|
|
|
|
* glist("lifo", "Last In First Out", "Use newest lots first.")
|
|
|
|
* etc.
|
|
|
|
* )
|
|
|
|
* Both levels of lists must be freed with g_list_free().
|
|
|
|
*/
|
|
|
|
GList * gnc_get_valid_policy_list (void);
|
|
|
|
|
|
|
|
/** Valid Policy
|
|
|
|
* Uses the Valid Policy List to determine if a policy name is valid.
|
|
|
|
*/
|
|
|
|
gboolean gnc_valid_policy (const gchar *name);
|
|
|
|
|
2010-02-17 23:31:54 -06:00
|
|
|
/** First-in, First-out Policy
|
2004-05-29 13:22:53 -05:00
|
|
|
* This policy will create FIFO Lots. FIFO Lots have the following
|
|
|
|
* properties:
|
|
|
|
* -- The lot is started with the earliest posted split that isn't
|
|
|
|
* a part of another lot already.
|
|
|
|
* -- Splits are added to the lot in date order, with earliest splits
|
|
|
|
* added first.
|
|
|
|
* -- All splits in the lot share the same transaction currency as
|
|
|
|
* the split that opened the lot.
|
|
|
|
*/
|
2010-02-17 23:31:54 -06:00
|
|
|
GNCPolicy *xaccGetFIFOPolicy (void);
|
2004-05-06 23:44:40 -05:00
|
|
|
|
2003-09-16 07:44:01 -05:00
|
|
|
#endif /* XACC_POLICY_H */
|
2004-05-06 23:44:40 -05:00
|
|
|
/** @} */
|
|
|
|
/** @} */
|