001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.financial.service;
017:
018: import java.util.List;
019: import java.util.Map;
020:
021: import org.kuali.core.util.KualiDecimal;
022: import org.kuali.module.financial.bo.BankAccount;
023: import org.kuali.module.financial.bo.CashieringItemInProcess;
024: import org.kuali.module.financial.bo.Check;
025: import org.kuali.module.financial.bo.CoinDetail;
026: import org.kuali.module.financial.bo.CurrencyDetail;
027: import org.kuali.module.financial.bo.Deposit;
028: import org.kuali.module.financial.document.CashManagementDocument;
029: import org.kuali.module.financial.document.CashReceiptDocument;
030:
031: /**
032: * This service interface defines methods that a CashManagementService implementation must provide.
033: *
034: */
035: public interface CashManagementService {
036: /**
037: * Creates and returns a CashManagementDocument, opening the CashDrawer associated with the given verification unit.
038: *
039: * @param workgroupName
040: * @param docDescription
041: * @param annotation
042: * @return A properly initialized CashManagementDocument instance.
043: */
044: public CashManagementDocument createCashManagementDocument(
045: String workgroupName, String docDescription,
046: String annotation);
047:
048: /**
049: * Uses the given information to lock the appropriate CashDrawer, create a Deposit, and associate it with the given
050: * CashManagementDocument and CashReceipts.
051: *
052: * @param cashManagementDoc
053: * @param depositTicketNumber
054: * @param bankAccount
055: * @param selectedCashReceipts
056: * @param isFinalDeposit
057: */
058: public void addDeposit(CashManagementDocument cashManagementDoc,
059: String depositTicketNumber, BankAccount bankAccount,
060: List selectedCashReceipts, List selectedCashieringChecks,
061: boolean isFinalDeposit);
062:
063: /**
064: * Cancels the given Deposit, updating the related CashManagementDocument, CashReceipts, and CashDrawer as needed
065: *
066: * @param deposit
067: */
068: public void cancelDeposit(Deposit deposit);
069:
070: /**
071: * Cancels the given CashManagementDocument, canceling the Deposits it contains and closing the CashDrawer associated with the
072: * given verification unit. Called in response to a workflow CANCEL request, so this method doesn't invoke workflow itself.
073: *
074: * @param cmDoc
075: */
076: public void cancelCashManagementDocument(
077: CashManagementDocument cmDoc);
078:
079: /**
080: * Finalizes the given CashManagementDocument, updating the status of the CashReceipt documents in the Deposits it contains and
081: * closing the CashDrawer associated with the given verification unit. Called in response to a workflow document status change,
082: * so this method doesn't invoke workflow itself.
083: *
084: * @param cmDoc
085: */
086: public void finalizeCashManagementDocument(
087: CashManagementDocument cmDoc);
088:
089: /**
090: * Retrieves a CashManagementDocument instance associated with the cash receipt id provided.
091: *
092: * @param documentId The id of the cash receipt document associated with the cash management document.
093: * @return CashManagementDocument which contains the Deposit which contains the given CashReceipt, or null if the CashReceipt is
094: * not contained in a Deposit
095: */
096: public CashManagementDocument getCashManagementDocumentForCashReceiptId(
097: String documentId);
098:
099: /**
100: * Returns a List of all CashReceipts associated with the given Deposit.
101: *
102: * @param deposit The deposit the cash receipts will be retrieved from.
103: * @return List the of CashReceipts associated with given deposit.
104: */
105: public List retrieveCashReceipts(Deposit deposit);
106:
107: /**
108: * Apply a cashiering transaction to a cash management document. This means:
109: * 0. check rules???
110: * 1. Updating the cash drawer with any incoming currency and coin
111: * 2. Moving any checks from the transaction to the CM document
112: * 3. Checking if any items in process were closed; if so, saving that info
113: * 4. Saving currency and coin records
114: * 5. Saving any new item in process
115: * 6. saving any checks
116: *
117: * @param cmDoc The transaction to apply to the cash management document.
118: * @param cashieringTransaction The transaction being applied to the cash management document.
119: */
120: public void applyCashieringTransaction(CashManagementDocument cmDoc);
121:
122: /**
123: * Retrieve the open cashiering items in process for the given cash management document.
124: *
125: * @param cmDoc The cash management document to retrieve the items in process for.
126: * @return A list of all open items in process.
127: */
128: public List<CashieringItemInProcess> getOpenItemsInProcess(
129: CashManagementDocument cmDoc);
130:
131: /**
132: * Returns all items in process associated with this workgroup, closed within the past 30 days
133: *
134: * @param cmDoc The cash management document which is associated with the workgroup that the closed items in process would have also been associated with.
135: * @return A list of any items in process recently closed.
136: */
137: public List<CashieringItemInProcess> getRecentlyClosedItemsInProcess(
138: CashManagementDocument cmDoc);
139:
140: /**
141: * Generates the master currency detail, which sounds bad, but which is really just okay.
142: * A master currency detail is the composite effect of all the transactions of a cash
143: * management document on a cash drawer.
144: *
145: * @param cmDoc The cash management document to generate the master record for.
146: * @return The master currency detail record. "Master" in the sense of "Platonic ideal" from which
147: * all else is a copy.
148: */
149: public CurrencyDetail generateMasterCurrencyDetail(
150: CashManagementDocument cmDoc);
151:
152: /**
153: * This generates the "master" coin detail record - a composite of all the coin detail activity that occurred to the cash drawer.
154: *
155: * @param cmDoc The cash management document to generate the master record for.
156: * @return The master coin detail record. "Master" in the sense of "Platonic ideal" from which
157: * all else is a copy.
158: */
159: public CoinDetail generateMasterCoinDetail(
160: CashManagementDocument cmDoc);
161:
162: /**
163: * Verifies if a given cash receipt is deposited as part of the given cash management document.
164: *
165: * @param cmDoc The cash management document to search through.
166: * @param crDoc The cash receipt to check the deposited status of.
167: * @return true If the given cash receipt document is deposited as part of the given cash management document, false if otherwise.
168: */
169: public boolean verifyCashReceiptIsDeposited(
170: CashManagementDocument cmDoc, CashReceiptDocument crDoc);
171:
172: /**
173: * This method verifies that all cash receipts for the document are deposited.
174: *
175: * @param cmDoc The cash management document to verify.
176: * @return True if all CRs are deposited, false if otherwise.
177: */
178: public boolean allVerifiedCashReceiptsAreDeposited(
179: CashManagementDocument cmDoc);
180:
181: /**
182: * This method turns the last interim deposit into the final deposit and locks the cash drawer.
183: *
184: * @param cmDoc The cash management document to take deposits from for finalization.
185: */
186: public void finalizeLastInterimDeposit(CashManagementDocument cmDoc);
187:
188: /**
189: * This method creates new cumulative currency and coin details for a document.
190: *
191: * @param cmDoc The cash management document the cumulative details will be associated with.
192: * @param cashieringSource The cashiering record source for the new details.
193: */
194: public void createNewCashDetails(CashManagementDocument cmDoc,
195: String cashieringSource);
196:
197: /**
198: * Grab the currency and coin detail for final deposits.
199: *
200: * @param cmDoc The cash management document which has deposits to populate.
201: */
202: public void populateCashDetailsForDeposit(
203: CashManagementDocument cmDoc);
204:
205: /**
206: * Retrieves from the database any undeposited cashiering transaction checks associated with the given cash management document.
207: *
208: * @param documentNumber The document number of a cash management document that cashiering transaction checks may be associated with.
209: * @return A list of checks associated with the document number given.
210: */
211: public List<Check> selectUndepositedCashieringChecks(
212: String documentNumber);
213:
214: /**
215: * Retrieves from the database all deposited cashiering transaction checks associated with the given cash management document number.
216: *
217: * @param documentNumber The document number of a cash management document that cashiering transaction checks may be associated with.
218: * @return A list of deposited cashiering checks associated with the document number given.
219: */
220: public List<Check> selectDepositedCashieringChecks(
221: String documentNumber);
222:
223: /**
224: * Retrieves from the database all cashiering transaction checks deposited for a given deposit.
225: *
226: * @param documentNumber The document number of a cash management document that cashiering transaction checks have been deposited for.
227: * @param depositLineNumber The line number of the deposit to find checks deposited for.
228: * @return A list of checks associated with the given deposit.
229: */
230: public List<Check> selectCashieringChecksForDeposit(
231: String documentNumber, Integer depositLineNumber);
232:
233: /**
234: * Total up the amounts of all checks so far deposited as part of the given cash management document.
235: *
236: * @param documentNumber The id of a cash management document.
237: * @return The total of cashiering checks deposited so far as part of that document.
238: */
239: public KualiDecimal calculateDepositedCheckTotal(
240: String documentNumber);
241:
242: /**
243: * Total up the amounts of all cashiering checks not yet deposited as part of the given cash management document.
244: *
245: * @param documentNumber The id of a cash management document.
246: * @return The total of cashiering checks not yet deposited as part of that document.
247: */
248: public KualiDecimal calculateUndepositedCheckTotal(
249: String documentNumber);
250:
251: /**
252: * This method determines whether or not the given cash management document can be canceled.
253: *
254: * @param cmDoc The cash management document to be canceled.
255: * @return True if cancellation is possible, false if otherwise.
256: */
257: public boolean allowDocumentCancellation(
258: CashManagementDocument cmDoc);
259:
260: /**
261: * Select the next available check line number for the given cash management document.
262: *
263: * @param documentNumber The document number of a cash management document.
264: * @return The next available check line number for cashiering checks.
265: */
266: public Integer selectNextAvailableCheckLineNumber(
267: String documentNumber);
268:
269: /**
270: * This returns the currency and coin details for the final deposit, in a map keyed on the detail class
271: *
272: * This returns the currency and coin details for the final deposit, in a map keyed on the detail class.
273: *
274: * @param documentNumber The document number to find the final deposit cash details for.
275: * @return A map with the cash details in it.
276: */
277: public Map<Class, Object> getCashDetailsForFinalDeposit(
278: String documentNumber);
279: }
|