mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* gncInvoice.c -- implement GetTotal() -- fixes #96833
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7411 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
d245d4607b
commit
2fbc9d7d30
@ -5,6 +5,8 @@
|
||||
* invoice.glade: add a summary bar dock at the bottom of the page.
|
||||
Partial fix for bug #96833
|
||||
|
||||
* gncInvoice.c -- implement GetTotal() -- fixes #96833
|
||||
|
||||
2002-10-27 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/import-export/hbci/*.c: add #include config.h for correct
|
||||
|
@ -373,13 +373,6 @@ const char * gncInvoiceGetNotes (GncInvoice *invoice)
|
||||
return invoice->notes;
|
||||
}
|
||||
|
||||
gnc_numeric gncInvoiceGetTotal (GncInvoice *invoice)
|
||||
{
|
||||
gnc_numeric total = { 200, 100 };
|
||||
if (!invoice) return gnc_numeric_zero();
|
||||
return total;
|
||||
}
|
||||
|
||||
static GncOwnerType gncInvoiceGetOwnerType (GncInvoice *invoice)
|
||||
{
|
||||
GncOwner *owner;
|
||||
@ -389,6 +382,35 @@ static GncOwnerType gncInvoiceGetOwnerType (GncInvoice *invoice)
|
||||
return (gncOwnerGetType (owner));
|
||||
}
|
||||
|
||||
gnc_numeric gncInvoiceGetTotal (GncInvoice *invoice)
|
||||
{
|
||||
GList *node;
|
||||
gnc_numeric total = gnc_numeric_zero();
|
||||
gboolean reverse;
|
||||
|
||||
if (!invoice) return total;
|
||||
|
||||
reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
|
||||
|
||||
for (node = gncInvoiceGetEntries(invoice); node; node = node->next) {
|
||||
GncEntry *entry = node->data;
|
||||
gnc_numeric value, tax;
|
||||
|
||||
gncEntryGetValue (entry, reverse, &value, NULL, &tax, NULL);
|
||||
|
||||
if (gnc_numeric_check (value) == GNC_ERROR_OK)
|
||||
total = gnc_numeric_add (total, value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
|
||||
else
|
||||
g_warning ("bad value in our entry");
|
||||
|
||||
if (gnc_numeric_check (value) == GNC_ERROR_OK)
|
||||
total = gnc_numeric_add (total, tax, GNC_DENOM_AUTO, GNC_DENOM_LCD);
|
||||
else
|
||||
g_warning ("bad tax-value in our entry");
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
const char * gncInvoiceGetType (GncInvoice *invoice)
|
||||
{
|
||||
if (!invoice) return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user