Accounting Policy (FIFO/LIFO)
[GnuCash Engine: Core, Non-GUI Accounting Functions]


Detailed Description

This file implements Accounting Policy. The Accounting Policy determines how Splits are assigned to Lots. The contents of a Lot determines the Gains on that Lot. The default policy is the FIFO policy: the first thing bought is also the first thing sold.


Files

file  policy.h
 Implement Accounting Policy.

Typedefs

typedef gncpolicy_s GNCPolicy

Functions

GNCPolicyxaccGetFIFOPolicy (void)
GNCPolicyxaccGetLIFOPolicy (void)


Function Documentation

GNCPolicy* xaccGetFIFOPolicy ( void   ) 

First-in, First-out Policy 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.

Definition at line 176 of file policy.c.

00177 {
00178    static GNCPolicy *pcy = NULL;
00179 
00180    if (!pcy)
00181    {
00182       pcy = g_new (GNCPolicy, 1);
00183       pcy->PolicyGetLot = FIFOPolicyGetLot;
00184       pcy->PolicyGetSplit = FIFOPolicyGetSplit;
00185       pcy->PolicyGetLotOpening = FIFOPolicyGetLotOpening;
00186       pcy->PolicyIsOpeningSplit = FIFOPolicyIsOpeningSplit;
00187    }
00188    return pcy;
00189 }

GNCPolicy* xaccGetLIFOPolicy ( void   ) 

Last-in, First-out Policy This policy will create LIFO Lots. LIFO Lots have the following properties: -- XXX I think the implementation is broken right now. -- All splits in the lot share the same transaction currency as the split that opened the lot.

Definition at line 241 of file policy.c.

00242 {
00243    static GNCPolicy *pcy = NULL;
00244 
00245    if (!pcy)
00246    {
00247       pcy = g_new (GNCPolicy, 1);
00248       pcy->PolicyGetLot = LIFOPolicyGetLot;
00249       pcy->PolicyGetSplit = LIFOPolicyGetSplit;
00250       pcy->PolicyGetLotOpening = LIFOPolicyGetLotOpening;
00251       pcy->PolicyIsOpeningSplit = LIFOPolicyIsOpeningSplit;
00252    }
00253    return pcy;
00254 }


Generated on Mon Sep 8 05:04:37 2008 for GnuCash by  doxygen 1.5.2