GnuCash  4.12-558-g06612b8434
Files | Functions

This file implements Accounting Policy. More...

Files

file  policy.h
 Implement Accounting Policy.
 

Functions

GNCPolicy * xaccGetFIFOPolicy (void)
 First-in, First-out Policy This policy will create FIFO Lots. More...
 

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.

Function Documentation

◆ xaccGetFIFOPolicy()

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 190 of file policy.c.

191 {
192  static GNCPolicy *pcy = NULL;
193 
194  if (!pcy)
195  {
196  pcy = g_new (GNCPolicy, 1);
197  pcy->PolicyGetLot = FIFOPolicyGetLot;
198  pcy->PolicyGetSplit = FIFOPolicyGetSplit;
199  pcy->PolicyGetLotOpening = FIFOPolicyGetLotOpening;
200  pcy->PolicyIsOpeningSplit = FIFOPolicyIsOpeningSplit;
201  }
202  return pcy;
203 }