com.moneydance.apps.md.model
Class TxnUtil

java.lang.Object
  extended by com.moneydance.apps.md.model.TxnUtil

public class TxnUtil
extends java.lang.Object


Field Summary
static int[] ALL_TXN_TYPES
           
static int TXN_TYPE_BANK
           
static int TXN_TYPE_BUY
           
static int TXN_TYPE_BUY_XFER
           
static int TXN_TYPE_COVER
           
static int TXN_TYPE_DIVIDEND
           
static int TXN_TYPE_DIVIDEND_REINVEST
           
static int TXN_TYPE_DIVIDENDXFR
           
static int TXN_TYPE_MISCEXP
           
static int TXN_TYPE_MISCINC
           
static int TXN_TYPE_SELL
           
static int TXN_TYPE_SELL_XFER
           
static int TXN_TYPE_SHORT
           
 
Method Summary
static void applyVAT(ParentTxn ptxn)
          Apply any VAT/GST transformation (ie adding/adjusting splits) to the given transaction.
static void copyVATInfo(AbstractTxn fromTxn, AbstractTxn toTxn)
          Copy any VAT/GST-related tags from one split to another.
static SplitTxn findVATGSTSplit(ParentTxn txn, SplitTxn split)
          Find the matching VAT/GST split, if any, for the given split under the given parent txn.
static SplitTxn getCommissionPart(ParentTxn ptxn)
          Get the part of the transaction that doesn't go to a security.
static SplitTxn getExpensePart(ParentTxn ptxn)
          Get the part of the transaction that is expense.
static SplitTxn getIncomePart(ParentTxn ptxn)
          Get the part of the transaction that is income.
static int getInvstTxnType(ParentTxn ptxn)
          Get the investment transaction type code for the given transaction
static long getNumShares(SplitTxn split)
          As of Build 256.
static SplitTxn getSecurityPart(ParentTxn ptxn)
          Get the part of the transaction that goes to a security account.
static SplitTxn getXfrPart(ParentTxn ptxn)
          Get the part of the transaction that goes to another bank account.
static void markOnlineTxnsAsOf(java.util.Enumeration txns, int asOfDate, byte statusFlag)
          Mark transactions in the given enumeration with the given status flag if they fall on or before the given date.
static java.util.Hashtable parseCostBasisTag(SplitTxn split)
          This is only available on Build 256 and up.
static void setCommissionPart(SplitTxn commSplit)
          Tag the given split as the commission/fee part of its investment transaction.
static void setExpensePart(SplitTxn secSplit)
          Tag the given split as the expense part of its investment transaction.
static void setIncomePart(SplitTxn secSplit)
          Tag the given split as the income part of its investment transaction.
static void setInvstTxnType(ParentTxn ptxn, int txnType)
          Tag the given (investment) transaction with the given transaction type
static void setSecurityPart(SplitTxn secSplit)
          Tag the given split as the security part of its investment transaction.
static void setXfrPart(SplitTxn xfrSplit)
          Tag the given split as the transfer part of its investment transaction.
static boolean wasTxnDownloaded(AbstractTxn txn)
          Returns true if the given transaction was downloaded, or imported from a downloaded file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TXN_TYPE_BUY

public static final int TXN_TYPE_BUY
See Also:
Constant Field Values

TXN_TYPE_SELL

public static final int TXN_TYPE_SELL
See Also:
Constant Field Values

TXN_TYPE_BUY_XFER

public static final int TXN_TYPE_BUY_XFER
See Also:
Constant Field Values

TXN_TYPE_SELL_XFER

public static final int TXN_TYPE_SELL_XFER
See Also:
Constant Field Values

TXN_TYPE_BANK

public static final int TXN_TYPE_BANK
See Also:
Constant Field Values

TXN_TYPE_DIVIDEND

public static final int TXN_TYPE_DIVIDEND
See Also:
Constant Field Values

TXN_TYPE_SHORT

public static final int TXN_TYPE_SHORT
See Also:
Constant Field Values

TXN_TYPE_COVER

public static final int TXN_TYPE_COVER
See Also:
Constant Field Values

TXN_TYPE_DIVIDENDXFR

public static final int TXN_TYPE_DIVIDENDXFR
See Also:
Constant Field Values

TXN_TYPE_MISCINC

public static final int TXN_TYPE_MISCINC
See Also:
Constant Field Values

TXN_TYPE_MISCEXP

public static final int TXN_TYPE_MISCEXP
See Also:
Constant Field Values

TXN_TYPE_DIVIDEND_REINVEST

public static final int TXN_TYPE_DIVIDEND_REINVEST
See Also:
Constant Field Values

ALL_TXN_TYPES

public static final int[] ALL_TXN_TYPES
Method Detail

setInvstTxnType

public static final void setInvstTxnType(ParentTxn ptxn,
                                         int txnType)
Tag the given (investment) transaction with the given transaction type


getInvstTxnType

public static final int getInvstTxnType(ParentTxn ptxn)
Get the investment transaction type code for the given transaction


applyVAT

public static final void applyVAT(ParentTxn ptxn)
Apply any VAT/GST transformation (ie adding/adjusting splits) to the given transaction.


copyVATInfo

public static final void copyVATInfo(AbstractTxn fromTxn,
                                     AbstractTxn toTxn)
Copy any VAT/GST-related tags from one split to another. This should only be used when duplicating transactions (ie for auto-completion) for which you would like the VAT/GST status to also be transferred.


findVATGSTSplit

public static final SplitTxn findVATGSTSplit(ParentTxn txn,
                                             SplitTxn split)
Find the matching VAT/GST split, if any, for the given split under the given parent txn. Note: Available as of build 312.


getSecurityPart

public static final SplitTxn getSecurityPart(ParentTxn ptxn)
Get the part of the transaction that goes to a security account.


getXfrPart

public static final SplitTxn getXfrPart(ParentTxn ptxn)
Get the part of the transaction that goes to another bank account.


getIncomePart

public static final SplitTxn getIncomePart(ParentTxn ptxn)
Get the part of the transaction that is income.


getExpensePart

public static final SplitTxn getExpensePart(ParentTxn ptxn)
Get the part of the transaction that is expense.


getCommissionPart

public static final SplitTxn getCommissionPart(ParentTxn ptxn)
Get the part of the transaction that doesn't go to a security. (ie. the commission expense).


parseCostBasisTag

public static final java.util.Hashtable parseCostBasisTag(SplitTxn split)
This is only available on Build 256 and up. This returns the set of buy transactions matched with the given sell transaction.


getNumShares

public static final long getNumShares(SplitTxn split)
As of Build 256. This method returns the number of shares accounted for.


setXfrPart

public static final void setXfrPart(SplitTxn xfrSplit)
Tag the given split as the transfer part of its investment transaction. This also un-tags any other splits as the transfer part of the same transaction. [Added in build 302]


setCommissionPart

public static final void setCommissionPart(SplitTxn commSplit)
Tag the given split as the commission/fee part of its investment transaction. This also un-tags any other splits as the commission part of the same transaction. [Added in build 302]


setSecurityPart

public static final void setSecurityPart(SplitTxn secSplit)
Tag the given split as the security part of its investment transaction. This also un-tags any other splits as the security part of the same transaction. [Added in build 302]


setIncomePart

public static final void setIncomePart(SplitTxn secSplit)
Tag the given split as the income part of its investment transaction. This also un-tags any other splits as the income part of the same transaction. [Added in build 302]


setExpensePart

public static final void setExpensePart(SplitTxn secSplit)
Tag the given split as the expense part of its investment transaction. This also un-tags any other splits as the expense part of the same transaction. [Added in build 302]


wasTxnDownloaded

public static final boolean wasTxnDownloaded(AbstractTxn txn)
Returns true if the given transaction was downloaded, or imported from a downloaded file.


markOnlineTxnsAsOf

public static final void markOnlineTxnsAsOf(java.util.Enumeration txns,
                                            int asOfDate,
                                            byte statusFlag)
Mark transactions in the given enumeration with the given status flag if they fall on or before the given date. Note: This method fires a txn-modified event for every transaction that is changed.