Skip to content

Instantly share code, notes, and snippets.

@mauritslamers
Created October 23, 2019 15:47
Show Gist options
  • Save mauritslamers/0e09322d05fc122f87695456e7a6f8d5 to your computer and use it in GitHub Desktop.
Save mauritslamers/0e09322d05fc122f87695456e7a6f8d5 to your computer and use it in GitHub Desktop.
getter for invoice type
GncInvoiceType
gnc_invoice_get_type(InvoiceWindow *iw)
{
/* uses the same approach as gnc_invoice_get_title */
switch (gncOwnerGetType(&iw->owner))
{
case GNC_OWNER_CUSTOMER:
return iw->is_credit_note ? GNC_INVOICE_CUST_CREDIT_NOTE
: GNC_INVOICE_CUST_INVOICE;
break;
case GNC_OWNER_VENDOR:
return iw->is_credit_note ? GNC_INVOICE_VEND_CREDIT_NOTE
: GNC_INVOICE_VEND_INVOICE;
break;
case GNC_OWNER_EMPLOYEE:
return iw->is_credit_note ? GNC_INVOICE_EMPL_CREDIT_NOTE
: GNC_INVOICE_EMPL_INVOICE;
break;
default:
return GNC_INVOICE_UNDEFINED;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment