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.ar.document.service;
017    
018    import java.util.Collection;
019    import java.util.List;
020    
021    import org.kuali.kfs.module.ar.businessobject.CustomerCreditMemoDetail;
022    import org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail;
023    import org.kuali.kfs.module.ar.document.CustomerInvoiceDocument;
024    
025    /**
026     * This class provides services related to the customer invoice document
027     */
028    public interface CustomerInvoiceDetailService {
029    
030        /**
031         * This method returns a customer invoice detail for use on the CustomerInvoiceDocumentAction. If corresponding organization
032         * accounting default exists for billing chart and org, then the customer invoice detail is defaulted using the organization
033         * accounting default values.
034         * 
035         * @return
036         */
037        public CustomerInvoiceDetail getCustomerInvoiceDetailFromOrganizationAccountingDefault(Integer universityFiscalYear, String chartOfAccountsCode, String organizationCode);
038    
039        /**
040         * This method returns a customer invoice detail for current user and current fiscal year for use on the
041         * CustomerInvoiceDocumentAction. If corresponding organization accounting default exists for billing chart and org, then the
042         * customer invoice detail is defaulted using the organization accounting default values.
043         * 
044         * @return
045         */
046        public CustomerInvoiceDetail getCustomerInvoiceDetailFromOrganizationAccountingDefaultForCurrentYear();
047    
048        /**
049         * This method ...
050         * 
051         * @param accountNumber
052         * @return
053         */
054        public List<String> getCustomerInvoiceDocumentNumbersByAccountNumber(String accountNumber);
055    
056        /**
057         * This method returns a customer invoice detail from a customer invoice item code for a current user
058         * 
059         * @param invoiceItemCode
060         * @return
061         */
062        public CustomerInvoiceDetail getCustomerInvoiceDetailFromCustomerInvoiceItemCodeForCurrentUser(String invoiceItemCode);
063    
064        /**
065         * This method...
066         * 
067         * @param invoiceItemCode
068         * @param chartOfAccountsCode
069         * @param organizationCode
070         * @return
071         */
072        public CustomerInvoiceDetail getCustomerInvoiceDetailFromCustomerInvoiceItemCode(String invoiceItemCode, String chartOfAccountsCode, String organizationCode);
073    
074        /**
075         * This method returns a discount customer invoice detail based on a customer invoice detail, the chart of accounts code
076         * 
077         * @param customerInvoiceDetail
078         * @param chartOfAccountsCode
079         * @param organizationCode
080         * @return
081         */
082        public CustomerInvoiceDetail getDiscountCustomerInvoiceDetail(CustomerInvoiceDetail customerInvoiceDetail, Integer universityFiscalYear, String chartOfAccountsCode, String organizationCode);
083    
084        /**
085         * This method returns a discount customer invoice detail for the current year
086         * 
087         * @param customerInvoiceDetail
088         * @param chartOfAccountsCode
089         * @param organizationCode
090         * @return
091         */
092        public CustomerInvoiceDetail getDiscountCustomerInvoiceDetailForCurrentYear(CustomerInvoiceDetail customerInvoiceDetail, CustomerInvoiceDocument customerInvoiceDocument);
093    
094        /**
095         * This method returns a customer invoice detail based on invoice document number and invoice item sequence number
096         * 
097         * @param documentNumber
098         * @param sequenceNumber
099         * @return
100         */
101        public CustomerInvoiceDetail getCustomerInvoiceDetail(String documentNumber, Integer sequenceNumber);
102    
103        
104        /**
105         * This method is used to recalculate a customer invoice detail based on updated values
106         * 
107         * @param customerInvoiceDetail
108         */
109        public void recalculateCustomerInvoiceDetail(CustomerInvoiceDocument document, CustomerInvoiceDetail customerInvoiceDetail);
110    
111        /**
112         * This method is used to update account for corresponding discount line based on parent line's account
113         * 
114         * @param parentDiscountCustomerInvoiceDetail
115         */
116        public void updateAccountsForCorrespondingDiscount(CustomerInvoiceDetail parentDiscountCustomerInvoiceDetail);
117    
118        /**
119         * This method is used to update the accounts receivable object code if receivable options 1 or 2 are selected.
120         * 
121         * @param customerInvoiceDetail
122         */
123        public void updateAccountsReceivableObjectCode(CustomerInvoiceDetail customerInvoiceDetail);
124    
125        /**
126         * This method returns the correct accounts receivable object code based on a receivable parameter.
127         * 
128         * @return
129         */
130        public String getAccountsReceivableObjectCodeBasedOnReceivableParameter(CustomerInvoiceDetail customerInvoiceDetail);
131    
132        /**
133         * This method is used to make sure the amounts are calculated correctly and the correct AR object code is in place
134         * 
135         * @param customerInvoiceDetail
136         * @param customerInvoiceDocument
137         */
138        public void prepareCustomerInvoiceDetailForAdd(CustomerInvoiceDetail customerInvoiceDetail, CustomerInvoiceDocument customerInvoiceDocument);
139    
140        /**
141         * Updates the specified customerInvoiceDetail as part of the process needed when the associated customerInvoiceDocument is being corrected.
142         * 
143         * @param customerInvoiceDetail the specified customerInvoiceDetail to be updated.
144         * @param customerInvoiceDocument the associated customerInvoiceDocument being corrected.
145         *
146        public void prepareCustomerInvoiceDetailForErrorCorrection(CustomerInvoiceDetail customerInvoiceDetail, CustomerInvoiceDocument customerInvoiceDocument);
147         */
148            
149        /**
150         * @param customerInvoiceDocument
151         * @return
152         */
153        public Collection<CustomerInvoiceDetail> getCustomerInvoiceDetailsForInvoice(CustomerInvoiceDocument customerInvoiceDocument);
154    
155        /**
156         * @param customerInvoiceDocumentNumber
157         * @return
158         */
159        public Collection<CustomerInvoiceDetail> getCustomerInvoiceDetailsForInvoice(String customerInvoiceDocumentNumber);
160    
161        /**
162         * Cached for better performance...
163         * 
164         * @param customerInvoiceDocumentNumber
165         * @return List of customer invoice details
166         */
167        public Collection<CustomerInvoiceDetail> getCustomerInvoiceDetailsForInvoiceWithCaching(String customerInvoiceDocumentNumber);
168    
169        /**
170         * Gets the financial object code for the specified customerCreditMemoDetail.   
171         *
172         * @param customerInvoiceDetail the specified customerCreditMemoDetail
173         * @return the financial object code for the specified customerCreditMemoDetail
174         *
175        public String getFinancialObjectCode(CustomerCreditMemoDetail customerCreditMemoDetail);
176         */
177        
178        /**
179         * Updates the financial object code for the specified customerCreditMemoDetail if it's for a prior year(s) customer invoice.
180         *
181         * @param customerInvoiceDetail the specified customerCreditMemoDetail
182         *
183        public void updateFinancialObjectCode(CustomerCreditMemoDetail customerCreditMemoDetail);
184         */
185    }