add a currency trading account type

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1179 57a11ea4-9604-0410-9ed3-97b8803252fd
zzzoldfeatures/xacc-12-patch
Linas Vepstas 28 years ago
parent 657222d6cc
commit 430e2a2fd8

@ -15,9 +15,10 @@ char *account_type_name[NUM_ACCOUNT_TYPES] =
INCOME_STR,
EXPENSE_STR,
EQUITY_STR,
CHECKING_STR,
SAVINGS_STR,
CHECKING_STR,
SAVINGS_STR,
MONEYMRKT_STR,
CREDITLINE_STR
CREDITLINE_STR,
CURRENCY_STR
};

@ -89,13 +89,13 @@ enum
MONEYMRKT = 12,
CREDITLINE = 13, /* line of credit */
/* CURRENCY = 20, */
CURRENCY = 14,
/* The currency account type indicates that the account is a currency trading
* account. In many ways, a currency trading account is like a stock trading
* account, where both quantities and prices are set.
*/
NUM_ACCOUNT_TYPES = 14
NUM_ACCOUNT_TYPES = 15
};
/* hack alert -- we need a better way of dealing with

@ -674,7 +674,16 @@ xaccAccountSetType (Account *acc, int tip)
if (!acc) return;
CHECK (acc);
/* hack alert -- check for a valid type */
/* After an account type has been set, it cannot be changed */
if (-1 < acc->type) {
printf ("Error: xaccAccountSetType(): "
"the type of the account cannot be changed "
"after its been set! \n"
);
return;
}
/* hack alert -- check to make sure type is valid ... */
acc->type = tip;
}
@ -682,7 +691,7 @@ void
xaccAccountSetName (Account *acc, char *str)
{
char * tmp;
if (!acc) return;
if ((!acc) || (!str)) return;
CHECK (acc);
/* make strdup before freeing */
@ -695,7 +704,7 @@ void
xaccAccountSetDescription (Account *acc, char *str)
{
char * tmp;
if (!acc) return;
if ((!acc) || (!str)) return;
CHECK (acc);
/* make strdup before freeing */
@ -717,6 +726,22 @@ xaccAccountSetNotes (Account *acc, char *str)
acc->notes = tmp;
}
void
xaccAccountSetCurrency (Account *acc, char *str)
{
if ((!acc) || (!str)) return;
CHECK (acc);
if (acc->currency) {
printf ("Error: xacAccountSetCurrency(): "
"the currency denomination of an account "
"cannot be changed!\n"
);
return;
}
acc->currency = strdup (str);
}
/********************************************************************\
\********************************************************************/
@ -762,6 +787,13 @@ xaccAccountGetNotes (Account *acc)
return (acc->notes);
}
char *
xaccAccountGetCurrency (Account *acc)
{
if (!acc) return NULL;
return (acc->notes);
}
double
xaccAccountGetBalance (Account *acc)
{

@ -52,7 +52,7 @@ int xaccGetAccountID (Account *);
/*
* The xaccAccountInsertSplit() method will insert the indicated
* split into the indicated account. If the split already
* belongs to anothe account, it will be removed from that
* belongs to another account, it will be removed from that
* account first.
*/
void xaccAccountInsertSplit (Account *, Split *);
@ -101,11 +101,13 @@ void xaccAccountSetType (Account *, int);
void xaccAccountSetName (Account *, char *);
void xaccAccountSetDescription (Account *, char *);
void xaccAccountSetNotes (Account *, char *);
void xaccAccountSetCurrency (Account *, char *);
int xaccAccountGetType (Account *);
char * xaccAccountGetName (Account *);
char * xaccAccountGetDescription (Account *);
char * xaccAccountGetNotes (Account *);
char * xaccAccountGetCurrency (Account *);
AccountGroup * xaccAccountGetChildren (Account *);
AccountGroup * xaccAccountGetParent (Account *);

Loading…
Cancel
Save