X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fhomebank;a=blobdiff_plain;f=src%2Fhb-transaction.h;h=47f8ed80dfb24d3fd1b77b3148d0f189f1a18500;hp=ca6666ee146e5d243fdc1234dc6a49647c06f70b;hb=HEAD;hpb=27f6e3b112df235c8e9afc9911b1f6bce208a001 diff --git a/src/hb-transaction.h b/src/hb-transaction.h index ca6666e..47f8ed8 100644 --- a/src/hb-transaction.h +++ b/src/hb-transaction.h @@ -1,5 +1,5 @@ /* HomeBank -- Free, easy, personal accounting for everyone. - * Copyright (C) 1995-2014 Maxime DOYEN + * Copyright (C) 1995-2019 Maxime DOYEN * * This file is part of HomeBank. * @@ -17,24 +17,17 @@ * along with this program. If not, see . */ + #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; -}; - +#include "hb-account.h" struct _transaction { @@ -44,48 +37,71 @@ struct _transaction gushort flags; guint32 kpay; guint32 kcat; - gchar *wording; + gchar *memo; 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]; + + GPtrArray *splits; /* unsaved datas */ - GList *same; //used for import todo: change this + guint32 kcur; + gushort marker; + gushort pad1; gdouble balance; + gboolean overdraft; + GList *same; //used for import todo: change this }; -#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; + +enum { + TXN_MARK_NONE, + TXN_MARK_DUPSRC, + TXN_MARK_DUPDST +}; + + Transaction *da_transaction_malloc(void); -Transaction *da_transaction_copy(Transaction *src_txn, Transaction *dst_txn); +//Transaction *da_transaction_copy(Transaction *src_txn, Transaction *dst_txn); Transaction *da_transaction_init_from_template(Transaction *txn, Archive *arc); +Transaction *da_transaction_set_default_template(Transaction *txn); Transaction *da_transaction_clone(Transaction *src_item); void da_transaction_clean(Transaction *item); 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 @@ -97,33 +113,30 @@ enum 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_remove(Transaction *ope); +void transaction_changed(Transaction *txn); +gboolean da_transaction_insert_memo(Transaction *item); +Transaction *transaction_add(GtkWindow *parent, Transaction *ope); -void transaction_add_treeview(Transaction *ope, GtkWidget *treeview, guint32 accnum); -void transaction_add(Transaction *ope, GtkWidget *treeview, guint32 accnum); +gboolean transaction_acc_move(Transaction *txn, guint32 okacc, guint32 nkacc); -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); +Transaction *transaction_xfer_child_strong_get(Transaction *src); +void transaction_xfer_search_or_add_child(GtkWindow *parent, Transaction *ope, guint32 kdstacc); 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_child_sync(Transaction *s_txn, Transaction *child); +void transaction_xfer_remove_child(Transaction *src); Transaction *transaction_old_get_child_transfer(Transaction *src); -guint transaction_tags_count(Transaction *ope); -guint transaction_tags_parse(Transaction *ope, const gchar *tagstring); -gchar *transaction_tags_tostring(Transaction *ope); -gint transaction_auto_assign(GList *ope_list, guint32 key); +guint transaction_auto_assign(GList *ope_list, guint32 key); void da_transaction_consistency(Transaction *item); + +gint transaction_similar_mark(Account *acc, guint32 daygap); +void transaction_similar_unmark(Account *acc); + + #endif