1 /* 2 * Copyright 2007 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.ole.module.purap.document.service; 17 18 import org.kuali.ole.module.purap.businessobject.PurApAccountingLineBase; 19 import org.kuali.ole.module.purap.businessobject.PurchaseOrderItem; 20 import org.kuali.ole.module.purap.document.AccountsPayableDocument; 21 import org.kuali.ole.module.purap.document.PurchaseOrderDocument; 22 import org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocument; 23 import org.kuali.ole.module.purap.util.ExpiredOrClosedAccountEntry; 24 25 import java.util.HashMap; 26 27 /** 28 * Contains logic for use by the individual AccountsPayable documents 29 */ 30 public interface AccountsPayableService { 31 32 /** 33 * Generates a list of continuation accounts for expired or closed accounts as well as a list of expired or closed 34 * accounts with no continuation accounts. 35 * 36 * @param document The accounts payable document whose accounts we are trying to retrieve. 37 * @return A HashMap where the keys are the string representations of the chart and account of the 38 * original account and the values are the ExpiredOrClosedAccountEntry. 39 */ 40 public HashMap<String, ExpiredOrClosedAccountEntry> getExpiredOrClosedAccountList(AccountsPayableDocument document); 41 42 /** 43 * Generates a note of where continuation accounts were used and adds them as a note to the document. 44 * 45 * @param document The accounts payable document to which we're adding the notes. 46 * @param expiredOrClosedAccountList The HashMap where the keys are the string representations of the chart and 47 * account of the original account and the values are the ExpiredOrClosedAccountEntry. 48 */ 49 public void generateExpiredOrClosedAccountNote(AccountsPayableDocument document, HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountList); 50 51 /** 52 * Adds a warning message to the message list if expired or closed accounts have been used on the document and the 53 * document is not in any of these state: Initiate, In Process or Awaiting Accounts Payable Review and the 54 * current user is a fiscal user. 55 * 56 * @param document The accounts payable document to which we're adding the warning message. 57 */ 58 public void generateExpiredOrClosedAccountWarning(AccountsPayableDocument document); 59 60 /** 61 * Performs the replacement of an expired/closed account with a continuation account. 62 * 63 * @param acctLineBase The accounting line whose chart and account we're going to replace. 64 * @param expiredOrClosedAccountList The HashMap where the keys are the string representations of the chart 65 * and account of the original account and the values are the ExpiredOrClosedAccountEntry. 66 */ 67 public void processExpiredOrClosedAccount(PurApAccountingLineBase acctLineBase, HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountList); 68 69 /** 70 * This method cancels a document, it uses DocumentSpecificService to call the actual logic on the PaymentRequestService 71 * or CreditMemoService as appropriate. In certain cases it will also reopen a closed PurchaseOrderDocument 72 * 73 * @param apDocument The accounts payable document to be canceled. 74 * @param currentNodeName The string representing the current node, which we'll need when we 75 * want to update the document status by node. Note: if this is blank it is assumed 76 * the request is not coming from workflow. 77 */ 78 public void cancelAccountsPayableDocument(AccountsPayableDocument apDocument, String currentNodeName); 79 80 /** 81 * This method cancels an AccountsPayableDocument according to the document status. 82 * 83 * @param apDocument The accounts payable document to be canceled. 84 * @param noteText Notes users input when canceling the document 85 */ 86 public void cancelAccountsPayableDocumentByCheckingDocumentStatus(AccountsPayableDocument apDocument, String noteText) throws Exception; 87 88 /** 89 * Updates the item list based on what's eligible to be payed on purchase order. 90 * 91 * @param apDocument The accounts payable document containing the items to be updated. 92 */ 93 public void updateItemList(AccountsPayableDocument apDocument); 94 95 /** 96 * Determines if item is eligible for payment. 97 * 98 * @param poi The purchase order item whose eligibility for payment is to be determined. 99 * @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 /** 114 * checks if an accounting line with zero dollar amount can be copied from PO to PREQ. This will check 115 * the system parameter COPY_ACCOUNTING_LINES_WITH_ZERO_AMOUNT_FROM_PO_TO_PREQ_IND and determines if the 116 * line can be copied or not. 117 * 118 * @return true if the system parameter value is Y else returns N. 119 */ 120 public boolean canCopyAccountingLinesWithZeroAmount(); 121 }