org.kuali.kfs.module.purap.document.service.impl
Class AccountsPayableServiceImpl

java.lang.Object
  extended by org.kuali.kfs.module.purap.document.service.impl.AccountsPayableServiceImpl
All Implemented Interfaces:
AccountsPayableService

@Transactional
public class AccountsPayableServiceImpl
extends Object
implements AccountsPayableService


Field Summary
protected  AccountService accountService
           
protected  org.kuali.rice.kns.service.DateTimeService dateTimeService
           
protected  org.kuali.rice.kns.service.DocumentService documentService
           
protected  org.kuali.rice.kns.service.ParameterService parameterService
           
protected  PurapAccountingService purapAccountingService
           
protected  PurapGeneralLedgerService purapGeneralLedgerService
           
protected  PurapService purapService
           
protected  PurchaseOrderService purchaseOrderService
           
 
Constructor Summary
AccountsPayableServiceImpl()
           
 
Method Summary
protected  void addContinuationAccountsNote(AccountsPayableDocument document, HashMap<String,ExpiredOrClosedAccountEntry> accounts)
          Creates and adds a note indicating accounts replaced and what they replaced and attaches it to the document.
 void cancelAccountsPayableDocument(AccountsPayableDocument apDocument, String currentNodeName)
          This method cancels a document, it uses DocumentSpecificService to call the actual logic on the PaymentRequestService or CreditMemoService as appropriate.
 void cancelAccountsPayableDocumentByCheckingDocumentStatus(AccountsPayableDocument document, String noteText)
          This method cancels an AccountsPayableDocument according to the document status.
protected  String createChartAccountString(ExpiredOrClosedAccount ecAccount)
          Creates a chart-account string.
protected  HashMap<String,ExpiredOrClosedAccountEntry> expiredOrClosedAccountsList(AccountsPayableDocument document)
          Generates a list of replacement accounts for expired or closed accounts, as well as for expired/closed accounts without a continuation account.
 HashMap<String,ExpiredOrClosedAccountEntry> expiredOrClosedAccountsList(PurchaseOrderDocument po)
          Generates a list of replacement accounts for expired or closed accounts, as well as for expired/closed accounts without a continuation account.
 void generateExpiredOrClosedAccountNote(AccountsPayableDocument document, HashMap<String,ExpiredOrClosedAccountEntry> expiredOrClosedAccountList)
          Generates a note of where continuation accounts were used and adds them as a note to the document.
 void generateExpiredOrClosedAccountWarning(AccountsPayableDocument document)
          Adds a warning message to the message list if expired or closed accounts have been used on the document and the document is not in any of these state: Initiate, In Process or Awaiting Accounts Payable Review and the current user is a fiscal user.
 HashMap<String,ExpiredOrClosedAccountEntry> getExpiredOrClosedAccountList(AccountsPayableDocument document)
          Generates a list of continuation accounts for expired or closed accounts as well as a list of expired or closed accounts with no continuation accounts.
protected  Account getReplaceAccountForClosedAccount(Account account, AccountsPayableDocument document)
          Gets the replacement account for the specified closed account.
protected  Account getReplaceAccountForExpiredAccount(Account account, AccountsPayableDocument document)
          Gets the replacement account for the specified expired account.
protected  boolean isAPUser(AccountsPayableDocument document, org.kuali.rice.kim.bo.Person user)
          Determines if the user is an AP user.
protected  boolean isFiscalUser(AccountsPayableDocument document, org.kuali.rice.kim.bo.Person user)
          Determines if the user is a fiscal officer.
 void performLogicForFullEntryCompleted(PurchasingAccountsPayableDocument purapDocument)
          Performs all the actions on an update document.
 void processExpiredOrClosedAccount(PurApAccountingLineBase acctLineBase, HashMap<String,ExpiredOrClosedAccountEntry> expiredOrClosedAccountList)
          Performs the replacement of an expired/closed account with a continuation account.
 boolean purchaseOrderItemEligibleForPayment(PurchaseOrderItem poi)
          Determines if item is eligible for payment.
 void setAccountService(AccountService accountService)
           
 void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
           
 void setDocumentService(org.kuali.rice.kns.service.DocumentService documentService)
           
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
           
 void setPurapAccountingService(PurapAccountingService purapAccountingService)
           
 void setPurapGeneralLedgerService(PurapGeneralLedgerService purapGeneralLedgerService)
           
 void setPurapService(PurapService purapService)
           
 void setPurchaseOrderService(PurchaseOrderService purchaseOrderService)
           
protected  void updateEncumberance(PurchaseOrderItem purchaseOrderItem, CreditMemoItem cmItem)
          Updates the encumberance related fields.
protected  void updateEncumberances(PaymentRequestItem preqItem, PurchaseOrderItem poItem, CreditMemoItem cmItem)
          Updates encumberances.
 void updateItemList(AccountsPayableDocument apDocument)
          Updates the item list based on what's eligible to be payed on purchase order.
protected  void updatePossibleAmmendedFields(PurchaseOrderItem sourceItem, PaymentRequestItem destItem)
          Updates fields that could've been changed on amendment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

purapAccountingService

protected PurapAccountingService purapAccountingService

purapGeneralLedgerService

protected PurapGeneralLedgerService purapGeneralLedgerService

documentService

protected org.kuali.rice.kns.service.DocumentService documentService

purapService

protected PurapService purapService

parameterService

protected org.kuali.rice.kns.service.ParameterService parameterService

dateTimeService

protected org.kuali.rice.kns.service.DateTimeService dateTimeService

purchaseOrderService

protected PurchaseOrderService purchaseOrderService

accountService

protected AccountService accountService
Constructor Detail

AccountsPayableServiceImpl

public AccountsPayableServiceImpl()
Method Detail

setParameterService

public void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)

setPurapService

public void setPurapService(PurapService purapService)

setPurapAccountingService

public void setPurapAccountingService(PurapAccountingService purapAccountingService)

setPurapGeneralLedgerService

public void setPurapGeneralLedgerService(PurapGeneralLedgerService purapGeneralLedgerService)

setDocumentService

public void setDocumentService(org.kuali.rice.kns.service.DocumentService documentService)

setDateTimeService

public void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)

setPurchaseOrderService

public void setPurchaseOrderService(PurchaseOrderService purchaseOrderService)

setAccountService

public void setAccountService(AccountService accountService)

getExpiredOrClosedAccountList

public HashMap<String,ExpiredOrClosedAccountEntry> getExpiredOrClosedAccountList(AccountsPayableDocument document)
Description copied from interface: AccountsPayableService
Generates a list of continuation accounts for expired or closed accounts as well as a list of expired or closed accounts with no continuation accounts.

Specified by:
getExpiredOrClosedAccountList in interface AccountsPayableService
Parameters:
document - The accounts payable document whose accounts we are trying to retrieve.
Returns:
A HashMap where the keys are the string representations of the chart and account of the original account and the values are the ExpiredOrClosedAccountEntry.
See Also:
AccountsPayableService.getExpiredOrClosedAccountList(org.kuali.kfs.module.purap.document.AccountsPayableDocument)

generateExpiredOrClosedAccountNote

public void generateExpiredOrClosedAccountNote(AccountsPayableDocument document,
                                               HashMap<String,ExpiredOrClosedAccountEntry> expiredOrClosedAccountList)
Description copied from interface: AccountsPayableService
Generates a note of where continuation accounts were used and adds them as a note to the document.

Specified by:
generateExpiredOrClosedAccountNote in interface AccountsPayableService
Parameters:
document - The accounts payable document to which we're adding the notes.
expiredOrClosedAccountList - The HashMap where the keys are the string representations of the chart and account of the original account and the values are the ExpiredOrClosedAccountEntry.
See Also:
AccountsPayableService.generateExpiredOrClosedAccountNote(org.kuali.kfs.module.purap.document.AccountsPayableDocument, java.util.HashMap)

generateExpiredOrClosedAccountWarning

public void generateExpiredOrClosedAccountWarning(AccountsPayableDocument document)
Description copied from interface: AccountsPayableService
Adds a warning message to the message list if expired or closed accounts have been used on the document and the document is not in any of these state: Initiate, In Process or Awaiting Accounts Payable Review and the current user is a fiscal user.

Specified by:
generateExpiredOrClosedAccountWarning in interface AccountsPayableService
Parameters:
document - The accounts payable document to which we're adding the warning message.
See Also:
AccountsPayableService.generateExpiredOrClosedAccountWarning(org.kuali.kfs.module.purap.document.AccountsPayableDocument)

processExpiredOrClosedAccount

public void processExpiredOrClosedAccount(PurApAccountingLineBase acctLineBase,
                                          HashMap<String,ExpiredOrClosedAccountEntry> expiredOrClosedAccountList)
Description copied from interface: AccountsPayableService
Performs the replacement of an expired/closed account with a continuation account.

Specified by:
processExpiredOrClosedAccount in interface AccountsPayableService
Parameters:
acctLineBase - The accounting line whose chart and account we're going to replace.
expiredOrClosedAccountList - The HashMap where the keys are the string representations of the chart and account of the original account and the values are the ExpiredOrClosedAccountEntry.
See Also:
AccountsPayableService.processExpiredOrClosedAccount(org.kuali.kfs.module.purap.businessobject.PurApAccountingLineBase, java.util.HashMap)

addContinuationAccountsNote

protected void addContinuationAccountsNote(AccountsPayableDocument document,
                                           HashMap<String,ExpiredOrClosedAccountEntry> accounts)
Creates and adds a note indicating accounts replaced and what they replaced and attaches it to the document.

Parameters:
document - The accounts payable document to which we're adding the note.
accounts - The HashMap where the keys are the string representations of the chart and account of the original account and the values are the ExpiredOrClosedAccountEntry.

getReplaceAccountForClosedAccount

protected Account getReplaceAccountForClosedAccount(Account account,
                                                    AccountsPayableDocument document)
Gets the replacement account for the specified closed account. In this case it's the continuation account of the the specified account.

Parameters:
account - the specified account which is closed.
Returns:
the replacement account for the specified account.

getReplaceAccountForExpiredAccount

protected Account getReplaceAccountForExpiredAccount(Account account,
                                                     AccountsPayableDocument document)
Gets the replacement account for the specified expired account. In this case it's the continuation account of the the specified account.

Parameters:
account - the specified account which is expired.
Returns:
the replacement account for the specified account.

expiredOrClosedAccountsList

protected HashMap<String,ExpiredOrClosedAccountEntry> expiredOrClosedAccountsList(AccountsPayableDocument document)
Generates a list of replacement accounts for expired or closed accounts, as well as for expired/closed accounts without a continuation account.

Parameters:
document - The accounts payable document from which we're obtaining the purchase order id to be used to obtain the purchase order document, whose accounts we'll use to generate the list of replacement accounts for expired or closed accounts.
Returns:
The HashMap where the keys are the string representations of the chart and account of the original account and the values are the ExpiredOrClosedAccountEntry.

expiredOrClosedAccountsList

public HashMap<String,ExpiredOrClosedAccountEntry> expiredOrClosedAccountsList(PurchaseOrderDocument po)
Generates a list of replacement accounts for expired or closed accounts, as well as for expired/closed accounts without a continuation account.

Specified by:
expiredOrClosedAccountsList in interface AccountsPayableService
Parameters:
document - The purchase order document whose accounts we'll use to generate the list of replacement accounts for expired or closed accounts.
Returns:
The HashMap where the keys are the string representations of the chart and account of the original account and the values are the ExpiredOrClosedAccountEntry.

createChartAccountString

protected String createChartAccountString(ExpiredOrClosedAccount ecAccount)
Creates a chart-account string.

Parameters:
ecAccount - The account whose chart and account number we're going to use to create the resulting String for this method.
Returns:
The string representing the chart and account number of the given ecAccount.

isFiscalUser

protected boolean isFiscalUser(AccountsPayableDocument document,
                               org.kuali.rice.kim.bo.Person user)
Determines if the user is a fiscal officer. Currently this only checks the doc and workflow status for approval requested

Parameters:
document - The document to be used to check the status code and whether the workflow approval is requested.
user - The current user.
Returns:
boolean true if the user is a fiscal officer.

isAPUser

protected boolean isAPUser(AccountsPayableDocument document,
                           org.kuali.rice.kim.bo.Person user)
Determines if the user is an AP user. Currently this only checks the doc and workflow status for approval requested

Parameters:
document - The document to be used to check the status code and whether the workflow approval is requested.
user - The current user.
Returns:
boolean true if the user is an AP User.

cancelAccountsPayableDocument

public void cancelAccountsPayableDocument(AccountsPayableDocument apDocument,
                                          String currentNodeName)
Description copied from interface: AccountsPayableService
This method cancels a document, it uses DocumentSpecificService to call the actual logic on the PaymentRequestService or CreditMemoService as appropriate. In certain cases it will also reopen a closed PurchaseOrderDocument

Specified by:
cancelAccountsPayableDocument in interface AccountsPayableService
Parameters:
apDocument - The accounts payable document to be canceled.
currentNodeName - The string representing the current node, which we'll need when we want to update the document status by node. Note: if this is blank it is assumed the request is not coming from workflow.
See Also:
AccountsPayableService.cancelAccountsPayableDocument(org.kuali.kfs.module.purap.document.AccountsPayableDocument, java.lang.String)

cancelAccountsPayableDocumentByCheckingDocumentStatus

public void cancelAccountsPayableDocumentByCheckingDocumentStatus(AccountsPayableDocument document,
                                                                  String noteText)
                                                           throws Exception
Description copied from interface: AccountsPayableService
This method cancels an AccountsPayableDocument according to the document status.

Specified by:
cancelAccountsPayableDocumentByCheckingDocumentStatus in interface AccountsPayableService
Parameters:
document - The accounts payable document to be canceled.
noteText - Notes users input when canceling the document
Throws:
Exception
See Also:
AccountsPayableService.cancelAccountsPayableDocumentByCheckingDocumentStatus(org.kuali.kfs.module.purap.document.AccountsPayableDocument, java.lang.String)

performLogicForFullEntryCompleted

public void performLogicForFullEntryCompleted(PurchasingAccountsPayableDocument purapDocument)
Description copied from interface: AccountsPayableService
Performs all the actions on an update document.

Specified by:
performLogicForFullEntryCompleted in interface AccountsPayableService
Parameters:
purapDocument - PurchasingAccountsPayableDocument
See Also:
AccountsPayableService.performLogicForFullEntryCompleted(org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument)

updateItemList

public void updateItemList(AccountsPayableDocument apDocument)
Description copied from interface: AccountsPayableService
Updates the item list based on what's eligible to be payed on purchase order.

Specified by:
updateItemList in interface AccountsPayableService
Parameters:
apDocument - The accounts payable document containing the items to be updated.
See Also:
AccountsPayableService.updateItemList(org.kuali.kfs.module.purap.document.AccountsPayableDocument)

updatePossibleAmmendedFields

protected void updatePossibleAmmendedFields(PurchaseOrderItem sourceItem,
                                            PaymentRequestItem destItem)
Updates fields that could've been changed on amendment.

Parameters:
sourceItem - The purchase order item from which we're getting the unit price, catalog number and description to be set in the destItem.
destItem - The payment request item to which we're setting the unit price, catalog number and description.

updateEncumberances

protected void updateEncumberances(PaymentRequestItem preqItem,
                                   PurchaseOrderItem poItem,
                                   CreditMemoItem cmItem)
Updates encumberances.

Parameters:
preqItem - The payment request item from which we're obtaining the item quantity, unit price and extended price.
poItem - The purchase order item from which we're obtaining the invoice total quantity, unit price and invoice total amount.
cmItem - The credit memo item whose invoice total quantity, unit price and extended price are to be updated.

updateEncumberance

protected void updateEncumberance(PurchaseOrderItem purchaseOrderItem,
                                  CreditMemoItem cmItem)
Updates the encumberance related fields.

Parameters:
purchaseOrderItem - The purchase order item from which we're obtaining the invoice total quantity, unit price and invoice total amount.
cmItem - The credit memo item whose invoice total quantity, unit price and extended price are to be updated.

purchaseOrderItemEligibleForPayment

public boolean purchaseOrderItemEligibleForPayment(PurchaseOrderItem poi)
Description copied from interface: AccountsPayableService
Determines if item is eligible for payment.

Specified by:
purchaseOrderItemEligibleForPayment in interface AccountsPayableService
Parameters:
poi - The purchase order item whose eligibility for payment is to be determined.
Returns:
boolean true if the item is eligible for payment.
See Also:
AccountsPayableService.purchaseOrderItemEligibleForPayment(org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.