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_SHORTCOVERFields inherited from class com.infinitekind.moneydance.model.MoneydanceSyncableItem
book, info, SECURITY_SUBTYPES_ITEM_TYPE -
Constructor Summary
-
Method Summary
Modifier and Type Method Description booleandeleteItem()Deletes this item by removing it from the parent.longgetAmount()Get the amount of this transaction in terms of the currency of the parent transaction.java.lang.StringgetCheckNumber()Get the checknumber associated with this transaction.AbstractTxn.ClearedStatusgetClearedStatus()Get the status associated with this transaction.longgetDateEntered()Get the date that this transaction was entered.intgetDateInt()Get the date of this transactionTxngetFlipSide()Return the 'flip side' of this split transaction.AbstractTxngetOtherTxn(int i)Return the "other transaction" for this split.intgetOtherTxnCount()Return the number of "other transactions".longgetParentAmount()Get the amount of this transaction in terms of the currency of the parent transaction.ParentTxngetParentTxn()Get the ParentTxn for which this is a split.longgetParentValue()Get the amount of this transaction in terms of the currency of the parent transaction.doublegetRate()Get the rate for the transaction.intgetTaxDateInt()Get the date of this transaction for tax purposes.java.lang.StringgetTransferType()Get the type of transaction.longgetValue()Get the amount that this transaction affects the account of the this transaction.protected booleanisSyncable()booleanisTransferTo(Account acct)Check whether or not this transaction includes a transfer to the given account.protected voiditemWasUpdated()This is called after an item is updated by calling itemWasUpdated(SyncRecord).protected voiditemWillSync()This is called just before an item will be stored and/or synced when itemWillSync(SyncRecord) is called.static SplitTxnmakeSplitTxn(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 SplitTxnmakeSplitTxn(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.voidnegateAmount()Reverses the sign of the amount of the splitvoidsetAmount(long splitAmount)Set the amount that this split affects the -other- side of the transaction.voidsetAmount(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.voidsetAmount(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.voidsetCheckNumber(java.lang.String newCheckNumber)voidsetParentAmount(double newRate, long newParentAmount)Set the amount of the transaction in the parent account.voidtakeAmounts(SplitTxn split)Take the amount and rates from the given split.voidtakeValuesFrom(SplitTxn otherTxn)java.lang.StringtoString()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, wasDownloadedMethods 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, syncItemMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
isSyncablein classMoneydanceSyncableItem
-
itemWasUpdated
protected void itemWasUpdated()Description copied from class:MoneydanceSyncableItemThis 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:
itemWasUpdatedin classAbstractTxn
-
itemWillSync
protected void itemWillSync()Description copied from class:MoneydanceSyncableItemThis 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:
itemWillSyncin 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:
deleteItemin classMoneydanceSyncableItem
-
getParentTxn
Get the ParentTxn for which this is a split.- Specified by:
getParentTxnin interfaceTxn- Specified by:
getParentTxnin classAbstractTxn
-
getDateEntered
public long getDateEntered()Get the date that this transaction was entered.- Specified by:
getDateEnteredin interfaceTxn- Specified by:
getDateEnteredin classAbstractTxn
-
getDateInt
public int getDateInt()Get the date of this transaction- Specified by:
getDateIntin interfaceTxn- Specified by:
getDateIntin classAbstractTxn
-
getTaxDateInt
public int getTaxDateInt()Get the date of this transaction for tax purposes.- Specified by:
getTaxDateIntin interfaceTxn- Specified by:
getTaxDateIntin 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:
getValuein interfaceTxn- Specified by:
getValuein classAbstractTxn
-
isTransferTo
Check whether or not this transaction includes a transfer to the given account.- Specified by:
isTransferToin interfaceTxn- Specified by:
isTransferToin 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:
getTransferTypein interfaceTxn- Specified by:
getTransferTypein 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:AbstractTxnGet the checknumber associated with this transaction.- Specified by:
getCheckNumberin interfaceTxn- Specified by:
getCheckNumberin classAbstractTxn
-
setCheckNumber
public final void setCheckNumber(java.lang.String newCheckNumber) -
getClearedStatus
Description copied from interface:TxnGet the status associated with this transaction.- Specified by:
getClearedStatusin interfaceTxn- Overrides:
getClearedStatusin classAbstractTxn
-
getOtherTxnCount
public int getOtherTxnCount()Return the number of "other transactions".- Specified by:
getOtherTxnCountin interfaceTxn- Specified by:
getOtherTxnCountin classAbstractTxn
-
getOtherTxn
Return the "other transaction" for this split.- Specified by:
getOtherTxnin interfaceTxn- Specified by:
getOtherTxnin 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:
toStringin 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.
-