001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.purap.service;
017:
018: import java.util.List;
019: import java.util.Set;
020:
021: import org.kuali.core.util.KualiDecimal;
022: import org.kuali.kfs.bo.SourceAccountingLine;
023: import org.kuali.module.purap.bo.PurApAccountingLine;
024: import org.kuali.module.purap.bo.PurApItem;
025: import org.kuali.module.purap.document.PurchasingAccountsPayableDocument;
026: import org.kuali.module.purap.util.SummaryAccount;
027:
028: /**
029: * This class is used to generate Account Summaries for the Purchasing Accounts Payable Module account lists as well as to generate account lists that can be
030: * used for distribution to below the line items or any other items that may require distribution
031: */
032: public interface PurapAccountingService {
033:
034: /**
035: * unused see other generateAccountDistribution methods
036: * @deprecated
037: * @param accounts
038: * @param totalAmount
039: * @param percentScale
040: * @return
041: */
042: public List<PurApAccountingLine> generateAccountDistributionForProration(
043: List<SourceAccountingLine> accounts,
044: KualiDecimal totalAmount, Integer percentScale);
045:
046: /**
047: *
048: * Determines an appropriate account distribution for a particular Purchasing Accounts Payable list of Accounts. It does this by looking at the accounts that were provided
049: * which should be generated from a generateSummary method. It then builds up a list of PurApAccountingLines (specified by the Class variable) and tries to determine the
050: * appropriate percents to use on the new accounts, this may require some moving of percents to the last account as a slush.
051: *
052: * @param accounts the incoming source accounts from generateSummary
053: * @param totalAmount the total amount of the document
054: * @param percentScale the scale to round to
055: * @param clazz the class of the Purchasing Accounts Payable Account
056: * @return a list of new Purchasing Accounts Payable Accounts
057: */
058: public List<PurApAccountingLine> generateAccountDistributionForProration(
059: List<SourceAccountingLine> accounts,
060: KualiDecimal totalAmount, Integer percentScale, Class clazz);
061:
062: /**
063: *
064: * Determines an appropriate account distribution for a particular Purchasing Accounts Payable list of Accounts. It does this by looking at the accounts that were provided
065: * which should be generated from a generateSummary method. It then builds up a list of PurApAccountingLines (specified by the Class variable) and tries to determine the
066: * appropriate percents to use on the new accounts, this may require some moving of percents to the last account as a slush. This is called when a document has a zero dollar
067: * total
068:
069: * @param accounts the incoming source accounts from generateSummary
070: * @param percentScale the scale to round to
071: * @param clazz the class of the Purchasing Accounts Payable Account
072: * @return a list of new Purchasing Accounts Payable Accounts
073: */
074: public List<PurApAccountingLine> generateAccountDistributionForProrationWithZeroTotal(
075: List<PurApAccountingLine> accounts, Integer percentScale);
076:
077: /**
078: *
079: * This creates summary accounts based on a list of items.
080: * @param document the document to generate the summary accounts from
081: * @return a list of summary accounts.
082: */
083: public List<SummaryAccount> generateSummaryAccounts(
084: PurchasingAccountsPayableDocument document);
085:
086: /**
087: *
088: * Generates an account summary, that is it creates a list of source accounts
089: * by rounding up the Purchasing Accounts Payable accounts off of the Purchasing Accounts Payable items.
090: *
091: * @param document the document to generate the summary from
092: * @return a list of source accounts
093: */
094: public List<SourceAccountingLine> generateSummary(
095: List<PurApItem> items);
096:
097: /**
098: *
099: * convenience method that generates a list of source accounts while excluding items with
100: * $0 amounts
101: *
102: * @param items the items to generate source accounts from
103: * @return a list of source accounts "rolled up" from the purap accounts
104: */
105: public List<SourceAccountingLine> generateSummaryWithNoZeroTotals(
106: List<PurApItem> items);
107:
108: /**
109: *
110: * convenience method that generates a list of source accounts while excluding items with
111: * $0 amounts and using the alternate amount
112: *
113: * @param items the items to generate source accounts from
114: * @return a list of source accounts "rolled up" from the purap accounts
115: */
116: public List<SourceAccountingLine> generateSummaryWithNoZeroTotalsUsingAlternateAmount(
117: List<PurApItem> items);
118:
119: /**
120: *
121: * convenience method that generates a list of source accounts while excluding items with
122: * the specified item types
123: *
124: * @param items the items to generate source accounts from
125: * @param excludedItemTypeCodes the item types to exclude
126: * @return a list of source accounts "rolled up" from the purap accounts
127: */
128: public List<SourceAccountingLine> generateSummaryExcludeItemTypes(
129: List<PurApItem> items, Set excludedItemTypeCodes);
130:
131: /**
132: *
133: * convenience method that generates a list of source accounts while excluding items with
134: * the specified item types and not including items with zero totals
135: *
136: * @param items the items to generate source accounts from
137: * @param excludedItemTypeCodes the item types to exclude
138: * @return a list of source accounts "rolled up" from the purap accounts
139: */
140: public List<SourceAccountingLine> generateSummaryExcludeItemTypesAndNoZeroTotals(
141: List<PurApItem> items, Set excludedItemTypeCodes);
142:
143: /**
144: *
145: * convenience method that generates a list of source accounts while only including items with
146: * the specified item types
147: *
148: * @param items the items to generate source accounts from
149: * @param excludedItemTypeCodes the item types to include
150: * @return a list of source accounts "rolled up" from the purap accounts
151: */
152: public List<SourceAccountingLine> generateSummaryIncludeItemTypes(
153: List<PurApItem> items, Set includedItemTypeCodes);
154:
155: /**
156: *
157: * convenience method that generates a list of source accounts while only including items with
158: * the specified item types and not including items with zero totals
159: *
160: * @param items the items to generate source accounts from
161: * @param excludedItemTypeCodes the item types to include
162: * @return a list of source accounts "rolled up" from the purap accounts
163: */
164: public List<SourceAccountingLine> generateSummaryIncludeItemTypesAndNoZeroTotals(
165: List<PurApItem> items, Set includedItemTypeCodes);
166:
167: /**
168: * This method updates account amounts based on the percents.
169: *
170: * @param document the document
171: */
172: public void updateAccountAmounts(
173: PurchasingAccountsPayableDocument document);
174:
175: /**
176: * This method updates a single items account amounts
177: *
178: * @param item
179: */
180: public void updateItemAccountAmounts(PurApItem item);
181:
182: public List<PurApAccountingLine> getAccountsFromItem(PurApItem item);
183: }
|