/* HomeBank -- Free, easy, personal accounting for everyone.
- * Copyright (C) 1995-2014 Maxime DOYEN
+ * Copyright (C) 1995-2016 Maxime DOYEN
*
* This file is part of HomeBank.
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef __HB_TRANSACTION_H__
#define __HB_TRANSACTION_H__
-#include "hb-archive.h"
+#include "hb-split.h"
-#define TXN_MAX_SPLIT 10
-typedef struct _split Split;
typedef struct _transaction Transaction;
-struct _split
-{
- guint32 kcat;
- gdouble amount;
- gchar *memo;
-};
-
-
struct _transaction
{
gdouble amount;
guint32 date;
gushort pos;
+ gushort status;
gchar *info;
guint32 *tags;
- guint32 kxfer; //internal xfer key
+ guint32 kxfer; //strong link xfer key
guint32 kxferacc;
Split *splits[TXN_MAX_SPLIT+1];
/* unsaved datas */
GList *same; //used for import todo: change this
+ guint32 kcur;
gdouble balance;
};
-#define OF_VALID (1<<0)
+#include "hb-archive.h"
+
+#define OF_OLDVALID (1<<0) //deprecated since 5.x
#define OF_INCOME (1<<1)
-#define OF_AUTO (1<<2) //tmp flag scheduled
+#define OF_AUTO (1<<2) //scheduled
#define OF_ADDED (1<<3) //tmp flag
#define OF_CHANGED (1<<4) //tmp flag
-#define OF_REMIND (1<<5)
+#define OF_OLDREMIND (1<<5) //deprecated since 5.x
#define OF_CHEQ2 (1<<6)
#define OF_LIMIT (1<<7) //scheduled
#define OF_SPLIT (1<<8)
+typedef enum {
+ TXN_STATUS_NONE,
+ TXN_STATUS_CLEARED,
+ TXN_STATUS_RECONCILED,
+ TXN_STATUS_REMIND,
+ //TXN_VOID
+} HbTxnStatus;
+
Transaction *da_transaction_malloc(void);
Transaction *da_transaction_copy(Transaction *src_txn, Transaction *dst_txn);
void da_transaction_free(Transaction *item);
GList *da_transaction_new(void);
-void da_transaction_destroy(GList *list);
+void da_transaction_destroy(void);
+void da_transaction_queue_sort(GQueue *queue);
GList *da_transaction_sort(GList *list);
gboolean da_transaction_prepend(Transaction *item);
gboolean da_transaction_insert_sorted(Transaction *item);
-guint32 da_transaction_get_max_kxfer(void);
/*
** transaction edit type
TRANSACTION_EDIT_MODIFY
};
-void da_transaction_splits_append(Transaction *txn, Split *split);
-void da_transaction_splits_free(Transaction *txn);
-guint da_transaction_splits_count(Transaction *txn);
-void da_transaction_splits_clone(Transaction *stxn, Transaction *dtxn);
-
-Split *da_split_new(guint32 kcat, gdouble amount, gchar *memo);
-guint transaction_splits_parse(Transaction *ope, gchar *cats, gchar *amounts, gchar *memos);
-guint transaction_splits_tostring(Transaction *ope, gchar **cats, gchar **amounts, gchar **memos);
+guint da_transaction_length(void);
void transaction_add_treeview(Transaction *ope, GtkWidget *treeview, guint32 accnum);
void transaction_add(Transaction *ope, GtkWidget *treeview, guint32 accnum);
-Transaction *transaction_strong_get_child_transfer(Transaction *src);
-GList *transaction_match_get_child_transfer(Transaction *src);
-Transaction *ui_dialog_transaction_xfer_select_child(GList *matchlist);
-void transaction_xfer_search_or_add_child(Transaction *ope, GtkWidget *treeview);
-void transaction_xfer_create_child(Transaction *ope, GtkWidget *treeview);
+gboolean transaction_acc_move(Transaction *txn, guint32 okacc, guint32 nkacc);
+
+Transaction *transaction_xfer_child_strong_get(Transaction *src);
+void transaction_xfer_search_or_add_child(GtkWindow *parentwindow, Transaction *ope, gboolean manual);
void transaction_xfer_change_to_child(Transaction *ope, Transaction *child);
void transaction_xfer_sync_child(Transaction *ope, Transaction *child);
-void transaction_xfer_delete_child(Transaction *src);
+void transaction_xfer_remove_child(Transaction *src);
Transaction *transaction_old_get_child_transfer(Transaction *src);
guint transaction_tags_count(Transaction *ope);
+void transaction_tags_clone(Transaction *src_txn, Transaction *dst_txn);
guint transaction_tags_parse(Transaction *ope, const gchar *tagstring);
gchar *transaction_tags_tostring(Transaction *ope);
gint transaction_auto_assign(GList *ope_list, guint32 key);