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

java.lang.Object
  extended by org.kuali.kfs.module.purap.document.service.impl.PaymentRequestServiceImpl
All Implemented Interfaces:
AccountsPayableDocumentSpecificService, PaymentRequestService

@Transactional
public class PaymentRequestServiceImpl
extends Object
implements PaymentRequestService

This class provides services of use to a payment request document


Constructor Summary
PaymentRequestServiceImpl()
           
 
Method Summary
 PaymentRequestDocument addHoldOnPaymentRequest(PaymentRequestDocument document, String note)
          Marks a payment request on hold.
protected  PurApAccountingLine addTaxAccountingLine(PurApItem taxItem, BigDecimal taxableAmount)
          Generates a PurAP accounting line and adds to the specified tax item.
protected  PurApItem addTaxItem(PaymentRequestDocument preq, String itemTypeCode, BigDecimal taxableAmount)
          Generates a NRA tax item and adds to the specified payment request, according to the specified item type code.
 boolean allowBackpost(PaymentRequestDocument paymentRequestDocument)
          Payment Requests created in the previous fiscal year get backdated if we're at the beginning of the new fiscal year (i.e.
 boolean autoApprovePaymentRequest(PaymentRequestDocument doc, org.kuali.rice.kns.util.KualiDecimal defaultMinimumLimit)
          NOTE: in the event of auto-approval failure, this method may throw a RuntimeException, indicating to Spring transactional management that the transaction should be rolled back.
 boolean autoApprovePaymentRequest(String docNumber, org.kuali.rice.kns.util.KualiDecimal defaultMinimumLimit)
          NOTE: in the event of auto-approval failure, this method may throw a RuntimeException, indicating to Spring transactional management that the transaction should be rolled back.
 boolean autoApprovePaymentRequests()
          Retrieve a list of PREQs that aren't approved, check to see if they match specific requirements, then auto-approve them if possible.
protected  void calculateDiscount(PaymentRequestDocument paymentRequestDocument)
          Calculates the discount item for this paymentRequest.
 Date calculatePayDate(Date invoiceDate, PaymentTermType terms)
          Calculate based on the terms and calculate a date 10 days from today.
 void calculatePaymentRequest(PaymentRequestDocument paymentRequest, boolean updateDiscount)
          Recalculate the payment request.
 void calculateTaxArea(PaymentRequestDocument preq)
          Performs calculations on the tax edit area, generates and adds NRA tax charge items as below the line items, with their accounting lines; the calculation will activate updates on the account summary tab and the general ledger entries as well.
 void cancelExtractedPaymentRequest(PaymentRequestDocument paymentRequest, String note)
          Cancels a PREQ that has already been extracted if allowed.
 void changeVendor(PaymentRequestDocument preq, Integer headerId, Integer detailId)
          Changes the current vendor to the vendor passed in.
protected  void clearRequestCancelFields(PaymentRequestDocument document)
          Clears the request cancel fields.
 String createPreqDocumentDescription(Integer purchaseOrderIdentifier, String vendorName)
          A method to create the description for the payment request document.
protected  void distributeAccounting(PaymentRequestDocument paymentRequestDocument)
          Distributes accounts for a payment request document.
 boolean encumberedItemExistsForInvoicing(PurchaseOrderDocument document)
           
protected  PaymentRequestItem findDiscountItem(PaymentRequestDocument paymentRequestDocument)
          Finds the discount item of the payment request document.
protected  PaymentRequestItem findFullOrderDiscountItem(PaymentRequestDocument paymentRequestDocument)
          Finds the full order discount item of the payment request document.
 void generateGLEntriesCreateAccountsPayableDocument(AccountsPayableDocument apDocument)
          The given document here actually needs to be a Payment Request.
 Collection<PaymentRequestDocument> getImmediatePaymentRequestsToExtract(String chartCode)
          Get all the payment requests that are immediate and need to be extracted to PDP.
protected  org.kuali.rice.kns.util.KualiDecimal getMinimumLimitAmount(Collection<NegativePaymentRequestApprovalLimit> limits, org.kuali.rice.kns.util.KualiDecimal minimumAmount)
          This method iterates a collection of negative payment request approval limits and returns the minimum of a given minimum amount and the least among the limits in the collection.
 PaymentRequestDocument getPaymentRequestByDocumentNumber(String documentNumber)
          Obtains the payment request document given the document number.
 PaymentRequestDocument getPaymentRequestById(Integer poDocId)
          Obtains the payment request document given the purapDocumentIdentifier.
 List getPaymentRequestsByPOIdInvoiceAmountInvoiceDate(Integer poId, org.kuali.rice.kns.util.KualiDecimal invoiceAmount, Date invoiceDate)
          Obtains a list of payment request documents given the purchase order id, the invoice amount and the invoice date.
 List<PaymentRequestDocument> getPaymentRequestsByPurchaseOrderId(Integer poDocId)
          Obtains a list of payment request documents given the purchase order id.
 List getPaymentRequestsByVendorNumber(Integer vendorHeaderGeneratedId, Integer vendorDetailAssignedId)
          Retrieves a list of payment request documents with the given vendor id and invoice number.
 List getPaymentRequestsByVendorNumberInvoiceNumber(Integer vendorHeaderGeneratedId, Integer vendorDetailAssignedId, String invoiceNumber)
          Retrieves a list of payment request documents with the given vendor id and invoice number.
 Collection<PaymentRequestDocument> getPaymentRequestsToExtract(Date onOrBeforePaymentRequestPayDate)
          Get all the payment requests that need to be extracted.
 Iterator<PaymentRequestDocument> getPaymentRequestsToExtractByCM(String campusCode, VendorCreditMemoDocument cmd)
          Get all the payment requests that match a credit memo.
 Collection<PaymentRequestDocument> getPaymentRequestsToExtractByVendor(String campusCode, VendorGroupingHelper vendor, Date onOrBeforePaymentRequestPayDate)
          Get all the payment requests that match a vendor.
 Collection<PaymentRequestDocument> getPaymentRequestsToExtractSpecialPayments(String chartCode, Date onOrBeforePaymentRequestPayDate)
          Get all the special payment requests for a single chart that need to be extracted.
 Collection<PaymentRequestDocument> getPaymentRequestToExtractByChart(String chartCode, Date onOrBeforePaymentRequestPayDate)
          Get all the regular payment requests for a single campus.
 org.kuali.rice.kim.bo.Person getPersonForCancel(AccountsPayableDocument apDoc)
           
 boolean hasActivePaymentRequestsForPurchaseOrder(Integer purchaseOrderIdentifier)
          Determines if there are active payment requests for a purchase order.
 boolean hasDiscountItem(PaymentRequestDocument preq)
          This method specifies whether the payment request document has a discount item.
protected  boolean isBeingAdHocRouted(PaymentRequestDocument document)
           
protected  boolean isEligibleForAutoApproval(PaymentRequestDocument document, org.kuali.rice.kns.util.KualiDecimal defaultMinimumLimit)
          Determines whether or not a payment request document can be automatically approved.
 boolean isExtracted(PaymentRequestDocument document)
          Returns true if the payment request has been extracted
 boolean isInvoiceDateAfterToday(Date invoiceDate)
          Determines whether the invoice date is after today.
 boolean isPurchaseOrderValidForPaymentRequestDocumentCreation(PaymentRequestDocument paymentRequestDocument, PurchaseOrderDocument po)
           
protected  void logAndThrowRuntimeException(String errorMessage)
          Records the specified error message into the Log file and throws a runtime exception.
protected  void logAndThrowRuntimeException(String errorMessage, Exception e)
          Records the specified error message into the Log file and throws the specified runtime exception.
 void markPaid(PaymentRequestDocument pr, Date processDate)
          Mark a payment request as being paid and set the payment request's paid date as the processDate.
 HashMap<String,String> paymentRequestDuplicateMessages(PaymentRequestDocument document)
          Performs the processing to check whether the payment request is a duplicate and if so, adds the information about the type of duplication into the resulting HashMap to be returned by this method.
protected  void paymentTermsDateCalculation(String dueTypeDescription, Calendar invoicedDateCalendar, Integer dueNumber)
          Calculates the paymentTermsDate given the dueTypeDescription, invoicedDateCalendar and the dueNumber.
 boolean poItemEligibleForAp(AccountsPayableDocument apDoc, PurchaseOrderItem poi)
           
 void populateAndSavePaymentRequest(PaymentRequestDocument preq)
          Populate and save payment request.
 void populatePaymentRequest(PaymentRequestDocument paymentRequestDocument)
          Populate payment request.
 void processPaymentRequestInReceivingStatus()
           
 PaymentRequestDocument removeHoldOnPaymentRequest(PaymentRequestDocument document, String note)
          Removes a hold on a payment request.
 void removeIneligibleAdditionalCharges(PaymentRequestDocument document)
          Removes additional charge items that are not eligible on the payment request document.
 void removeRequestCancelOnPaymentRequest(PaymentRequestDocument document, String note)
          Removes a request cancel on payment request.
protected  void removeTaxItems(PaymentRequestDocument preq)
          Removes all existing NRA tax items from the specified payment request.
 void requestCancelOnPaymentRequest(PaymentRequestDocument document, String note)
          Marks a payment request as requested to be canceled.
 void resetExtractedPaymentRequest(PaymentRequestDocument paymentRequest, String note)
          Resets a Payment Request that had an associated Payment Request or Credit Memo cancelled externally.
protected  Date returnLaterDate(Calendar invoicedDateCalendar, Calendar processedDateCalendar)
          Returns whichever date is later, the invoicedDateCalendar or the processedDateCalendar.
 void setAccountsPayableService(AccountsPayableService accountsPayableService)
           
 void setBusinessObjectService(org.kuali.rice.kns.service.BusinessObjectService businessObjectService)
           
 void setConfigurationService(org.kuali.rice.kns.service.KualiConfigurationService configurationService)
           
 void setDataDictionaryService(org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService)
           
 void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
           
 void setDocumentService(org.kuali.rice.kns.service.DocumentService documentService)
           
 void setNegativePaymentRequestApprovalLimitService(NegativePaymentRequestApprovalLimitService negativePaymentRequestApprovalLimitService)
           
 void setNoteService(org.kuali.rice.kns.service.NoteService noteService)
           
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
           
 void setPaymentRequestDao(PaymentRequestDao paymentRequestDao)
           
 void setPurapAccountingService(PurapAccountingService purapAccountingService)
           
 void setPurapService(PurapService purapService)
           
 void setPurapWorkflowIntegrationService(PurApWorkflowIntegrationService purapWorkflowIntegrationService)
           
 void setUniversityDateService(UniversityDateService universityDateService)
           
protected  void setVendorAddress(VendorAddress va, PaymentRequestDocument preq)
          Set the Vendor address of the given ID.
 void setVendorService(VendorService vendorService)
           
 void setWorkflowDocumentService(org.kuali.rice.kns.workflow.service.WorkflowDocumentService workflowDocumentService)
           
 boolean shouldPurchaseOrderBeReversed(AccountsPayableDocument apDoc)
          If the full document entry has been completed and the status of the related purchase order document is closed, return true, otherwise return false.
 void takePurchaseOrderCancelAction(AccountsPayableDocument apDoc)
           
 String updateStatusByNode(String currentNodeName, AccountsPayableDocument apDoc)
           
protected  String updateStatusByNode(String currentNodeName, PaymentRequestDocument preqDoc)
          Updates the status of the payment request document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PaymentRequestServiceImpl

public PaymentRequestServiceImpl()
Method Detail

setDateTimeService

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

setParameterService

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

setConfigurationService

public void setConfigurationService(org.kuali.rice.kns.service.KualiConfigurationService configurationService)

setDocumentService

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

setNoteService

public void setNoteService(org.kuali.rice.kns.service.NoteService noteService)

setPurapService

public void setPurapService(PurapService purapService)

setPaymentRequestDao

public void setPaymentRequestDao(PaymentRequestDao paymentRequestDao)

setNegativePaymentRequestApprovalLimitService

public void setNegativePaymentRequestApprovalLimitService(NegativePaymentRequestApprovalLimitService negativePaymentRequestApprovalLimitService)

setPurapAccountingService

public void setPurapAccountingService(PurapAccountingService purapAccountingService)

setBusinessObjectService

public void setBusinessObjectService(org.kuali.rice.kns.service.BusinessObjectService businessObjectService)

setPurapWorkflowIntegrationService

public void setPurapWorkflowIntegrationService(PurApWorkflowIntegrationService purapWorkflowIntegrationService)

setWorkflowDocumentService

public void setWorkflowDocumentService(org.kuali.rice.kns.workflow.service.WorkflowDocumentService workflowDocumentService)

setAccountsPayableService

public void setAccountsPayableService(AccountsPayableService accountsPayableService)

setVendorService

public void setVendorService(VendorService vendorService)

setDataDictionaryService

public void setDataDictionaryService(org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService)

setUniversityDateService

public void setUniversityDateService(UniversityDateService universityDateService)

getPaymentRequestsToExtractByCM

public Iterator<PaymentRequestDocument> getPaymentRequestsToExtractByCM(String campusCode,
                                                                        VendorCreditMemoDocument cmd)
Description copied from interface: PaymentRequestService
Get all the payment requests that match a credit memo.

Specified by:
getPaymentRequestsToExtractByCM in interface PaymentRequestService
cmd - The credit memo document to be used to obtain the payment requests.
Returns:
The iterator of the resulting payment request documents returned by the paymentRequestDao.
See Also:
org.kuali.module.purap.server.PaymentRequestService.getPaymentRequestsToExtractByCM()

getPaymentRequestsToExtractByVendor

public Collection<PaymentRequestDocument> getPaymentRequestsToExtractByVendor(String campusCode,
                                                                              VendorGroupingHelper vendor,
                                                                              Date onOrBeforePaymentRequestPayDate)
Description copied from interface: PaymentRequestService
Get all the payment requests that match a vendor.

Specified by:
getPaymentRequestsToExtractByVendor in interface PaymentRequestService
onOrBeforePaymentRequestPayDate - only payment requests with a pay date on or before this date will be extracted
Returns:
Collection of the resulting payment request documents returned by the paymentRequestDao.
See Also:
PaymentRequestService.getPaymentRequestsToExtractByVendor(java.lang.String, org.kuali.kfs.module.purap.util.VendorGroupingHelper, java.sql.Date)

getPaymentRequestsToExtract

public Collection<PaymentRequestDocument> getPaymentRequestsToExtract(Date onOrBeforePaymentRequestPayDate)
Description copied from interface: PaymentRequestService
Get all the payment requests that need to be extracted.

Specified by:
getPaymentRequestsToExtract in interface PaymentRequestService
Returns:
The Collection of the resulting payment request documents returned by the paymentRequestDao.
See Also:
org.kuali.module.purap.server.PaymentRequestService.getPaymentRequestsToExtract(Date)

getPaymentRequestsToExtractSpecialPayments

public Collection<PaymentRequestDocument> getPaymentRequestsToExtractSpecialPayments(String chartCode,
                                                                                     Date onOrBeforePaymentRequestPayDate)
Description copied from interface: PaymentRequestService
Get all the special payment requests for a single chart that need to be extracted.

Specified by:
getPaymentRequestsToExtractSpecialPayments in interface PaymentRequestService
Parameters:
chartCode - The chart code to be used as one of the criterias to retrieve the payment request documents.
Returns:
The Collection of the resulting payment request documents returned by the paymentRequestDao.
See Also:
PaymentRequestService.getPaymentRequestsToExtractSpecialPayments(java.lang.String, java.sql.Date)

getImmediatePaymentRequestsToExtract

public Collection<PaymentRequestDocument> getImmediatePaymentRequestsToExtract(String chartCode)
Description copied from interface: PaymentRequestService
Get all the payment requests that are immediate and need to be extracted to PDP.

Specified by:
getImmediatePaymentRequestsToExtract in interface PaymentRequestService
Parameters:
chartCode - The chart code to be used as one of the criterias to retrieve the payment request documents.
Returns:
The iterator of the list of the resulting payment request documents returned by the paymentRequestDao.
See Also:
PaymentRequestService.getImmediatePaymentRequestsToExtract(java.lang.String)

getPaymentRequestToExtractByChart

public Collection<PaymentRequestDocument> getPaymentRequestToExtractByChart(String chartCode,
                                                                            Date onOrBeforePaymentRequestPayDate)
Description copied from interface: PaymentRequestService
Get all the regular payment requests for a single campus.

Specified by:
getPaymentRequestToExtractByChart in interface PaymentRequestService
Parameters:
chartCode - The chart code to be used as one of the criterias to retrieve the payment request documents.
Returns:
The collection of the resulting payment request documents returned by the paymentRequestDao.
See Also:
PaymentRequestService.getPaymentRequestToExtractByChart(java.lang.String, java.sql.Date)

autoApprovePaymentRequests

public boolean autoApprovePaymentRequests()
Description copied from interface: PaymentRequestService
Retrieve a list of PREQs that aren't approved, check to see if they match specific requirements, then auto-approve them if possible.

Specified by:
autoApprovePaymentRequests in interface PaymentRequestService
Returns:
boolean true if the auto approval of payment requests has at least one error.
See Also:
org.kuali.kfs.module.purap.document.service.PaymentRequestService.autoApprovePaymentRequests()

autoApprovePaymentRequest

public boolean autoApprovePaymentRequest(String docNumber,
                                         org.kuali.rice.kns.util.KualiDecimal defaultMinimumLimit)
NOTE: in the event of auto-approval failure, this method may throw a RuntimeException, indicating to Spring transactional management that the transaction should be rolled back.

Specified by:
autoApprovePaymentRequest in interface PaymentRequestService
Parameters:
docNumber - The payment request document number (not the payment request ID) to be auto approved.
defaultMinimumLimit - The default minimum limit amount to be used in determining the eligibility of the document to be auto approved.
Returns:
boolean true if the payment request document is not eligible for auto approval.
See Also:
PaymentRequestService.autoApprovePaymentRequest(java.lang.String, org.kuali.rice.kns.util.KualiDecimal)

autoApprovePaymentRequest

public boolean autoApprovePaymentRequest(PaymentRequestDocument doc,
                                         org.kuali.rice.kns.util.KualiDecimal defaultMinimumLimit)
NOTE: in the event of auto-approval failure, this method may throw a RuntimeException, indicating to Spring transactional management that the transaction should be rolled back.

Specified by:
autoApprovePaymentRequest in interface PaymentRequestService
Parameters:
doc - The payment request document to be auto approved.
defaultMinimumLimit - The default minimum limit amount to be used in determining the eligibility of the document to be auto approved.
Returns:
boolean true if the payment request document is not eligible for auto approval.
See Also:
PaymentRequestService.autoApprovePaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument, org.kuali.rice.kns.util.KualiDecimal)

isEligibleForAutoApproval

protected boolean isEligibleForAutoApproval(PaymentRequestDocument document,
                                            org.kuali.rice.kns.util.KualiDecimal defaultMinimumLimit)
Determines whether or not a payment request document can be automatically approved. FYI - If fiscal reviewers are allowed to save account changes without the full account validation running then this method must call full account validation to make sure auto approver is not blanket approving an invalid document according the the accounts on the items

Parameters:
document - The payment request document to be determined whether it can be automatically approved.
defaultMinimumLimit - The amount to be used as the minimum amount if no limit was found or the default is less than the limit.
Returns:
boolean true if the payment request document is eligible for auto approval.

getMinimumLimitAmount

protected org.kuali.rice.kns.util.KualiDecimal getMinimumLimitAmount(Collection<NegativePaymentRequestApprovalLimit> limits,
                                                                     org.kuali.rice.kns.util.KualiDecimal minimumAmount)
This method iterates a collection of negative payment request approval limits and returns the minimum of a given minimum amount and the least among the limits in the collection.

Parameters:
limits - The collection of NegativePaymentRequestApprovalLimit to be used in determining the minimum limit amount.
minimumAmount - The amount to be compared with the collection of NegativePaymentRequestApprovalLimit to determine the minimum limit amount.
Returns:
The minimum of the given minimum amount and the least among the limits in the collection.

getPaymentRequestsByVendorNumber

public List getPaymentRequestsByVendorNumber(Integer vendorHeaderGeneratedId,
                                             Integer vendorDetailAssignedId)
Retrieves a list of payment request documents with the given vendor id and invoice number.

Specified by:
getPaymentRequestsByVendorNumber in interface PaymentRequestService
Parameters:
vendorHeaderGeneratedId - The vendor header generated id.
vendorDetailAssignedId - The vendor detail assigned id.
invoiceNumber - The invoice number as entered by AP.
Returns:
List of payment request document.

getPaymentRequestsByVendorNumberInvoiceNumber

public List getPaymentRequestsByVendorNumberInvoiceNumber(Integer vendorHeaderGeneratedId,
                                                          Integer vendorDetailAssignedId,
                                                          String invoiceNumber)
Retrieves a list of payment request documents with the given vendor id and invoice number.

Specified by:
getPaymentRequestsByVendorNumberInvoiceNumber in interface PaymentRequestService
Parameters:
vendorHeaderGeneratedId - The vendor header generated id.
vendorDetailAssignedId - The vendor detail assigned id.
invoiceNumber - The invoice number as entered by AP.
Returns:
List of payment request document.

paymentRequestDuplicateMessages

public HashMap<String,String> paymentRequestDuplicateMessages(PaymentRequestDocument document)
Description copied from interface: PaymentRequestService
Performs the processing to check whether the payment request is a duplicate and if so, adds the information about the type of duplication into the resulting HashMap to be returned by this method.

Specified by:
paymentRequestDuplicateMessages in interface PaymentRequestService
Parameters:
document - The payment request document to be processed/checked for duplicates.
Returns:
The HashMap containing "PREQDuplicateInvoice" as the key and the string describing the types of duplication as the value.
See Also:
PaymentRequestService.paymentRequestDuplicateMessages(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

getPaymentRequestByDocumentNumber

public PaymentRequestDocument getPaymentRequestByDocumentNumber(String documentNumber)
Description copied from interface: PaymentRequestService
Obtains the payment request document given the document number.

Specified by:
getPaymentRequestByDocumentNumber in interface PaymentRequestService
Parameters:
documentNumber - The document number to be used to obtain the payment request document.
Returns:
The payment request document whose document number matches with the given input parameter.
See Also:
PaymentRequestService.getPaymentRequestByDocumentNumber(java.lang.String)

getPaymentRequestById

public PaymentRequestDocument getPaymentRequestById(Integer poDocId)
Description copied from interface: PaymentRequestService
Obtains the payment request document given the purapDocumentIdentifier.

Specified by:
getPaymentRequestById in interface PaymentRequestService
Parameters:
poDocId - The purapDocumentIdentifier of the payment request document to be obtained.
Returns:
The payment request document whose purapDocumentIdentifier matches with the input parameter.
See Also:
PaymentRequestService.getPaymentRequestById(java.lang.Integer)

getPaymentRequestsByPurchaseOrderId

public List<PaymentRequestDocument> getPaymentRequestsByPurchaseOrderId(Integer poDocId)
Description copied from interface: PaymentRequestService
Obtains a list of payment request documents given the purchase order id.

Specified by:
getPaymentRequestsByPurchaseOrderId in interface PaymentRequestService
Parameters:
poDocId - The purchase order id to be used to obtain a list of payment request documents.
Returns:
The List of payment request documents given the purchase order id.
See Also:
PaymentRequestService.getPaymentRequestsByPurchaseOrderId(java.lang.Integer)

getPaymentRequestsByPOIdInvoiceAmountInvoiceDate

public List getPaymentRequestsByPOIdInvoiceAmountInvoiceDate(Integer poId,
                                                             org.kuali.rice.kns.util.KualiDecimal invoiceAmount,
                                                             Date invoiceDate)
Description copied from interface: PaymentRequestService
Obtains a list of payment request documents given the purchase order id, the invoice amount and the invoice date.

Specified by:
getPaymentRequestsByPOIdInvoiceAmountInvoiceDate in interface PaymentRequestService
Parameters:
poId - The purchase order id used to obtain the payment request documents.
invoiceAmount - The invoice amount used to obtain the payment request documents.
invoiceDate - The invoice date used to obtain the payment request documents.
Returns:
The List of payment request documents that match the given criterias (purchase order id, invoice amount and invoice date).
See Also:
PaymentRequestService.getPaymentRequestsByPOIdInvoiceAmountInvoiceDate(java.lang.Integer, org.kuali.rice.kns.util.KualiDecimal, java.sql.Date)

isInvoiceDateAfterToday

public boolean isInvoiceDateAfterToday(Date invoiceDate)
Description copied from interface: PaymentRequestService
Determines whether the invoice date is after today.

Specified by:
isInvoiceDateAfterToday in interface PaymentRequestService
Parameters:
invoiceDate - The invoice date to be determined whether it's after today.
Returns:
boolean true if the given invoice date is after today.
See Also:
PaymentRequestService.isInvoiceDateAfterToday(java.sql.Date)

calculatePayDate

public Date calculatePayDate(Date invoiceDate,
                             PaymentTermType terms)
Description copied from interface: PaymentRequestService
Calculate based on the terms and calculate a date 10 days from today. Pick the one that is the farthest out. We always calculate the discount date, if there is one.

Specified by:
calculatePayDate in interface PaymentRequestService
Parameters:
invoiceDate - The invoice date to be used in the pay date calculation.
terms - The payment term type to be used in the pay date calculation.
Returns:
The resulting pay date given the invoice date and the terms.
See Also:
PaymentRequestService.calculatePayDate(java.sql.Date, org.kuali.kfs.vnd.businessobject.PaymentTermType)

returnLaterDate

protected Date returnLaterDate(Calendar invoicedDateCalendar,
                               Calendar processedDateCalendar)
Returns whichever date is later, the invoicedDateCalendar or the processedDateCalendar.

Parameters:
invoicedDateCalendar - One of the dates to be used in determining which date is later.
processedDateCalendar - The other date to be used in determining which date is later.
Returns:
The date which is the later of the two given dates in the input parameters.

paymentTermsDateCalculation

protected void paymentTermsDateCalculation(String dueTypeDescription,
                                           Calendar invoicedDateCalendar,
                                           Integer dueNumber)
Calculates the paymentTermsDate given the dueTypeDescription, invoicedDateCalendar and the dueNumber.

Parameters:
dueTypeDescription - The due type description of the payment term.
invoicedDateCalendar - The Calendar object of the invoice date.
discountDueNumber - Either the vendorDiscountDueNumber or the vendorDiscountDueNumber of the payment term.

calculatePaymentRequest

public void calculatePaymentRequest(PaymentRequestDocument paymentRequest,
                                    boolean updateDiscount)
Description copied from interface: PaymentRequestService
Recalculate the payment request.

Specified by:
calculatePaymentRequest in interface PaymentRequestService
Parameters:
paymentRequest - The payment request document to be calculated.
updateDiscount - boolean true if we also want to calculate the discount items for the payment request.
See Also:
PaymentRequestService.calculatePaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument, boolean)

calculateDiscount

protected void calculateDiscount(PaymentRequestDocument paymentRequestDocument)
Calculates the discount item for this paymentRequest.

Parameters:
paymentRequestDocument - The payment request document whose discount to be calculated.

calculateTaxArea

public void calculateTaxArea(PaymentRequestDocument preq)
Description copied from interface: PaymentRequestService
Performs calculations on the tax edit area, generates and adds NRA tax charge items as below the line items, with their accounting lines; the calculation will activate updates on the account summary tab and the general ledger entries as well. The non-resident alien (NRA) tax lines consist of four possible sets of tax lines: - Federal tax lines - Federal Gross up tax lines - State tax lines - State Gross up tax lines Federal tax lines are generated if the federal tax rate in the payment request is not zero. State tax lines are generated if the state tax rate in the payment request is not zero. Gross up tax lines are generated if the tax gross up indicator is set on the payment request and the tax rate is not zero.

Specified by:
calculateTaxArea in interface PaymentRequestService
Parameters:
preq - The payment request the NRA tax lines will be added to.
See Also:
PaymentRequestService.calculateTaxArea(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

removeTaxItems

protected void removeTaxItems(PaymentRequestDocument preq)
Removes all existing NRA tax items from the specified payment request.

Parameters:
preq - The payment request from which all tax items are to be removed.

addTaxItem

protected PurApItem addTaxItem(PaymentRequestDocument preq,
                               String itemTypeCode,
                               BigDecimal taxableAmount)
Generates a NRA tax item and adds to the specified payment request, according to the specified item type code.

Parameters:
preq - The payment request the tax item will be added to.
itemTypeCode - The item type code for the tax item.
taxableAmount - The amount to which tax is computed against.
Returns:
A fully populated PurApItem instance representing NRA tax amount data for the specified payment request.

addTaxAccountingLine

protected PurApAccountingLine addTaxAccountingLine(PurApItem taxItem,
                                                   BigDecimal taxableAmount)
Generates a PurAP accounting line and adds to the specified tax item.

Parameters:
taxItem - The specified tax item the accounting line will be associated with.
taxableAmount - The amount to which tax is computed against.
Returns:
A fully populated PurApAccountingLine instance for the specified tax item.

findDiscountItem

protected PaymentRequestItem findDiscountItem(PaymentRequestDocument paymentRequestDocument)
Finds the discount item of the payment request document.

Parameters:
paymentRequestDocument - The payment request document to be used to find the discount item.
Returns:
The discount item if it exists.

findFullOrderDiscountItem

protected PaymentRequestItem findFullOrderDiscountItem(PaymentRequestDocument paymentRequestDocument)
Finds the full order discount item of the payment request document.

Parameters:
paymentRequestDocument - The payment request document to be used to find the full order discount item.
Returns:
The discount item if it exists.

distributeAccounting

protected void distributeAccounting(PaymentRequestDocument paymentRequestDocument)
Distributes accounts for a payment request document.

Parameters:
paymentRequestDocument -

addHoldOnPaymentRequest

public PaymentRequestDocument addHoldOnPaymentRequest(PaymentRequestDocument document,
                                                      String note)
                                               throws Exception
Description copied from interface: PaymentRequestService
Marks a payment request on hold.

Specified by:
addHoldOnPaymentRequest in interface PaymentRequestService
Parameters:
document - The payment request document to be marked as on hold.
note - The note to be added to the payment request document while being marked as on hold.
Returns:
The PaymentRequestDocument with updated information.
Throws:
Exception
See Also:
PaymentRequestService.addHoldOnPaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument, java.lang.String)

removeHoldOnPaymentRequest

public PaymentRequestDocument removeHoldOnPaymentRequest(PaymentRequestDocument document,
                                                         String note)
                                                  throws Exception
Description copied from interface: PaymentRequestService
Removes a hold on a payment request.

Specified by:
removeHoldOnPaymentRequest in interface PaymentRequestService
Parameters:
document - The payment request document whose hold is to be removed.
note - The note to be added to the payment request document while its hold is being removed.
Returns:
The PaymentRequestDocument with updated information.
Throws:
Exception
See Also:
org.kuali.kfs.module.purap.document.service.PaymentRequestService#removeHoldOnPaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

requestCancelOnPaymentRequest

public void requestCancelOnPaymentRequest(PaymentRequestDocument document,
                                          String note)
                                   throws Exception
Description copied from interface: PaymentRequestService
Marks a payment request as requested to be canceled.

Specified by:
requestCancelOnPaymentRequest in interface PaymentRequestService
Parameters:
document - The payment request document to be marked as requested to be canceled.
note - The note to be added to the payment request document while being marked as requested to be canceled.
Throws:
Exception
See Also:
PaymentRequestService.addHoldOnPaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument, java.lang.String)

removeRequestCancelOnPaymentRequest

public void removeRequestCancelOnPaymentRequest(PaymentRequestDocument document,
                                                String note)
                                         throws Exception
Description copied from interface: PaymentRequestService
Removes a request cancel on payment request.

Specified by:
removeRequestCancelOnPaymentRequest in interface PaymentRequestService
Parameters:
document - The payment request document to be used for request cancel.
note - The note to be added to the payment request document upon the removal of the request cancel.
Throws:
Exception
See Also:
org.kuali.kfs.module.purap.document.service.PaymentRequestService#removeHoldOnPaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

clearRequestCancelFields

protected void clearRequestCancelFields(PaymentRequestDocument document)
Clears the request cancel fields.

Parameters:
document - The payment request document whose request cancel fields to be cleared.

isExtracted

public boolean isExtracted(PaymentRequestDocument document)
Description copied from interface: PaymentRequestService
Returns true if the payment request has been extracted

Specified by:
isExtracted in interface PaymentRequestService
Parameters:
document - The payment request document to be determined whether it is extracted.
Returns:
boolean true if the payment request document is extracted.
See Also:
PaymentRequestService.isExtracted(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

isBeingAdHocRouted

protected boolean isBeingAdHocRouted(PaymentRequestDocument document)

cancelExtractedPaymentRequest

public void cancelExtractedPaymentRequest(PaymentRequestDocument paymentRequest,
                                          String note)
Description copied from interface: PaymentRequestService
Cancels a PREQ that has already been extracted if allowed.

Specified by:
cancelExtractedPaymentRequest in interface PaymentRequestService
Parameters:
paymentRequest - The extracted payment request document to be canceled.
note - The note to be added to the payment request document.
See Also:
PaymentRequestService.cancelExtractedPaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument, java.lang.String)

resetExtractedPaymentRequest

public void resetExtractedPaymentRequest(PaymentRequestDocument paymentRequest,
                                         String note)
Description copied from interface: PaymentRequestService
Resets a Payment Request that had an associated Payment Request or Credit Memo cancelled externally.

Specified by:
resetExtractedPaymentRequest in interface PaymentRequestService
Parameters:
paymentRequest - The extracted payment request document to be resetted.
note - The note to be added to the payment request document upon its reset.
See Also:
PaymentRequestService.resetExtractedPaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument, java.lang.String)

populatePaymentRequest

public void populatePaymentRequest(PaymentRequestDocument paymentRequestDocument)
Description copied from interface: PaymentRequestService
Populate payment request.

Specified by:
populatePaymentRequest in interface PaymentRequestService
Parameters:
paymentRequestDocument - The payment request document to be populated.
See Also:
PaymentRequestService.populatePaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

createPreqDocumentDescription

public String createPreqDocumentDescription(Integer purchaseOrderIdentifier,
                                            String vendorName)
Description copied from interface: PaymentRequestService
A method to create the description for the payment request document.

Specified by:
createPreqDocumentDescription in interface PaymentRequestService
Parameters:
purchaseOrderIdentifier - The purchase order identifier to be used as part of the description.
vendorName - The vendor name to be used as part of the description.
Returns:
The resulting description string for the payment request document.
See Also:
PaymentRequestService.createPreqDocumentDescription(java.lang.Integer, java.lang.String)

populateAndSavePaymentRequest

public void populateAndSavePaymentRequest(PaymentRequestDocument preq)
                                   throws org.kuali.rice.kew.exception.WorkflowException
Description copied from interface: PaymentRequestService
Populate and save payment request.

Specified by:
populateAndSavePaymentRequest in interface PaymentRequestService
Parameters:
preq - The payment request document to be populated and saved.
Throws:
org.kuali.rice.kew.exception.WorkflowException
See Also:
PaymentRequestService.populateAndSavePaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

shouldPurchaseOrderBeReversed

public boolean shouldPurchaseOrderBeReversed(AccountsPayableDocument apDoc)
If the full document entry has been completed and the status of the related purchase order document is closed, return true, otherwise return false.

Specified by:
shouldPurchaseOrderBeReversed in interface AccountsPayableDocumentSpecificService
Parameters:
apDoc - The AccountsPayableDocument to be determined whether its purchase order should be reversed.
Returns:
boolean true if the purchase order should be reversed.
See Also:
(org.kuali.kfs.module.purap.document.AccountsPayableDocument)

getPersonForCancel

public org.kuali.rice.kim.bo.Person getPersonForCancel(AccountsPayableDocument apDoc)
Specified by:
getPersonForCancel in interface AccountsPayableDocumentSpecificService
See Also:
AccountsPayableDocumentSpecificService.getPersonForCancel(org.kuali.kfs.module.purap.document.AccountsPayableDocument)

takePurchaseOrderCancelAction

public void takePurchaseOrderCancelAction(AccountsPayableDocument apDoc)
Specified by:
takePurchaseOrderCancelAction in interface AccountsPayableDocumentSpecificService
See Also:
AccountsPayableDocumentSpecificService.takePurchaseOrderCancelAction(org.kuali.kfs.module.purap.document.AccountsPayableDocument)

updateStatusByNode

public String updateStatusByNode(String currentNodeName,
                                 AccountsPayableDocument apDoc)
Specified by:
updateStatusByNode in interface AccountsPayableDocumentSpecificService
See Also:
AccountsPayableDocumentSpecificService.updateStatusByNode(java.lang.String, org.kuali.kfs.module.purap.document.AccountsPayableDocument)

updateStatusByNode

protected String updateStatusByNode(String currentNodeName,
                                    PaymentRequestDocument preqDoc)
Updates the status of the payment request document.

Parameters:
currentNodeName - The current node name.
preqDoc - The payment request document whose status to be updated.
Returns:
The canceled status code.

markPaid

public void markPaid(PaymentRequestDocument pr,
                     Date processDate)
Description copied from interface: PaymentRequestService
Mark a payment request as being paid and set the payment request's paid date as the processDate.

Specified by:
markPaid in interface PaymentRequestService
Parameters:
pr - The payment request document to be marked as paid and paid date to be set.
processDate - The date to be set as the payment request's paid date.
See Also:
PaymentRequestService.markPaid(org.kuali.kfs.module.purap.document.PaymentRequestDocument, java.sql.Date)

hasDiscountItem

public boolean hasDiscountItem(PaymentRequestDocument preq)
Description copied from interface: PaymentRequestService
This method specifies whether the payment request document has a discount item.

Specified by:
hasDiscountItem in interface PaymentRequestService
Parameters:
preq - The payment request document to be verified whether it has a discount item.
Returns:
boolean true if the payment request document has at least one discount item.
See Also:
PaymentRequestService.hasDiscountItem(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

poItemEligibleForAp

public boolean poItemEligibleForAp(AccountsPayableDocument apDoc,
                                   PurchaseOrderItem poi)
Specified by:
poItemEligibleForAp in interface AccountsPayableDocumentSpecificService
See Also:
AccountsPayableDocumentSpecificService.poItemEligibleForAp(org.kuali.kfs.module.purap.document.AccountsPayableDocument, org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)

removeIneligibleAdditionalCharges

public void removeIneligibleAdditionalCharges(PaymentRequestDocument document)
Description copied from interface: PaymentRequestService
Removes additional charge items that are not eligible on the payment request document.

Specified by:
removeIneligibleAdditionalCharges in interface PaymentRequestService

changeVendor

public void changeVendor(PaymentRequestDocument preq,
                         Integer headerId,
                         Integer detailId)
Description copied from interface: PaymentRequestService
Changes the current vendor to the vendor passed in.

Specified by:
changeVendor in interface PaymentRequestService

setVendorAddress

protected void setVendorAddress(VendorAddress va,
                                PaymentRequestDocument preq)
Set the Vendor address of the given ID.

Parameters:
addressID - ID of the address to set
pr - PaymentRequest to set in

logAndThrowRuntimeException

protected void logAndThrowRuntimeException(String errorMessage)
Records the specified error message into the Log file and throws a runtime exception.

Parameters:
errorMessage - the error message to be logged.

logAndThrowRuntimeException

protected void logAndThrowRuntimeException(String errorMessage,
                                           Exception e)
Records the specified error message into the Log file and throws the specified runtime exception.

Parameters:
errorMessage - the specified error message.
e - the specified runtime exception.

generateGLEntriesCreateAccountsPayableDocument

public void generateGLEntriesCreateAccountsPayableDocument(AccountsPayableDocument apDocument)
The given document here actually needs to be a Payment Request.

Specified by:
generateGLEntriesCreateAccountsPayableDocument in interface AccountsPayableDocumentSpecificService
Parameters:
apDocument - An AccountsPayableDocument
See Also:
AccountsPayableDocumentSpecificService.generateGLEntriesCreateAccountsPayableDocument(org.kuali.kfs.module.purap.document.AccountsPayableDocument)

hasActivePaymentRequestsForPurchaseOrder

public boolean hasActivePaymentRequestsForPurchaseOrder(Integer purchaseOrderIdentifier)
Description copied from interface: PaymentRequestService
Determines if there are active payment requests for a purchase order.

Specified by:
hasActivePaymentRequestsForPurchaseOrder in interface PaymentRequestService
Returns:
See Also:
PaymentRequestService.hasActivePaymentRequestsForPurchaseOrder(java.lang.Integer)

processPaymentRequestInReceivingStatus

public void processPaymentRequestInReceivingStatus()
Specified by:
processPaymentRequestInReceivingStatus in interface PaymentRequestService

allowBackpost

public boolean allowBackpost(PaymentRequestDocument paymentRequestDocument)
Description copied from interface: PaymentRequestService
Payment Requests created in the previous fiscal year get backdated if we're at the beginning of the new fiscal year (i.e. prior to first closing)

Specified by:
allowBackpost in interface PaymentRequestService
Returns:
See Also:
PaymentRequestService.allowBackpost(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

isPurchaseOrderValidForPaymentRequestDocumentCreation

public boolean isPurchaseOrderValidForPaymentRequestDocumentCreation(PaymentRequestDocument paymentRequestDocument,
                                                                     PurchaseOrderDocument po)
Specified by:
isPurchaseOrderValidForPaymentRequestDocumentCreation in interface PaymentRequestService

encumberedItemExistsForInvoicing

public boolean encumberedItemExistsForInvoicing(PurchaseOrderDocument document)
Specified by:
encumberedItemExistsForInvoicing in interface PaymentRequestService


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