Describes billing terms, that is when a bill is due, and what sort of discount is applied (if any).
More...
|
#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. More...
|
|
#define | gncBillTermGetGUID(x) qof_instance_get_guid (QOF_INSTANCE(x)) |
|
|
enum | GncBillTermType { GNC_TERM_TYPE_DAYS =1,
GNC_TERM_TYPE_PROXIMO,
GNC_TERM_TYPE_DAYS =1,
GNC_TERM_TYPE_PROXIMO
} |
|
enum | GncBillTermType { GNC_TERM_TYPE_DAYS =1,
GNC_TERM_TYPE_PROXIMO,
GNC_TERM_TYPE_DAYS =1,
GNC_TERM_TYPE_PROXIMO
} |
|
|
GType | gnc_billterm_get_type (void) |
|
time64 | gncBillTermComputeDueDate (const GncBillTerm *term, time64 post_date) |
|
|
#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" |
|
|
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) |
|
|
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) |
|
|
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) |
|
|
int | gncBillTermCompare (const GncBillTerm *a, const GncBillTerm *b) |
| Compare BillTerms on their name for sorting. More...
|
|
gboolean | gncBillTermEqual (const GncBillTerm *a, const GncBillTerm *b) |
| Check if all internal fields of a and b match. More...
|
|
gboolean | gncBillTermIsFamily (const GncBillTerm *a, const GncBillTerm *b) |
| Check only if the bill terms are "family". More...
|
|
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.
◆ 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.
◆ gncBillTermCompare()
int gncBillTermCompare |
( |
const GncBillTerm * |
a, |
|
|
const GncBillTerm * |
b |
|
) |
| |
Compare BillTerms on their name for sorting.
Definition at line 629 of file gncBillTerm.c.
633 if (!a && !b)
return 0;
637 ret = g_strcmp0 (a->name, b->name);
640 return g_strcmp0 (a->desc, b->desc);
◆ 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.
645 if (a == NULL && b == NULL)
return TRUE;
646 if (a == NULL || b == NULL)
return FALSE;
648 g_return_val_if_fail(GNC_IS_BILLTERM(a), FALSE);
649 g_return_val_if_fail(GNC_IS_BILLTERM(b), FALSE);
651 if (g_strcmp0(a->name, b->name) != 0)
653 PWARN(
"Names differ: %s vs %s", a->name, b->name);
657 if (g_strcmp0(a->desc, b->desc) != 0)
659 PWARN(
"Descriptions differ: %s vs %s", a->desc, b->desc);
663 if (a->type != b->type)
665 PWARN(
"Types differ");
669 if (a->due_days != b->due_days)
671 PWARN(
"Due days differ: %d vs %d", a->due_days, b->due_days);
675 if (a->disc_days != b->disc_days)
677 PWARN(
"Discount days differ: %d vs %d", a->disc_days, b->disc_days);
683 PWARN(
"Discounts differ");
687 if (a->cutoff != b->cutoff)
689 PWARN(
"Cutoffs differ: %d vs %d", a->cutoff, b->cutoff);
693 if (a->invisible != b->invisible)
695 PWARN(
"Invisible flags differ");
gboolean gnc_numeric_equal(gnc_numeric a, gnc_numeric b)
Equivalence predicate: Returns TRUE (1) if a and b represent the same number.
#define PWARN(format, args...)
Log a warning.
◆ 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.
int gncBillTermCompare(const GncBillTerm *a, const GncBillTerm *b)
Compare BillTerms on their name for sorting.