GnuCash 7574033+
Loading...
Searching...
No Matches
Lots: Core Function for AR/AP, Inventory, Stock Lots, Cap Gains

One often needs to know that the item 'bought' in one transaction is the same one as the item 'sold' in a different transaction. More...

Files

file  gnc-lot.h

Data Structures

struct  GncLotClass

Macros

#define GNCLotClass   GncLotClass
#define GNC_TYPE_LOT   (gnc_lot_get_type ())
#define GNC_LOT(o)
#define GNC_LOT_CLASS(k)
#define GNC_IS_LOT(o)
#define GNC_IS_LOT_CLASS(k)
#define GNC_LOT_GET_CLASS(o)
#define gnc_lot_get_guid(X)
#define LOT_IS_CLOSED   "is-closed?"
#define LOT_BALANCE   "balance"
#define LOT_TITLE   "lot-title"
#define LOT_NOTES   "notes"

Functions

GType gnc_lot_get_type (void)
GNCLot * gnc_lot_new (QofBook *)
void gnc_lot_destroy (GNCLot *)
GNCLot * gnc_lot_lookup (const GncGUID *guid, QofBook *book)
QofBook * gnc_lot_get_book (GNCLot *)
void gnc_lot_begin_edit (GNCLot *lot)
void gnc_lot_commit_edit (GNCLot *lot)
void gnc_lot_add_split (GNCLot *, Split *)
 Adds a split to this lot.
void gnc_lot_remove_split (GNCLot *, Split *)
 Adds a split from this lot.
SplitList * gnc_lot_get_split_list (const GNCLot *)
 Returns a list of all the splits in this lot.
gint gnc_lot_count_splits (const GNCLot *)
Account * gnc_lot_get_account (const GNCLot *)
 Returns the account with which this lot is associated.
void gnc_lot_set_account (GNCLot *, Account *)
GncInvoice * gnc_lot_get_cached_invoice (const GNCLot *lot)
 Returns the invoice with which this lot is associated.
void gnc_lot_set_cached_invoice (GNCLot *lot, GncInvoice *invoice)
gnc_numeric gnc_lot_get_balance (GNCLot *)
 Returns the lot balance.
void gnc_lot_get_balance_before (const GNCLot *, const Split *, gnc_numeric *, gnc_numeric *)
 Computes both the balance and value in the lot considering only splits in transactions prior to the one containing the given split or other splits in the same transaction.
gboolean gnc_lot_is_closed (GNCLot *)
 Returns closed status of the given lot.
Split * gnc_lot_get_earliest_split (GNCLot *lot)
 Convenience routine to identify the earliest date in the lot.
Split * gnc_lot_get_latest_split (GNCLot *lot)
 Convenience routineto identify the date this lot was closed.
void gnc_lot_set_closed_unknown (GNCLot *)
 Reset closed flag so that it will be recalculated.
GNCLot * gnc_lot_make_default (Account *acc)

Get/set the account title and notes.

const char * gnc_lot_get_title (const GNCLot *)
const char * gnc_lot_get_notes (const GNCLot *)
void gnc_lot_set_title (GNCLot *, const char *)
void gnc_lot_set_notes (GNCLot *, const char *)

Detailed Description

One often needs to know that the item 'bought' in one transaction is the same one as the item 'sold' in a different transaction.

Lots are used to make this association. One Lot holds all of the splits that involve the same item. A lot is typically formed when the item is bought, and is closed when the item is sold out. A lot need not be a single item, it can be a quantity of the same thing e.g. 500 gallons of paint (sold off a few gallons at a time).

Lots are required to correctly implement invoices, inventory, depreciation and stock market investment gains. See the file src/doc/lots.txt for a detailed implementation overview.

A lot is "closed" when the number of items in the lot has gone to zero. It is very easy to compute the gains/losses for a closed lot: it is the sum-total of the values of the items put into/taken out of the lot. (Realized) Gains on still-open lots can be computed by pro-rating the purchase prices.

Lots are nothing more than a collection or grouping of splits in an account. All of the splits in a lot must belong to the same account; there's no mix-n-match. Thus, in this sense, a lot belongs to an account as well.

Lots have an implicit "opening date": the date of the earliest split in the lot. The "close date" is the date of the split that brought the lot item balance down to zero.

Macro Definition Documentation

◆ GNC_IS_LOT

#define GNC_IS_LOT ( o)
Value:
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_LOT))

Definition at line 85 of file gnc-lot.h.

85#define GNC_IS_LOT(o) \
86 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_LOT))

◆ GNC_IS_LOT_CLASS

#define GNC_IS_LOT_CLASS ( k)
Value:
(G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_LOT))

Definition at line 87 of file gnc-lot.h.

87#define GNC_IS_LOT_CLASS(k) \
88 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_LOT))

◆ GNC_LOT

#define GNC_LOT ( o)
Value:
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_LOT, GNCLot))

Definition at line 81 of file gnc-lot.h.

81#define GNC_LOT(o) \
82 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_LOT, GNCLot))

◆ GNC_LOT_CLASS

#define GNC_LOT_CLASS ( k)
Value:
(G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_LOT, GNCLotClass))

Definition at line 83 of file gnc-lot.h.

83#define GNC_LOT_CLASS(k) \
84 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_LOT, GNCLotClass))

◆ GNC_LOT_GET_CLASS

#define GNC_LOT_GET_CLASS ( o)
Value:
(G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_LOT, GNCLotClass))

Definition at line 89 of file gnc-lot.h.

89#define GNC_LOT_GET_CLASS(o) \
90 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_LOT, GNCLotClass))

◆ gnc_lot_get_guid

#define gnc_lot_get_guid ( X)
Value:
qof_entity_get_guid(QOF_INSTANCE(X))
const GncGUID * qof_entity_get_guid(gconstpointer ent)

Definition at line 193 of file gnc-lot.h.

◆ GNC_TYPE_LOT

#define GNC_TYPE_LOT   (gnc_lot_get_type ())

Definition at line 80 of file gnc-lot.h.

◆ GNCLotClass

#define GNCLotClass   GncLotClass

Definition at line 77 of file gnc-lot.h.

◆ LOT_BALANCE

#define LOT_BALANCE   "balance"

Definition at line 196 of file gnc-lot.h.

◆ LOT_IS_CLOSED

#define LOT_IS_CLOSED   "is-closed?"

Definition at line 195 of file gnc-lot.h.

◆ LOT_NOTES

#define LOT_NOTES   "notes"

Definition at line 198 of file gnc-lot.h.

◆ LOT_TITLE

#define LOT_TITLE   "lot-title"

Definition at line 197 of file gnc-lot.h.

Function Documentation

◆ gnc_lot_add_split()

void gnc_lot_add_split ( GNCLot * lot,
Split * split )

Adds a split to this lot.

Note
  • All splits in a lot must be in the same account.
  • Splits are added unconditionally, with no regard for the accounting policy. To enforce a particular accounting policy, use the xaccSplitAssignToLot() routine instead.

Definition at line 580 of file gnc-lot.cpp.

581{
582 GNCLotPrivate* priv;
583 Account * acc;
584 if (!lot || !split) return;
585 priv = GET_PRIVATE(lot);
586
587 ENTER ("(lot=%p, split=%p) %s amt=%s val=%s", lot, split,
588 gnc_lot_get_title (lot),
589 gnc_num_dbg_to_string (split->amount),
590 gnc_num_dbg_to_string (split->value));
591 gnc_lot_begin_edit(lot);
592 acc = xaccSplitGetAccount (split);
593 qof_instance_set_dirty(QOF_INSTANCE(lot));
594 if (nullptr == priv->account)
595 {
596 xaccAccountInsertLot (acc, lot);
597 }
598 else if (priv->account != acc)
599 {
600 PERR ("splits from different accounts cannot "
601 "be added to this lot!\n"
602 "\tlot account=\'%s\', split account=\'%s\'\n",
603 xaccAccountGetName(priv->account), xaccAccountGetName (acc));
604 gnc_lot_commit_edit(lot);
605 LEAVE("different accounts");
606 return;
607 }
608
609 if (lot == split->lot)
610 {
611 gnc_lot_commit_edit(lot);
612 LEAVE("already in lot");
613 return; /* handle not-uncommon no-op */
614 }
615 if (split->lot)
616 {
617 gnc_lot_remove_split (split->lot, split);
618 }
619 xaccSplitSetLot(split, lot);
620
621 priv->splits = g_list_append (priv->splits, split);
622
623 /* for recomputation of is-closed */
624 priv->is_closed = LOT_CLOSED_UNKNOWN;
625 gnc_lot_commit_edit(lot);
626
627 qof_event_gen (QOF_INSTANCE(lot), QOF_EVENT_MODIFY, nullptr);
628 LEAVE("added to lot");
629}
const char * xaccAccountGetName(const Account *acc)
Get the account's name.
Definition Account.cpp:3270
void xaccAccountInsertLot(Account *acc, GNCLot *lot)
The xaccAccountInsertLot() method will register the indicated lot with this account.
Definition Account.cpp:2129
void qof_event_gen(QofInstance *entity, QofEventId event_id, gpointer event_data)
Invoke all registered event handlers using the given arguments.
Definition qofevent.cpp:231
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition qoflog.h:282
#define PERR(format, args...)
Log a serious error.
Definition qoflog.h:244
#define ENTER(format, args...)
Print a function entry debugging message.
Definition qoflog.h:272
void gnc_lot_remove_split(GNCLot *lot, Split *split)
Adds a split from this lot.
Definition gnc-lot.cpp:632
gchar * gnc_num_dbg_to_string(gnc_numeric n)
Convert to string.
void xaccSplitSetLot(Split *split, GNCLot *lot)
Assigns the split to a specific Lot.
Definition Split.cpp:1937
Account * xaccSplitGetAccount(const Split *split)
Returns the account of this split, which was set through xaccAccountInsertSplit().
STRUCTS.

◆ gnc_lot_begin_edit()

void gnc_lot_begin_edit ( GNCLot * lot)

Definition at line 320 of file gnc-lot.cpp.

321{
322 qof_begin_edit(QOF_INSTANCE(lot));
323}
gboolean qof_begin_edit(QofInstance *inst)
begin_edit

◆ gnc_lot_commit_edit()

void gnc_lot_commit_edit ( GNCLot * lot)

Definition at line 341 of file gnc-lot.cpp.

342{
343 if (!qof_commit_edit (QOF_INSTANCE(lot))) return;
344 qof_commit_edit_part2 (QOF_INSTANCE(lot), commit_err, noop, lot_free);
345}
gboolean qof_commit_edit_part2(QofInstance *inst, void(*on_error)(QofInstance *, QofBackendError), void(*on_done)(QofInstance *), void(*on_free)(QofInstance *))
part2 – deal with the backend
gboolean qof_commit_edit(QofInstance *inst)
commit_edit helpers

◆ gnc_lot_count_splits()

gint gnc_lot_count_splits ( const GNCLot * lot)

Definition at line 433 of file gnc-lot.cpp.

434{
435 GNCLotPrivate* priv;
436 if (!lot) return 0;
437 priv = GET_PRIVATE(lot);
438 return g_list_length (priv->splits);
439}

◆ gnc_lot_destroy()

void gnc_lot_destroy ( GNCLot * lot)

Definition at line 308 of file gnc-lot.cpp.

309{
310 if (!lot) return;
311
312 gnc_lot_begin_edit(lot);
313 qof_instance_set_destroying(lot, TRUE);
314 gnc_lot_commit_edit(lot);
315}

◆ gnc_lot_get_account()

Account * gnc_lot_get_account ( const GNCLot * lot)

Returns the account with which this lot is associated.

Definition at line 377 of file gnc-lot.cpp.

378{
379 GNCLotPrivate* priv;
380 if (!lot) return nullptr;
381 priv = GET_PRIVATE(lot);
382 return priv->account;
383}

◆ gnc_lot_get_balance()

gnc_numeric gnc_lot_get_balance ( GNCLot * lot)

Returns the lot balance.

This balance will be expressed in the lot account's commodity.

Definition at line 487 of file gnc-lot.cpp.

488{
489 GNCLotPrivate* priv;
490 GList *node;
491 gnc_numeric zero = gnc_numeric_zero();
492 gnc_numeric baln = zero;
493 if (!lot) return zero;
494
495 priv = GET_PRIVATE(lot);
496 if (!priv->splits)
497 {
498 priv->is_closed = FALSE;
499 return zero;
500 }
501
502 /* Sum over splits; because they all belong to same account
503 * they will have same denominator.
504 */
505 for (node = priv->splits; node; node = node->next)
506 {
507 Split *s = GNC_SPLIT(node->data);
508 if (xaccSplitIsStockSplit(s)) continue;
509 gnc_numeric amt = xaccSplitGetAdjustedAmount (s);
510 baln = gnc_numeric_add_fixed (baln, amt);
511 g_assert (gnc_numeric_check (baln) == GNC_ERROR_OK);
512 }
513
514 /* cache a zero balance as a closed lot */
515 if (gnc_numeric_equal (baln, zero))
516 {
517 priv->is_closed = TRUE;
518 }
519 else
520 {
521 priv->is_closed = FALSE;
522 }
523
524 return baln;
525}
GNCNumericErrorCode gnc_numeric_check(gnc_numeric in)
Check for error signal in value.
gboolean gnc_numeric_equal(gnc_numeric a, gnc_numeric b)
Equivalence predicate: Returns TRUE (1) if a and b represent the same number.
@ GNC_ERROR_OK
No error.
gnc_numeric xaccSplitGetAdjustedAmount(const Split *s)
Returns the stock-split adjusted amount of the split in the account's commodity.
Definition Split.cpp:1351
gboolean xaccSplitIsStockSplit(Split *s)
Returns true if the split is of type stock split.
Definition Split.cpp:2089

◆ gnc_lot_get_balance_before()

void gnc_lot_get_balance_before ( const GNCLot * lot,
const Split * split,
gnc_numeric * amount,
gnc_numeric * value )

Computes both the balance and value in the lot considering only splits in transactions prior to the one containing the given split or other splits in the same transaction.

The first return value is the amount and the second is the value.

Definition at line 530 of file gnc-lot.cpp.

532{
533 GNCLotPrivate* priv;
534 GList *node;
535 gnc_numeric zero = gnc_numeric_zero();
536 gnc_numeric amt = zero;
537 gnc_numeric val = zero;
538
539 *amount = amt;
540 *value = val;
541 if (lot == nullptr) return;
542
543 priv = GET_PRIVATE(lot);
544 if (priv->splits)
545 {
546 Transaction *ta, *tb;
547 const Split *target;
548 /* If this is a gains split, find the source of the gains and use
549 its transaction for the comparison. Gains splits are in separate
550 transactions that may sort after non-gains transactions. */
551 target = xaccSplitGetGainsSourceSplit (split);
552 if (target == nullptr)
553 target = split;
554 tb = xaccSplitGetParent (target);
555 for (node = priv->splits; node; node = node->next)
556 {
557 Split *s = GNC_SPLIT(node->data);
558 Split *source = xaccSplitGetGainsSourceSplit (s);
559 if (source == nullptr)
560 source = s;
561 ta = xaccSplitGetParent (source);
562 if ((ta == tb && source != target) ||
563 xaccTransOrder (ta, tb) < 0)
564 {
565 gnc_numeric tmpval = xaccSplitGetAdjustedAmount (s);
566 amt = gnc_numeric_add_fixed (amt, tmpval);
567 tmpval = xaccSplitGetValue (s);
568 val = gnc_numeric_add_fixed (val, tmpval);
569 }
570 }
571 }
572
573 *amount = amt;
574 *value = val;
575}
Split * xaccSplitGetGainsSourceSplit(const Split *split)
The xaccSplitGetGainsSourceSplit() routine returns the split that is the source of the cap gains in t...
int xaccTransOrder(const Transaction *ta, const Transaction *tb)
The xaccTransOrder(ta,tb) method is useful for sorting.
Transaction * xaccSplitGetParent(const Split *split)
Returns the parent transaction of the split.
gnc_numeric xaccSplitGetValue(const Split *split)
Returns the value of this split in the transaction's commodity.

◆ gnc_lot_get_book()

QofBook * gnc_lot_get_book ( GNCLot * lot)

Definition at line 359 of file gnc-lot.cpp.

360{
361 return qof_instance_get_book(QOF_INSTANCE(lot));
362}
QofBook * qof_instance_get_book(gconstpointer inst)
Return the book pointer.

◆ gnc_lot_get_cached_invoice()

GncInvoice * gnc_lot_get_cached_invoice ( const GNCLot * lot)

Returns the invoice with which this lot is associated.

Definition at line 385 of file gnc-lot.cpp.

386{
387 if (!lot) return nullptr;
388 else
389 {
390 GNCLotPrivate *priv = GET_PRIVATE(lot);
391 return priv->cached_invoice;
392 }
393}

◆ gnc_lot_get_earliest_split()

Split * gnc_lot_get_earliest_split ( GNCLot * lot)

Convenience routine to identify the earliest date in the lot.

It loops over all of the splits in the lot, and returns the split with the earliest split->transaction->date_posted. It may not necessarily identify the lot opening split.

Definition at line 659 of file gnc-lot.cpp.

660{
661 GNCLotPrivate* priv;
662 if (!lot) return nullptr;
663 priv = GET_PRIVATE(lot);
664 if (! priv->splits) return nullptr;
665 priv->splits = g_list_sort (priv->splits, (GCompareFunc) xaccSplitOrderDateOnly);
666 return GNC_SPLIT(priv->splits->data);
667}

◆ gnc_lot_get_latest_split()

Split * gnc_lot_get_latest_split ( GNCLot * lot)

Convenience routineto identify the date this lot was closed.

It simply loops over all of the splits in the lot, and returns the split with the latest split->transaction->date_posted.

Definition at line 671 of file gnc-lot.cpp.

672{
673 GNCLotPrivate* priv;
674 SplitList *node;
675
676 if (!lot) return nullptr;
677 priv = GET_PRIVATE(lot);
678 if (! priv->splits) return nullptr;
679 priv->splits = g_list_sort (priv->splits, (GCompareFunc) xaccSplitOrderDateOnly);
680
681 for (node = priv->splits; node->next; node = node->next)
682 ;
683
684 return GNC_SPLIT(node->data);
685}
GList SplitList
GList of Split.
Definition gnc-engine.h:207

◆ gnc_lot_get_notes()

const char * gnc_lot_get_notes ( const GNCLot * lot)

Definition at line 454 of file gnc-lot.cpp.

455{
456 if (!lot) return nullptr;
457
458 auto str{qof_instance_get_path_kvp<const char*> (QOF_INSTANCE (lot), {"notes"})};
459 return str ? *str : nullptr;
460}

◆ gnc_lot_get_split_list()

SplitList * gnc_lot_get_split_list ( const GNCLot * lot)

Returns a list of all the splits in this lot.

Returns
GList

This GList is owned and managed by the lot.

Definition at line 425 of file gnc-lot.cpp.

426{
427 GNCLotPrivate* priv;
428 if (!lot) return nullptr;
429 priv = GET_PRIVATE(lot);
430 return priv->splits;
431}

◆ gnc_lot_get_title()

const char * gnc_lot_get_title ( const GNCLot * lot)

Definition at line 445 of file gnc-lot.cpp.

446{
447 if (!lot) return nullptr;
448
449 auto str{qof_instance_get_path_kvp<const char*> (QOF_INSTANCE (lot), {"title"})};
450 return str ? *str : nullptr;
451}

◆ gnc_lot_is_closed()

gboolean gnc_lot_is_closed ( GNCLot * lot)

Returns closed status of the given lot.

A lot is closed if its balance is zero. This routine is faster than using gnc_lot_get_balance() because once the balance goes to zero, this fact is cached.

Returns
boolean

Definition at line 367 of file gnc-lot.cpp.

368{
369 GNCLotPrivate* priv;
370 if (!lot) return TRUE;
371 priv = GET_PRIVATE(lot);
372 if (0 > priv->is_closed) gnc_lot_get_balance (lot);
373 return priv->is_closed;
374}
gnc_numeric gnc_lot_get_balance(GNCLot *lot)
Returns the lot balance.
Definition gnc-lot.cpp:487

◆ gnc_lot_lookup()

GNCLot * gnc_lot_lookup ( const GncGUID * guid,
QofBook * book )

Definition at line 350 of file gnc-lot.cpp.

351{
352 QofCollection *col;
353 if (!guid || !book) return nullptr;
354 col = qof_book_get_collection (book, GNC_ID_LOT);
355 return (GNCLot *) qof_collection_lookup_entity (col, guid);
356}
QofCollection * qof_book_get_collection(const QofBook *book, QofIdType entity_type)
Return The table of entities of the given type.
Definition qofbook.cpp:521
QofInstance * qof_collection_lookup_entity(const QofCollection *col, const GncGUID *guid)
Find the entity going only from its guid.
Definition qofid.cpp:209

◆ gnc_lot_make_default()

GNCLot * gnc_lot_make_default ( Account * acc)
Todo
Document this function ?

Definition at line 766 of file gnc-lot.cpp.

767{
768 GNCLot * lot;
769 gint64 id = 0;
770 gchar *buff;
771
772 lot = gnc_lot_new (qof_instance_get_book(acc));
773
774 /* Provide a reasonable title for the new lot */
776 qof_instance_get (QOF_INSTANCE (acc), "lot-next-id", &id, nullptr);
777 buff = g_strdup_printf ("%s %" G_GINT64_FORMAT, _("Lot"), id);
778 gnc_lot_set_title (lot, buff);
779 id ++;
780 qof_instance_set (QOF_INSTANCE (acc), "lot-next-id", id, nullptr);
782 g_free (buff);
783 return lot;
784}
void xaccAccountCommitEdit(Account *acc)
ThexaccAccountCommitEdit() subroutine is the second phase of a two-phase-commit wrapper for account u...
Definition Account.cpp:1505
void xaccAccountBeginEdit(Account *acc)
The xaccAccountBeginEdit() subroutine is the first phase of a two-phase-commit wrapper for account up...
Definition Account.cpp:1464
void qof_instance_set(QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_set Group setting multiple parameters in a single begin/commit/rollback.
void qof_instance_get(const QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_get.

◆ gnc_lot_new()

GNCLot * gnc_lot_new ( QofBook * book)

Definition at line 267 of file gnc-lot.cpp.

268{
269 GNCLot *lot;
270 g_return_val_if_fail (book, nullptr);
271
272 lot = GNC_LOT(g_object_new (GNC_TYPE_LOT, nullptr));
273 qof_instance_init_data(QOF_INSTANCE(lot), GNC_ID_LOT, book);
274 qof_event_gen (QOF_INSTANCE(lot), QOF_EVENT_CREATE, nullptr);
275 return lot;
276}
void qof_instance_init_data(QofInstance *inst, QofIdType type, QofBook *book)
Initialise the settings associated with an instance.

◆ gnc_lot_remove_split()

void gnc_lot_remove_split ( GNCLot * lot,
Split * split )

Adds a split from this lot.

Definition at line 632 of file gnc-lot.cpp.

633{
634 GNCLotPrivate* priv;
635 if (!lot || !split) return;
636 priv = GET_PRIVATE(lot);
637
638 ENTER ("(lot=%p, split=%p)", lot, split);
639 gnc_lot_begin_edit(lot);
640 qof_instance_set_dirty(QOF_INSTANCE(lot));
641 priv->splits = g_list_remove (priv->splits, split);
642 xaccSplitSetLot(split, nullptr);
643 priv->is_closed = LOT_CLOSED_UNKNOWN; /* force an is-closed computation */
644
645 if (!priv->splits && priv->account)
646 {
647 xaccAccountRemoveLot (priv->account, lot);
648 priv->account = nullptr;
649 }
650 gnc_lot_commit_edit(lot);
651 qof_event_gen (QOF_INSTANCE(lot), QOF_EVENT_MODIFY, nullptr);
652 LEAVE("removed from lot");
653}

◆ gnc_lot_set_account()

void gnc_lot_set_account ( GNCLot * lot,
Account * account )

Definition at line 403 of file gnc-lot.cpp.

404{
405 if (lot != nullptr)
406 {
407 GNCLotPrivate* priv;
408 priv = GET_PRIVATE(lot);
409 priv->account = account;
410 }
411}

◆ gnc_lot_set_cached_invoice()

void gnc_lot_set_cached_invoice ( GNCLot * lot,
GncInvoice * invoice )

Definition at line 396 of file gnc-lot.cpp.

397{
398 if (!lot) return;
399 GET_PRIVATE(lot)->cached_invoice = invoice;
400}

◆ gnc_lot_set_closed_unknown()

void gnc_lot_set_closed_unknown ( GNCLot * lot)

Reset closed flag so that it will be recalculated.

Definition at line 414 of file gnc-lot.cpp.

415{
416 GNCLotPrivate* priv;
417 if (lot != nullptr)
418 {
419 priv = GET_PRIVATE(lot);
420 priv->is_closed = LOT_CLOSED_UNKNOWN;
421 }
422}

◆ gnc_lot_set_notes()

void gnc_lot_set_notes ( GNCLot * lot,
const char * str )

Definition at line 474 of file gnc-lot.cpp.

475{
476 if (!lot) return;
477
478 qof_begin_edit(QOF_INSTANCE(lot));
479 qof_instance_set_path_kvp<const char*> (QOF_INSTANCE (lot), g_strdup(str), {"notes"});
480 qof_instance_set_dirty(QOF_INSTANCE(lot));
481 gnc_lot_commit_edit(lot);
482}

◆ gnc_lot_set_title()

void gnc_lot_set_title ( GNCLot * lot,
const char * str )

Definition at line 463 of file gnc-lot.cpp.

464{
465 if (!lot) return;
466
467 qof_begin_edit(QOF_INSTANCE(lot));
468 qof_instance_set_path_kvp<const char*> (QOF_INSTANCE (lot), g_strdup(str), {"title"});
469 qof_instance_set_dirty(QOF_INSTANCE(lot));
470 gnc_lot_commit_edit(lot);
471}