mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
start isolating the engine functions
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@672 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
67f863e41b
commit
2903edb8f9
@ -30,6 +30,7 @@
|
||||
#include "date.h"
|
||||
#include "messages.h"
|
||||
#include "Transaction.h"
|
||||
#include "TransactionP.h"
|
||||
#include "util.h"
|
||||
|
||||
int next_free_unique_account_id = 0;
|
||||
|
@ -87,6 +87,7 @@
|
||||
#include "FileIO.h"
|
||||
#include "Group.h"
|
||||
#include "messages.h"
|
||||
#include "TransactionP.h"
|
||||
#include "util.h"
|
||||
|
||||
#define PERMS 0666
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "Account.h"
|
||||
#include "Group.h"
|
||||
#include "TransactionP.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifndef FALSE
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "Account.h"
|
||||
#include "Group.h"
|
||||
#include "FileIO.h"
|
||||
#include "TransactionP.h"
|
||||
#include "util.h"
|
||||
|
||||
#define PERMS 0666
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "Account.h"
|
||||
#include "date.h"
|
||||
#include "Transaction.h"
|
||||
#include "TransactionP.h"
|
||||
#include "util.h"
|
||||
|
||||
/********************************************************************\
|
||||
@ -585,6 +586,21 @@ xaccTransSetReconcile (Transaction *trans, char recn)
|
||||
MARK_SPLIT (&(trans->source_split));
|
||||
}
|
||||
|
||||
void
|
||||
xaccTransSetDateToday (Transaction *trans)
|
||||
{
|
||||
todaysDate( &(trans->date) );
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
Split *
|
||||
xaccTransGetSourceSplit (Transaction *trans)
|
||||
{
|
||||
return (&(trans->source_split));
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
|
@ -48,38 +48,8 @@
|
||||
* between "dining", "tips" and "taxes" categories.
|
||||
*/
|
||||
|
||||
typedef struct _split {
|
||||
struct _account *acc; /* back-pointer to debited/credited account */
|
||||
struct _transaction *parent; /* parent of split */
|
||||
char * memo;
|
||||
char * action; /* Buy, Sell, Div, etc. */
|
||||
char reconciled;
|
||||
double damount; /* num-shares; if > 0.0, deposit, else paymt */
|
||||
double share_price; /* the share price, ==1.0 for bank account */
|
||||
|
||||
/* the various "balances" are the sum of all of the values of
|
||||
* all the splits in the account, up to and including this split */
|
||||
double balance;
|
||||
double cleared_balance;
|
||||
double reconciled_balance;
|
||||
|
||||
double share_balance;
|
||||
double share_cleared_balance;
|
||||
double share_reconciled_balance;
|
||||
|
||||
} Split;
|
||||
|
||||
|
||||
typedef struct _transaction {
|
||||
char * num; /* transaction id */
|
||||
Date date; /* transaction date */
|
||||
char * description;
|
||||
|
||||
Split source_split; /* source (creidted) account */
|
||||
Split **dest_splits; /* list of splits, null terminated */
|
||||
|
||||
char write_flag; /* used only during file IO */
|
||||
} Transaction;
|
||||
typedef struct _split Split;
|
||||
typedef struct _transaction Transaction;
|
||||
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
@ -98,12 +68,19 @@ Transaction * xaccMallocTransaction (void); /* mallocs and inits */
|
||||
void xaccInitTransaction (Transaction *);/* clears a trans struct */
|
||||
|
||||
void xaccTransSetDate (Transaction *, int day, int mon, int year);
|
||||
|
||||
/* set the transaction date to the current system time. */
|
||||
void xaccTransSetDateToday (Transaction *);
|
||||
|
||||
void xaccTransSetNum (Transaction *, const char *);
|
||||
void xaccTransSetDescription (Transaction *, const char *);
|
||||
void xaccTransSetMemo (Transaction *, const char *);
|
||||
void xaccTransSetAction (Transaction *, const char *);
|
||||
void xaccTransSetReconcile (Transaction *, char);
|
||||
|
||||
/* return pointer to the source split */
|
||||
Split * xaccTransGetSourceSplit (Transaction *);
|
||||
|
||||
void xaccSplitSetMemo (Split *, const char *);
|
||||
void xaccSplitSetAction (Split *, const char *);
|
||||
void xaccSplitSetReconcile (Split *, char);
|
||||
|
93
src/engine/TransactionP.h
Normal file
93
src/engine/TransactionP.h
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* FILE:
|
||||
* TransactionP.h
|
||||
*
|
||||
* FUNCTION:
|
||||
* The is the *private* transaction header file. Code outside of
|
||||
* engine should *not* include this file. This is because code
|
||||
* outside of the engine should *never* access any of the structure
|
||||
* members directly.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************************\
|
||||
* TransactionP.h -- defines transaction for xacc (X-Accountant) *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1997, 1998 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
* Author: Rob Clark *
|
||||
* Internet: rclark@cs.hmc.edu *
|
||||
* Address: 609 8th Street *
|
||||
* Huntington Beach, CA 92648-4632 *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __XACC_TRANSACTION_P_H__
|
||||
#define __XACC_TRANSACTION_P_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "date.h" /* for Date */
|
||||
#include "Transaction.h" /* for typedefs */
|
||||
|
||||
|
||||
/** STRUCTS *********************************************************/
|
||||
/* The debit & credit pointers are used to implement a double-entry
|
||||
* accounting system. Basically, the idea with double entry is that
|
||||
* there is always an account that is debited, and another that is
|
||||
* credited. These two pointers identify the two accounts.
|
||||
*/
|
||||
|
||||
/* A split transaction is one which shows up as a credit (or debit) in
|
||||
* one account, and peices of it show up as debits (or credits) in other
|
||||
* accounts. Thus, a single credit-card transaction might be split
|
||||
* between "dining", "tips" and "taxes" categories.
|
||||
*/
|
||||
|
||||
struct _split {
|
||||
struct _account *acc; /* back-pointer to debited/credited account */
|
||||
struct _transaction *parent; /* parent of split */
|
||||
char * memo;
|
||||
char * action; /* Buy, Sell, Div, etc. */
|
||||
char reconciled;
|
||||
double damount; /* num-shares; if > 0.0, deposit, else paymt */
|
||||
double share_price; /* the share price, ==1.0 for bank account */
|
||||
|
||||
/* the various "balances" are the sum of all of the values of
|
||||
* all the splits in the account, up to and including this split */
|
||||
double balance;
|
||||
double cleared_balance;
|
||||
double reconciled_balance;
|
||||
|
||||
double share_balance;
|
||||
double share_cleared_balance;
|
||||
double share_reconciled_balance;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct _transaction {
|
||||
char * num; /* transaction id */
|
||||
Date date; /* transaction date */
|
||||
char * description;
|
||||
|
||||
Split source_split; /* source (creidted) account */
|
||||
Split **dest_splits; /* list of splits, null terminated */
|
||||
|
||||
char write_flag; /* used only during file IO */
|
||||
};
|
||||
|
||||
|
||||
#endif /* __XACC_TRANSACTION_P_H__ */
|
Loading…
Reference in New Issue
Block a user