001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.kfs.module.endow.document.service;
017    
018    import java.math.BigDecimal;
019    import java.util.Collection;
020    
021    import org.kuali.kfs.module.endow.businessobject.CurrentTaxLotBalance;
022    import org.kuali.kfs.module.endow.businessobject.HoldingTaxLot;
023    import org.kuali.rice.kns.util.KualiInteger;
024    
025    public interface CurrentTaxLotService {
026    
027        /**
028         * Gets a current tax lot based on primary keys: kemid, security id, registration code, lot number and IP indicator.
029         * 
030         * @param kemid
031         * @param securityId
032         * @param registrationCode
033         * @param lotNumber
034         * @param ipIndicator
035         * @return the corresponding tax lot
036         */
037        public CurrentTaxLotBalance getByPrimaryKey(String kemid, String securityId, String registrationCode, KualiInteger lotNumber, String ipIndicator);
038    
039        /**
040         * Gets matching records from END_CRNT_TAX_LOT_BAL_T table
041         * @param securityId
042         * @return currentTaxLotBal Records from the table matching the securityId
043         */
044        public Collection<CurrentTaxLotBalance>getCurrentTaxLotBalancesBySecurityId(String securityId);
045    
046        /**
047         * Gets matching records from END_CRNT_TAX_LOT_BAL_T table
048         * @param securityClassCode, securityId
049         * @return currentTaxLotBal Records from the table matching the securityClassCode, securityId
050         */
051        public Collection<CurrentTaxLotBalance>getCurrentTaxLotBalancesForMatchingSecurityClassCode(String securityClassCode);
052        
053        
054        /**
055         * Gets matching records from END_CRNT_TAX_LOT_BAL_T table
056         * @param securityClassCode, securityId
057         * @return currentTaxLotBal Records from the table matching the securityClassCode, securityId
058         */
059        public Collection<CurrentTaxLotBalance>getCurrentTaxLotBalancesForMatchingSecurityClassCodeAndSecurityId(String securityClassCode, String securityId);
060        
061        /**
062         * Gets matching records from END_CRNT_TAX_LOT_BAL_T table
063         * @param incomePrincipalIndicator
064         * @return currentTaxLotBalances Records from the table matching the incomePrincipalIndicator
065         */
066        public Collection<CurrentTaxLotBalance>getCurrentTaxLotBalancesByIncomePrincipalIndicator(String incomePrincipalIndicator);
067        /**
068         * updates a current tax lot
069         * 
070         * @param currentTaxLotBalances
071         */
072        public void updateCurrentTaxLotBalance(CurrentTaxLotBalance currentTaxLotBalance);
073    
074        /**
075         * clears all the records from the CurrentTaxLotBalance table.
076         */
077        public void clearAllCurrentTaxLotRecords();
078    
079        /**
080         * Method to copy HoldingTaxLot record to currentTaxLotBalance record
081         * 
082         * @param holdingTaxLot
083         * @return currentTaxLotBalance
084         */
085        public CurrentTaxLotBalance copyHoldingTaxLotToCurrentTaxLotBalance(HoldingTaxLot holdingTaxLot);
086    
087        /**
088         * Method to get the security unit value for the current balance tax lot record
089         * 
090         * @param securityId
091         * @return securityUnitValue
092         */
093        public BigDecimal getCurrentTaxLotBalanceSecurityUnitValue(String securityId);
094    
095        /**
096         * Method to calculate Next Twelve Months Estimated value
097         * 
098         * @param securityId
099         * @return nextTwelveMonthsEstimatedValue
100         */
101        public BigDecimal getNextTwelveMonthsEstimatedValue(HoldingTaxLot holdingTaxLot, String securityId);
102    
103        /**
104         * Method to calculate remainder of fiscal year estimated income
105         * 
106         * @param securityId
107         * @return remainderOfFiscalYearEstimatedIncome
108         */
109        public BigDecimal getRemainderOfFiscalYearEstimatedIncome(HoldingTaxLot holdingTaxLot, String securityId);
110    
111        /**
112         * Method to calculate next fiscal year investment income
113         * 
114         * @param securityId
115         * @return nextFiscalyearInvestmentIncome
116         */
117        public BigDecimal getNextFiscalYearInvestmentIncome(HoldingTaxLot holdingTaxLot, String securityId);
118    
119        /**
120         * Gets the Sum of the HLDG _MVAL for all records for the Security in END_CURR_TAX_LOT_BAL_T.
121         * 
122         * @param securityId the security for which we return the sum
123         * @return the Sum of the HLDG _MVAL for all records for the Security
124         */
125        public BigDecimal getHoldingMarketValueSumForSecurity(String securityId);
126        
127        /**
128         * Retrieves all the records from END_CURR_TAX_LOT_BAL_T
129         * @return currentBalances
130         */
131        public Collection<CurrentTaxLotBalance> getAllCurrentTaxLotBalance();
132        
133        /**
134         * Gets the holding market value as follows:
135         * Class type code = B => MV = Units x Unit value / 100
136         * Class type code = A => Market Valuation (END_SEC_T: SEC_VAL_BY_MKT) minus the total cash activity 
137         *  (income and principal) since the last value date (END_SEC_T: SEC_VAL_DT)
138         * Class type code = O => Units x Unit value
139         */
140        public BigDecimal getHoldingMarketValue(HoldingTaxLot holdingTaxLot, String securityId);
141    }