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 org.kuali.kfs.module.ar.businessobject.CashControlDetail;
019    import org.kuali.kfs.module.ar.document.CashControlDocument;
020    import org.kuali.kfs.module.ar.document.PaymentApplicationDocument;
021    import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper;
022    import org.kuali.rice.kew.exception.WorkflowException;
023    
024    public interface CashControlDocumentService {
025    
026        /**
027         * This method add a new cash control detail to the cash control document
028         * 
029         * @param descritpion the description tells whether the detail was added by cash controo doc or by lockbox
030         * @param cashControlDocument the cash control document
031         * @param cashControlDetail the cash control detail to be added
032         * @throws WorkflowException
033         */
034        public void addNewCashControlDetail(String descritpion, CashControlDocument cashControlDocument, CashControlDetail cashControlDetail) throws WorkflowException;
035    
036        /**
037         * This method creates a new PaymentApplicationDocument
038         * 
039         * @param description the description tells whether the detail was added by cash controo doc or by lockbox
040         * @param cashControlDocument the cash control document
041         * @param cashControlDetail the cash control detail
042         * @return true if all application document have been approved, false otherwise
043         * @throws WorkflowException
044         */
045        public PaymentApplicationDocument createAndSavePaymentApplicationDocument(String description, CashControlDocument cashControlDocument, CashControlDetail cashControlDetail) throws WorkflowException;
046    
047        /**
048         * This method creates the GLPEs with document type CR
049         * 
050         * @param cashControlDocument
051         * @param sequenceHelper
052         * @return true if glpes successfuly created false otherwise
053         */
054        public boolean createCashReceiptGLPEs(CashControlDocument cashControlDocument, GeneralLedgerPendingEntrySequenceHelper sequenceHelper);
055    
056        /**
057         * This method creates the GLPEs with document type DI
058         * 
059         * @param cashControlDocument
060         * @param sequenceHelper
061         * @return true if glpes successfuly created false otherwise
062         */
063        public boolean createDistributionOfIncomeAndExpenseGLPEs(CashControlDocument cashControlDocument, GeneralLedgerPendingEntrySequenceHelper sequenceHelper);
064    
065        /**
066         * This method creates the GLPEs with document type GEC
067         * 
068         * @param cashControlDocument
069         * @param sequenceHelper
070         * @return true if glpes successfuly created false otherwise
071         */
072        public boolean createGeneralErrorCorrectionGLPEs(CashControlDocument cashControlDocument, GeneralLedgerPendingEntrySequenceHelper sequenceHelper);
073    
074        /**
075         * This method saves CashControl document GLPEs in the database
076         * 
077         * @param cashControlDocument
078         */
079        public void saveGLPEs(CashControlDocument cashControlDocument);
080        
081        /**
082         * This method gets the lockbox number for the current CashControl document
083         * 
084         * @return the lockbox number
085         */
086        public String getLockboxNumber(CashControlDocument cashControlDocument); 
087        
088        /**
089         * Creates bank offset GLPEs for the cash control document
090         * @param cashControlDocument the document to create cash control GLPEs for
091         * @param sequenceHelper the sequence helper which will sequence the new GLPEs
092         * @return true if the new bank offset GLPEs were created successfully, false otherwise
093         */
094        public abstract boolean createBankOffsetGLPEs(CashControlDocument cashControlDocument, GeneralLedgerPendingEntrySequenceHelper sequenceHelper);
095    
096    }