com.moneydance.apps.md.model
Class SplitTxn

java.lang.Object
  extended by com.moneydance.apps.md.model.AbstractTxn
      extended by com.moneydance.apps.md.model.SplitTxn

public final class SplitTxn
extends AbstractTxn

Concrete class that represents the destination side of a transaction. The destination side of the transaction is associated with exactly one source (or parent) transactions. The amount of a SplitTxn is stored in terms of the currency of the account for the associated ParentTxn.


Field Summary
 
Fields inherited from class com.moneydance.apps.md.model.AbstractTxn
BANK_TRANSACTION_TYPE, SPLIT_TRANSACTION_TYPE, STATUS_CLEARED, STATUS_RECONCILING, STATUS_UNRECONCILED, TAG_FITID_PREFIX, TAG_INVST_SPLIT_EXP, TAG_INVST_SPLIT_FEE, TAG_INVST_SPLIT_INC, TAG_INVST_SPLIT_SEC, TAG_INVST_SPLIT_TYPE, TAG_INVST_SPLIT_XFR, TAG_ONLINE_PMT_ID, TAG_QIF_IMPORT_SESSION, TAG_QIF_INVST_ACTION, TAG_RECON_ASOFDT, TAG_RECON_DATE, TAG_SPLIT_ADDED, TAG_SPLIT_AMOUNT, TAG_SPLIT_CALC, TAG_SPLIT_PAIR, TRANSFER_TYPE_BANK, TRANSFER_TYPE_BUYSELL, TRANSFER_TYPE_BUYSELLXFR, TRANSFER_TYPE_DIVIDEND, TRANSFER_TYPE_DIVIDENDXFR, TRANSFER_TYPE_MISCINCEXP, TRANSFER_TYPE_SHORTCOVER
 
Constructor Summary
SplitTxn(ParentTxn parentTxn, long parentAmount, double rate, Account account, java.lang.String description, long txnId, byte status)
          Deprecated. Please use the other constructor
SplitTxn(ParentTxn parentTxn, long parentAmount, long splitAmount, double rate, Account account, java.lang.String description, long txnId, byte status)
          Creates a SplitTxn with the parentAmount having a negative effect on the account of parentTxn, and splitAmount having a positive effect on the account of this SplitTxn.
 
Method Summary
 long getAmount()
          Get the amount of this transaction in terms of the currency of the parent transaction.
 java.lang.String getCheckNumber()
          Get the checknumber associated with this transaction.
 long getDate()
          Deprecated. use getDateInt() instead!
 long getDateEntered()
          Get the date that this transaction was entered.
 int getDateInt()
          Get the date of this transaction
 AbstractTxn getOtherTxn(int i)
          Return the "other transaction" for this split.
 int getOtherTxnCount()
          Return the number of "other transactions".
 long getParentAmount()
          Get the amount of this transaction in terms of the currency of the parent transaction.
 ParentTxn getParentTxn()
          Get the ParentTxn for which this is a split.
 double getRate()
          Get the rate for the transaction.
 long getTaxDate()
          Deprecated. use getTaxDateInt() instead!
 int getTaxDateInt()
          Get the date of this transaction for tax purposes.
 java.lang.String getTransferType()
          Get the type of transaction.
 long getValue()
          Get the amount that this transaction affects the account of the this transaction.
 boolean isTransferTo(Account acct)
          Check whether or not this transaction includes a transfer to the given account.
 void negateAmount()
          Reverses the sign of the amount of the split
 void setAmount(long newAmount)
          Set the amount that this split affects the -other- side of the transaction.
 void setAmount(long newSplitAmount, double newRate, long newParentAmount)
          Set the amounts for this transaction, including the amount of the transaction in the split account, the rate, and the amount of the transaction in the account of the parent transaction.
 void setAmount(long newSplitAmount, long newParentAmount)
          Set the amounts for this transaction, including the amount of the transaction in the split account, and the amount of the transaction in the account of the parent transaction.
 void setCheckNumber(java.lang.String newCheckNumber)
           
 void setParentAmount(double newRate, long newParentAmount)
          Set the amount of the transaction in the parent account.
 void setRate(double newRate)
          Set the amount that this split affects the Account of this transaction.
 void takeAmounts(SplitTxn split)
          Take the amount and rates from the given split.
 java.lang.String toString()
           
 
Methods inherited from class com.moneydance.apps.md.model.AbstractTxn
getAccount, getCheckNumAsInt, getDescription, getFiTxnId, getStatus, getStatusChar, getTag, getTag, getTags, getTxnId, isDirty, needsToBePrinted, removeTag, resetDirty, setAccount, setDescription, setDirty, setFiTxnId, setStatus, setTag, setTags, wasDownloaded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SplitTxn

public SplitTxn(ParentTxn parentTxn,
                long parentAmount,
                double rate,
                Account account,
                java.lang.String description,
                long txnId,
                byte status)
Deprecated. Please use the other constructor

Creates a SplitTxn


SplitTxn

public SplitTxn(ParentTxn parentTxn,
                long parentAmount,
                long splitAmount,
                double rate,
                Account account,
                java.lang.String description,
                long txnId,
                byte status)
Creates a SplitTxn with the parentAmount having a negative effect on the account of parentTxn, and splitAmount having a positive effect on the account of this SplitTxn. The given rate is only acknowledged if the parentAmount or splitAmount are zero.

Method Detail

getParentTxn

public ParentTxn getParentTxn()
Get the ParentTxn for which this is a split.

Specified by:
getParentTxn in class AbstractTxn

getDate

public long getDate()
Deprecated. use getDateInt() instead!

Get the date of this transaction

Specified by:
getDate in class AbstractTxn

getDateEntered

public long getDateEntered()
Get the date that this transaction was entered.

Specified by:
getDateEntered in class AbstractTxn

getTaxDate

public long getTaxDate()
Deprecated. use getTaxDateInt() instead!

Get the date of this transaction for tax purposes.

Specified by:
getTaxDate in class AbstractTxn

getDateInt

public int getDateInt()
Get the date of this transaction

Specified by:
getDateInt in class AbstractTxn

getTaxDateInt

public int getTaxDateInt()
Get the date of this transaction for tax purposes.

Specified by:
getTaxDateInt in class AbstractTxn

getParentAmount

public long getParentAmount()
Get the amount of this transaction in terms of the currency of the parent transaction.


getAmount

public long getAmount()
Get the amount of this transaction in terms of the currency of the parent transaction.


getValue

public long getValue()
Get the amount that this transaction affects the account of the this transaction.

Specified by:
getValue in class AbstractTxn

isTransferTo

public boolean isTransferTo(Account acct)
Check whether or not this transaction includes a transfer to the given account.

Specified by:
isTransferTo in class AbstractTxn

getRate

public double getRate()
Get the rate for the transaction. This is the rate used to calculate the amount in the source account. For example, the amount of this transaction, divided by the rate will yield the amount subtracted from the source account.


getTransferType

public java.lang.String getTransferType()
Get the type of transaction. Usually only used in the investment register to differentiate between buy, sell, and stock split transactions.

Specified by:
getTransferType in class AbstractTxn

setParentAmount

public void setParentAmount(double newRate,
                            long newParentAmount)
Set the amount of the transaction in the parent account. The newRate value indicates the rate that should be used to calculate the amount of the transaction in the split account.


negateAmount

public void negateAmount()
Reverses the sign of the amount of the split


takeAmounts

public void takeAmounts(SplitTxn split)
Take the amount and rates from the given split.


setAmount

public void setAmount(long newSplitAmount,
                      long newParentAmount)
Set the amounts for this transaction, including the amount of the transaction in the split account, and the amount of the transaction in the account of the parent transaction.


setAmount

public void setAmount(long newSplitAmount,
                      double newRate,
                      long newParentAmount)
Set the amounts for this transaction, including the amount of the transaction in the split account, the rate, and the amount of the transaction in the account of the parent transaction. newParentAmount must equal -Math.round(newSplitAmount * rate). The rate is ignored unless newParentAmount or newSplitAmount are zero (thus invalidating the above equation.


setAmount

public void setAmount(long newAmount)
Set the amount that this split affects the -other- side of the transaction. If the amount as well as the rate of the transaction. Note: If the currency of the account for this split is the same as the currency of the .


setRate

public void setRate(double newRate)
Set the amount that this split affects the Account of this transaction.


getCheckNumber

public final java.lang.String getCheckNumber()
Description copied from class: AbstractTxn
Get the checknumber associated with this transaction.

Specified by:
getCheckNumber in class AbstractTxn

setCheckNumber

public final void setCheckNumber(java.lang.String newCheckNumber)

getOtherTxnCount

public int getOtherTxnCount()
Return the number of "other transactions".

Specified by:
getOtherTxnCount in class AbstractTxn

getOtherTxn

public AbstractTxn getOtherTxn(int i)
Return the "other transaction" for this split.

Specified by:
getOtherTxn in class AbstractTxn

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object