Class SplitTxn
java.lang.Object
com.infinitekind.moneydance.model.MoneydanceSyncableItem
com.infinitekind.moneydance.model.AbstractTxn
com.infinitekind.moneydance.model.SplitTxn
- All Implemented Interfaces:
Txn
,com.infinitekind.tiksync.SyncableItem
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.infinitekind.moneydance.model.AbstractTxn
AbstractTxn.ClearedStatus
-
Field Summary
Fields inherited from class com.infinitekind.moneydance.model.AbstractTxn
BANK_TRANSACTION_TYPE, PRINT_CHECKNUM_PREFIX, PRINT_CHECKNUM_SUFFIX, SPLIT_TRANSACTION_TYPE, STATUS_CLEARED, STATUS_RECONCILING, STATUS_UNRECONCILED, syncID, TAG_FI_ID, 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_INVST_TXN_TYPE, TAG_IS_NEW_TXN, 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
Fields inherited from class com.infinitekind.moneydance.model.MoneydanceSyncableItem
book, info, SECURITY_SUBTYPES_ITEM_TYPE
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description boolean
deleteItem()
Deletes this item by removing it from the parent.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.AbstractTxn.ClearedStatus
getClearedStatus()
Get the status associated with this transaction.long
getDateEntered()
Get the date that this transaction was entered.int
getDateInt()
Get the date of this transactionTxn
getFlipSide()
Return the 'flip side' of this split 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.long
getParentValue()
Get the amount of this transaction in terms of the currency of the parent transaction.double
getRate()
Get the rate for the transaction.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.protected boolean
isSyncable()
boolean
isTransferTo(Account acct)
Check whether or not this transaction includes a transfer to the given account.protected void
itemWasUpdated()
This is called after an item is updated by calling itemWasUpdated(SyncRecord).protected void
itemWillSync()
This is called just before an item will be stored and/or synced when itemWillSync(SyncRecord) is called.static SplitTxn
makeSplitTxn(ParentTxn parentTxn, long parentAmount, double rate, Account account, java.lang.String description, long txnId, byte status)
Deprecated.please use the other makeSplitTxn call as the amounts will not be subject to floating point inaccuraciesstatic SplitTxn
makeSplitTxn(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.void
negateAmount()
Reverses the sign of the amount of the splitvoid
setAmount(long splitAmount)
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
takeAmounts(SplitTxn split)
Take the amount and rates from the given split.void
takeValuesFrom(SplitTxn otherTxn)
java.lang.String
toString()
Methods inherited from class com.infinitekind.moneydance.model.AbstractTxn
autoSyncsChanges, getAccount, getAddress, getAttachmentKeys, getAttachmentTag, getCheckNumAsInt, getCheckNumAsLong, getDatePostedOnline, getDescription, getFIID, getFiTxnId, getOldTxnID, getOriginalOnlineTxn, getStatus, getStatusChar, getTags, hasAttachments, isDirty, isNew, loadFromStorage, needsToBePrinted, removeAttachmentTag, resetDirty, setAccount, setAttachmentTag, setClearedStatus, setDescription, setDirty, setFIID, setFiTxnId, setIsNew, setOriginalOnlineTxn, setStatus, wasDownloaded
Methods inherited from class com.infinitekind.moneydance.model.MoneydanceSyncableItem
addParameters, addTags, decodeKeywordList, doesParameterExist, duplicate, encodeKeywordList, equals, getAccountParameter, getAddressParameter, getBook, getBooleanParameter, getCurrencyParameter, getCurrencyParameter, getCurrencyParameter, getDoubleParameter, getIntParameter, getKeywords, getLongParameter, getOriginalItem, getParameter, getParameter, getParameterCount, getParameterKeys, getPreference, getPreferenceBoolean, getPreferenceDouble, getPreferenceInt, getPreferenceIntArray, getPreferenceLong, getPreferenceStringList, getPreferenceSublist, getPreferenceSubset, getStringListParameter, getSyncInfo, getSyncItemType, getSyncTimestamp, getUUID, hasBeenSynced, hashCode, hasKeywordSubstring, initialize, isInEditingMode, itemWasUpdated, itemWillSync, makeSyncableItem, removeParameter, setAccountParameter, setAddress, setAddressParameter, setCurrencyParameter, setCurrencyParameter, setCurrencyParameter, setEditingMode, setKeywords, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterNoNotify, setPreference, setPreference, setPreference, syncItem
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.infinitekind.moneydance.model.Txn
getKeywords, getParameter, getParameter
-
Constructor Details
-
SplitTxn
Creates a SplitTxn attached to the given ParentTxn
-
-
Method Details
-
isSyncable
protected boolean isSyncable()- Overrides:
isSyncable
in classMoneydanceSyncableItem
-
itemWasUpdated
protected void itemWasUpdated()Description copied from class:MoneydanceSyncableItem
This is called after an item is updated by calling itemWasUpdated(SyncRecord). This can occur from the syncing process or from being loaded locally. Override this method to be notified.- Overrides:
itemWasUpdated
in classAbstractTxn
-
itemWillSync
protected void itemWillSync()Description copied from class:MoneydanceSyncableItem
This is called just before an item will be stored and/or synced when itemWillSync(SyncRecord) is called. Override this method to be notified or if you'd like to store anything into the info record to be synced.- Overrides:
itemWillSync
in classAbstractTxn
-
deleteItem
public boolean deleteItem()Deletes this item by removing it from the parent. The parent will then need to be saved (syncItem()) in order to commit the change.- Overrides:
deleteItem
in classMoneydanceSyncableItem
-
getParentTxn
Get the ParentTxn for which this is a split.- Specified by:
getParentTxn
in interfaceTxn
- Specified by:
getParentTxn
in classAbstractTxn
-
getDateEntered
public long getDateEntered()Get the date that this transaction was entered.- Specified by:
getDateEntered
in interfaceTxn
- Specified by:
getDateEntered
in classAbstractTxn
-
getDateInt
public int getDateInt()Get the date of this transaction- Specified by:
getDateInt
in interfaceTxn
- Specified by:
getDateInt
in classAbstractTxn
-
getTaxDateInt
public int getTaxDateInt()Get the date of this transaction for tax purposes.- Specified by:
getTaxDateInt
in interfaceTxn
- Specified by:
getTaxDateInt
in classAbstractTxn
-
getParentAmount
public long getParentAmount()Get the amount of this transaction in terms of the currency of the parent transaction. -
getParentValue
public long getParentValue()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 interfaceTxn
- Specified by:
getValue
in classAbstractTxn
-
isTransferTo
Check whether or not this transaction includes a transfer to the given account.- Specified by:
isTransferTo
in interfaceTxn
- Specified by:
isTransferTo
in classAbstractTxn
-
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 interfaceTxn
- Specified by:
getTransferType
in classAbstractTxn
-
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
Take the amount and rates from the given split. -
takeValuesFrom
-
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 splitAmount)Set the amount that this split affects the -other- side of the transaction. -
getCheckNumber
public final java.lang.String getCheckNumber()Description copied from class:AbstractTxn
Get the checknumber associated with this transaction.- Specified by:
getCheckNumber
in interfaceTxn
- Specified by:
getCheckNumber
in classAbstractTxn
-
setCheckNumber
public final void setCheckNumber(java.lang.String newCheckNumber) -
getClearedStatus
Description copied from interface:Txn
Get the status associated with this transaction.- Specified by:
getClearedStatus
in interfaceTxn
- Overrides:
getClearedStatus
in classAbstractTxn
-
getOtherTxnCount
public int getOtherTxnCount()Return the number of "other transactions".- Specified by:
getOtherTxnCount
in interfaceTxn
- Specified by:
getOtherTxnCount
in classAbstractTxn
-
getOtherTxn
Return the "other transaction" for this split.- Specified by:
getOtherTxn
in interfaceTxn
- Specified by:
getOtherTxn
in classAbstractTxn
-
getFlipSide
Return the 'flip side' of this split transaction. This is experimental, so please don't use it for any extensions yet. Basically, this returns the ParentTxn if this split is the only split. Otherwise, this returns a cached anonymous inner class that has the normal AbstractTxn methods mapped to return a value for the "other side" of just this split.- Since:
- Moneydance build 744
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
makeSplitTxn
public static SplitTxn makeSplitTxn(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 used if the parentAmount or splitAmount are zero. -
makeSplitTxn
public static SplitTxn makeSplitTxn(ParentTxn parentTxn, long parentAmount, double rate, Account account, java.lang.String description, long txnId, byte status)Deprecated.please use the other makeSplitTxn call as the amounts will not be subject to floating point inaccuraciesCreates 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.
-