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.cam.document.service;
017
018 import java.lang.reflect.InvocationTargetException;
019
020 import org.kuali.kfs.module.cam.businessobject.Asset;
021 import org.kuali.kfs.module.cam.businessobject.AssetGlobal;
022 import org.kuali.kfs.module.cam.businessobject.AssetPayment;
023 import org.kuali.kfs.module.cam.businessobject.AssetPaymentDetail;
024 import org.kuali.kfs.module.cam.document.AssetPaymentDocument;
025
026 public interface AssetPaymentService {
027
028 /**
029 * Finds out the maximum value of payment sequence for an asset
030 *
031 * @param assetPayment Asset Payment
032 * @return Maximum sequence value of asset payment within an asset
033 */
034 Integer getMaxSequenceNumber(Long capitalAssetNumber);
035
036 /**
037 * Checks if asset payment is federally funder or not
038 *
039 * @param assetPayment Payment record
040 * @return True if financial object sub type code indicates federal contribution
041 */
042 boolean isPaymentFederalOwned(AssetPayment assetPayment);
043
044 /**
045 * Checks active status of financial object of the payment
046 *
047 * @param assetPayment Payment record
048 * @return True if object is active
049 */
050 boolean isPaymentFinancialObjectActive(AssetPayment assetPayment);
051
052
053 /**
054 * Stores the approved asset payment detail records in the asset payment table, and updates the total cost of the asset in the
055 * asset table
056 *
057 * @param assetPaymentDetail
058 */
059 public void processApprovedAssetPayment(AssetPaymentDocument assetPaymentDocument);
060
061
062 /**
063 * This method uses reflection and performs below steps on all Amount fields
064 * <li>If it is a depreciation field, then reset the value to null, so that they don't get copied to offset payments </li>
065 * <li>If it is an amount field, then reverse the amount by multiplying with -1 </li>
066 *
067 * @param offsetPayment Offset payment
068 * @param reverseAmount true if amounts needs to be multiplied with -1
069 * @param nullPeriodDepreciation true if depreciation period amount needs to be null
070 * @throws NoSuchMethodException
071 * @throws IllegalAccessException
072 * @throws InvocationTargetException
073 */
074 public void adjustPaymentAmounts(AssetPayment assetPayment, boolean reverseAmount, boolean nullPeriodDepreciation) throws IllegalAccessException, InvocationTargetException;
075
076 /**
077 * Checks if payment is eligible for GL posting
078 *
079 * @param assetPayment AssetPayment
080 * @return true if elgible for GL posting
081 */
082 public boolean isPaymentEligibleForGLPosting(AssetPayment assetPayment);
083
084
085 /**
086 * Checks if object sub type is non depreciable federally owned
087 *
088 * @param string objectSubType
089 * @return true if is NON_DEPRECIABLE_FEDERALLY_OWNED_OBJECT_SUB_TYPES
090 */
091 public boolean isNonDepreciableFederallyOwnedObjSubType(String objectSubType);
092
093 /**
094 * sets in an assetPaymentDetail BO the posting year and posting period that is retrived from the university date table using
095 * the asset payment posted date as a key.
096 *
097 * @param assetPaymentDetail
098 * @return boolean
099 */
100 public boolean extractPostedDatePeriod(AssetPaymentDetail assetPaymentDetail);
101
102 /**
103 * Returns asset payment details quantity
104 *
105 * @param assetGlobal
106 * @return Integer
107 */
108 public Integer getAssetPaymentDetailQuantity(AssetGlobal assetGlobal);
109
110
111 /**
112 * Validates the assets inputed in the asset payment document
113 *
114 * @param errorPath
115 * @param asset
116 * @return
117 */
118 public boolean validateAssets(String errorPath, Asset asset);
119
120 /**
121 * This method determines whether or not an asset has different object sub type codes in its documents.
122 *
123 * @return true when the asset has payments with object codes that point to different object sub type codes
124 */
125 public boolean hasDifferentObjectSubTypes(AssetPaymentDocument document);
126
127 /**
128 * Check if payment is eligible for CAPITALIZATION GL posting.
129 *
130 * @param assetPayment
131 * @return
132 */
133 public boolean isPaymentEligibleForCapitalizationGLPosting(AssetPayment assetPayment);
134
135 /**
136 * Check if payment is eligible for ACCUMMULATE_DEPRECIATION GL posting.
137 *
138 * @param assetPayment
139 * @return
140 */
141 public boolean isPaymentEligibleForAccumDeprGLPosting(AssetPayment assetPayment);
142
143
144 /**
145 * Check if payment is eligible for OFFSET_AMOUNT GL posting.
146 *
147 * @param assetPayment
148 * @return
149 */
150 public boolean isPaymentEligibleForOffsetGLPosting(AssetPayment assetPayment);
151
152 }