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.InvoiceDocument; 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 * Invoice DAO Interface. 28 */ 29 public interface InvoiceDao { 30 31 /** 32 * Get all the invoices that need to be extracted that match a credit memo. 33 * 34 * @param campusCode - limit results to a single chart 35 * @param invoiceIdentifier - Invoice 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 invoices that need to be extracted 42 */ 43 public List<InvoiceDocument> getInvoicesToExtract(String campusCode, Integer invoiceIdentifier, Integer purchaseOrderIdentifier, Integer vendorHeaderGeneratedIdentifier, Integer vendorDetailAssignedIdentifier, Date currentSqlDateMidnight); 44 45 /** 46 * Get all the invoices 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 onOrBeforeInvoicePayDate only invoices with a pay date on or before this value will be returned in the 51 * iterator 52 * @return - list of invoices that need to be extracted 53 */ 54 public Collection<InvoiceDocument> getInvoicesToExtractForVendor(String campusCode, VendorGroupingHelper vendor, Date onOrBeforeInvoicePayDate); 55 56 /** 57 * Get all the invoices that need to be extracted to PDP. 58 * 59 * @param onlySpecialPayments - true only include special payments, False - include all 60 * @param chartCode - if not null, limit results to a single chart 61 * @return - Collection of invoices 62 */ 63 public List<InvoiceDocument> getInvoicesToExtract(boolean onlySpecialPayments, String chartCode, Date onOrBeforeInvoicePayDate); 64 65 /** 66 * Get all the invoices that are marked immediate that need to be extracted to PDP. 67 * 68 * @param chartCode - chart of accounts code 69 * @return - Collection of invoices 70 */ 71 public List<InvoiceDocument> getImmediateInvoicesToExtract(String chartCode); 72 73 /** 74 * Get all invoice documents that are eligible for auto-approval. Whether or not a document is eligible for 75 * auto-approval is determined according to whether or not the document total is below a pre-determined minimum amount. This 76 * amount is derived from the accounts, charts and/or organizations associated with a given document. If no minimum amount can 77 * be determined from chart associations a default minimum specified as a system parameter is used to determine the minimum 78 * amount threshold. 79 * 80 * @param todayAtMidnight 81 * @return - an Iterator over all invoice documents eligible for automatic approval 82 */ 83 public List<String> getEligibleForAutoApproval(Date todayAtMidnight); 84 85 /** 86 * Get a invoice document number by id. 87 * 88 * @param id - Invoice Id 89 * @return - Invoice or null if not found 90 */ 91 public String getDocumentNumberByInvoiceId(Integer id); 92 93 /** 94 * Retrieves a list of document numbers by purchase order id. 95 * 96 * @param id - purchase order id 97 * @return - list of document numbers 98 */ 99 public List<String> getDocumentNumbersByPurchaseOrderId(Integer id); 100 101 102 /** 103 * Retrieves a list of Invoices with the given vendor id and invoice number. 104 * 105 * @param vendorHeaderGeneratedId - header id of the vendor id 106 * @param vendorDetailAssignedId - detail id of the vendor id 107 * @param invoiceNumber - invoice number as entered by AP 108 * @return - List of Invoices. 109 */ 110 public List getActiveInvoicesByVendorNumberInvoiceNumber(Integer vendorHeaderGeneratedId, Integer vendorDetailAssignedId, String invoiceNumber); 111 112 /** 113 * Retrieves a list of Invoices with the given vendor id and invoice number. 114 * 115 * @param vendorHeaderGeneratedId - header id of the vendor id 116 * @param vendorDetailAssignedId - detail id of the vendor id 117 * @return - List of Invoices. 118 */ 119 public List getActiveInvoicesByVendorNumber(Integer vendorHeaderGeneratedId, Integer vendorDetailAssignedId); 120 121 /** 122 * Retrieves a list of Invoices with the given PO Id, invoice amount, and invoice date. 123 * 124 * @param poId - purchase order ID 125 * @param invoiceAmount - amount of the invoice as entered by AP 126 * @param invoiceDate - date of the invoice as entered by AP 127 * @return - List of Pay Reqs. 128 */ 129 public List getActiveInvoicesByPOIdInvoiceAmountInvoiceDate(Integer poId, KualiDecimal invoiceAmount, Date invoiceDate); 130 131 /** 132 * Retrieves a list of potentially active invoices for a purchase order by status code. Active being defined as being 133 * 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 134 * final (as there isn't a final status code for invoice). Workflow status must be checked further after retrieval. 135 * 136 * @param purchaseOrderId 137 * @return 138 */ 139 public List<String> getActiveInvoiceDocumentNumbersForPurchaseOrder(Integer purchaseOrderId); 140 141 /** 142 * Get all invoice which are waiting in receiving status queue 143 * 144 * @return 145 */ 146 public List<String> getInvoiceInReceivingStatus(); 147 148 }