Date: Sun, 24 Oct 1999 11:57:54 -0700

From: Dave Peticolas <peticola@morpheus.cs.ucdavis.edu>


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1948 57a11ea4-9604-0410-9ed3-97b8803252fd
zzzoldreleases/1.4
Linas Vepstas 27 years ago
parent e8dd6bccf0
commit 6302da0d08

@ -25,6 +25,11 @@
#include "messages.h"
#include "util.h"
/* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_ENGINE;
/* =========================================================== */
#define GNC_RETURN_ENUM_AS_STRING(x) case x: return #x;
@ -85,6 +90,48 @@ char * xaccAccountGetTypeStr (int type)
return (account_type_name [type]);
}
/* =========================================================== */
gncBoolean
xaccAccountTypesCompatible (int parent_type, int child_type)
{
gncBoolean compatible = GNC_F;
switch(parent_type)
{
case BANK:
case CASH:
case ASSET:
case STOCK:
case MUTUAL:
case CURRENCY:
compatible = ((child_type == BANK) ||
(child_type == CASH) ||
(child_type == ASSET) ||
(child_type == STOCK) ||
(child_type == MUTUAL) ||
(child_type == CURRENCY));
break;
case CREDIT:
case LIABILITY:
compatible = ((child_type == CREDIT) || (child_type == LIABILITY));
break;
case INCOME:
compatible = (child_type == INCOME);
break;
case EXPENSE:
compatible = (child_type == EXPENSE);
break;
case EQUITY:
compatible = (child_type == EQUITY);
break;
default:
PERR("xaccAccountTypesCompatible: bad account type: %d", parent_type);
break;
}
return compatible;
}
/* =========================================================== */
AccInfo *

@ -27,6 +27,8 @@
#define __ACCINFO_H__
#include "config.h"
#include "gnc-common.h"
/*
* The account types are used to determine how the transaction data
@ -41,6 +43,9 @@
enum
{
BAD_TYPE = -1,
/* Not a type */
BANK = 0,
/* The bank account type denotes a savings or checking account
* held at a bank. Often interest bearing.
@ -102,6 +107,9 @@ char * xaccAccountGetTypeStr (int type); /* GUI names */
Used for text exports */
char * xaccAccountTypeEnumAsString (int type);
gncBoolean xaccAccountTypesCompatible (int parent_type, int child_type);
typedef struct _BankAcct BankAcct;
typedef struct _InvAcct InvAcct;
typedef union _AccInfo AccInfo;

Loading…
Cancel
Save