Exemplo n.º 1
0
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getCurrentTaxLotBalanceSecurityUnitValue(String)
   *     Method to get the security unit value for the current balance tax lot record
   * @param securityId
   * @return securityUnitValue
   */
  public BigDecimal getCurrentTaxLotBalanceSecurityUnitValue(String securityId) {
    BigDecimal securityUnitValue = BigDecimal.ZERO;

    Security security = securityService.getByPrimaryKey(securityId);

    return security.getUnitValue();
  }
Exemplo n.º 2
0
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getNextTwelveMonthsEstimatedValue(String)
   *     Method to calculate Next Twelve Months Estimated value
   * @param securityId
   * @return nextTwelveMonthsEstimatedValue
   */
  public BigDecimal getNextTwelveMonthsEstimatedValue(
      HoldingTaxLot holdingTaxLot, String securityId) {
    BigDecimal nextTweleveMonthsEstimatedValue = BigDecimal.ZERO;

    Security security = securityService.getByPrimaryKey(securityId);

    return KEMCalculationRoundingHelper.multiply(
        holdingTaxLot.getUnits(),
        security.getIncomeRate(),
        EndowConstants.Scale.SECURITY_MARKET_VALUE);
  }
Exemplo n.º 3
0
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getNextFiscalYearInvestmentIncome(HoldingTaxLot,
   *     String) Method to calculate next fiscal year investment income
   * @param securityId
   * @return nextFiscalyearInvestmentIncome
   */
  public BigDecimal getNextFiscalYearInvestmentIncome(
      HoldingTaxLot holdingTaxLot, String securityId) {
    BigDecimal nextFiscalyearInvestmentIncome = BigDecimal.ZERO;

    Security security = securityService.getByPrimaryKey(securityId);
    nextFiscalyearInvestmentIncome =
        KEMCalculationRoundingHelper.multiply(
            security.getNextFiscalYearDistributionAmount(),
            holdingTaxLot.getUnits(),
            EndowConstants.Scale.SECURITY_MARKET_VALUE);

    return nextFiscalyearInvestmentIncome;
  }
Exemplo n.º 4
0
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getRemainderOfFiscalYearEstimatedIncome(HoldingTaxLot,
   *     String) Method to calculate remainder of fiscal year estimated income
   * @param securityId
   * @return remainderOfFiscalYearEstimatedIncome
   */
  public BigDecimal getRemainderOfFiscalYearEstimatedIncome(
      HoldingTaxLot holdingTaxLot, String securityId) {
    BigDecimal incomeAmount = BigDecimal.ZERO;

    Security security = securityService.getByPrimaryKey(securityId);

    String classCodeType = security.getClassCode().getClassCodeType();

    if (EndowConstants.ClassCodeTypes.ALTERNATIVE_INVESTMENT.equalsIgnoreCase(classCodeType)) {
      return BigDecimal.ZERO;
    }
    // calculations for BONDS
    if (EndowConstants.ClassCodeTypes.BOND.equalsIgnoreCase(classCodeType)) {
      return getRemainderOfFiscalYearEstimatedIncomeForBonds(security, holdingTaxLot);
    }

    // calculations for CASH
    if (EndowConstants.ClassCodeTypes.CASH_EQUIVALENTS.equalsIgnoreCase(classCodeType)) {
      return getRemainderOfFiscalYearEstimatedIncomeForCash(security, holdingTaxLot);
    }

    // calculations for LIABILITIES
    if (EndowConstants.ClassCodeTypes.LIABILITY.equalsIgnoreCase(classCodeType)) {
      return BigDecimal.ZERO;
    }

    // calculations for OTHER
    if (EndowConstants.ClassCodeTypes.OTHER.equalsIgnoreCase(classCodeType)) {
      return BigDecimal.ZERO;
    }

    // calculations for POOLED FUNDS
    if (EndowConstants.ClassCodeTypes.POOLED_INVESTMENT.equalsIgnoreCase(classCodeType)) {
      return getRemainderOfFiscalYearEstimatedIncomeForPooledFunds(security, holdingTaxLot);
    }

    // calculations for STOCKS
    if (EndowConstants.ClassCodeTypes.STOCKS.equalsIgnoreCase(classCodeType)) {
      return getRemainderOfFiscalYearEstimatedIncomeForStocks(security, holdingTaxLot);
    }

    return incomeAmount;
  }
Exemplo n.º 5
0
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getHoldingMarketValue(HoldingTaxLot,
   *     String)
   */
  public BigDecimal getHoldingMarketValue(HoldingTaxLot holdingTaxLot, String securityId) {
    BigDecimal holdingMarketValue = BigDecimal.ZERO;

    Security security = securityService.getByPrimaryKey(securityId);

    String classCodeType = security.getClassCode().getClassCodeType();

    if (EndowConstants.ClassCodeTypes.ALTERNATIVE_INVESTMENT.equalsIgnoreCase(classCodeType)) {
      String kemid = holdingTaxLot.getKemid();
      if (dataDictionaryService.getAttributeForceUppercase(
          TransactionArchive.class, EndowPropertyConstants.TRANSACTION_ARCHIVE_KEM_ID)) {
        kemid = kemid.toUpperCase();
      }
      BigDecimal totalCashActivity =
          transactionArchiveDao.getTransactionArchivesTotalCashActivity(kemid, securityId);
      return (security.getSecurityValueByMarket().subtract(totalCashActivity));
    }
    // calculations for BONDS
    if (EndowConstants.ClassCodeTypes.BOND.equalsIgnoreCase(classCodeType)) {
      holdingMarketValue =
          KEMCalculationRoundingHelper.multiply(
              holdingTaxLot.getUnits(),
              security.getUnitValue(),
              EndowConstants.Scale.SECURITY_MARKET_VALUE);
      holdingMarketValue =
          KEMCalculationRoundingHelper.divide(
              holdingMarketValue,
              BigDecimal.valueOf(100),
              EndowConstants.Scale.SECURITY_MARKET_VALUE);
      return holdingMarketValue;
    }

    // other cases...
    holdingMarketValue =
        KEMCalculationRoundingHelper.multiply(
            holdingTaxLot.getUnits(),
            security.getUnitValue(),
            EndowConstants.Scale.SECURITY_MARKET_VALUE);

    return holdingMarketValue;
  }
  /**
   * @see
   *     org.kuali.kfs.module.endow.document.service.UpdateTaxLotsBasedOnAccMethodAndTransSubtypeService#updateTransactionLineTaxLots(boolean,
   *     org.kuali.kfs.module.endow.document.EndowmentTaxLotLinesDocument,
   *     org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine)
   */
  public void updateTransactionLineTaxLots(
      boolean isUpdate,
      EndowmentTaxLotLinesDocument endowmentTaxLotLinesDocument,
      EndowmentTransactionLine transLine) {

    EndowmentTransactionSecurity endowmentTransactionSecurity =
        endowmentTaxLotLinesDocument.getSourceTransactionSecurity();
    String accountingMethod =
        parameterService.getParameterValueAsString(
            KfsParameterConstants.ENDOWMENT_ALL.class,
            EndowParameterKeyConstants.TAX_LOTS_ACCOUNTING_METHOD);
    Security security =
        securityService.getByPrimaryKey(endowmentTransactionSecurity.getSecurityID());

    if (ObjectUtils.isNotNull(security)) {
      // In the Asset Decrease document, if transaction sub type is non-cash and IF the user inserts
      // an amount in the
      // transaction amount, that amount along with the units sill be used to generate the
      // transaction tax lot lines. The
      // amount will not be calculated by the addition of the transaction line. In the event the
      // user has entered an amount in
      // the transaction amount field, that amount along with the units will be spread
      // proportionately among the tax lots.
      if (endowmentTaxLotLinesDocument instanceof AssetDecreaseDocument
          && EndowConstants.TransactionSubTypeCode.NON_CASH.equalsIgnoreCase(
              endowmentTaxLotLinesDocument.getTransactionSubTypeCode())
          && transLine.getTransactionAmount() != null
          && transLine.getTransactionAmount().bigDecimalValue().compareTo(BigDecimal.ZERO) != 0) {
        updateTaxLotsForSubTypeNonCashAndTransAmtNonZero(
            isUpdate, endowmentTransactionSecurity, transLine);
      } else {

        if (EndowConstants.TaxLotsAccountingMethodOptions.AVERAGE_BALANCE.equalsIgnoreCase(
                accountingMethod)
            || (EndowConstants.TaxLotsAccountingMethodOptions.FIFO.equalsIgnoreCase(
                    accountingMethod)
                && !security.getClassCode().isTaxLotIndicator())) {
          if (EndowConstants.TransactionSubTypeCode.CASH.equalsIgnoreCase(
              endowmentTaxLotLinesDocument.getTransactionSubTypeCode())) {
            updateTaxLotsForAccountingMethodAverageBalance(
                true, isUpdate, endowmentTransactionSecurity, transLine);
          }
          if (EndowConstants.TransactionSubTypeCode.NON_CASH.equalsIgnoreCase(
              endowmentTaxLotLinesDocument.getTransactionSubTypeCode())) {
            updateTaxLotsForAccountingMethodAverageBalance(
                false, isUpdate, endowmentTransactionSecurity, transLine);
            setTransactionLineTotal(transLine);
          }
        }

        if ((EndowConstants.TaxLotsAccountingMethodOptions.FIFO.equalsIgnoreCase(accountingMethod)
                || EndowConstants.TaxLotsAccountingMethodOptions.LIFO.equalsIgnoreCase(
                    accountingMethod))
            && security.getClassCode().isTaxLotIndicator()) {
          boolean isFIFO =
              EndowConstants.TaxLotsAccountingMethodOptions.FIFO.equalsIgnoreCase(accountingMethod);

          if (EndowConstants.TransactionSubTypeCode.CASH.equalsIgnoreCase(
              endowmentTaxLotLinesDocument.getTransactionSubTypeCode())) {
            updateTaxLotsForAccountingMethodFIFOorLIFO(
                true, isUpdate, isFIFO, endowmentTransactionSecurity, transLine);
          }
          if (EndowConstants.TransactionSubTypeCode.NON_CASH.equalsIgnoreCase(
              endowmentTaxLotLinesDocument.getTransactionSubTypeCode())) {
            updateTaxLotsForAccountingMethodFIFOorLIFO(
                false, isUpdate, isFIFO, endowmentTransactionSecurity, transLine);
            setTransactionLineTotal(transLine);
          }
        }
      }
    }
  }