/** * Service Method to create a new current tax lot balance record and copy HoldingTaxLot record to * it * * @param holdingTaxLot * @return currentTaxLotBalance */ public CurrentTaxLotBalance copyHoldingTaxLotToCurrentTaxLotBalance(HoldingTaxLot holdingTaxLot) { CurrentTaxLotBalance currentTaxLotBalance = new CurrentTaxLotBalance(); currentTaxLotBalance.setKemid(holdingTaxLot.getKemid()); currentTaxLotBalance.setSecurityId(holdingTaxLot.getSecurityId()); currentTaxLotBalance.setRegistrationCode(holdingTaxLot.getRegistrationCode()); currentTaxLotBalance.setLotNumber(holdingTaxLot.getLotNumber()); currentTaxLotBalance.setIncomePrincipalIndicator(holdingTaxLot.getIncomePrincipalIndicator()); currentTaxLotBalance.setUnits(holdingTaxLot.getUnits()); currentTaxLotBalance.setCost(holdingTaxLot.getCost()); currentTaxLotBalance.setAcquiredDate(holdingTaxLot.getAcquiredDate()); currentTaxLotBalance.setPriorAccrual(holdingTaxLot.getPriorAccrual()); currentTaxLotBalance.setCurrentAccrual(holdingTaxLot.getCurrentAccrual()); currentTaxLotBalance.setLastTransactionDate(holdingTaxLot.getLastTransactionDate()); return currentTaxLotBalance; }
/** * @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; }