Contarius/include/subaccount.h

33 lines
954 B
C

/**
* @file subaccount.h
* Subaccount strucuture header file used in the program
*/
#ifndef SUBACCOUNT_H
#define SUBACCOUNT_H
#include "money.h"
#include "entry.h"
/**
* @struct subaccount
* @brief Struct representing a subaccount on the T-Account
*
*/
typedef struct subaccount {
char *name; ///< Name of the subaccount
char *description; ///< Description of the subaccount
Money *value; ///< Total of the values of the entries
Entry *entries; ///< List of entries
int numberOfEntries; ///< Counter of entries in the subaccount
struct subaccount *next; ///< Reference to the next subaccount
} SubAccount;
SubAccount *initializeSubAccount(char *name, char *description);
void updateSubAccountValue(SubAccount *subaccount, Money *value);
void addEntryToSubAccount(SubAccount *subaccount, Entry *entry);
void appendSubAccount(SubAccount *subaccount, SubAccount *newSubaccount);
void destroySubAccount(SubAccount *subaccount);
#endif