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    
017    package org.kuali.kfs.fp.businessobject;
018    
019    import java.math.BigDecimal;
020    import java.sql.Date;
021    import java.util.Iterator;
022    import java.util.LinkedHashMap;
023    import java.util.List;
024    
025    import org.kuali.kfs.sys.KFSPropertyConstants;
026    import org.kuali.kfs.sys.businessobject.AccountingLineBase;
027    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
028    import org.kuali.rice.kns.util.KualiDecimal;
029    import org.kuali.rice.kns.util.TypedArrayList;
030    
031    /**
032     * This class is used to represent a procurement card transaction detail business object.
033     */
034    public class ProcurementCardTransactionDetail extends PersistableBusinessObjectBase {
035    
036        private String documentNumber;
037        private Integer financialDocumentTransactionLineNumber;
038        private Date transactionDate;
039        private String transactionReferenceNumber;
040        private Date transactionPostingDate;
041        private String transactionOriginalCurrencyCode;
042        private String transactionBillingCurrencyCode;
043        private KualiDecimal transactionOriginalCurrencyAmount;
044        private BigDecimal transactionCurrencyExchangeRate;
045        private KualiDecimal transactionSettlementAmount;
046        private KualiDecimal transactionSalesTaxAmount;
047        private boolean transactionTaxExemptIndicator;
048        private boolean transactionPurchaseIdentifierIndicator;
049        private String transactionPurchaseIdentifierDescription;
050        private String transactionUnitContactName;
051        private String transactionTravelAuthorizationCode;
052        private String transactionPointOfSaleCode;
053        private Date transactionCycleStartDate;
054        private Date transactionCycleEndDate;
055        private KualiDecimal transactionTotalAmount;
056    
057        private ProcurementCardVendor procurementCardVendor;
058    
059        private List sourceAccountingLines;
060        private List targetAccountingLines;
061    
062        /**
063         * Default constructor.
064         */
065        public ProcurementCardTransactionDetail() {
066            sourceAccountingLines = new TypedArrayList(ProcurementCardSourceAccountingLine.class);
067            targetAccountingLines = new TypedArrayList(ProcurementCardTargetAccountingLine.class);
068        }
069    
070        /**
071         * @see org.kuali.rice.kns.document.TransactionalDocument#getTargetTotal()
072         */
073        public KualiDecimal getTargetTotal() {
074            KualiDecimal total = KualiDecimal.ZERO;
075            AccountingLineBase al = null;
076            Iterator iter = getTargetAccountingLines().iterator();
077            while (iter.hasNext()) {
078                al = (AccountingLineBase) iter.next();
079    
080                KualiDecimal amount = al.getAmount();
081                if (amount != null) {
082                    total = total.add(amount);
083                }
084            }
085            return total;
086        }
087    
088        /**
089         * Gets the documentNumber attribute.
090         * 
091         * @return Returns the documentNumber
092         */
093        public String getDocumentNumber() {
094            return documentNumber;
095        }
096    
097        /**
098         * Sets the documentNumber attribute.
099         * 
100         * @param documentNumber The documentNumber to set.
101         */
102        public void setDocumentNumber(String documentNumber) {
103            this.documentNumber = documentNumber;
104        }
105    
106    
107        /**
108         * Gets the financialDocumentTransactionLineNumber attribute.
109         * 
110         * @return Returns the financialDocumentTransactionLineNumber
111         */
112        public Integer getFinancialDocumentTransactionLineNumber() {
113            return financialDocumentTransactionLineNumber;
114        }
115    
116        /**
117         * Sets the financialDocumentTransactionLineNumber attribute.
118         * 
119         * @param financialDocumentTransactionLineNumber The financialDocumentTransactionLineNumber to set.
120         */
121        public void setFinancialDocumentTransactionLineNumber(Integer financialDocumentTransactionLineNumber) {
122            this.financialDocumentTransactionLineNumber = financialDocumentTransactionLineNumber;
123        }
124    
125    
126        /**
127         * Gets the transactionDate attribute.
128         * 
129         * @return Returns the transactionDate
130         */
131        public Date getTransactionDate() {
132            return transactionDate;
133        }
134    
135        /**
136         * Sets the transactionDate attribute.
137         * 
138         * @param transactionDate The transactionDate to set.
139         */
140        public void setTransactionDate(Date transactionDate) {
141            this.transactionDate = transactionDate;
142        }
143    
144    
145        /**
146         * Gets the transactionReferenceNumber attribute.
147         * 
148         * @return Returns the transactionReferenceNumber
149         */
150        public String getTransactionReferenceNumber() {
151            return transactionReferenceNumber;
152        }
153    
154        /**
155         * Sets the transactionReferenceNumber attribute.
156         * 
157         * @param transactionReferenceNumber The transactionReferenceNumber to set.
158         */
159        public void setTransactionReferenceNumber(String transactionReferenceNumber) {
160            this.transactionReferenceNumber = transactionReferenceNumber;
161        }
162    
163    
164        /**
165         * Gets the transactionPostingDate attribute.
166         * 
167         * @return Returns the transactionPostingDate
168         */
169        public Date getTransactionPostingDate() {
170            return transactionPostingDate;
171        }
172    
173        /**
174         * Sets the transactionPostingDate attribute.
175         * 
176         * @param transactionPostingDate The transactionPostingDate to set.
177         */
178        public void setTransactionPostingDate(Date transactionPostingDate) {
179            this.transactionPostingDate = transactionPostingDate;
180        }
181    
182    
183        /**
184         * Gets the transactionOriginalCurrencyCode attribute.
185         * 
186         * @return Returns the transactionOriginalCurrencyCode
187         */
188        public String getTransactionOriginalCurrencyCode() {
189            return transactionOriginalCurrencyCode;
190        }
191    
192        /**
193         * Sets the transactionOriginalCurrencyCode attribute.
194         * 
195         * @param transactionOriginalCurrencyCode The transactionOriginalCurrencyCode to set.
196         */
197        public void setTransactionOriginalCurrencyCode(String transactionOriginalCurrencyCode) {
198            this.transactionOriginalCurrencyCode = transactionOriginalCurrencyCode;
199        }
200    
201    
202        /**
203         * Gets the transactionBillingCurrencyCode attribute.
204         * 
205         * @return Returns the transactionBillingCurrencyCode
206         */
207        public String getTransactionBillingCurrencyCode() {
208            return transactionBillingCurrencyCode;
209        }
210    
211        /**
212         * Sets the transactionBillingCurrencyCode attribute.
213         * 
214         * @param transactionBillingCurrencyCode The transactionBillingCurrencyCode to set.
215         */
216        public void setTransactionBillingCurrencyCode(String transactionBillingCurrencyCode) {
217            this.transactionBillingCurrencyCode = transactionBillingCurrencyCode;
218        }
219    
220    
221        /**
222         * Gets the transactionOriginalCurrencyAmount attribute.
223         * 
224         * @return Returns the transactionOriginalCurrencyAmount
225         */
226        public KualiDecimal getTransactionOriginalCurrencyAmount() {
227            return transactionOriginalCurrencyAmount;
228        }
229    
230        /**
231         * Sets the transactionOriginalCurrencyAmount attribute.
232         * 
233         * @param transactionOriginalCurrencyAmount The transactionOriginalCurrencyAmount to set.
234         */
235        public void setTransactionOriginalCurrencyAmount(KualiDecimal transactionOriginalCurrencyAmount) {
236            this.transactionOriginalCurrencyAmount = transactionOriginalCurrencyAmount;
237        }
238    
239    
240        /**
241         * Gets the transactionCurrencyExchangeRate attribute.
242         * 
243         * @return Returns the transactionCurrencyExchangeRate
244         */
245        public BigDecimal getTransactionCurrencyExchangeRate() {
246            return transactionCurrencyExchangeRate;
247        }
248    
249        /**
250         * Sets the transactionCurrencyExchangeRate attribute.
251         * 
252         * @param transactionCurrencyExchangeRate The transactionCurrencyExchangeRate to set.
253         */
254        public void setTransactionCurrencyExchangeRate(BigDecimal transactionCurrencyExchangeRate) {
255            this.transactionCurrencyExchangeRate = transactionCurrencyExchangeRate;
256        }
257    
258    
259        /**
260         * Gets the transactionSettlementAmount attribute.
261         * 
262         * @return Returns the transactionSettlementAmount
263         */
264        public KualiDecimal getTransactionSettlementAmount() {
265            return transactionSettlementAmount;
266        }
267    
268        /**
269         * Sets the transactionSettlementAmount attribute.
270         * 
271         * @param transactionSettlementAmount The transactionSettlementAmount to set.
272         */
273        public void setTransactionSettlementAmount(KualiDecimal transactionSettlementAmount) {
274            this.transactionSettlementAmount = transactionSettlementAmount;
275        }
276    
277    
278        /**
279         * Gets the transactionSalesTaxAmount attribute.
280         * 
281         * @return Returns the transactionSalesTaxAmount
282         */
283        public KualiDecimal getTransactionSalesTaxAmount() {
284            return transactionSalesTaxAmount;
285        }
286    
287        /**
288         * Sets the transactionSalesTaxAmount attribute.
289         * 
290         * @param transactionSalesTaxAmount The transactionSalesTaxAmount to set.
291         */
292        public void setTransactionSalesTaxAmount(KualiDecimal transactionSalesTaxAmount) {
293            this.transactionSalesTaxAmount = transactionSalesTaxAmount;
294        }
295    
296    
297        /**
298         * Gets the transactionTaxExemptIndicator attribute.
299         * 
300         * @return Returns the transactionTaxExemptIndicator
301         */
302        public boolean getTransactionTaxExemptIndicator() {
303            return transactionTaxExemptIndicator;
304        }
305    
306        /**
307         * Sets the transactionTaxExemptIndicator attribute.
308         * 
309         * @param transactionTaxExemptIndicator The transactionTaxExemptIndicator to set.
310         */
311        public void setTransactionTaxExemptIndicator(boolean transactionTaxExemptIndicator) {
312            this.transactionTaxExemptIndicator = transactionTaxExemptIndicator;
313        }
314    
315    
316        /**
317         * Gets the transactionPurchaseIdentifierIndicator attribute.
318         * 
319         * @return Returns the transactionPurchaseIdentifierIndicator
320         */
321        public boolean getTransactionPurchaseIdentifierIndicator() {
322            return transactionPurchaseIdentifierIndicator;
323        }
324    
325        /**
326         * Sets the transactionPurchaseIdentifierIndicator attribute.
327         * 
328         * @param transactionPurchaseIdentifierIndicator The transactionPurchaseIdentifierIndicator to set.
329         */
330        public void setTransactionPurchaseIdentifierIndicator(boolean transactionPurchaseIdentifierIndicator) {
331            this.transactionPurchaseIdentifierIndicator = transactionPurchaseIdentifierIndicator;
332        }
333    
334    
335        /**
336         * Gets the transactionPurchaseIdentifierDescription attribute.
337         * 
338         * @return Returns the transactionPurchaseIdentifierDescription
339         */
340        public String getTransactionPurchaseIdentifierDescription() {
341            return transactionPurchaseIdentifierDescription;
342        }
343    
344        /**
345         * Sets the transactionPurchaseIdentifierDescription attribute.
346         * 
347         * @param transactionPurchaseIdentifierDescription The transactionPurchaseIdentifierDescription to set.
348         */
349        public void setTransactionPurchaseIdentifierDescription(String transactionPurchaseIdentifierDescription) {
350            this.transactionPurchaseIdentifierDescription = transactionPurchaseIdentifierDescription;
351        }
352    
353    
354        /**
355         * Gets the transactionUnitContactName attribute.
356         * 
357         * @return Returns the transactionUnitContactName
358         */
359        public String getTransactionUnitContactName() {
360            return transactionUnitContactName;
361        }
362    
363        /**
364         * Sets the transactionUnitContactName attribute.
365         * 
366         * @param transactionUnitContactName The transactionUnitContactName to set.
367         */
368        public void setTransactionUnitContactName(String transactionUnitContactName) {
369            this.transactionUnitContactName = transactionUnitContactName;
370        }
371    
372    
373        /**
374         * Gets the transactionTravelAuthorizationCode attribute.
375         * 
376         * @return Returns the transactionTravelAuthorizationCode
377         */
378        public String getTransactionTravelAuthorizationCode() {
379            return transactionTravelAuthorizationCode;
380        }
381    
382        /**
383         * Sets the transactionTravelAuthorizationCode attribute.
384         * 
385         * @param transactionTravelAuthorizationCode The transactionTravelAuthorizationCode to set.
386         */
387        public void setTransactionTravelAuthorizationCode(String transactionTravelAuthorizationCode) {
388            this.transactionTravelAuthorizationCode = transactionTravelAuthorizationCode;
389        }
390    
391    
392        /**
393         * Gets the transactionPointOfSaleCode attribute.
394         * 
395         * @return Returns the transactionPointOfSaleCode
396         */
397        public String getTransactionPointOfSaleCode() {
398            return transactionPointOfSaleCode;
399        }
400    
401        /**
402         * Sets the transactionPointOfSaleCode attribute.
403         * 
404         * @param transactionPointOfSaleCode The transactionPointOfSaleCode to set.
405         */
406        public void setTransactionPointOfSaleCode(String transactionPointOfSaleCode) {
407            this.transactionPointOfSaleCode = transactionPointOfSaleCode;
408        }
409    
410    
411        /**
412         * Gets the sourceAccountingLines attribute.
413         * 
414         * @return Returns the sourceAccountingLines.
415         */
416        public List getSourceAccountingLines() {
417            return sourceAccountingLines;
418        }
419    
420    
421        /**
422         * Sets the sourceAccountingLines attribute value.
423         * 
424         * @param sourceAccountingLines The sourceAccountingLines to set.
425         */
426        public void setSourceAccountingLines(List sourceAccountingLines) {
427            this.sourceAccountingLines = sourceAccountingLines;
428        }
429    
430    
431        /**
432         * Gets the targetAccountingLines attribute.
433         * 
434         * @return Returns the targetAccountingLines.
435         */
436        public List getTargetAccountingLines() {
437            return targetAccountingLines;
438        }
439    
440    
441        /**
442         * Sets the targetAccountingLines attribute value.
443         * 
444         * @param targetAccountingLines The targetAccountingLines to set.
445         */
446        public void setTargetAccountingLines(List targetAccountingLines) {
447            this.targetAccountingLines = targetAccountingLines;
448        }
449    
450    
451        /**
452         * Gets the transactionCycleEndDate attribute.
453         * 
454         * @return Returns the transactionCycleEndDate.
455         */
456        public Date getTransactionCycleEndDate() {
457            return transactionCycleEndDate;
458        }
459    
460        /**
461         * Sets the transactionCycleEndDate attribute value.
462         * 
463         * @param transactionCycleEndDate The transactionCycleEndDate to set.
464         */
465        public void setTransactionCycleEndDate(Date transactionCycleEndDate) {
466            this.transactionCycleEndDate = transactionCycleEndDate;
467        }
468    
469        /**
470         * Gets the transactionCycleStartDate attribute.
471         * 
472         * @return Returns the transactionCycleStartDate.
473         */
474        public Date getTransactionCycleStartDate() {
475            return transactionCycleStartDate;
476        }
477    
478        /**
479         * Sets the transactionCycleStartDate attribute value.
480         * 
481         * @param transactionCycleStartDate The transactionCycleStartDate to set.
482         */
483        public void setTransactionCycleStartDate(Date transactionCycleStartDate) {
484            this.transactionCycleStartDate = transactionCycleStartDate;
485        }
486    
487        /**
488         * Gets the procurementCardVendor attribute.
489         * 
490         * @return Returns the procurementCardVendor.
491         */
492        public ProcurementCardVendor getProcurementCardVendor() {
493            return procurementCardVendor;
494        }
495    
496        /**
497         * Sets the procurementCardVendor attribute value.
498         * 
499         * @param procurementCardVendor The procurementCardVendor to set.
500         */
501        public void setProcurementCardVendor(ProcurementCardVendor procurementCardVendor) {
502            this.procurementCardVendor = procurementCardVendor;
503        }
504    
505        /**
506         * Gets the transactionTotalAmount attribute.
507         * 
508         * @return Returns the transactionTotalAmount.
509         */
510        public KualiDecimal getTransactionTotalAmount() {
511            return transactionTotalAmount;
512        }
513    
514        /**
515         * Sets the transactionTotalAmount attribute value.
516         * 
517         * @param transactionTotalAmount The transactionTotalAmount to set.
518         */
519        public void setTransactionTotalAmount(KualiDecimal transactionTotalAmount) {
520            this.transactionTotalAmount = transactionTotalAmount;
521        }
522    
523        /**
524         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
525         */
526        protected LinkedHashMap toStringMapper() {
527            LinkedHashMap m = new LinkedHashMap();
528            m.put(KFSPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
529            if (this.financialDocumentTransactionLineNumber != null) {
530                m.put("financialDocumentTransactionLineNumber", this.financialDocumentTransactionLineNumber.toString());
531            }
532            return m;
533        }
534    
535    }