GnuCash c935c2f+
Loading...
Searching...
No Matches
Files | Macros | Enumerations | Functions

Describes billing terms, that is when a bill is due, and what sort of discount is applied (if any). More...

Files

file  gncBillTerm.h
 Billing Term interface.
 

Macros

#define GNC_ID_BILLTERM   "gncBillTerm"
 
#define GNC_TYPE_BILLTERM   (gnc_billterm_get_type ())
 
#define GNC_BILLTERM(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_BILLTERM, GncBillTerm))
 
#define GNC_BILLTERM_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_BILLTERM, GncBillTermClass))
 
#define GNC_IS_BILLTERM(o)    (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_BILLTERM))
 
#define GNC_IS_BILLTERM_CLASS(k)    (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_BILLTERM))
 
#define GNC_BILLTERM_GET_CLASS(o)    (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_BILLTERM, GncBillTermClass))
 
#define ENUM_TERMS_TYPE(_)
 How to interpret the amount.
 
#define gncBillTermGetGUID(x)   qof_instance_get_guid (QOF_INSTANCE(x))
 

Enumerations

enum  GncBillTermType { ENUM_TERMS_TYPE =(ENUM_BODY) }
 

Functions

GType gnc_billterm_get_type (void)
 
time64 gncBillTermComputeDueDate (const GncBillTerm *term, time64 post_date)
 

Create/Destroy Functions

GncBillTerm * gncBillTermCreate (QofBook *book)
 
void gncBillTermDestroy (GncBillTerm *term)
 
void gncBillTermIncRef (GncBillTerm *term)
 
void gncBillTermDecRef (GncBillTerm *term)
 
void gncBillTermChanged (GncBillTerm *term)
 
void gncBillTermBeginEdit (GncBillTerm *term)
 
void gncBillTermCommitEdit (GncBillTerm *term)
 

Set Functions

void gncBillTermSetName (GncBillTerm *term, const char *name)
 
void gncBillTermSetDescription (GncBillTerm *term, const char *name)
 
void gncBillTermSetType (GncBillTerm *term, GncBillTermType type)
 
void gncBillTermSetDueDays (GncBillTerm *term, gint days)
 
void gncBillTermSetDiscountDays (GncBillTerm *term, gint days)
 
void gncBillTermSetDiscount (GncBillTerm *term, gnc_numeric discount)
 
void gncBillTermSetCutoff (GncBillTerm *term, gint cutoff)
 

Get Functions

GncBillTerm * gncBillTermLookupByName (QofBook *book, const char *name)
 
GList * gncBillTermGetTerms (QofBook *book)
 
const char * gncBillTermGetName (const GncBillTerm *term)
 
const char * gncBillTermGetDescription (const GncBillTerm *term)
 
GncBillTermType gncBillTermGetType (const GncBillTerm *term)
 
gint gncBillTermGetDueDays (const GncBillTerm *term)
 
gint gncBillTermGetDiscountDays (const GncBillTerm *term)
 
gnc_numeric gncBillTermGetDiscount (const GncBillTerm *term)
 
gint gncBillTermGetCutoff (const GncBillTerm *term)
 
gboolean gncBillTermIsDirty (const GncBillTerm *term)
 
GncBillTerm * gncBillTermGetParent (const GncBillTerm *term)
 
GncBillTerm * gncBillTermReturnChild (GncBillTerm *term, gboolean make_new)
 
gint64 gncBillTermGetRefcount (const GncBillTerm *term)
 
#define gncBillTermGetChild(t)   gncBillTermReturnChild((t),FALSE)
 

Comparison Functions

int gncBillTermCompare (const GncBillTerm *a, const GncBillTerm *b)
 Compare BillTerms on their name for sorting.
 
gboolean gncBillTermEqual (const GncBillTerm *a, const GncBillTerm *b)
 Check if all internal fields of a and b match.
 
gboolean gncBillTermIsFamily (const GncBillTerm *a, const GncBillTerm *b)
 Check only if the bill terms are "family".
 

BillTerm parameter names

#define GNC_BILLTERM_NAME   "name"
 
#define GNC_BILLTERM_DESC   "description"
 
#define GNC_BILLTERM_DUEDAYS   "number of days due"
 
#define GNC_BILLTERM_DISCDAYS   "number of discounted days"
 
#define GNC_BILLTERM_CUTOFF   "cut off"
 
#define GNC_BILLTERM_TYPE   "bill type"
 
#define GNC_BILLTERM_DISCOUNT   "amount of discount"
 
#define GNC_BILLTERM_REFCOUNT   "reference count"
 

Detailed Description

Describes billing terms, that is when a bill is due, and what sort of discount is applied (if any).

The BillTerm object currently supports: the discount applied to a bill (absolute numeric value) the number of days until a discount expires information about the invoice due date

This last one can be defined in multiple ways: using a simple number of days value: the due date is posted date incremented with this number of days using the "proximo" method which is explained below:

A proximo billing term has two parameters: due day: day of the month the invoice/bill will be due cutoff: day of the month used to decide if the due date will be in the next month or in the month thereafter. This can be a negative number in which case the cutoff date is relative to the end of the month and counting backwards. Eg: cutoff = -3 would mean 25 in February or 28 in June

How does it work: Assume cutoff = 19 and due day = 20

Example 1 post date = 14-06-2010 (European date format) 14 is less than the cutoff of 19, so the due date will be in the next month. Since the due day is set to 20, the due date will be 20-07-2010

Example 2 post date = 22-06-2010 (European date format) 22 is more than the cutoff of 19, so the due date will be in the month after next month. Since the due day is set to 20, the due date will be 20-02-2010

Note
A billing term added to an invoice is immutable, that is it can't change any more. To achieve that a billing term is copied when added to an invoice. This uses some internal fields to track this which are explained in Some notes on tracking fields in gncBillTerm and gncTaxTable objects.

Macro Definition Documentation

◆ ENUM_TERMS_TYPE

#define ENUM_TERMS_TYPE (   _)
Value:
_(GNC_TERM_TYPE_DAYS,=1) \
_(GNC_TERM_TYPE_PROXIMO,)

How to interpret the amount.

You can interpret it as a VALUE or a PERCENT. ??? huh? NOTE: This enum /depends/ on starting at value 1

Definition at line 116 of file gncBillTerm.h.

122{
123 GNC_TERM_TYPE_DAYS = 1,
124 GNC_TERM_TYPE_PROXIMO,
125} GncBillTermType;
126#endif
127
130GncBillTerm * gncBillTermCreate (QofBook *book);
131void gncBillTermDestroy (GncBillTerm *term);
132void gncBillTermIncRef (GncBillTerm *term);
133void gncBillTermDecRef (GncBillTerm *term);
134
135void gncBillTermChanged (GncBillTerm *term);
136void gncBillTermBeginEdit (GncBillTerm *term);
137void gncBillTermCommitEdit (GncBillTerm *term);
143void gncBillTermSetName (GncBillTerm *term, const char *name);
144void gncBillTermSetDescription (GncBillTerm *term, const char *name);
145void gncBillTermSetType (GncBillTerm *term, GncBillTermType type);
146void gncBillTermSetDueDays (GncBillTerm *term, gint days);
147void gncBillTermSetDiscountDays (GncBillTerm *term, gint days);
148void gncBillTermSetDiscount (GncBillTerm *term, gnc_numeric discount);
149void gncBillTermSetCutoff (GncBillTerm *term, gint cutoff);
150
159static inline GncBillTerm * gncBillTermLookup (const QofBook *book, const GncGUID *guid)
160{
161 QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_BILLTERM, GncBillTerm);
162}
163
164GncBillTerm *gncBillTermLookupByName (QofBook *book, const char *name);
165GList * gncBillTermGetTerms (QofBook *book);
166
167const char *gncBillTermGetName (const GncBillTerm *term);
168const char *gncBillTermGetDescription (const GncBillTerm *term);
169GncBillTermType gncBillTermGetType (const GncBillTerm *term);
170gint gncBillTermGetDueDays (const GncBillTerm *term);
171gint gncBillTermGetDiscountDays (const GncBillTerm *term);
172gnc_numeric gncBillTermGetDiscount (const GncBillTerm *term);
173gint gncBillTermGetCutoff (const GncBillTerm *term);
174
175gboolean gncBillTermIsDirty (const GncBillTerm *term);
176
177GncBillTerm *gncBillTermGetParent (const GncBillTerm *term);
178GncBillTerm *gncBillTermReturnChild (GncBillTerm *term, gboolean make_new);
179#define gncBillTermGetChild(t) gncBillTermReturnChild((t),FALSE)
180gint64 gncBillTermGetRefcount (const GncBillTerm *term);
186int gncBillTermCompare (const GncBillTerm *a, const GncBillTerm *b);
188gboolean gncBillTermEqual(const GncBillTerm *a, const GncBillTerm *b);
197gboolean gncBillTermIsFamily (const GncBillTerm *a, const GncBillTerm *b);
200/********************************************************/
201/* functions to compute dates from Bill Terms */
202
203/* Compute the due date and discount dates from the post date */
204time64 gncBillTermComputeDueDate (const GncBillTerm *term, time64 post_date);
205
206/* deprecated */
207#define gncBillTermGetGUID(x) qof_instance_get_guid (QOF_INSTANCE(x))
208
209#ifdef __cplusplus
210}
211#endif
212
213#endif /* GNC_BILLTERM_H_ */
gboolean gncBillTermEqual(const GncBillTerm *a, const GncBillTerm *b)
Check if all internal fields of a and b match.
int gncBillTermCompare(const GncBillTerm *a, const GncBillTerm *b)
Compare BillTerms on their name for sorting.
gboolean gncBillTermIsFamily(const GncBillTerm *a, const GncBillTerm *b)
Check only if the bill terms are "family".
#define QOF_BOOK_RETURN_ENTITY(book, guid, e_type, c_type)
Encapsulates all the information about a dataset manipulated by QOF.
Definition qofbook.h:101
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
The type used to store guids in C.
Definition guid.h:75
QofBook reference.
Definition qofbook-p.hpp:47

◆ GNC_BILLTERM

#define GNC_BILLTERM (   o)     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_BILLTERM, GncBillTerm))

Definition at line 85 of file gncBillTerm.h.

◆ GNC_BILLTERM_CLASS

#define GNC_BILLTERM_CLASS (   k)     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_BILLTERM, GncBillTermClass))

Definition at line 87 of file gncBillTerm.h.

◆ GNC_BILLTERM_CUTOFF

#define GNC_BILLTERM_CUTOFF   "cut off"

Definition at line 103 of file gncBillTerm.h.

◆ GNC_BILLTERM_DESC

#define GNC_BILLTERM_DESC   "description"

Definition at line 100 of file gncBillTerm.h.

◆ GNC_BILLTERM_DISCDAYS

#define GNC_BILLTERM_DISCDAYS   "number of discounted days"

Definition at line 102 of file gncBillTerm.h.

◆ GNC_BILLTERM_DISCOUNT

#define GNC_BILLTERM_DISCOUNT   "amount of discount"

Definition at line 105 of file gncBillTerm.h.

◆ GNC_BILLTERM_DUEDAYS

#define GNC_BILLTERM_DUEDAYS   "number of days due"

Definition at line 101 of file gncBillTerm.h.

◆ GNC_BILLTERM_GET_CLASS

#define GNC_BILLTERM_GET_CLASS (   o)     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_BILLTERM, GncBillTermClass))

Definition at line 93 of file gncBillTerm.h.

◆ GNC_BILLTERM_NAME

#define GNC_BILLTERM_NAME   "name"

Definition at line 99 of file gncBillTerm.h.

◆ GNC_BILLTERM_REFCOUNT

#define GNC_BILLTERM_REFCOUNT   "reference count"

Definition at line 106 of file gncBillTerm.h.

◆ GNC_BILLTERM_TYPE

#define GNC_BILLTERM_TYPE   "bill type"

Definition at line 104 of file gncBillTerm.h.

◆ GNC_ID_BILLTERM

#define GNC_ID_BILLTERM   "gncBillTerm"

Definition at line 81 of file gncBillTerm.h.

◆ GNC_IS_BILLTERM

#define GNC_IS_BILLTERM (   o)     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_BILLTERM))

Definition at line 89 of file gncBillTerm.h.

◆ GNC_IS_BILLTERM_CLASS

#define GNC_IS_BILLTERM_CLASS (   k)     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_BILLTERM))

Definition at line 91 of file gncBillTerm.h.

◆ GNC_TYPE_BILLTERM

#define GNC_TYPE_BILLTERM   (gnc_billterm_get_type ())

Definition at line 84 of file gncBillTerm.h.

◆ gncBillTermGetChild

#define gncBillTermGetChild (   t)    gncBillTermReturnChild((t),FALSE)

Definition at line 180 of file gncBillTerm.h.

◆ gncBillTermGetGUID

#define gncBillTermGetGUID (   x)    qof_instance_get_guid (QOF_INSTANCE(x))

Definition at line 208 of file gncBillTerm.h.

Enumeration Type Documentation

◆ GncBillTermType

enum GncBillTermType

Definition at line 120 of file gncBillTerm.h.

Function Documentation

◆ gncBillTermBeginEdit()

void gncBillTermBeginEdit ( GncBillTerm *  term)

Definition at line 466 of file gncBillTerm.c.

467{
468 qof_begin_edit(&term->inst);
469}
gboolean qof_begin_edit(QofInstance *inst)
begin_edit

◆ gncBillTermChanged()

void gncBillTermChanged ( GncBillTerm *  term)

Definition at line 460 of file gncBillTerm.c.

461{
462 if (!term) return;
463 term->child = NULL;
464}

◆ gncBillTermCommitEdit()

void gncBillTermCommitEdit ( GncBillTerm *  term)

Definition at line 485 of file gncBillTerm.c.

486{
487 if (!qof_commit_edit (QOF_INSTANCE(term))) return;
488 qof_commit_edit_part2 (&term->inst, gncBillTermOnError,
489 on_done, bill_free);
490}
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

◆ gncBillTermCompare()

int gncBillTermCompare ( const GncBillTerm *  a,
const GncBillTerm *  b 
)

Compare BillTerms on their name for sorting.

Definition at line 629 of file gncBillTerm.c.

630{
631 int ret;
632
633 if (!a && !b) return 0;
634 if (!a) return -1;
635 if (!b) return 1;
636
637 ret = g_strcmp0 (a->name, b->name);
638 if (ret) return ret;
639
640 return g_strcmp0 (a->desc, b->desc);
641}

◆ gncBillTermComputeDueDate()

time64 gncBillTermComputeDueDate ( const GncBillTerm *  term,
time64  post_date 
)

Definition at line 824 of file gncBillTerm.c.

825{
826 if (!term) return post_date;
827 return compute_time (term, post_date, term->due_days);
828}

◆ gncBillTermCreate()

GncBillTerm * gncBillTermCreate ( QofBook book)

Definition at line 248 of file gncBillTerm.c.

249{
250 GncBillTerm *term;
251 if (!book) return NULL;
252
253 term = g_object_new (GNC_TYPE_BILLTERM, NULL);
254 qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
255 term->name = CACHE_INSERT ("");
256 term->desc = CACHE_INSERT ("");
257 term->discount = gnc_numeric_zero ();
258 addObj (term);
259 qof_event_gen (&term->inst, QOF_EVENT_CREATE, NULL);
260 return term;
261}
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
void qof_instance_init_data(QofInstance *inst, QofIdType type, QofBook *book)
Initialise the settings associated with an instance.

◆ gncBillTermDecRef()

void gncBillTermDecRef ( GncBillTerm *  term)

Definition at line 430 of file gncBillTerm.c.

431{
432 if (!term) return;
433 if (term->parent || term->invisible) return; /* children dont need refcounts */
434 g_return_if_fail (term->refcount >= 1);
435 gncBillTermBeginEdit (term);
436 term->refcount--;
437 mark_term (term);
438 gncBillTermCommitEdit (term);
439}

◆ gncBillTermDestroy()

void gncBillTermDestroy ( GncBillTerm *  term)

Definition at line 263 of file gncBillTerm.c.

264{
265 gchar guidstr[GUID_ENCODING_LENGTH+1];
266 if (!term) return;
267 guid_to_string_buff(qof_instance_get_guid(&term->inst),guidstr);
268 DEBUG("destroying bill term %s (%p)", guidstr, term);
269 qof_instance_set_destroying(term, TRUE);
270 qof_instance_set_dirty (&term->inst);
271 gncBillTermCommitEdit (term);
272}
#define GUID_ENCODING_LENGTH
Number of characters needed to encode a guid as a string not including the null terminator.
Definition guid.h:84
gchar * guid_to_string_buff(const GncGUID *guid, gchar *str)
The guid_to_string_buff() routine puts a null-terminated string encoding of the id into the memory po...
Definition guid.cpp:208
const GncGUID * qof_instance_get_guid(gconstpointer inst)
Return the GncGUID of this instance.
#define DEBUG(format, args...)
Print a debugging message.
Definition qoflog.h:264

◆ gncBillTermEqual()

gboolean gncBillTermEqual ( const GncBillTerm *  a,
const GncBillTerm *  b 
)

Check if all internal fields of a and b match.

Definition at line 643 of file gncBillTerm.c.

644{
645 if (a == NULL && b == NULL) return TRUE;
646 if (a == NULL || b == NULL) return FALSE;
647
648 g_return_val_if_fail(GNC_IS_BILLTERM(a), FALSE);
649 g_return_val_if_fail(GNC_IS_BILLTERM(b), FALSE);
650
651 if (g_strcmp0(a->name, b->name) != 0)
652 {
653 PWARN("Names differ: %s vs %s", a->name, b->name);
654 return FALSE;
655 }
656
657 if (g_strcmp0(a->desc, b->desc) != 0)
658 {
659 PWARN("Descriptions differ: %s vs %s", a->desc, b->desc);
660 return FALSE;
661 }
662
663 if (a->type != b->type)
664 {
665 PWARN("Types differ");
666 return FALSE;
667 }
668
669 if (a->due_days != b->due_days)
670 {
671 PWARN("Due days differ: %d vs %d", a->due_days, b->due_days);
672 return FALSE;
673 }
674
675 if (a->disc_days != b->disc_days)
676 {
677 PWARN("Discount days differ: %d vs %d", a->disc_days, b->disc_days);
678 return FALSE;
679 }
680
681 if (!gnc_numeric_equal(a->discount, b->discount))
682 {
683 PWARN("Discounts differ");
684 return FALSE;
685 }
686
687 if (a->cutoff != b->cutoff)
688 {
689 PWARN("Cutoffs differ: %d vs %d", a->cutoff, b->cutoff);
690 return FALSE;
691 }
692
693 if (a->invisible != b->invisible)
694 {
695 PWARN("Invisible flags differ");
696 return FALSE;
697 }
698
699// gint64 refcount;
700// GncBillTerm * parent; /* if non-null, we are an immutable child */
701// GncBillTerm * child; /* if non-null, we have not changed */
702// GList * children; /* list of children for disconnection */
703
704 return TRUE;
705}
#define PWARN(format, args...)
Log a warning.
Definition qoflog.h:250
gboolean gnc_numeric_equal(gnc_numeric a, gnc_numeric b)
Equivalence predicate: Returns TRUE (1) if a and b represent the same number.

◆ gncBillTermGetCutoff()

gint gncBillTermGetCutoff ( const GncBillTerm *  term)

Definition at line 565 of file gncBillTerm.c.

566{
567 if (!term) return 0;
568 return term->cutoff;
569}

◆ gncBillTermGetDescription()

const char * gncBillTermGetDescription ( const GncBillTerm *  term)

Definition at line 522 of file gncBillTerm.c.

523{
524 if (!term) return NULL;
525 return term->desc;
526}

◆ gncBillTermGetDiscount()

gnc_numeric gncBillTermGetDiscount ( const GncBillTerm *  term)

Definition at line 559 of file gncBillTerm.c.

560{
561 if (!term) return gnc_numeric_zero ();
562 return term->discount;
563}

◆ gncBillTermGetDiscountDays()

gint gncBillTermGetDiscountDays ( const GncBillTerm *  term)

Definition at line 553 of file gncBillTerm.c.

554{
555 if (!term) return 0;
556 return term->disc_days;
557}

◆ gncBillTermGetDueDays()

gint gncBillTermGetDueDays ( const GncBillTerm *  term)

Definition at line 547 of file gncBillTerm.c.

548{
549 if (!term) return 0;
550 return term->due_days;
551}

◆ gncBillTermGetName()

const char * gncBillTermGetName ( const GncBillTerm *  term)

Definition at line 516 of file gncBillTerm.c.

517{
518 if (!term) return NULL;
519 return term->name;
520}

◆ gncBillTermGetParent()

GncBillTerm * gncBillTermGetParent ( const GncBillTerm *  term)

Definition at line 611 of file gncBillTerm.c.

612{
613 if (!term) return NULL;
614 return term->parent;
615}

◆ gncBillTermGetRefcount()

gint64 gncBillTermGetRefcount ( const GncBillTerm *  term)

Definition at line 617 of file gncBillTerm.c.

618{
619 if (!term) return 0;
620 return term->refcount;
621}

◆ gncBillTermGetTerms()

GList * gncBillTermGetTerms ( QofBook book)

Definition at line 507 of file gncBillTerm.c.

508{
509 struct _book_info *bi;
510 if (!book) return NULL;
511
512 bi = qof_book_get_data (book, _GNC_MOD_NAME);
513 return bi->terms;
514}

◆ gncBillTermGetType()

GncBillTermType gncBillTermGetType ( const GncBillTerm *  term)

Definition at line 528 of file gncBillTerm.c.

529{
530 if (!term) return 0;
531 return term->type;
532}

◆ gncBillTermIncRef()

void gncBillTermIncRef ( GncBillTerm *  term)

Definition at line 420 of file gncBillTerm.c.

421{
422 if (!term) return;
423 if (term->parent || term->invisible) return; /* children dont need refcounts */
424 gncBillTermBeginEdit (term);
425 term->refcount++;
426 mark_term (term);
427 gncBillTermCommitEdit (term);
428}

◆ gncBillTermIsDirty()

gboolean gncBillTermIsDirty ( const GncBillTerm *  term)

Definition at line 715 of file gncBillTerm.c.

716{
717 if (!term) return FALSE;
718 return qof_instance_get_dirty_flag(term);
719}
gboolean qof_instance_get_dirty_flag(gconstpointer ptr)
Retrieve the flag that indicates whether or not this object has been modified.

◆ gncBillTermIsFamily()

gboolean gncBillTermIsFamily ( const GncBillTerm *  a,
const GncBillTerm *  b 
)

Check only if the bill terms are "family".

This is the case if

  • a and b are the same bill term
  • a is b's parent or vice versa
  • a and be are children of the same parent

In practice, this check if performed by comparing the bill term's names. This is required to be unique per parent/children group.

Definition at line 707 of file gncBillTerm.c.

708{
709 if (!gncBillTermCompare (a, b))
710 return TRUE;
711 else
712 return FALSE;
713}

◆ gncBillTermLookupByName()

GncBillTerm * gncBillTermLookupByName ( QofBook book,
const char *  name 
)

Definition at line 494 of file gncBillTerm.c.

495{
496 GList *list = gncBillTermGetTerms (book);
497
498 for ( ; list; list = list->next)
499 {
500 GncBillTerm *term = list->data;
501 if (!g_strcmp0 (term->name, name))
502 return list->data;
503 }
504 return NULL;
505}

◆ gncBillTermReturnChild()

GncBillTerm * gncBillTermReturnChild ( GncBillTerm *  term,
gboolean  make_new 
)

Definition at line 595 of file gncBillTerm.c.

596{
597 GncBillTerm *child = NULL;
598
599 if (!term) return NULL;
600 if (term->child) return term->child;
601 if (term->parent || term->invisible) return term;
602 if (make_new)
603 {
604 child = gncBillTermCopy (term);
605 gncBillTermSetChild (term, child);
606 gncBillTermSetParent (child, term);
607 }
608 return child;
609}

◆ gncBillTermSetCutoff()

void gncBillTermSetCutoff ( GncBillTerm *  term,
gint  cutoff 
)

Definition at line 378 of file gncBillTerm.c.

379{
380 if (!term) return;
381 if (term->cutoff == cutoff) return;
382 gncBillTermBeginEdit (term);
383 term->cutoff = cutoff;
384 mark_term (term);
385 gncBillTermCommitEdit (term);
386}

◆ gncBillTermSetDescription()

void gncBillTermSetDescription ( GncBillTerm *  term,
const char *  name 
)

Definition at line 317 of file gncBillTerm.c.

318{
319 if (!term || !desc) return;
320 SET_STR (term, term->desc, desc);
321 mark_term (term);
322 maybe_resort_list (term);
323 gncBillTermCommitEdit (term);
324}

◆ gncBillTermSetDiscount()

void gncBillTermSetDiscount ( GncBillTerm *  term,
gnc_numeric  discount 
)

Definition at line 368 of file gncBillTerm.c.

369{
370 if (!term) return;
371 if (gnc_numeric_eq (term->discount, discount)) return;
372 gncBillTermBeginEdit (term);
373 term->discount = discount;
374 mark_term (term);
375 gncBillTermCommitEdit (term);
376}
gboolean gnc_numeric_eq(gnc_numeric a, gnc_numeric b)
Equivalence predicate: Returns TRUE (1) if a and b are exactly the same (have the same numerator and ...

◆ gncBillTermSetDiscountDays()

void gncBillTermSetDiscountDays ( GncBillTerm *  term,
gint  days 
)

Definition at line 358 of file gncBillTerm.c.

359{
360 if (!term) return;
361 if (term->disc_days == days) return;
362 gncBillTermBeginEdit (term);
363 term->disc_days = days;
364 mark_term (term);
365 gncBillTermCommitEdit (term);
366}

◆ gncBillTermSetDueDays()

void gncBillTermSetDueDays ( GncBillTerm *  term,
gint  days 
)

Definition at line 348 of file gncBillTerm.c.

349{
350 if (!term) return;
351 if (term->due_days == days) return;
352 gncBillTermBeginEdit (term);
353 term->due_days = days;
354 mark_term (term);
355 gncBillTermCommitEdit (term);
356}

◆ gncBillTermSetName()

void gncBillTermSetName ( GncBillTerm *  term,
const char *  name 
)

Definition at line 308 of file gncBillTerm.c.

309{
310 if (!term || !name) return;
311 SET_STR (term, term->name, name);
312 mark_term (term);
313 maybe_resort_list (term);
314 gncBillTermCommitEdit (term);
315}

◆ gncBillTermSetType()

void gncBillTermSetType ( GncBillTerm *  term,
GncBillTermType  type 
)

Definition at line 326 of file gncBillTerm.c.

327{
328 if (!term) return;
329 if (term->type == type) return;
330 gncBillTermBeginEdit (term);
331 term->type = type;
332 mark_term (term);
333 gncBillTermCommitEdit (term);
334}