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.purap.document.service; 017 018 import java.util.HashMap; 019 020 import org.kuali.kfs.module.purap.businessobject.PurApAccountingLineBase; 021 import org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem; 022 import org.kuali.kfs.module.purap.document.AccountsPayableDocument; 023 import org.kuali.kfs.module.purap.document.PurchaseOrderDocument; 024 import org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument; 025 import org.kuali.kfs.module.purap.util.ExpiredOrClosedAccountEntry; 026 027 /** 028 * Contains logic for use by the individual AccountsPayable documents 029 */ 030 public interface AccountsPayableService { 031 032 /** 033 * Generates a list of continuation accounts for expired or closed accounts as well as a list of expired or closed 034 * accounts with no continuation accounts. 035 * 036 * @param document The accounts payable document whose accounts we are trying to retrieve. 037 * @return A HashMap where the keys are the string representations of the chart and account of the 038 * original account and the values are the ExpiredOrClosedAccountEntry. 039 */ 040 public HashMap<String, ExpiredOrClosedAccountEntry> getExpiredOrClosedAccountList(AccountsPayableDocument document); 041 042 /** 043 * Generates a note of where continuation accounts were used and adds them as a note to the document. 044 * 045 * @param document The accounts payable document to which we're adding the notes. 046 * @param expiredOrClosedAccountList The HashMap where the keys are the string representations of the chart and 047 * account of the original account and the values are the ExpiredOrClosedAccountEntry. 048 */ 049 public void generateExpiredOrClosedAccountNote(AccountsPayableDocument document, HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountList); 050 051 /** 052 * Adds a warning message to the message list if expired or closed accounts have been used on the document and the 053 * document is not in any of these state: Initiate, In Process or Awaiting Accounts Payable Review and the 054 * current user is a fiscal user. 055 * 056 * @param document The accounts payable document to which we're adding the warning message. 057 */ 058 public void generateExpiredOrClosedAccountWarning(AccountsPayableDocument document); 059 060 /** 061 * Performs the replacement of an expired/closed account with a continuation account. 062 * 063 * @param acctLineBase The accounting line whose chart and account we're going to replace. 064 * @param expiredOrClosedAccountList The HashMap where the keys are the string representations of the chart 065 * and account of the original account and the values are the ExpiredOrClosedAccountEntry. 066 */ 067 public void processExpiredOrClosedAccount(PurApAccountingLineBase acctLineBase, HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountList); 068 069 /** 070 * This method cancels a document, it uses DocumentSpecificService to call the actual logic on the PaymentRequestService 071 * or CreditMemoService as appropriate. In certain cases it will also reopen a closed PurchaseOrderDocument 072 * 073 * @param apDocument The accounts payable document to be canceled. 074 * @param currentNodeName The string representing the current node, which we'll need when we 075 * want to update the document status by node. Note: if this is blank it is assumed 076 * the request is not coming from workflow. 077 */ 078 public void cancelAccountsPayableDocument(AccountsPayableDocument apDocument, String currentNodeName); 079 080 /** 081 * This method cancels an AccountsPayableDocument according to the document status. 082 * 083 * @param apDocument The accounts payable document to be canceled. 084 * @param noteText Notes users input when canceling the document 085 */ 086 public void cancelAccountsPayableDocumentByCheckingDocumentStatus(AccountsPayableDocument apDocument, String noteText) throws Exception; 087 088 /** 089 * Updates the item list based on what's eligible to be payed on purchase order. 090 * 091 * @param apDocument The accounts payable document containing the items to be updated. 092 */ 093 public void updateItemList(AccountsPayableDocument apDocument); 094 095 /** 096 * Determines if item is eligible for payment. 097 * 098 * @param poi The purchase order item whose eligibility for payment is to be determined. 099 * @return boolean true if the item is eligible for payment. 100 */ 101 public boolean purchaseOrderItemEligibleForPayment(PurchaseOrderItem poi); 102 103 /** 104 * Performs all the actions on an update document. 105 * 106 * @param purapDocument PurchasingAccountsPayableDocument 107 */ 108 public void performLogicForFullEntryCompleted(PurchasingAccountsPayableDocument purapDocument); 109 110 111 public HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountsList(PurchaseOrderDocument po); 112 113 }