mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
move credit account to split
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@376 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
bf3d975da9
commit
a0e9dfb56f
@ -133,9 +133,9 @@ freeAccount( Account *acc )
|
||||
if (!trans) continue;
|
||||
/* free the transaction only if its not
|
||||
* a part of a double entry */
|
||||
if (_acc == trans->credit) trans->credit = NULL;
|
||||
if (_acc == trans->credit_split.acc) trans->credit_split.acc = NULL;
|
||||
if (_acc == trans->debit) trans->debit = NULL;
|
||||
if ( (NULL == trans->debit) && (NULL == trans->credit) ) {
|
||||
if ( (NULL == trans->debit) && (NULL == trans->credit_split.acc) ) {
|
||||
freeTransaction( trans );
|
||||
}
|
||||
}
|
||||
@ -257,7 +257,8 @@ removeTransaction( Account *acc, int num )
|
||||
|
||||
/* if this is a double-entry transaction, be sure to
|
||||
* unmark it. */
|
||||
if (((Account *)trans->credit) == acc) trans->credit = NULL;
|
||||
if (((Account *)trans->credit_split.acc) == acc)
|
||||
trans->credit_split.acc = NULL;
|
||||
if (((Account *)trans->debit) == acc) trans->debit = NULL;
|
||||
|
||||
return trans;
|
||||
@ -307,11 +308,11 @@ insertTransaction( Account *acc, Transaction *trans )
|
||||
* in another account, assume this is the other half.
|
||||
*/
|
||||
|
||||
if ( (acc != (Account *) trans->credit) &&
|
||||
if ( (acc != (Account *) trans->credit_split.acc) &&
|
||||
(acc != (Account *) trans->debit) ) {
|
||||
|
||||
if (NULL == trans->credit) {
|
||||
trans->credit = (struct _account *) acc;
|
||||
if (NULL == trans->credit_split.acc) {
|
||||
trans->credit_split.acc = (struct _account *) acc;
|
||||
} else
|
||||
if (NULL == trans->debit) {
|
||||
trans->debit = (struct _account *) acc;
|
||||
@ -323,7 +324,7 @@ insertTransaction( Account *acc, Transaction *trans )
|
||||
}
|
||||
}
|
||||
|
||||
if (trans->debit == trans->credit) {
|
||||
if (trans->debit == trans->credit_split.acc) {
|
||||
printf ("Internal Error: insertTransaction(): \n");
|
||||
printf ("debited and credit accounts cannot be the same\n");
|
||||
return -1;
|
||||
@ -448,9 +449,9 @@ xaccGetOtherAccount( Account *acc, Transaction *trans )
|
||||
if (NULL == acc) return NULL;
|
||||
|
||||
if (acc == ((Account *) trans->debit)) {
|
||||
return ((Account *) trans->credit);
|
||||
return ((Account *) trans->credit_split.acc);
|
||||
} else
|
||||
if (acc == ((Account *) trans->credit)) {
|
||||
if (acc == ((Account *) trans->credit_split.acc)) {
|
||||
return ((Account *) trans->debit);
|
||||
} else {
|
||||
printf ("Internal Error: xaccGetOtherAccount(): inconsistent entry \n");
|
||||
@ -477,19 +478,22 @@ double xaccGetAmount (Account *acc, Transaction *trans)
|
||||
double xaccGetShareAmount (Account *acc, Transaction *trans)
|
||||
{
|
||||
double themount; /* amount */
|
||||
struct _account *_acc = (struct _account *) acc;
|
||||
|
||||
if (NULL == trans) return 0.0;
|
||||
if (NULL == acc) return 0.0;
|
||||
|
||||
/* for a double-entry, determine if this is a credit or a debit */
|
||||
if ( trans->credit == ((struct _account *) acc) ) {
|
||||
if ( trans->credit_split.acc == _acc ) {
|
||||
themount = trans->damount;
|
||||
} else
|
||||
if ( trans->debit == ((struct _account *) acc) ) {
|
||||
if ( trans->debit == _acc ) {
|
||||
themount = - (trans->damount);
|
||||
} else {
|
||||
printf ("Internal Error: xaccGetShareAmount: missing double entry \n");
|
||||
printf ("this error should not occur. Please report the problem. \n");
|
||||
printf ("acc=%p deb=%p cred=%p\n", acc, trans->debit, trans->credit);
|
||||
printf ("acc=%p deb=%p cred=%p\n",
|
||||
acc, trans->debit, trans->credit_split.acc);
|
||||
themount = 0.0; /* punt */
|
||||
}
|
||||
return themount;
|
||||
@ -500,11 +504,13 @@ double xaccGetShareAmount (Account *acc, Transaction *trans)
|
||||
|
||||
void xaccSetShareAmount (Account *acc, Transaction *trans, double themount)
|
||||
{
|
||||
struct _account *_acc = (struct _account *) acc;
|
||||
|
||||
/* for a double-entry, determine if this is a credit or a debit */
|
||||
if ( trans->credit == ((struct _account *) acc) ) {
|
||||
if ( trans->credit_split.acc == _acc ) {
|
||||
trans->damount = themount;
|
||||
} else
|
||||
if ( trans->debit == ((struct _account *) acc) ) {
|
||||
if ( trans->debit == _acc ) {
|
||||
trans->damount = - themount;
|
||||
} else {
|
||||
printf ("Internal Error: xaccSetShareAmount: missing double entry \n");
|
||||
@ -530,12 +536,13 @@ void xaccSetAmount (Account *acc, Transaction *trans, double themount)
|
||||
double xaccGetBalance (Account *acc, Transaction *trans)
|
||||
{
|
||||
double themount; /* amount */
|
||||
struct _account *_acc = (struct _account *) acc;
|
||||
|
||||
/* for a double-entry, determine if this is a credit or a debit */
|
||||
if ( trans->credit == ((struct _account *) acc) ) {
|
||||
if ( trans->credit_split.acc == _acc ) {
|
||||
themount = trans->credit_balance;
|
||||
} else
|
||||
if ( trans->debit == ((struct _account *) acc) ) {
|
||||
if ( trans->debit == _acc ) {
|
||||
themount = trans->debit_balance;
|
||||
} else {
|
||||
printf ("Internal Error: xaccGetBalance: missing double entry \n");
|
||||
@ -551,12 +558,13 @@ double xaccGetBalance (Account *acc, Transaction *trans)
|
||||
double xaccGetClearedBalance (Account *acc, Transaction *trans)
|
||||
{
|
||||
double themount; /* amount */
|
||||
|
||||
struct _account *_acc = (struct _account *) acc;
|
||||
|
||||
/* for a double-entry, determine if this is a credit or a debit */
|
||||
if ( trans->credit == ((struct _account *) acc) ) {
|
||||
if ( trans->credit_split.acc == _acc ) {
|
||||
themount = trans->credit_cleared_balance;
|
||||
} else
|
||||
if ( trans->debit == ((struct _account *) acc) ) {
|
||||
if ( trans->debit == _acc ) {
|
||||
themount = trans->debit_cleared_balance;
|
||||
} else {
|
||||
printf ("Internal Error: xaccGetClearedBalance: missing double entry \n");
|
||||
@ -572,12 +580,13 @@ double xaccGetClearedBalance (Account *acc, Transaction *trans)
|
||||
double xaccGetReconciledBalance (Account *acc, Transaction *trans)
|
||||
{
|
||||
double themount; /* amount */
|
||||
struct _account *_acc = (struct _account *) acc;
|
||||
|
||||
/* for a double-entry, determine if this is a credit or a debit */
|
||||
if ( trans->credit == ((struct _account *) acc) ) {
|
||||
if ( trans->credit_split.acc == _acc ) {
|
||||
themount = trans->credit_reconciled_balance;
|
||||
} else
|
||||
if ( trans->debit == ((struct _account *) acc) ) {
|
||||
if ( trans->debit == _acc ) {
|
||||
themount = trans->debit_reconciled_balance;
|
||||
} else {
|
||||
printf ("Internal Error: xaccGetReconciledBalance: missing double entry \n");
|
||||
@ -593,12 +602,13 @@ double xaccGetReconciledBalance (Account *acc, Transaction *trans)
|
||||
double xaccGetShareBalance (Account *acc, Transaction *trans)
|
||||
{
|
||||
double themount; /* amount */
|
||||
struct _account *_acc = (struct _account *) acc;
|
||||
|
||||
/* for a double-entry, determine if this is a credit or a debit */
|
||||
if ( trans->credit == ((struct _account *) acc) ) {
|
||||
if ( trans->credit_split.acc == _acc ) {
|
||||
themount = trans->credit_share_balance;
|
||||
} else
|
||||
if ( trans->debit == ((struct _account *) acc) ) {
|
||||
if ( trans->debit == _acc ) {
|
||||
themount = trans->debit_share_balance;
|
||||
} else {
|
||||
printf ("Internal Error: xaccGetShareBalance: missing double entry \n");
|
||||
@ -669,7 +679,7 @@ xaccRecomputeBalance( Account * acc )
|
||||
dreconciled_balance += amt * (trans->share_price);
|
||||
}
|
||||
|
||||
tracc = (Account *) trans->credit;
|
||||
tracc = (Account *) trans->credit_split.acc;
|
||||
if (tracc == acc) {
|
||||
/* For bank accounts, the invarient subtotal is the dollar
|
||||
* amount. For stock accoounts, the invarient is the share amount */
|
||||
@ -797,7 +807,7 @@ xaccCheckDateOrderDE (Transaction *trans )
|
||||
|
||||
if (NULL == trans) return 0;
|
||||
|
||||
acc = (Account *) (trans->credit);
|
||||
acc = (Account *) (trans->credit_split.acc);
|
||||
outOfOrder += xaccCheckDateOrder (acc, trans);
|
||||
acc = (Account *) (trans->debit);
|
||||
outOfOrder += xaccCheckDateOrder (acc, trans);
|
||||
@ -882,7 +892,7 @@ xaccConsolidateTransactions (Account * acc)
|
||||
|
||||
/* if no match, then continue on in the loop.
|
||||
* we really must match everything to get a duplicate */
|
||||
if (ta->credit != tb->credit) continue;
|
||||
if (ta->credit_split.acc != tb->credit_split.acc) continue;
|
||||
if (ta->debit != tb->debit) continue;
|
||||
if (ta->credit_split.reconciled != tb->credit_split.reconciled) continue;
|
||||
if (ta->date.year != tb->date.year) continue;
|
||||
@ -898,13 +908,13 @@ xaccConsolidateTransactions (Account * acc)
|
||||
/* if we got to here, then there must be a duplicate. */
|
||||
/* before deleting it, remove it from the other
|
||||
* double-entry account */
|
||||
if (acc == (Account *) tb->credit) {
|
||||
if (acc == (Account *) tb->credit_split.acc) {
|
||||
xaccRemoveTransaction ((Account *) tb->debit, tb);
|
||||
}
|
||||
if (acc == (Account *) tb->debit) {
|
||||
xaccRemoveTransaction ((Account *) tb->credit, tb);
|
||||
xaccRemoveTransaction ((Account *) tb->credit_split.acc, tb);
|
||||
}
|
||||
tb->credit = NULL;
|
||||
tb->credit_split.acc = NULL;
|
||||
tb->debit = NULL;
|
||||
|
||||
/* Free the transaction, and shuffle down by one.
|
||||
|
@ -561,8 +561,10 @@ xaccMergeAccounts (AccountGroup *grp)
|
||||
Transaction *trans;
|
||||
trans = acc_b->transaction[k];
|
||||
acc_b->transaction[k] = NULL;
|
||||
if (acc_b == (Account *) trans->debit) trans->debit = (struct _account *) acc_a;
|
||||
if (acc_b == (Account *) trans->credit) trans->credit = (struct _account *) acc_a;
|
||||
if (acc_b == (Account *) trans->debit)
|
||||
trans->debit = (struct _account *) acc_a;
|
||||
if (acc_b == (Account *) trans->credit_split.acc)
|
||||
trans->credit_split.acc = (struct _account *) acc_a;
|
||||
insertTransaction (acc_a, trans);
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ readTransaction( int fd, Account *acc, int token )
|
||||
XACC_FLIP_INT (acc_id);
|
||||
INFO_2 ("readTransaction(): credit %d\n", acc_id);
|
||||
peer_acc = locateAccount (acc_id);
|
||||
trans -> credit = (struct _account *) peer_acc;
|
||||
trans -> credit_split.acc = (struct _account *) peer_acc;
|
||||
|
||||
/* insert the transaction into both the debit and
|
||||
* the credit accounts; first the credit ... */
|
||||
@ -1032,7 +1032,7 @@ writeTransaction( int fd, Transaction *trans )
|
||||
return -1;
|
||||
|
||||
/* write the double-entry values */
|
||||
xfer_acc = (Account *) (trans->credit);
|
||||
xfer_acc = (Account *) (trans->credit_split.acc);
|
||||
acc_id = -1;
|
||||
if (xfer_acc) acc_id = xfer_acc -> id;
|
||||
INFO_2 ("writeTransaction: credit %d \n", acc_id);
|
||||
|
12
src/QIFIO.c
12
src/QIFIO.c
@ -606,7 +606,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
|
||||
|
||||
if (!qifline) {
|
||||
xaccRemoveTransaction ((Account *) trans->debit, trans);
|
||||
xaccRemoveTransaction ((Account *) trans->credit, trans);
|
||||
xaccRemoveTransaction ((Account *) trans->credit_split.acc, trans);
|
||||
freeTransaction (trans);
|
||||
return NULL;
|
||||
}
|
||||
@ -774,7 +774,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
|
||||
* transaction, and return */
|
||||
if ('!' == qifline[0]) {
|
||||
xaccRemoveTransaction ((Account *) trans->debit, trans);
|
||||
xaccRemoveTransaction ((Account *) trans->credit, trans);
|
||||
xaccRemoveTransaction ((Account *) trans->credit_split.acc, trans);
|
||||
freeTransaction (trans);
|
||||
return qifline;
|
||||
}
|
||||
@ -807,7 +807,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
|
||||
* sub_acc; the security account is credited.
|
||||
* But, just in case its missing, avoid a core dump */
|
||||
if (sub_acc) {
|
||||
trans->credit = (struct _account *) sub_acc;
|
||||
trans->credit_split.acc = (struct _account *) sub_acc;
|
||||
insertTransaction (sub_acc, trans);
|
||||
}
|
||||
} else {
|
||||
@ -819,10 +819,10 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
|
||||
* account gets the dividend credit; otherwise, the
|
||||
* main account gets it */
|
||||
if (xfer_acc) {
|
||||
trans->credit = (struct _account *) xfer_acc;
|
||||
trans->credit_split.acc = (struct _account *) xfer_acc;
|
||||
insertTransaction (xfer_acc, trans);
|
||||
} else {
|
||||
trans->credit = (struct _account *) acc;
|
||||
trans->credit_split.acc = (struct _account *) acc;
|
||||
insertTransaction( acc, trans );
|
||||
}
|
||||
}
|
||||
@ -836,7 +836,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc)
|
||||
}
|
||||
|
||||
/* the transaction itself appears as a credit */
|
||||
trans->credit = (struct _account *) acc;
|
||||
trans->credit_split.acc = (struct _account *) acc;
|
||||
insertTransaction( acc, trans );
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ xaccGetDisplayAmountStrings (RegWindow *regData,
|
||||
acc = (Account *) (trans->debit);
|
||||
show_debit = xaccIsAccountInList (acc, regData->blackacc);
|
||||
|
||||
acc = (Account *) (trans->credit);
|
||||
acc = (Account *) (trans->credit_split.acc);
|
||||
show_credit = xaccIsAccountInList (acc, regData->blackacc);
|
||||
|
||||
/* attempt to keep all displayed quantities positive by
|
||||
@ -427,7 +427,7 @@ xaccGetDisplayAmountStrings (RegWindow *regData,
|
||||
}
|
||||
|
||||
show_credit = 0;
|
||||
acc = (Account *) (trans->credit);
|
||||
acc = (Account *) (trans->credit_split.acc);
|
||||
if (acc) {
|
||||
if ((MUTUAL == acc->type) || (STOCK == acc->type) ) {
|
||||
show_credit = xaccIsAccountInList (acc, regData->blackacc);
|
||||
@ -562,8 +562,8 @@ regRefresh( RegWindow *regData )
|
||||
trans = tarray[i];
|
||||
if (0.0 > trans->damount) {
|
||||
struct _account *tmp;
|
||||
tmp = trans->credit;
|
||||
trans->credit = trans->debit;
|
||||
tmp = trans->credit_split.acc;
|
||||
trans->credit_split.acc = trans->debit;
|
||||
trans->debit = tmp;
|
||||
trans->damount = - (trans->damount);
|
||||
}
|
||||
@ -597,7 +597,7 @@ regRefresh( RegWindow *regData )
|
||||
sprintf( buf, "%s", xfer_acc->accountName );
|
||||
newData[row+XFRM_CELL_R][XFRM_CELL_C] = XtNewString(buf);
|
||||
}
|
||||
xfer_acc = (Account *) trans -> credit;
|
||||
xfer_acc = (Account *) trans -> credit_split.acc;
|
||||
if (xfer_acc) {
|
||||
sprintf( buf, "%s", xfer_acc->accountName );
|
||||
newData[row+XTO_CELL_R][XTO_CELL_C] = XtNewString(buf);
|
||||
@ -703,7 +703,7 @@ regRefresh( RegWindow *regData )
|
||||
}
|
||||
|
||||
show_credit = 0;
|
||||
acc = (Account *) (trans->credit);
|
||||
acc = (Account *) (trans->credit_split.acc);
|
||||
if (acc) {
|
||||
if ( (MUTUAL == acc->type) || (STOCK == acc->type) ) {
|
||||
show_credit = xaccIsAccountInList (acc, regData->blackacc);
|
||||
@ -838,7 +838,7 @@ regRecalculateBalance( RegWindow *regData )
|
||||
continue;
|
||||
}
|
||||
|
||||
credit_acc = (Account *) (trans->credit);
|
||||
credit_acc = (Account *) (trans->credit_split.acc);
|
||||
debit_acc = (Account *) (trans->debit);
|
||||
|
||||
/* figure out if this transaction shows up as a debit
|
||||
@ -1040,7 +1040,7 @@ regRecalculateBalance( RegWindow *regData )
|
||||
#else
|
||||
value = DABS(value);
|
||||
#endif
|
||||
acc = (Account *) (trans->credit);
|
||||
acc = (Account *) (trans->credit_split.acc);
|
||||
show = xaccIsAccountInList (acc, regData->blackacc);
|
||||
/* show only if value is non-zero (it may be zero if a price
|
||||
* is recorded) */
|
||||
@ -1067,7 +1067,7 @@ regRecalculateBalance( RegWindow *regData )
|
||||
}
|
||||
}
|
||||
|
||||
acc = (Account *) (trans->credit);
|
||||
acc = (Account *) (trans->credit_split.acc);
|
||||
if (acc) {
|
||||
if ((MUTUAL == acc->type) || (STOCK == acc->type)) {
|
||||
show += xaccIsAccountInList (acc, regData->blackacc);
|
||||
@ -1235,12 +1235,12 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
acc->parent->saved = False;
|
||||
|
||||
/* by default, new transactions are considered credits */
|
||||
trans->credit = (struct _account *) acc;
|
||||
trans->credit_split.acc = (struct _account *) acc;
|
||||
}
|
||||
} else {
|
||||
/* Be sure to prompt the user to save to disk after changes are made! */
|
||||
Account *acc;
|
||||
acc = (Account *) trans->credit;
|
||||
acc = (Account *) trans->credit_split.acc;
|
||||
if (acc) acc->parent->saved = False;
|
||||
acc = (Account *) trans->debit;
|
||||
if (acc) acc->parent->saved = False;
|
||||
@ -1268,7 +1268,7 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
DEBUG("MOD_XTO_PHASE_ONE\n");
|
||||
|
||||
/* for a general ledger, from and to are easy to determine */
|
||||
xfer_acct = (Account *) trans->credit;
|
||||
xfer_acct = (Account *) trans->credit_split.acc;
|
||||
|
||||
if (xfer_acct) {
|
||||
/* remove the transaction from wherever it used to be */
|
||||
@ -1320,7 +1320,7 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
/* if a transfer account exists, and we are not trying to transfer
|
||||
* from ourself to ourself, then proceed, otheriwse ignore. */
|
||||
if (xfer_acct) {
|
||||
if (((1 < regData->numAcc) && (xfer_acct != (Account *) (trans->credit)))
|
||||
if (((1 < regData->numAcc) && (xfer_acct != (Account *) (trans->credit_split.acc)))
|
||||
|| ((1 >= regData->numAcc) && (xfer_acct != regData->blackacc[0])) ) {
|
||||
|
||||
/* for a new transaction, the default will be that the
|
||||
@ -1374,12 +1374,13 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
if (xfer_acct != ((Account *) (trans->debit))) {
|
||||
/* for a ledger, the transfer-to account is always
|
||||
* the credited account. */
|
||||
if (NULL != trans->credit) {
|
||||
if (NULL != trans->credit_split.acc) {
|
||||
printf ("Internal Error: regSaveTransaction(): ");
|
||||
printf ("the credited account is not null. \n");
|
||||
printf (" was 0x%x will be 0x%x \n", trans->credit, xfer_acct);
|
||||
printf (" was 0x%x will be 0x%x \n",
|
||||
trans->credit_split.acc, xfer_acct);
|
||||
}
|
||||
trans->credit = (struct _account *)xfer_acct;
|
||||
trans->credit_split.acc = (struct _account *)xfer_acct;
|
||||
|
||||
/* insert the transaction into the transfer account */
|
||||
insertTransaction (xfer_acct, trans);
|
||||
@ -1478,7 +1479,7 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
|
||||
acc = (Account *) (trans->debit);
|
||||
show += xaccIsAccountInList (acc, regData->blackacc);
|
||||
acc = (Account *) (trans->credit);
|
||||
acc = (Account *) (trans->credit_split.acc);
|
||||
show += xaccIsAccountInList (acc, regData->blackacc);
|
||||
|
||||
themount = 0.0;
|
||||
@ -1578,7 +1579,7 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
|
||||
/* for single-account registers, the insertion account
|
||||
* is always the credited account */
|
||||
trans->credit = (struct _account *) acc;
|
||||
trans->credit_split.acc = (struct _account *) acc;
|
||||
insertTransaction (acc, trans);
|
||||
}
|
||||
|
||||
@ -1591,7 +1592,7 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
* where to insert.
|
||||
*
|
||||
* Warn the user about this. */
|
||||
if ((NULL == trans->credit) && (NULL == trans->debit)) {
|
||||
if ((NULL == trans->credit_split.acc) && (NULL == trans->debit)) {
|
||||
errorBox (toplevel, XFER_NO_ACC_MSG);
|
||||
freeTransaction (trans);
|
||||
regData->changed = MOD_NONE;
|
||||
@ -1621,7 +1622,7 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
* recalculate the balances */
|
||||
if( regData->changed & (MOD_XFRM | MOD_XTO | MOD_RECN |
|
||||
MOD_AMNT | MOD_PRIC | MOD_NEW)) {
|
||||
RECALC_BALANCE ((trans->credit));
|
||||
RECALC_BALANCE ((trans->credit_split.acc));
|
||||
RECALC_BALANCE ((trans->debit));
|
||||
|
||||
/* if this is a ledger window, then we have to update
|
||||
@ -1644,7 +1645,7 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
REFRESH_REGISTER (old_xto_acct);
|
||||
}
|
||||
|
||||
REFRESH_REGISTER ((trans->credit));
|
||||
REFRESH_REGISTER ((trans->credit_split.acc));
|
||||
REFRESH_REGISTER ((trans->debit));
|
||||
/* if this is a ledger window, then we have to update
|
||||
* it as well. If this is not a ledger window, one of
|
||||
@ -1694,7 +1695,7 @@ regSaveTransaction( RegWindow *regData, int position )
|
||||
} \
|
||||
}
|
||||
|
||||
REFRESH_RECONCILE_WIN ((trans->credit));
|
||||
REFRESH_RECONCILE_WIN ((trans->credit_split.acc));
|
||||
REFRESH_RECONCILE_WIN ((trans->debit));
|
||||
|
||||
regData->changed = MOD_NONE;
|
||||
@ -2678,7 +2679,7 @@ deleteCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
|
||||
if( verifyBox( toplevel, buf ) )
|
||||
{
|
||||
Account * cred = (Account *) (trans->credit);
|
||||
Account * cred = (Account *) (trans->credit_split.acc);
|
||||
Account * deb = (Account *) (trans->debit);
|
||||
|
||||
/* remove the transaction from both accounts */
|
||||
|
@ -124,7 +124,6 @@ initTransaction( Transaction * trans )
|
||||
|
||||
/* fill in some sane defaults */
|
||||
trans->debit = 0x0;
|
||||
trans->credit = 0x0;
|
||||
|
||||
trans->num = XtNewString("");
|
||||
trans->description = XtNewString("");
|
||||
@ -171,7 +170,7 @@ freeTransaction( Transaction *trans )
|
||||
/* free a transaction only if it is not claimed
|
||||
* by any accounts. */
|
||||
if (trans->debit) return;
|
||||
if (trans->credit) return;
|
||||
if (trans->credit_split.acc) return;
|
||||
/*
|
||||
hack alert -- don't do this until splits are fully
|
||||
implemented and tested.
|
||||
|
@ -474,7 +474,7 @@ xferCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
|
||||
/* make note of which accounts this was transfered from & to */
|
||||
trans->debit = (struct _account *) getAccount(grp,xferData->from);
|
||||
trans->credit = (struct _account *) getAccount(grp,xferData->to);
|
||||
trans->credit_split.acc = (struct _account *) getAccount(grp,xferData->to);
|
||||
|
||||
/* insert transaction into from acount */
|
||||
acc = getAccount(grp,xferData->from);
|
||||
|
Loading…
Reference in New Issue
Block a user