public class TxnUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int[] |
ALL_TXN_TYPES
Deprecated.
Use
InvestTxnType.ALL_TXN_TYPES instead. |
static boolean |
DEBUG |
static int |
TXN_TYPE_BANK
Deprecated.
Use
InvestTxnType.BANK instead. |
static int |
TXN_TYPE_BUY
Deprecated.
Use
InvestTxnType.BUY instead. |
static int |
TXN_TYPE_BUY_XFER
Deprecated.
Use
InvestTxnType.BUY_XFER instead. |
static int |
TXN_TYPE_COVER
Deprecated.
Use
InvestTxnType.COVER instead. |
static int |
TXN_TYPE_DIVIDEND
Deprecated.
Use
InvestTxnType.DIVIDEND instead. |
static int |
TXN_TYPE_DIVIDEND_REINVEST
Deprecated.
Use
InvestTxnType.DIVIDEND_REINVEST instead. |
static int |
TXN_TYPE_DIVIDENDXFR
Deprecated.
Use
InvestTxnType.DIVIDENDXFR instead. |
static int |
TXN_TYPE_MISCEXP
Deprecated.
Use
InvestTxnType.MISCEXP instead. |
static int |
TXN_TYPE_MISCINC
Deprecated.
Use
InvestTxnType.MISCINC instead. |
static int |
TXN_TYPE_SELL
Deprecated.
Use
InvestTxnType.SELL instead. |
static int |
TXN_TYPE_SELL_XFER
Deprecated.
Use
InvestTxnType.SELL_XFER instead. |
static int |
TXN_TYPE_SHORT
Deprecated.
Use
InvestTxnType.SHORT instead. |
Modifier and Type | Method and Description |
---|---|
static void |
applyVAT(ParentTxn ptxn)
Apply any VAT/GST transformation (ie adding/adjusting splits) to the
given transaction.
|
static void |
copyFromSimilarPreviousTxn(ParentTxn target,
ParentTxn source,
boolean adjustAmounts)
Copies the descriptions/memos, categories and amounts from the given source transaction,
optionally adjusting the amounts to match the current target transaction value.
|
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 AbstractTxn |
getCorrespondingDuplicate(ParentTxn dupTxn,
AbstractTxn txn) |
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 InvestTxnType |
getInvestTxnType(ParentTxn ptxn) |
static int |
getInvstTxnType(ParentTxn ptxn) |
static java.lang.String |
getKeywordsAsString(java.util.List<java.lang.String> keywords) |
static java.util.List<java.lang.String> |
getListOfAllUsedTransactionTags(TxnSet txns) |
static long |
getNumShares(SplitTxn split)
As of Build 256.
|
static TxnSearch |
getSearch(Account account,
DateRange range) |
static TxnSearch |
getSearch(DateRange range) |
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.Iterator<AbstractTxn> 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 MediaType |
mediaTypeForFilename(java.lang.String filename)
Return the best guess for the kind of media contained in the given file
|
static java.util.Hashtable<java.lang.String,java.lang.String> |
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,
InvestTxnType txnType)
Tag the given (investment) transaction with the given transaction type
|
static void |
setRatesInTxn(AbstractTxn txn)
If the given transaction contains any inter-currency (or security to/from currency) elements, adjust
the rates based on the the currency and security rate/price tables at the time of the transaction.
|
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 |
txnIsClearedForArchiving(AbstractTxn txn)
Return whether all parts of the given transaction are cleared for archiving.
|
static boolean |
txnTouchesInvestment(AbstractTxn txn)
Return true iff this transaction is a transfer to, from or within an investment account.
|
static boolean |
wasTxnDownloaded(AbstractTxn txn)
Returns true if the given transaction was downloaded, or imported
from a downloaded file.
|
public static boolean DEBUG
public static final int TXN_TYPE_BUY
InvestTxnType.BUY
instead.public static final int TXN_TYPE_SELL
InvestTxnType.SELL
instead.public static final int TXN_TYPE_BUY_XFER
InvestTxnType.BUY_XFER
instead.public static final int TXN_TYPE_SELL_XFER
InvestTxnType.SELL_XFER
instead.public static final int TXN_TYPE_BANK
InvestTxnType.BANK
instead.public static final int TXN_TYPE_DIVIDEND
InvestTxnType.DIVIDEND
instead.public static final int TXN_TYPE_SHORT
InvestTxnType.SHORT
instead.public static final int TXN_TYPE_COVER
InvestTxnType.COVER
instead.public static final int TXN_TYPE_DIVIDENDXFR
InvestTxnType.DIVIDENDXFR
instead.public static final int TXN_TYPE_MISCINC
InvestTxnType.MISCINC
instead.public static final int TXN_TYPE_MISCEXP
InvestTxnType.MISCEXP
instead.public static final int TXN_TYPE_DIVIDEND_REINVEST
InvestTxnType.DIVIDEND_REINVEST
instead.public static final int[] ALL_TXN_TYPES
InvestTxnType.ALL_TXN_TYPES
instead.public static final void setInvstTxnType(ParentTxn ptxn, InvestTxnType txnType)
public static java.lang.String getKeywordsAsString(java.util.List<java.lang.String> keywords)
public static int getInvstTxnType(ParentTxn ptxn)
public static InvestTxnType getInvestTxnType(ParentTxn ptxn)
public static final void applyVAT(ParentTxn ptxn)
public static final void copyVATInfo(AbstractTxn fromTxn, AbstractTxn toTxn)
public static final SplitTxn findVATGSTSplit(ParentTxn txn, SplitTxn split)
public static final void copyFromSimilarPreviousTxn(ParentTxn target, ParentTxn source, boolean adjustAmounts)
target
- the transaction to modify based on the categories and descriptions of the sourcesource
- the transaction from which to get the split information such as descriptions, categories, etcadjustAmounts
- if true, adjust all split amounts proportionally to match the current target txn valuepublic static final SplitTxn getSecurityPart(ParentTxn ptxn)
public static final SplitTxn getXfrPart(ParentTxn ptxn)
public static final SplitTxn getIncomePart(ParentTxn ptxn)
public static final SplitTxn getExpensePart(ParentTxn ptxn)
public static final SplitTxn getCommissionPart(ParentTxn ptxn)
public static final java.util.Hashtable<java.lang.String,java.lang.String> parseCostBasisTag(SplitTxn split)
public static final long getNumShares(SplitTxn split)
public static final void setXfrPart(SplitTxn xfrSplit)
public static final void setCommissionPart(SplitTxn commSplit)
public static final void setSecurityPart(SplitTxn secSplit)
public static final void setIncomePart(SplitTxn secSplit)
public static final void setExpensePart(SplitTxn secSplit)
public static final boolean wasTxnDownloaded(AbstractTxn txn)
public static final boolean txnTouchesInvestment(AbstractTxn txn)
public static final boolean txnIsClearedForArchiving(AbstractTxn txn)
public static final void markOnlineTxnsAsOf(java.util.Iterator<AbstractTxn> txns, int asOfDate, byte statusFlag)
public static AbstractTxn getCorrespondingDuplicate(ParentTxn dupTxn, AbstractTxn txn)
public static void setRatesInTxn(AbstractTxn txn)
public static final java.util.List<java.lang.String> getListOfAllUsedTransactionTags(TxnSet txns)
public static MediaType mediaTypeForFilename(java.lang.String filename)