View Javadoc
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.dataaccess;
17  
18  import org.kuali.ole.module.purap.document.PaymentRequestDocument;
19  import org.kuali.ole.module.purap.util.VendorGroupingHelper;
20  import org.kuali.rice.core.api.util.type.KualiDecimal;
21  
22  import java.sql.Date;
23  import java.util.Collection;
24  import java.util.List;
25  
26  /**
27   * Payment Request DAO Interface.
28   */
29  public interface PaymentRequestDao {
30  
31      /**
32       * Get all the payment requests that need to be extracted that match a credit memo.
33       *
34       * @param campusCode                     - limit results to a single chart
35       * @param paymentRequestIdentifier       - Payment Request Identifier (can be null)
36       * @param purchaseOrderIdentifier        - PO Identifier (can be null)
37       * @param vendorHeaderGeneratedIdentifier
38       *                                       - Vendor Header ID
39       * @param vendorDetailAssignedIdentifier - Vendor Detail ID
40       * @param currentSqlDateMidnight         current SQL date midnight
41       * @return - list of payment requests that need to be extracted
42       */
43      public List<PaymentRequestDocument> getPaymentRequestsToExtract(String campusCode, Integer paymentRequestIdentifier, Integer purchaseOrderIdentifier, Integer vendorHeaderGeneratedIdentifier, Integer vendorDetailAssignedIdentifier, Date currentSqlDateMidnight);
44  
45      /**
46       * Get all the payment requests that need to be extracted that match a credit memo.
47       *
48       * @param campusCode - limit results to a single chart
49       * @param vendor     - Vendor Header ID, Vendor Detail ID, Country, Zip Code
50       * @param onOrBeforePaymentRequestPayDate
51       *                   only payment requests with a pay date on or before this value will be returned in the
52       *                   iterator
53       * @return - list of payment requests that need to be extracted
54       */
55      public Collection<PaymentRequestDocument> getPaymentRequestsToExtractForVendor(String campusCode, VendorGroupingHelper vendor, Date onOrBeforePaymentRequestPayDate);
56  
57      /**
58       * Get all the payment requests that need to be extracted to PDP.
59       *
60       * @param onlySpecialPayments - true only include special payments, False - include all
61       * @param chartCode           - if not null, limit results to a single chart
62       * @return - Collection of payment requests
63       */
64      public List<PaymentRequestDocument> getPaymentRequestsToExtract(boolean onlySpecialPayments, String chartCode, Date onOrBeforePaymentRequestPayDate);
65  
66      /**
67       * Get all the payment requests that are marked immediate that need to be extracted to PDP.
68       *
69       * @param chartCode - chart of accounts code
70       * @return - Collection of payment requests
71       */
72      public List<PaymentRequestDocument> getImmediatePaymentRequestsToExtract(String chartCode);
73  
74      /**
75       * Get all payment request documents that are eligible for auto-approval. Whether or not a document is eligible for
76       * auto-approval is determined according to whether or not the document total is below a pre-determined minimum amount. This
77       * amount is derived from the accounts, charts and/or organizations associated with a given document. If no minimum amount can
78       * be determined from chart associations a default minimum specified as a system parameter is used to determine the minimum
79       * amount threshold.
80       *
81       * @param todayAtMidnight
82       * @return - an Iterator over all payment request documents eligible for automatic approval
83       */
84      public List<String> getEligibleForAutoApproval(Date todayAtMidnight);
85  
86      public List<String> getEligibleForAutoApproval();
87  
88      /**
89       * Get a payment request document number by id.
90       *
91       * @param id - PaymentRequest Id
92       * @return - PaymentRequest or null if not found
93       */
94      public String getDocumentNumberByPaymentRequestId(Integer id);
95  
96      /**
97       * Retrieves a list of document numbers by purchase order id.
98       *
99       * @param id - purchase order id
100      * @return - list of document numbers
101      */
102     public List<String> getDocumentNumbersByPurchaseOrderId(Integer id);
103 
104 
105     /**
106      * Retrieves a list of Payment Requests with the given vendor id and invoice number.
107      *
108      * @param vendorHeaderGeneratedId - header id of the vendor id
109      * @param vendorDetailAssignedId  - detail id of the vendor id
110      * @param invoiceNumber           - invoice number as entered by AP
111      * @return - List of Payment Requests.
112      */
113     public List getActivePaymentRequestsByVendorNumberInvoiceNumber(Integer vendorHeaderGeneratedId, Integer vendorDetailAssignedId, String invoiceNumber);
114 
115     /**
116      * Retrieves a list of Payment Requests with the given vendor id and invoice number.
117      *
118      * @param vendorHeaderGeneratedId - header id of the vendor id
119      * @param vendorDetailAssignedId  - detail id of the vendor id
120      * @return - List of Payment Requests.
121      */
122     public List getActivePaymentRequestsByVendorNumber(Integer vendorHeaderGeneratedId, Integer vendorDetailAssignedId);
123 
124     /**
125      * Retrieves a list of Payment Requests with the given PO Id, invoice amount, and invoice date.
126      *
127      * @param poId          - purchase order ID
128      * @param invoiceAmount - amount of the invoice as entered by AP
129      * @param invoiceDate   - date of the invoice as entered by AP
130      * @return - List of Pay Reqs.
131      */
132     public List getActivePaymentRequestsByPOIdInvoiceAmountInvoiceDate(Integer poId, KualiDecimal invoiceAmount, Date invoiceDate);
133 
134     /**
135      * Retrieves a list of potentially active payment requests for a purchase order by status code. Active being defined as being
136      * enroute and before final. The issue is that a status of vendor_tax_review may not mean that it's in review, but could be in
137      * final (as there isn't a final status code for payment request). Workflow status must be checked further after retrieval.
138      *
139      * @param purchaseOrderId
140      * @return
141      */
142     public List<String> getActivePaymentRequestDocumentNumbersForPurchaseOrder(Integer purchaseOrderId);
143 
144     /**
145      * Get all payment request which are waiting in receiving status queue
146      *
147      * @return
148      */
149     public List<String> getPaymentRequestInReceivingStatus();
150 
151 }