Ejemplo n.º 1
0
  /**
   * 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);
  }
Ejemplo n.º 2
0
  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);
  }
Ejemplo n.º 3
0
  @Override
  public void modifyTransaction(Transaction tran) {

    assert tran instanceof InvestmentTransaction;

    assert tran.getTransactionType() == TransactionType.ADDSHARE
        || tran.getTransactionType() == TransactionType.REMOVESHARE;

    InvestmentTransaction _tran = (InvestmentTransaction) tran;

    clearForm();

    modTrans = tran;

    datePanel.setDate(tran.getLocalDate());
    memoField.setText(tran.getMemo());
    priceField.setDecimal(_tran.getPrice());
    quantityField.setDecimal(_tran.getQuantity());
    securityCombo.setSelectedNode(_tran.getSecurityNode());

    setReconciledState(tran.getReconciled(getAccount()));

    updateTotalField();
  }