ofx_container_transaction.cpp
Go to the documentation of this file.
/***************************************************************************
ofx_container_account.cpp
-------------------
copyright : (C) 2002 by Benoit Gr�goire
email : benoitg@coeus.ca
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <cstdlib>
#include <string>
#include "messages.hh"
#include "libofx.h"
#include "ofx_containers.hh"
#include "ofx_utilities.hh"
extern OfxMainContainer * MainContainer;
/***************************************************************************
* OfxTransactionContainer *
***************************************************************************/
OfxTransactionContainer::OfxTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier):
OfxGenericContainer(p_libofx_context, para_parentcontainer, para_tag_identifier)
{
OfxGenericContainer * tmp_parentcontainer = parentcontainer;
memset(&data, 0, sizeof(data));
type = "TRANSACTION";
/* Find the parent statement container*/
while (tmp_parentcontainer != NULL && tmp_parentcontainer->type != "STATEMENT")
{
tmp_parentcontainer = tmp_parentcontainer->parentcontainer;
}
if (tmp_parentcontainer != NULL)
{
parent_statement = (OfxStatementContainer*)tmp_parentcontainer;
}
else
{
parent_statement = NULL;
message_out(ERROR, "Unable to find the enclosing statement container this transaction");
}
if (parent_statement != NULL && parent_statement->data.account_id_valid == true)
{
ASSIGN_STRNCPY(data.account_id, std::string(parent_statement->data.account_id));
}
}
OfxTransactionContainer::~OfxTransactionContainer()
{
}
int OfxTransactionContainer::gen_event()
{
if (data.unique_id_valid == true && MainContainer != NULL)
{
data.security_data_ptr = MainContainer->find_security(data.unique_id);
if (data.security_data_ptr != NULL)
{
data.security_data_valid = true;
}
}
libofx_context->transactionCallback(data);
return true;
}
int OfxTransactionContainer::add_to_main_tree()
{
if (MainContainer != NULL)
{
return MainContainer->add_container(this);
}
else
{
return false;
}
}
void OfxTransactionContainer::add_attribute(const std::string identifier, const std::string value)
{
if (identifier == "DTPOSTED")
{
ASSIGN(data.date_posted, ofxdate_to_time_t(value));
}
else if (identifier == "DTUSER")
{
ASSIGN(data.date_initiated, ofxdate_to_time_t(value));
}
else if (identifier == "DTAVAIL")
{
ASSIGN(data.date_funds_available, ofxdate_to_time_t(value));
}
else if (identifier == "FITID")
{
ASSIGN_STRNCPY(data.fi_id, value);
}
else if (identifier == "CORRECTFITID")
{
ASSIGN_STRNCPY(data.fi_id_corrected, value);
}
else if (identifier == "CORRECTACTION")
{
data.fi_id_correction_action_valid = true;
if (value == "REPLACE")
{
data.fi_id_correction_action = REPLACE;
}
else if (value == "DELETE")
{
data.fi_id_correction_action = DELETE;
}
else
{
data.fi_id_correction_action_valid = false;
}
}
else if ((identifier == "SRVRTID") || (identifier == "SRVRTID2"))
{
ASSIGN_STRNCPY(data.server_transaction_id, value);
}
else if (identifier == "MEMO" || identifier == "MEMO2")
{
ASSIGN_STRNCPY(data.memo, value);
}
else if (identifier == "CURRENCY")
{
ASSIGN(data.amounts_are_foreign_currency, false);
}
else if (identifier == "ORIGCURRENCY")
{
ASSIGN(data.amounts_are_foreign_currency, true);
}
else
{
/* Redirect unknown identifiers to the base class */
OfxGenericContainer::add_attribute(identifier, value);
}
}// end OfxTransactionContainer::add_attribute()
void OfxTransactionContainer::add_account(OfxAccountData * account_data)
{
if (account_data->account_id_valid == true)
{
data.account_ptr = account_data;
ASSIGN_STRNCPY(data.account_id, std::string(account_data->account_id));
}
}
/***************************************************************************
* OfxBankTransactionContainer *
***************************************************************************/
OfxBankTransactionContainer::OfxBankTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier):
OfxTransactionContainer(p_libofx_context, para_parentcontainer, para_tag_identifier)
{
;
}
void OfxBankTransactionContainer::add_attribute(const std::string identifier, const std::string value)
{
if ( identifier == "TRNTYPE")
{
data.transactiontype_valid = true;
if (value == "CREDIT")
{
data.transactiontype = OFX_CREDIT;
}
else if (value == "DEBIT")
{
data.transactiontype = OFX_DEBIT;
}
else if (value == "INT")
{
data.transactiontype = OFX_INT;
}
else if (value == "DIV")
{
data.transactiontype = OFX_DIV;
}
else if (value == "FEE")
{
data.transactiontype = OFX_FEE;
}
else if (value == "SRVCHG")
{
data.transactiontype = OFX_SRVCHG;
}
else if (value == "DEP")
{
data.transactiontype = OFX_DEP;
}
else if (value == "ATM")
{
data.transactiontype = OFX_ATM;
}
else if (value == "POS")
{
data.transactiontype = OFX_POS;
}
else if (value == "XFER")
{
data.transactiontype = OFX_XFER;
}
else if (value == "CHECK")
{
data.transactiontype = OFX_CHECK;
}
else if (value == "PAYMENT")
{
data.transactiontype = OFX_PAYMENT;
}
else if (value == "CASH")
{
data.transactiontype = OFX_CASH;
}
else if (value == "DIRECTDEP")
{
data.transactiontype = OFX_DIRECTDEP;
}
else if (value == "DIRECTDEBIT")
{
data.transactiontype = OFX_DIRECTDEBIT;
}
else if (value == "REPEATPMT")
{
data.transactiontype = OFX_REPEATPMT;
}
else if (value == "OTHER")
{
data.transactiontype = OFX_OTHER;
}
else
{
data.transactiontype_valid = false;
}
}//end TRANSTYPE
else if (identifier == "TRNAMT")
{
ASSIGN(data.amount, ofxamount_to_double(value));
ASSIGN(data.units, -data.amount);
ASSIGN(data.unitprice, 1.00);
}
else if (identifier == "CHECKNUM")
{
ASSIGN_STRNCPY(data.check_number, value);
}
else if (identifier == "REFNUM")
{
ASSIGN_STRNCPY(data.reference_number, value);
}
else if (identifier == "SIC")
{
ASSIGN(data.standard_industrial_code, atoi(value.c_str()));
}
else if ((identifier == "PAYEEID") || (identifier == "PAYEEID2"))
{
ASSIGN_STRNCPY(data.payee_id, value);
}
else if (identifier == "NAME")
{
ASSIGN_STRNCPY(data.name, value);
}
else
{
/* Redirect unknown identifiers to base class */
OfxTransactionContainer::add_attribute(identifier, value);
}
}//end OfxBankTransactionContainer::add_attribute
/***************************************************************************
* OfxInvestmentTransactionContainer *
***************************************************************************/
OfxInvestmentTransactionContainer::OfxInvestmentTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier):
OfxTransactionContainer(p_libofx_context, para_parentcontainer, para_tag_identifier)
{
type = "INVESTMENT";
ASSIGN(data.transactiontype, OFX_OTHER);
data.invtransactiontype_valid = true;
if (para_tag_identifier == "BUYDEBT")
{
data.invtransactiontype = OFX_BUYDEBT;
}
else if (para_tag_identifier == "BUYMF")
{
data.invtransactiontype = OFX_BUYMF;
}
else if (para_tag_identifier == "BUYOPT")
{
data.invtransactiontype = OFX_BUYOPT;
}
else if (para_tag_identifier == "BUYOTHER")
{
data.invtransactiontype = OFX_BUYOTHER;
}
else if (para_tag_identifier == "BUYSTOCK")
{
data.invtransactiontype = OFX_BUYSTOCK;
}
else if (para_tag_identifier == "CLOSUREOPT")
{
data.invtransactiontype = OFX_CLOSUREOPT;
}
else if (para_tag_identifier == "INCOME")
{
data.invtransactiontype = OFX_INCOME;
}
else if (para_tag_identifier == "INVEXPENSE")
{
data.invtransactiontype = OFX_INVEXPENSE;
}
else if (para_tag_identifier == "JRNLFUND")
{
data.invtransactiontype = OFX_JRNLFUND;
}
else if (para_tag_identifier == "JRNLSEC")
{
data.invtransactiontype = OFX_JRNLSEC;
}
else if (para_tag_identifier == "MARGININTEREST")
{
data.invtransactiontype = OFX_MARGININTEREST;
}
else if (para_tag_identifier == "REINVEST")
{
data.invtransactiontype = OFX_REINVEST;
}
else if (para_tag_identifier == "RETOFCAP")
{
data.invtransactiontype = OFX_RETOFCAP;
}
else if (para_tag_identifier == "SELLDEBT")
{
data.invtransactiontype = OFX_SELLDEBT;
}
else if (para_tag_identifier == "SELLMF")
{
data.invtransactiontype = OFX_SELLMF;
}
else if (para_tag_identifier == "SELLOPT")
{
data.invtransactiontype = OFX_SELLOPT;
}
else if (para_tag_identifier == "SELLOTHER")
{
data.invtransactiontype = OFX_SELLOTHER;
}
else if (para_tag_identifier == "SELLSTOCK")
{
data.invtransactiontype = OFX_SELLSTOCK;
}
else if (para_tag_identifier == "SPLIT")
{
data.invtransactiontype = OFX_SPLIT;
}
else if (para_tag_identifier == "TRANSFER")
{
data.invtransactiontype = OFX_TRANSFER;
}
else if (para_tag_identifier == "INVBANKTRAN")
{
data.invtransactiontype = OFX_INVBANKTRAN;
}
else
{
message_out(ERROR, "This should not happen, " + para_tag_identifier + " is an unknown investment transaction type");
data.invtransactiontype_valid = false;
}
}
void OfxInvestmentTransactionContainer::add_attribute(const std::string identifier, const std::string value)
{
if (identifier == "UNIQUEID")
{
ASSIGN_STRNCPY(data.unique_id, value);
}
else if (identifier == "UNIQUEIDTYPE")
{
ASSIGN_STRNCPY(data.unique_id_type, value);
}
else if (identifier == "UNITS")
{
ASSIGN(data.units, ofxamount_to_double(value));
}
else if (identifier == "UNITPRICE")
{
ASSIGN(data.unitprice, ofxamount_to_double(value));
}
else if (identifier == "MKTVAL")
{
ASSIGN(data.market_value, ofxamount_to_double(value));
}
else if (identifier == "TOTAL")
{
ASSIGN(data.amount, ofxamount_to_double(value));
}
else if (identifier == "CURRATE")
{
ASSIGN(data.currency_ratio, ofxamount_to_double(value));
}
else if (identifier == "CURSYM")
{
ASSIGN_STRNCPY(data.currency, value);
}
else if (identifier == "DTSETTLE")
{
ASSIGN(data.date_posted, ofxdate_to_time_t(value));
}
else if (identifier == "DTTRADE")
{
ASSIGN(data.date_initiated, ofxdate_to_time_t(value));
}
else if (identifier == "COMMISSION")
{
ASSIGN(data.commission, ofxamount_to_double(value));
}
else if (identifier == "FEES")
{
ASSIGN(data.fees, ofxamount_to_double(value));
}
else if (identifier == "OLDUNITS")
{
ASSIGN(data.oldunits, ofxamount_to_double(value));
}
else if (identifier == "NEWUNITS")
{
ASSIGN(data.newunits, ofxamount_to_double(value));
}
else if (identifier == "ACCRDINT")
{
ASSIGN(data.accrued_interest, ofxamount_to_double(value));
}
else if (identifier == "AVGCOSTBASIS")
{
ASSIGN(data.avg_cost_basis, ofxamount_to_double(value));
}
else if (identifier == "BUYTYPE" || identifier == "OPTBUYTYPE")
{
if (value == "BUY")
{
ASSIGN(data.buy_type, data.OFX_BUY_TYPE_BUY);
}
else if (value == "BUYTOCOVER")
{
ASSIGN(data.buy_type, data.OFX_BUY_TYPE_BUYTOCOVER);
}
else if (value == "BUYTOOPEN")
{
ASSIGN(data.buy_type, data.OFX_BUY_TYPE_BUYTOOPEN);
}
else if (value == "BUYTOCLOSE")
{
ASSIGN(data.buy_type, data.OFX_BUY_TYPE_BUYTOCLOSE);
}
}
else if (identifier == "DENOMINATOR")
{
ASSIGN(data.denominator, ofxamount_to_double(value));
}
else if (identifier == "DTPAYROLL")
{
ASSIGN(data.date_payroll, ofxdate_to_time_t(value));
}
else if (identifier == "DTPURCHASE")
{
ASSIGN(data.date_purchase, ofxdate_to_time_t(value));
}
else if (identifier == "GAIN")
{
ASSIGN(data.gain, ofxamount_to_double(value));
}
else if (identifier == "FRACCASH")
{
ASSIGN(data.cash_for_fractional, ofxamount_to_double(value));
}
else if (identifier == "INCOMETYPE")
{
if (value == "CGLONG")
{
ASSIGN(data.income_type, data.OFX_CGLONG);
}
else if (value == "CGSHORT")
{
ASSIGN(data.income_type, data.OFX_CGSHORT);
}
else if (value == "DIV")
{
ASSIGN(data.income_type, data.OFX_DIVIDEND);
}
else if (value == "INTEREST")
{
ASSIGN(data.income_type, data.OFX_INTEREST);
}
else if (value == "MISC")
{
ASSIGN(data.income_type, data.OFX_MISC);
}
}
else if (identifier == "INV401KSOURCE")
{
if (value == "PRETAX")
{
ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_PRETAX);
}
else if (value == "AFTERTAX")
{
ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_AFTERTAX);
}
else if (value == "MATCH")
{
ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_MATCH);
}
else if (value == "PROFITSHARING")
{
ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_PROFITSHARING);
}
else if (value == "ROLLOVER")
{
ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_ROLLOVER);
}
else if (value == "OTHERVEST")
{
ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_OTHERVEST);
}
else if (value == "OTHERNONVEST")
{
ASSIGN(data.inv_401k_source, data.OFX_401K_SOURCE_OTHERNONVEST);
}
}
else if (identifier == "LOAD")
{
ASSIGN(data.load, ofxamount_to_double(value));
}
else if (identifier == "LOANID")
{
ASSIGN_STRNCPY(data.loan_id, value);
}
else if (identifier == "LOANINTEREST")
{
ASSIGN(data.loan_interest, ofxamount_to_double(value));
}
else if (identifier == "LOANPRINCIPAL")
{
ASSIGN(data.loan_principal, ofxamount_to_double(value));
}
else if (identifier == "MARKDOWN")
{
ASSIGN(data.markdown, ofxamount_to_double(value));
}
else if (identifier == "MARKUP")
{
ASSIGN(data.markup, ofxamount_to_double(value));
}
else if (identifier == "NUMERATOR")
{
ASSIGN(data.numerator, ofxamount_to_double(value));
}
else if (identifier == "OPTACTION")
{
if (value == "EXERCISE")
{
ASSIGN(data.opt_action, data.OFX_OPTACTION_EXERCISE);
}
else if (value == "ASSIGN")
{
ASSIGN(data.opt_action, data.OFX_OPTACTION_ASSIGN);
}
else if (value == "EXPIRE")
{
ASSIGN(data.opt_action, data.OFX_OPTACTION_EXPIRE);
}
}
else if (identifier == "PENALTY")
{
ASSIGN(data.penalty, ofxamount_to_double(value));
}
else if (identifier == "POSTYPE")
{
if (value == "LONG")
{
ASSIGN(data.pos_type, data.OFX_POSTYPE_LONG);
}
else if (value == "SHORT")
{
ASSIGN(data.pos_type, data.OFX_POSTYPE_SHORT);
}
}
else if (identifier == "PRIORYEARCONTRIB")
{
if (value == "Y")
{
ASSIGN(data.prior_year_contrib, true);
}
else if (value == "N")
{
ASSIGN(data.prior_year_contrib, false);
}
}
else if (identifier == "RELFITID")
{
ASSIGN_STRNCPY(data.related_fi_tid, value);
}
else if (identifier == "RELTYPE")
{
if (value == "SPREAD")
{
ASSIGN(data.related_type, data.OFX_RELTYPE_SPREAD);
}
else if (value == "STRADDLE")
{
ASSIGN(data.related_type, data.OFX_RELTYPE_STRADDLE);
}
else if (value == "NONE")
{
ASSIGN(data.related_type, data.OFX_RELTYPE_NONE);
}
else if (value == "OTHER")
{
ASSIGN(data.related_type, data.OFX_RELTYPE_OTHER);
}
}
else if (identifier == "SECURED")
{
if (value == "NAKED")
{
ASSIGN(data.option_secured, data.OFX_SECURED_NAKED);
}
else if (value == "COVERED")
{
ASSIGN(data.option_secured, data.OFX_SECURED_COVERED);
}
}
else if (identifier == "SELLREASON")
{
if (value == "CALL")
{
ASSIGN(data.sell_reason, data.OFX_SELLREASON_CALL);
}
else if (value == "SELL")
{
ASSIGN(data.sell_reason, data.OFX_SELLREASON_SELL);
}
else if (value == "MATURITY")
{
ASSIGN(data.sell_reason, data.OFX_SELLREASON_MATURITY);
}
}
else if (identifier == "SELLTYPE" || identifier == "OPTSELLTYPE")
{
if (value == "SELL")
{
ASSIGN(data.sell_type, data.OFX_SELL_TYPE_SELL);
}
else if (value == "SELLSHORT")
{
ASSIGN(data.sell_type, data.OFX_SELL_TYPE_SELLSHORT);
}
else if (value == "SELLTOOPEN")
{
ASSIGN(data.sell_type, data.OFX_SELL_TYPE_SELLTOOPEN);
}
else if (value == "SELLTOCLOSE")
{
ASSIGN(data.sell_type, data.OFX_SELL_TYPE_SELLTOCLOSE);
}
}
else if (identifier == "SHPERCTRCT")
{
ASSIGN(data.shares_per_cont, ofxamount_to_double(value));
}
else if (identifier == "STATEWITHHOLDING")
{
ASSIGN(data.state_withholding, ofxamount_to_double(value));
}
else if (identifier == "SUBACCTFROM")
{
if (value == "CASH")
{
ASSIGN(data.subacct_from, data.OFX_SUBACCT_CASH);
}
else if (value == "MARGIN")
{
ASSIGN(data.subacct_from, data.OFX_SUBACCT_MARGIN);
}
else if (value == "SHORT")
{
ASSIGN(data.subacct_from, data.OFX_SUBACCT_SHORT);
}
else if (value == "OTHER")
{
ASSIGN(data.subacct_from, data.OFX_SUBACCT_OTHER);
}
}
else if (identifier == "SUBACCTFUND")
{
if (value == "CASH")
{
ASSIGN(data.subacct_funding, data.OFX_SUBACCT_CASH);
}
else if (value == "MARGIN")
{
ASSIGN(data.subacct_funding, data.OFX_SUBACCT_MARGIN);
}
else if (value == "SHORT")
{
ASSIGN(data.subacct_funding, data.OFX_SUBACCT_SHORT);
}
else if (value == "OTHER")
{
ASSIGN(data.subacct_funding, data.OFX_SUBACCT_OTHER);
}
}
else if (identifier == "SUBACCTSEC")
{
if (value == "CASH")
{
ASSIGN(data.subacct_security, data.OFX_SUBACCT_CASH);
}
else if (value == "MARGIN")
{
ASSIGN(data.subacct_security, data.OFX_SUBACCT_MARGIN);
}
else if (value == "SHORT")
{
ASSIGN(data.subacct_security, data.OFX_SUBACCT_SHORT);
}
else if (value == "OTHER")
{
ASSIGN(data.subacct_security, data.OFX_SUBACCT_OTHER);
}
}
else if (identifier == "SUBACCTTO")
{
if (value == "CASH")
{
ASSIGN(data.subacct_to, data.OFX_SUBACCT_CASH);
}
else if (value == "MARGIN")
{
ASSIGN(data.subacct_to, data.OFX_SUBACCT_MARGIN);
}
else if (value == "SHORT")
{
ASSIGN(data.subacct_to, data.OFX_SUBACCT_SHORT);
}
else if (value == "OTHER")
{
ASSIGN(data.subacct_to, data.OFX_SUBACCT_OTHER);
}
}
else if (identifier == "TAXES")
{
ASSIGN(data.taxes, ofxamount_to_double(value));
}
else if (identifier == "TAXEXEMPT")
{
if (value == "Y")
{
ASSIGN(data.tax_exempt, true);
}
else if (value == "N")
{
ASSIGN(data.tax_exempt, false);
}
}
else if (identifier == "TFERACTION")
{
if (value == "IN")
{
ASSIGN(data.transfer_action, data.OFX_TFERACTION_IN);
}
else if (value == "OUT")
{
ASSIGN(data.transfer_action, data.OFX_TFERACTION_OUT);
}
}
else if (identifier == "UNITTYPE")
{
if (value == "SHARES")
{
ASSIGN(data.unit_type, data.OFX_UNITTYPE_SHARES);
}
else if (value == "CURRENCY")
{
ASSIGN(data.unit_type, data.OFX_UNITTYPE_CURRENCY);
}
}
else if (identifier == "WITHHOLDING")
{
ASSIGN(data.withholding, ofxamount_to_double(value));
}
/* the following fields are <STMTTRN> elements for <INVBANKTRAN> */
else if ( identifier == "TRNTYPE")
{
data.transactiontype_valid = true;
if (value == "CREDIT")
{
data.transactiontype = OFX_CREDIT;
}
else if (value == "DEBIT")
{
data.transactiontype = OFX_DEBIT;
}
else if (value == "INT")
{
data.transactiontype = OFX_INT;
}
else if (value == "DIV")
{
data.transactiontype = OFX_DIV;
}
else if (value == "FEE")
{
data.transactiontype = OFX_FEE;
}
else if (value == "SRVCHG")
{
data.transactiontype = OFX_SRVCHG;
}
else if (value == "DEP")
{
data.transactiontype = OFX_DEP;
}
else if (value == "ATM")
{
data.transactiontype = OFX_ATM;
}
else if (value == "POS")
{
data.transactiontype = OFX_POS;
}
else if (value == "XFER")
{
data.transactiontype = OFX_XFER;
}
else if (value == "CHECK")
{
data.transactiontype = OFX_CHECK;
}
else if (value == "PAYMENT")
{
data.transactiontype = OFX_PAYMENT;
}
else if (value == "CASH")
{
data.transactiontype = OFX_CASH;
}
else if (value == "DIRECTDEP")
{
data.transactiontype = OFX_DIRECTDEP;
}
else if (value == "DIRECTDEBIT")
{
data.transactiontype = OFX_DIRECTDEBIT;
}
else if (value == "REPEATPMT")
{
data.transactiontype = OFX_REPEATPMT;
}
else if (value == "OTHER")
{
data.transactiontype = OFX_OTHER;
}
else
{
data.transactiontype_valid = false;
}
}//end TRANSTYPE
else if (identifier == "TRNAMT")
{
ASSIGN(data.amount, ofxamount_to_double(value));
ASSIGN(data.units, -data.amount);
ASSIGN(data.unitprice, 1.00);
}
else if (identifier == "CHECKNUM")
{
ASSIGN_STRNCPY(data.check_number, value);
}
else if (identifier == "REFNUM")
{
ASSIGN_STRNCPY(data.reference_number, value);
}
else if (identifier == "SIC")
{
ASSIGN(data.standard_industrial_code, atoi(value.c_str()));
}
else if ((identifier == "PAYEEID") || (identifier == "PAYEEID2"))
{
ASSIGN_STRNCPY(data.payee_id, value);
}
else if (identifier == "NAME")
{
ASSIGN_STRNCPY(data.name, value);
}
else
{
/* Redirect unknown identifiers to the base class */
OfxTransactionContainer::add_attribute(identifier, value);
}
}//end OfxInvestmentTransactionContainer::add_attribute
OfxTransactionData::fi_id
char fi_id[OFX_FITID_LENGTH]
Definition: inc/libofx.h:737
OfxTransactionData::gain
double gain
Definition: inc/libofx.h:879
OfxGenericContainer::type
std::string type
Definition: ofx_containers.hh:41
OfxTransactionData::unitprice
double unitprice
Definition: inc/libofx.h:727
ASSIGN
#define ASSIGN(DEST, VALUE)
Definition: ofx_utilities.hh:45
OfxTransactionData::markup
double markup
Definition: inc/libofx.h:924
OfxTransactionData::commission
double commission
Definition: inc/libofx.h:819
OfxTransactionData::account_ptr
struct OfxAccountData * account_ptr
Definition: inc/libofx.h:704
OfxTransactionContainer::gen_event
virtual int gen_event()
Generate libofx.h events.
Definition: ofx_container_transaction.cpp:68
OFX_BUYSTOCK
@ OFX_BUYSTOCK
Definition: inc/libofx.h:660
OfxTransactionData::fees
double fees
Definition: inc/libofx.h:822
OFX_CLOSUREOPT
@ OFX_CLOSUREOPT
Definition: inc/libofx.h:661
ASSIGN_STRNCPY
#define ASSIGN_STRNCPY(DEST, VALUE)
Definition: ofx_utilities.hh:52
OfxTransactionContainer::add_to_main_tree
virtual int add_to_main_tree()
Add this container to the main tree.
Definition: ofx_container_transaction.cpp:82
OfxAccountData::account_id
char account_id[OFX_ACCOUNT_ID_LENGTH]
Definition: inc/libofx.h:301
OfxTransactionData::shares_per_cont
double shares_per_cont
Definition: inc/libofx.h:997
OFX_FEE
@ OFX_FEE
Definition: inc/libofx.h:639
OfxTransactionData::payee_id
char payee_id[OFX_SVRTID2_LENGTH]
Definition: inc/libofx.h:809
OfxAccountData
An abstraction of an account.
Definition: inc/libofx.h:287
OfxMainContainer
The root container. Created by the <OFX> OFX element or by the export functions.
Definition: ofx_containers.hh:289
OfxTransactionData::market_value
double market_value
Definition: inc/libofx.h:832
OFX_DEP
@ OFX_DEP
Definition: inc/libofx.h:641
OfxTransactionData::amount
double amount
Definition: inc/libofx.h:731
OfxTransactionData::state_withholding
double state_withholding
Definition: inc/libofx.h:1001
OfxTransactionData::OFX_INTEREST
@ OFX_INTEREST
Definition: inc/libofx.h:891
OFX_POS
@ OFX_POS
Definition: inc/libofx.h:643
ERROR
@ ERROR
Definition: messages.hh:41
OFX_RETOFCAP
@ OFX_RETOFCAP
Definition: inc/libofx.h:668
OFX_XFER
@ OFX_XFER
Definition: inc/libofx.h:644
OFX_DEBIT
@ OFX_DEBIT
Definition: inc/libofx.h:636
OfxTransactionData::cash_for_fractional
double cash_for_fractional
Definition: inc/libofx.h:882
OFX_INT
@ OFX_INT
Definition: inc/libofx.h:637
OfxTransactionData::penalty
double penalty
Definition: inc/libofx.h:939
OfxTransactionData::OFX_SELLREASON_CALL
@ OFX_SELLREASON_CALL
Definition: inc/libofx.h:979
OfxTransactionData::fi_id_correction_action
FiIdCorrectionAction fi_id_correction_action
Definition: inc/libofx.h:786
OfxTransactionData::server_transaction_id
char server_transaction_id[OFX_SVRTID2_LENGTH]
Definition: inc/libofx.h:791
OfxTransactionData::prior_year_contrib
int prior_year_contrib
Definition: inc/libofx.h:951
OfxTransactionData::name
char name[OFX_TRANSACTION_NAME_LENGTH]
Definition: inc/libofx.h:812
OFX_REPEATPMT
@ OFX_REPEATPMT
Definition: inc/libofx.h:650
OfxTransactionData::fi_id_corrected
char fi_id_corrected[OFX_FITID_LENGTH]
Definition: inc/libofx.h:781
OFX_JRNLFUND
@ OFX_JRNLFUND
Definition: inc/libofx.h:664
OfxTransactionData::newunits
double newunits
Definition: inc/libofx.h:828
OFX_SELLDEBT
@ OFX_SELLDEBT
Definition: inc/libofx.h:669
OfxTransactionData::date_posted
time_t date_posted
Definition: inc/libofx.h:758
OfxTransactionData::tax_exempt
int tax_exempt
Definition: inc/libofx.h:1022
OfxTransactionData::oldunits
double oldunits
Definition: inc/libofx.h:825
OFX_SELLOTHER
@ OFX_SELLOTHER
Definition: inc/libofx.h:672
OFX_CHECK
@ OFX_CHECK
Definition: inc/libofx.h:645
OFX_CREDIT
@ OFX_CREDIT
Definition: inc/libofx.h:635
ofx_utilities.hh
Various simple functions for type conversion & al.
OFX_SELLMF
@ OFX_SELLMF
Definition: inc/libofx.h:670
DELETE
@ DELETE
Definition: inc/libofx.h:681
OFX_BUYDEBT
@ OFX_BUYDEBT
Definition: inc/libofx.h:656
OfxTransactionData::currency_ratio
double currency_ratio
Definition: inc/libofx.h:840
OfxGenericContainer
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
Definition: ofx_containers.hh:31
OfxGenericContainer::add_attribute
virtual void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_generic.cpp:57
OfxStatementData::account_id
char account_id[OFX_ACCOUNT_ID_LENGTH]
Definition: inc/libofx.h:1083
ofxamount_to_double
double ofxamount_to_double(const std::string ofxamount)
Convert OFX amount of money to double float.
Definition: ofx_utilities.cpp:130
OfxTransactionData::numerator
double numerator
Definition: inc/libofx.h:927
OFX_INCOME
@ OFX_INCOME
Definition: inc/libofx.h:662
OfxTransactionData::avg_cost_basis
double avg_cost_basis
Definition: inc/libofx.h:856
OfxTransactionData::account_id
char account_id[OFX_ACCOUNT_ID_LENGTH]
Definition: inc/libofx.h:701
LibofxContext
Definition: context.hh:23
OfxTransactionData::loan_principal
double loan_principal
Definition: inc/libofx.h:918
OfxBankTransactionContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_transaction.cpp:176
ofx_containers.hh
LibOFX internal object code.
message_out
int message_out(OfxMsgType error_type, const std::string message)
Message output function.
Definition: messages.cpp:67
OFX_CASH
@ OFX_CASH
Definition: inc/libofx.h:647
OfxTransactionData::memo
char memo[OFX_MEMO2_LENGTH]
Definition: inc/libofx.h:816
OFX_BUYOTHER
@ OFX_BUYOTHER
Definition: inc/libofx.h:659
OfxTransactionData::denominator
double denominator
Definition: inc/libofx.h:870
OfxTransactionData::withholding
double withholding
Definition: inc/libofx.h:1042
OfxTransactionData::OFX_CGSHORT
@ OFX_CGSHORT
Definition: inc/libofx.h:889
ofxdate_to_time_t
time_t ofxdate_to_time_t(const std::string &ofxdate)
Convert a C++ string containing a time in OFX format to a C time_t.
Definition: ofx_utilities.cpp:68
OfxTransactionData::security_data_valid
int security_data_valid
Definition: inc/libofx.h:756
REPLACE
@ REPLACE
Definition: inc/libofx.h:683
OfxTransactionData::currency
char currency[OFX_CURRENCY_LENGTH]
Definition: inc/libofx.h:836
OfxTransactionData::reference_number
char reference_number[OFX_REFERENCE_NUMBER_LENGTH]
Definition: inc/libofx.h:802
OfxTransactionData::unique_id_type
char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]
Definition: inc/libofx.h:751
OFX_INVEXPENSE
@ OFX_INVEXPENSE
Definition: inc/libofx.h:663
OfxTransactionData::amounts_are_foreign_currency
int amounts_are_foreign_currency
Definition: inc/libofx.h:846
OfxTransactionData::taxes
double taxes
Definition: inc/libofx.h:1018
OFX_SELLSTOCK
@ OFX_SELLSTOCK
Definition: inc/libofx.h:673
OfxTransactionData::OFX_DIVIDEND
@ OFX_DIVIDEND
Definition: inc/libofx.h:890
OfxInvestmentTransactionContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_transaction.cpp:390
OFX_DIV
@ OFX_DIV
Definition: inc/libofx.h:638
OfxTransactionData::OFX_MISC
@ OFX_MISC
Definition: inc/libofx.h:892
OFX_TRANSFER
@ OFX_TRANSFER
Definition: inc/libofx.h:675
OFX_BUYMF
@ OFX_BUYMF
Definition: inc/libofx.h:657
OFX_MARGININTEREST
@ OFX_MARGININTEREST
Definition: inc/libofx.h:666
OfxTransactionData::date_initiated
time_t date_initiated
Definition: inc/libofx.h:765
OfxStatementContainer
Represents a statement for either a bank account or a credit card account.
Definition: ofx_containers.hh:155
OfxTransactionData::OFX_SELLREASON_SELL
@ OFX_SELLREASON_SELL
Definition: inc/libofx.h:980
OfxTransactionData::standard_industrial_code
long int standard_industrial_code
Definition: inc/libofx.h:805
OfxTransactionData::transactiontype_valid
int transactiontype_valid
Definition: inc/libofx.h:709
OFX_DIRECTDEP
@ OFX_DIRECTDEP
Definition: inc/libofx.h:648
OfxTransactionData::accrued_interest
double accrued_interest
Definition: inc/libofx.h:853
OfxTransactionData::loan_id
char loan_id[OFX_LOANID_LENGTH]
Definition: inc/libofx.h:912
OFX_INVBANKTRAN
@ OFX_INVBANKTRAN
Definition: inc/libofx.h:676
OFX_DIRECTDEBIT
@ OFX_DIRECTDEBIT
Definition: inc/libofx.h:649
OFX_ATM
@ OFX_ATM
Definition: inc/libofx.h:642
OFX_JRNLSEC
@ OFX_JRNLSEC
Definition: inc/libofx.h:665
OfxTransactionContainer
Represents a generic transaction.
Definition: ofx_containers.hh:243
OFX_BUYOPT
@ OFX_BUYOPT
Definition: inc/libofx.h:658
OfxTransactionData::OFX_CGLONG
@ OFX_CGLONG
Definition: inc/libofx.h:888
OfxTransactionData::loan_interest
double loan_interest
Definition: inc/libofx.h:915
OfxTransactionData::load
double load
Definition: inc/libofx.h:909
OfxTransactionData::check_number
char check_number[OFX_CHECK_NUMBER_LENGTH]
Definition: inc/libofx.h:797
OFX_REINVEST
@ OFX_REINVEST
Definition: inc/libofx.h:667
OFX_SPLIT
@ OFX_SPLIT
Definition: inc/libofx.h:674
OFX_SRVCHG
@ OFX_SRVCHG
Definition: inc/libofx.h:640
OfxTransactionData::units
double units
Definition: inc/libofx.h:724
OfxTransactionData::date_funds_available
time_t date_funds_available
Definition: inc/libofx.h:773
OfxTransactionData::unique_id
char unique_id[OFX_UNIQUE_ID_LENGTH]
Definition: inc/libofx.h:749
OFX_OTHER
@ OFX_OTHER
Definition: inc/libofx.h:651
OFX_SELLOPT
@ OFX_SELLOPT
Definition: inc/libofx.h:671
OfxTransactionData::date_payroll
time_t date_payroll
Definition: inc/libofx.h:873
OfxTransactionData::date_purchase
time_t date_purchase
Definition: inc/libofx.h:876
OfxTransactionData::markdown
double markdown
Definition: inc/libofx.h:921
OfxTransactionData::OFX_SELLREASON_MATURITY
@ OFX_SELLREASON_MATURITY
Definition: inc/libofx.h:981
messages.hh
Message IO functionality.
OfxTransactionData::related_fi_tid
char related_fi_tid[OFX_FITID_LENGTH]
Definition: inc/libofx.h:955
OfxTransactionContainer::add_attribute
virtual void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_transaction.cpp:96
OFX_PAYMENT
@ OFX_PAYMENT
Definition: inc/libofx.h:646