Examples of StockExpensesAnnotation


Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

        stocksIncomeAnnotation_done
            .getTwoDecimalLongCodifiedAmount());
  }

  private void stockExpensesAnnotation(StocksBook stocksBook){
    StockExpensesAnnotation stockExpensesAnnotation_done = new StockExpensesAnnotation();
    stockExpensesAnnotation_done.setAmount(1000.0);
    stockExpensesAnnotation_done.setBook(stocksBook);
    stockExpensesAnnotation_done.setConcept("test_concept");
    Date date = new Date();
    stockExpensesAnnotation_done.setDate(date);
    stockExpensesAnnotation_done.setNumberOfStocks(100L);
   
    Assert.assertEquals(new Double(-1000.0),
        stockExpensesAnnotation_done
            .getSignedAmount());
    Assert.assertEquals(new Long(100000L),
        stockExpensesAnnotation_done
            .getTwoDecimalLongCodifiedAmount());
  }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

        Annotation annotation = annotationIterator.next();
        // if there a purchase stock transaction then we create its subtransaction
        // For a purchase stock the subtransaction is the same as the transaction initially
        // but it can then be splited depending on the sold stocks.
        if (annotation instanceof StockExpensesAnnotation) {
          StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
          stocksBuySubtransactionList
              .add(new StocksBuySubtransaction(
                  stockExpensesAnnotation));
        } else if (annotation instanceof StockIncomeAnnotation) {
          // if there a sell stock transaction then we compute the previous purchase
View Full Code Here

Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

        Boolean hasStocks = false;
        if (annotation instanceof StockIncomeAnnotation) {
          StockIncomeAnnotation stockIncomeAnnotation = (StockIncomeAnnotation) annotation;
          hasStocks = stockIncomeAnnotation.getNumberOfStocks() > 0;
        } else if (annotation instanceof StockExpensesAnnotation) {
          StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
          hasStocks = stockExpensesAnnotation.getNumberOfStocks() > 0;
        }
        if (hasStocks) {
          conceptToAnnotationMap.put(annotation.getConcept(),
              annotationsForMap);
        }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

      Map<String, StockState> symbolToCurrentStockState,
      Annotation annotation, Integer month, Integer year) {
    if (!symbolToCurrentStockState.keySet().contains(
        annotation.getConcept())) {
      if (annotation instanceof StockExpensesAnnotation) {
        StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
        StockState stockState = new StockState(
            stockExpensesAnnotation.getConcept(),
            -stockExpensesAnnotation.getAmount(),
            stockExpensesAnnotation.getNumberOfStocks(),
            month, year);
        symbolToCurrentStockState.put(annotation.getConcept(),
            stockState);
      } else {
        throw new AssetManagerRuntimeException("the first transaction should be buy stocks");
        // TODO: error, the first transaction should be buy stocks
      }
    } else {
      StockState stockState = symbolToCurrentStockState.get(annotation
          .getConcept());
      if (annotation instanceof StockExpensesAnnotation) {
        StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
        stockState = new StockState(stockState.getSymbol(),
            stockState.getBalance()
                - stockExpensesAnnotation.getAmount(),
            stockState.getNumberOfPurchasedStocks()
                + stockExpensesAnnotation.getNumberOfStocks(), month, year);
      } else if (annotation instanceof StockIncomeAnnotation) {
        StockIncomeAnnotation stockIncomeAnnotation = (StockIncomeAnnotation) annotation;
        stockState = new StockState(stockState.getSymbol(),
            stockState.getBalance()
                + stockIncomeAnnotation.getAmount(),
View Full Code Here

Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

  @NotifyChange({ "annotations" })
  @Command
  public void addStocksAnnotation() {
    Annotation annotation = null;
    if (annotationType.equals(AnnotationType.EXPENSES)) {
      StockExpensesAnnotation stockExpensesAnnotation = new StockExpensesAnnotation();
      annotation = stockExpensesAnnotation;
    } else if (annotationType.equals(AnnotationType.INCOME)) {
      StockIncomeAnnotation stockIncomeAnnotation = new StockIncomeAnnotation();
      annotation = stockIncomeAnnotation;
    }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

        // stocks book
        if (annotationImport.getTwoDecimalLongCodifiedAmount() >= 0) {
          StockIncomeAnnotation stockIncomeAnnotation = new StockIncomeAnnotation();
          annotationToCreate = stockIncomeAnnotation;
        } else {
          StockExpensesAnnotation stockExpensesAnnotation = new StockExpensesAnnotation();
          annotationToCreate = stockExpensesAnnotation;
        }
      } else {
        // general books
        if (annotationImport.getTwoDecimalLongCodifiedAmount() >= 0) {
View Full Code Here

Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

  @Override
  public String coerceToUi(StockIncomeDescription stockIncomeDescription, Label label,
      BindContext bindContext) {
    Annotation annotation = stockIncomeDescription.getStockIncomeAnnotation();
    if (annotation instanceof StockExpensesAnnotation) {
      StockExpensesAnnotation expensesAnnotation = (StockExpensesAnnotation) annotation;
      return "Comprados " + expensesAnnotation.getNumberOfStocks()
          + " valores por "
          + NumberFomatter.formatMoney(expensesAnnotation.getAmount());
    } else if (annotation instanceof StockIncomeAnnotation) {
      StockIncomeAnnotation incomeAnnotation = (StockIncomeAnnotation) annotation;
      return "Vendidos " + incomeAnnotation.getNumberOfStocks()
          + " valores por "
          + NumberFomatter.formatMoney(incomeAnnotation.getAmount());
View Full Code Here

Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

      amount= stockIncomeAnnotation.getAmount();
      if(stockIncomeAnnotation.getNumberOfStocks() > 0){
        numberOfStocks = stockIncomeAnnotation.getNumberOfStocks().doubleValue();
      }
    } else if (annotation instanceof StockExpensesAnnotation) {
      StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
      amount= stockExpensesAnnotation.getAmount();
      if(stockExpensesAnnotation.getNumberOfStocks() > 0){
        numberOfStocks = stockExpensesAnnotation.getNumberOfStocks().doubleValue();
      }
    }
    if(numberOfStocks != null){
      price = amount / numberOfStocks;
    }
View Full Code Here

Examples of org.pau.assetmanager.entities.StockExpensesAnnotation

      if (!(annotation instanceof StockExpensesAnnotation)
          && !(annotation instanceof StockIncomeAnnotation)) {
        currentList.add(annotation);
      } else {
        if (annotation instanceof StockExpensesAnnotation) {
          StockExpensesAnnotation stockExpensesAnnotation = (StockExpensesAnnotation) annotation;
          if (stockExpensesAnnotation.getNumberOfStocks() == 0) {
            currentList.add(stockExpensesAnnotation);
          }
        } else if (annotation instanceof StockIncomeAnnotation) {
          StockIncomeAnnotation stockIncomeAnnotation = (StockIncomeAnnotation) annotation;
          if (stockIncomeAnnotation.getNumberOfStocks() == 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.