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.businessobject;
017    
018    import java.sql.Date;
019    import java.util.LinkedHashMap;
020    
021    import org.kuali.kfs.sys.businessobject.Bank;
022    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
023    import org.kuali.rice.kns.util.KualiDecimal;
024    import org.kuali.rice.kns.util.ObjectUtils;
025    
026    /**
027     * @author Kuali Nervous System Team (kualidev@oncourse.iu.edu)
028     */
029    public class Lockbox extends PersistableBusinessObjectBase implements Comparable<Lockbox> {
030    
031        private Long invoiceSequenceNumber; //a unique number assigned to the invoice/payment processed.
032            private String lockboxNumber; //a unique number assigned to each processing organization.
033            private String customerNumber; //customer number.
034            private String financialDocumentReferenceInvoiceNumber; //document number of the invoice being processed.
035            private Date billingDate; //the date when the customer was billed.
036            private KualiDecimal invoiceTotalAmount; //the total amount an invoice was billed for.
037            private KualiDecimal invoicePaidOrAppliedAmount; //the amount paid by the customer.
038            private Date scannedInvoiceDate; //the date when the customer paid the invoice.
039            private String customerPaymentMediumCode; //Cash/Check/Credit. It will always be check for lockbox.
040            private Date processedInvoiceDate; //the date when the invoices/payments were processed.
041            private Integer batchSequenceNumber; //a batch of invoices/payments processed.
042            private String proxyInitiator;
043            private String bankCode; //a unique code used to identify the bank associated with this lockbox.
044            
045        private PaymentMedium customerPaymentMedium;
046        private Bank bank;
047        
048            /**
049             * Default constructor.
050             */
051            public Lockbox() {
052    
053            }
054    
055            /**
056             * Gets the invoiceSequenceNumber attribute.
057             * 
058             * @return Returns the invoiceSequenceNumber
059             * 
060             */
061            public Long getInvoiceSequenceNumber() { 
062                    return invoiceSequenceNumber;
063            }
064    
065            /**
066             * Sets the invoiceSequenceNumber attribute.
067             * 
068             * @param invoiceSequenceNumber The invoiceSequenceNumber to set.
069             * 
070             */
071            public void setInvoiceSequenceNumber(Long invoiceSequenceNumber) {
072                    this.invoiceSequenceNumber = invoiceSequenceNumber;
073            }
074    
075    
076            /**
077             * Gets the lockboxNumber attribute.
078             * 
079             * @return Returns the lockboxNumber
080             * 
081             */
082            public String getLockboxNumber() { 
083                    return lockboxNumber;
084            }
085    
086            /**
087             * Sets the lockboxNumber attribute.
088             * 
089             * @param lockboxNumber The lockboxNumber to set.
090             * 
091             */
092            public void setLockboxNumber(String lockboxNumber) {
093                    this.lockboxNumber = lockboxNumber;
094            }
095    
096    
097            /**
098             * Gets the customerNumber attribute.
099             * 
100             * @return Returns the customerNumber
101             * 
102             */
103            public String getCustomerNumber() { 
104                    return customerNumber;
105            }
106    
107            /**
108             * Sets the customerNumber attribute.
109             * 
110             * @param customerNumber The customerNumber to set.
111             * 
112             */
113            public void setCustomerNumber(String customerNumber) {
114                    this.customerNumber = customerNumber;
115            }
116    
117    
118            /**
119             * Gets the financialDocumentReferenceInvoiceNumber attribute.
120             * 
121             * @return Returns the financialDocumentReferenceInvoiceNumber
122             * 
123             */
124            public String getFinancialDocumentReferenceInvoiceNumber() { 
125                    return financialDocumentReferenceInvoiceNumber;
126            }
127    
128            /**
129             * Sets the financialDocumentReferenceInvoiceNumber attribute.
130             * 
131             * @param financialDocumentReferenceInvoiceNumber The financialDocumentReferenceInvoiceNumber to set.
132             * 
133             */
134            public void setFinancialDocumentReferenceInvoiceNumber(String financialDocumentReferenceInvoiceNumber) {
135                    this.financialDocumentReferenceInvoiceNumber = financialDocumentReferenceInvoiceNumber;
136            }
137    
138    
139            /**
140             * Gets the billingDate attribute.
141             * 
142             * @return Returns the billingDate
143             * 
144             */
145            public Date getBillingDate() { 
146                    return billingDate;
147            }
148    
149            /**
150             * Sets the billingDate attribute.
151             * 
152             * @param billingDate The billingDate to set.
153             * 
154             */
155            public void setBillingDate(Date billingDate) {
156                    this.billingDate = billingDate;
157            }
158    
159    
160            /**
161             * Gets the invoiceTotalAmount attribute.
162             * 
163             * @return Returns the invoiceTotalAmount
164             * 
165             */
166            public KualiDecimal getInvoiceTotalAmount() { 
167                    return invoiceTotalAmount;
168            }
169    
170            /**
171             * Sets the invoiceTotalAmount attribute.
172             * 
173             * @param invoiceTotalAmount The invoiceTotalAmount to set.
174             * 
175             */
176            public void setInvoiceTotalAmount(KualiDecimal invoiceTotalAmount) {
177                    this.invoiceTotalAmount = invoiceTotalAmount;
178            }
179    
180    
181            /**
182             * Gets the invoicePaidOrAppliedAmount attribute.
183             * 
184             * @return Returns the invoicePaidOrAppliedAmount
185             * 
186             */
187            public KualiDecimal getInvoicePaidOrAppliedAmount() { 
188                    return invoicePaidOrAppliedAmount;
189            }
190    
191            /**
192             * Sets the invoicePaidOrAppliedAmount attribute.
193             * 
194             * @param invoicePaidOrAppliedAmount The invoicePaidOrAppliedAmount to set.
195             * 
196             */
197            public void setInvoicePaidOrAppliedAmount(KualiDecimal invoicePaidOrAppliedAmount) {
198                    this.invoicePaidOrAppliedAmount = invoicePaidOrAppliedAmount;
199            }
200    
201    
202            /**
203             * Gets the scannedInvoiceDate attribute.
204             * 
205             * @return Returns the scannedInvoiceDate
206             * 
207             */
208            public Date getScannedInvoiceDate() { 
209                    return scannedInvoiceDate;
210            }
211    
212            /**
213             * Sets the scannedInvoiceDate attribute.
214             * 
215             * @param scannedInvoiceDate The scannedInvoiceDate to set.
216             * 
217             */
218            public void setScannedInvoiceDate(Date scannedInvoiceDate) {
219                    this.scannedInvoiceDate = scannedInvoiceDate;
220            }
221    
222    
223            /**
224             * Gets the customerPaymentMediumCode attribute.
225             * 
226             * @return Returns the customerPaymentMediumCode
227             * 
228             */
229            public String getCustomerPaymentMediumCode() { 
230                    return customerPaymentMediumCode;
231            }
232    
233            /**
234             * Sets the customerPaymentMediumCode attribute.
235             * 
236             * @param customerPaymentMediumCode The customerPaymentMediumCode to set.
237             * 
238             */
239            public void setCustomerPaymentMediumCode(String customerPaymentMediumCode) {
240                    this.customerPaymentMediumCode = customerPaymentMediumCode;
241            }
242    
243    
244            /**
245             * Gets the processedInvoiceDate attribute.
246             * 
247             * @return Returns the processedInvoiceDate
248             * 
249             */
250            public Date getProcessedInvoiceDate() { 
251                    return processedInvoiceDate;
252            }
253    
254            /**
255             * Sets the processedInvoiceDate attribute.
256             * 
257             * @param processedInvoiceDate The processedInvoiceDate to set.
258             * 
259             */
260            public void setProcessedInvoiceDate(Date processedInvoiceDate) {
261                    this.processedInvoiceDate = processedInvoiceDate;
262            }
263    
264    
265            /**
266             * Gets the batchSequenceNumber attribute.
267             * 
268             * @return Returns the batchSequenceNumber
269             * 
270             */
271            public Integer getBatchSequenceNumber() { 
272                    return batchSequenceNumber;
273            }
274    
275            /**
276             * Sets the batchSequenceNumber attribute.
277             * 
278             * @param batchSequenceNumber The batchSequenceNumber to set.
279             * 
280             */
281            public void setBatchSequenceNumber(Integer batchSequenceNumber) {
282                    this.batchSequenceNumber = batchSequenceNumber;
283            }
284    
285    
286            /**
287             * Gets the customerPaymentMedium attribute.
288             * 
289             * @return Returns the customerPaymentMedium
290             * 
291             */
292            public PaymentMedium getCustomerPaymentMedium() { 
293                    return customerPaymentMedium;
294            }
295    
296            /**
297             * Sets the customerPaymentMedium attribute.
298             * 
299             * @param customerPaymentMedium The customerPaymentMedium to set.
300             * @deprecated
301             */
302            public void setCustomerPaymentMedium(PaymentMedium customerPaymentMedium) {
303                    this.customerPaymentMedium = customerPaymentMedium;
304            }
305    
306            
307            public int compareTo(Lockbox lockbox) {
308                if (lockbox == null) {
309                    return -1;
310                }
311                if (ObjectUtils.nullSafeEquals(this.getBatchSequenceNumber(), lockbox.getBatchSequenceNumber())) {
312                    if (ObjectUtils.nullSafeEquals(this.getProcessedInvoiceDate(), lockbox.getProcessedInvoiceDate())) {
313                        return 0;
314                    }
315                }
316                return -1;
317        }
318    
319        /**
320             * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
321             */
322        @SuppressWarnings("unchecked")
323            protected LinkedHashMap toStringMapper() {
324                LinkedHashMap m = new LinkedHashMap();          
325            if (this.invoiceSequenceNumber != null) {
326                m.put("invoiceSequenceNumber", this.invoiceSequenceNumber.toString());
327            }
328                return m;
329        }
330    
331        /**
332         * 
333         * This method...
334         * @return
335         */
336        public String getProxyInitiator() {
337            return proxyInitiator;
338        }
339    
340        /**
341         * 
342         * This method...
343         * @param proxyInitiator
344         */
345        public void setProxyInitiator(String proxyInitiator) {
346            this.proxyInitiator = proxyInitiator;
347        }
348    
349        /**
350         * Gets the bankCode attribute. 
351         * @return Returns the bankCode.
352         */
353        public String getBankCode() {
354            return bankCode;
355        }
356    
357        /**
358         * Sets the bankCode attribute value.
359         * @param bankCode The bankCode to set.
360         */
361        public void setBankCode(String bankCode) {
362            this.bankCode = bankCode;
363        }
364    
365        public Bank getBank() {
366            return bank;
367        }
368    
369        public void setBank(Bank bank) {
370            this.bank = bank;
371        }
372        
373    }