001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.module.purap.document.dataaccess;
017
018 import java.sql.Date;
019 import java.util.Collection;
020 import java.util.Iterator;
021 import java.util.List;
022
023 import org.kuali.kfs.module.purap.document.VendorCreditMemoDocument;
024 import org.kuali.kfs.module.purap.util.VendorGroupingHelper;
025 import org.kuali.rice.kns.util.KualiDecimal;
026
027 /**
028 * Credit Memo DAO Interface. Defines DB access methods that a CreditMemoDaoImpl must implement.
029 */
030 public interface CreditMemoDao {
031
032 /**
033 * Get all the credit memos that need to be extracted
034 *
035 * @param chartCode - if not null, limit results to a single chart
036 * @return - Iterator of credit memos
037 */
038 public Iterator<VendorCreditMemoDocument> getCreditMemosToExtract(String chartCode);
039
040 /**
041 * Get all the credit memos that need to be extracted for a particular vendor record.
042 *
043 * @param chartCode - if not null, limit results to a single chart
044 * @param vendorHeaderGeneratedIdentifier
045 * @param vendorDetailAssignedIdentifier
046 * @return - Iterator of credit memos
047 */
048 public Collection<VendorCreditMemoDocument> getCreditMemosToExtractByVendor(String chartCode, VendorGroupingHelper vendor );
049
050 /**
051 * This method tests for a duplicate entry of a credit memo by the combination of vendorNumber HeaderId, vendorNumber and
052 * creditMemoNumber. This method accepts the three values as arguments, and returns a boolean, describing whether a duplicate
053 * exists in the system or not.
054 *
055 * @param vendorNumberHeaderId - vendor number header id
056 * @param vendorNumber - the composite two-part vendorNumber (headerId-detailId)
057 * @param creditMemoNumber - the vendor-supplied creditMemoNumber
058 * @return boolean - true if a match exists in the db, false if not
059 */
060 public boolean duplicateExists(Integer vendorNumberHeaderId, Integer vendorNumberDetailId, String creditMemoNumber);
061
062 /**
063 * This method tests for a duplicate entry of a credit memo by the combination of vendor number header id, vendor detail id,
064 * date and amount. This method accepts the values as arguments, and returns a boolean, describing whether a duplicate exists in
065 * the system or not.
066 *
067 * @param vendorNumberHeaderId
068 * @param vendorNumberDetailId
069 * @param date - date of transaction
070 * @param amount - amount of transaction
071 * @return boolean - true if a match exists in the db, false if not
072 */
073 public boolean duplicateExists(Integer vendorNumberHeaderId, Integer vendorNumberDetailId, Date date, KualiDecimal amount);
074
075 /**
076 * This method returns a credit memo document number by id.
077 *
078 * @param id - credit memo id
079 * @return - document number
080 */
081 public String getDocumentNumberByCreditMemoId(Integer id);
082
083 /**
084 * Retrieves a list of potentially active credit memos for a purchase order by
085 * status code. Active being defined as being enroute and before final. The issue
086 * is that a status of vendor_tax_review may not mean that it's in review, but could be
087 * in final (as there isn't a final status code for payment request). Workflow status
088 * must be checked further after retrieval.
089 *
090 * @param purchaseOrderId
091 * @return
092 */
093 public List<String> getActiveCreditMemoDocumentNumbersForPurchaseOrder(Integer purchaseOrderId);
094 }