38 #include "TransactionP.h"
53 gboolean want_positive;
62 if (!lot_account)
return NULL;
72 common_currency = split->parent->common_currency;
88 node = g_list_last (node);
96 if (split->lot)
goto donext;
100 if ((this_ts.tv_sec < open_ts.tv_sec) ||
101 ((this_ts.tv_sec == open_ts.tv_sec) &&
102 (this_ts.tv_nsec < open_ts.tv_nsec)))
112 split->parent->common_currency);
113 if (FALSE == is_match)
goto donext;
119 if ((want_positive && is_positive) ||
120 ((!want_positive) && (!is_positive)))
return split;
139 if (!split)
return NULL;
141 split->parent->common_currency);
147 return DirectionPolicyGetSplit (pcy, lot, 0);
156 Split *opening_split;
159 if (ret_amount) *ret_amount = opening_split->amount;
160 if (ret_value) *ret_value = opening_split->value;
161 if (ret_currency) *ret_currency = opening_split->parent->common_currency;
167 Split *opening_split;
169 return (split == opening_split);
185 pcy->PolicyGetLot = FIFOPolicyGetLot;
186 pcy->PolicyGetSplit = FIFOPolicyGetSplit;
187 pcy->PolicyGetLotOpening = FIFOPolicyGetLotOpening;
188 pcy->PolicyIsOpeningSplit = FIFOPolicyIsOpeningSplit;
198 G_GNUC_UNUSED
static GNCLot *
201 if (!split)
return NULL;
202 return xaccAccountFindLatestOpenLot (split->acc, split->amount,
203 split->parent->common_currency);
206 G_GNUC_UNUSED
static Split *
209 return DirectionPolicyGetSplit (pcy, lot, 1);
213 G_GNUC_UNUSED
static void
219 Split *opening_split;
222 if (ret_amount) *ret_amount = opening_split->amount;
223 if (ret_value) *ret_value = opening_split->value;
224 if (ret_currency) *ret_currency = opening_split->parent->common_currency;
228 G_GNUC_UNUSED
static gboolean
231 Split *opening_split;
233 return (split == opening_split);
GNCLot * xaccAccountFindEarliestOpenLot(Account *acc, gnc_numeric sign, gnc_commodity *currency)
SplitList * xaccAccountGetSplitList(const Account *acc)
Use a 64-bit unsigned int timespec.
gboolean gnc_numeric_zero_p(gnc_numeric a)
Transaction * xaccSplitGetParent(const Split *split)
Split * gnc_lot_get_earliest_split(GNCLot *lot)
gboolean gnc_numeric_negative_p(gnc_numeric a)
Split * gnc_lot_get_latest_split(GNCLot *lot)
Account handling public routines.
Implement Accounting Policy.
Implement Accounting Policy Private header File.
SplitList * gnc_lot_get_split_list(const GNCLot *lot)
All type declarations for the whole Gnucash engine.
gboolean gnc_numeric_positive_p(gnc_numeric a)
gboolean gnc_lot_is_closed(GNCLot *lot)
Timespec xaccTransRetDatePostedTS(const Transaction *trans)
Account * gnc_lot_get_account(const GNCLot *lot)
API for Transactions and Splits (journal entries)
Utilities to Automatically Compute Capital Gains/Losses.
gboolean gnc_commodity_equiv(const gnc_commodity *a, const gnc_commodity *b)
gnc_numeric gnc_lot_get_balance(GNCLot *lot)
GNCPolicy * xaccGetFIFOPolicy(void)