コード例 #1
0
ファイル: OfxExport.java プロジェクト: Cybernostics/jgnash
  /**
   * Reinvested transaction is a two part process. Need to show Income into cash and then the
   * reinvestment from cash
   *
   * @param transaction transaction to write
   */
  private void writeReinvestStockTransaction(final InvestmentTransaction transaction) {

    // Part one, show dividend income to cash
    writeDividendTransaction(transaction);

    // Part two, show reinvest from cash
    indentedWriter.println(wrapOpen(REINVEST), indentLevel++);

    indentedWriter.println(wrapOpen(INVTRAN), indentLevel++);

    // write the FITID
    writeFitID(transaction);

    indentedWriter.println(wrap(DTTRADE, encodeDate(transaction.getDate())), indentLevel);
    indentedWriter.println(wrap(DTSETTLE, encodeDate(transaction.getDate())), indentLevel);
    indentedWriter.println(
        wrap(MEMO, "Distribution reinvestment: " + transaction.getSecurityNode().getSymbol()),
        indentLevel);
    indentedWriter.println(wrapClose(INVTRAN), --indentLevel);

    // write security information
    writeSecID(transaction.getSecurityNode());
    indentedWriter.println(wrap(INCOMETYPE, "DIV"), indentLevel);
    indentedWriter.println(
        wrap(TOTAL, transaction.getTotal(account).abs().negate().toPlainString()), indentLevel);
    indentedWriter.println(wrap(SUBACCTSEC, "CASH"), indentLevel);

    indentedWriter.println(wrap(UNITS, transaction.getQuantity().toPlainString()), indentLevel);
    indentedWriter.println(wrap(UNITPRICE, transaction.getPrice().toPlainString()), indentLevel);
    indentedWriter.println(wrap(COMMISSION, transaction.getFees().toPlainString()), indentLevel);
    indentedWriter.println(wrapClose(REINVEST), --indentLevel);
  }
コード例 #2
0
ファイル: OfxExport.java プロジェクト: Cybernostics/jgnash
  private void writeSellStockTransaction(final InvestmentTransaction transaction) {
    indentedWriter.println(wrapOpen(SELLSTOCK), indentLevel++);
    indentedWriter.println(wrapOpen(INVSELL), indentLevel++);

    indentedWriter.println(wrapOpen(INVTRAN), indentLevel++);

    // write the FITID
    writeFitID(transaction);

    indentedWriter.println(wrap(DTTRADE, encodeDate(transaction.getDate())), indentLevel);
    indentedWriter.println(wrap(DTSETTLE, encodeDate(transaction.getDate())), indentLevel);
    indentedWriter.println(wrapClose(INVTRAN), --indentLevel);

    // write security information
    writeSecID(transaction.getSecurityNode());

    indentedWriter.println(wrap(UNITS, transaction.getQuantity().toPlainString()), indentLevel);
    indentedWriter.println(wrap(UNITPRICE, transaction.getPrice().toPlainString()), indentLevel);
    indentedWriter.println(wrap(COMMISSION, transaction.getFees().toPlainString()), indentLevel);
    indentedWriter.println(wrap(TOTAL, transaction.getTotal(account).toPlainString()), indentLevel);
    indentedWriter.println(wrap(SUBACCTSEC, "CASH"), indentLevel);
    indentedWriter.println(wrap(SUBACCTFUND, "CASH"), indentLevel);

    indentedWriter.println(wrapClose(INVSELL), --indentLevel);
    indentedWriter.println(wrap(SELLTYPE, "SELL"), indentLevel);
    indentedWriter.println(wrapClose(SELLSTOCK), --indentLevel);
  }
コード例 #3
0
ファイル: OfxExport.java プロジェクト: Cybernostics/jgnash
  private void writeDividendTransaction(final InvestmentTransaction transaction) {
    indentedWriter.println(wrapOpen(INCOME), indentLevel++);

    indentedWriter.println(wrapOpen(INVTRAN), indentLevel++);
    writeFitID(transaction); // write the FITID

    indentedWriter.println(wrap(DTTRADE, encodeDate(transaction.getDate())), indentLevel);
    indentedWriter.println(wrap(DTSETTLE, encodeDate(transaction.getDate())), indentLevel);
    indentedWriter.println(
        wrap(MEMO, "Dividend: " + transaction.getSecurityNode().getSymbol()), indentLevel);
    indentedWriter.println(wrapClose(INVTRAN), --indentLevel);

    // write security information
    writeSecID(transaction.getSecurityNode());

    indentedWriter.println(wrap(INCOMETYPE, "DIV"), indentLevel);
    indentedWriter.println(
        wrap(TOTAL, transaction.getTotal(account).abs().toPlainString()), indentLevel);
    indentedWriter.println(wrap(SUBACCTSEC, "CASH"), indentLevel);
    indentedWriter.println(wrap(SUBACCTFUND, "CASH"), indentLevel);
    indentedWriter.println(wrapClose(INCOME), --indentLevel);
  }