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:
017: package org.kuali.module.financial.bo;
018:
019: import java.util.LinkedHashMap;
020:
021: import org.kuali.core.bo.PersistableBusinessObjectBase;
022: import org.kuali.core.util.KualiDecimal;
023: import org.kuali.kfs.KFSConstants;
024: import org.kuali.kfs.KFSPropertyConstants;
025:
026: /**
027: * Represents a breakdown of currency amounts (i.e. $100, $50, $20, etc.)
028: */
029: public class CurrencyDetail extends PersistableBusinessObjectBase {
030:
031: private String documentNumber;
032: private String financialDocumentTypeCode;
033: private String cashieringRecordSource;
034: private KualiDecimal financialDocumentHundredDollarAmount;
035: private KualiDecimal financialDocumentFiftyDollarAmount;
036: private KualiDecimal financialDocumentTwentyDollarAmount;
037: private KualiDecimal financialDocumentTenDollarAmount;
038: private KualiDecimal financialDocumentFiveDollarAmount;
039: private KualiDecimal financialDocumentTwoDollarAmount;
040: private KualiDecimal financialDocumentOneDollarAmount;
041: private KualiDecimal financialDocumentOtherDollarAmount;
042:
043: /**
044: * Default constructor.
045: */
046: public CurrencyDetail() {
047:
048: }
049:
050: /**
051: * Gets the documentNumber attribute.
052: *
053: * @return Returns the documentNumber
054: */
055: public String getDocumentNumber() {
056: return documentNumber;
057: }
058:
059: /**
060: * Sets the documentNumber attribute.
061: *
062: * @param documentNumber The documentNumber to set.
063: */
064: public void setDocumentNumber(String documentNumber) {
065: this .documentNumber = documentNumber;
066: }
067:
068: /**
069: * Gets the financialDocumentTypeCode attribute.
070: *
071: * @return Returns the financialDocumentTypeCode
072: */
073: public String getFinancialDocumentTypeCode() {
074: return financialDocumentTypeCode;
075: }
076:
077: /**
078: * Sets the financialDocumentTypeCode attribute.
079: *
080: * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
081: */
082: public void setFinancialDocumentTypeCode(
083: String financialDocumentTypeCode) {
084: this .financialDocumentTypeCode = financialDocumentTypeCode;
085: }
086:
087: /**
088: * Gets the cashieringRecordSource attribute.
089: *
090: * @return Returns the cashieringRecordSource
091: */
092: public String getCashieringRecordSource() {
093: return cashieringRecordSource;
094: }
095:
096: /**
097: * Sets the cashieringRecordSource attribute.
098: *
099: * @param cashieringRecordSource The cashieringRecordSource to set.
100: */
101: public void setCashieringRecordSource(
102: String financialDocumentColumnTypeCode) {
103: this .cashieringRecordSource = financialDocumentColumnTypeCode;
104: }
105:
106: /**
107: * Gets the financialDocumentHundredDollarAmount attribute.
108: *
109: * @return Returns the financialDocumentHundredDollarAmount
110: */
111: public KualiDecimal getFinancialDocumentHundredDollarAmount() {
112: return financialDocumentHundredDollarAmount;
113: }
114:
115: /**
116: * Sets the financialDocumentHundredDollarAmount attribute.
117: *
118: * @param financialDocumentHundredDollarAmount The financialDocumentHundredDollarAmount to set.
119: */
120: public void setFinancialDocumentHundredDollarAmount(
121: KualiDecimal financialDocumentHundredDollarAmount) {
122: this .financialDocumentHundredDollarAmount = financialDocumentHundredDollarAmount;
123: }
124:
125: /**
126: * Returns the actual count of hundred dollar bills
127: *
128: * @return the number of hundred dollar bills present in the drawer
129: */
130: public Integer getHundredDollarCount() {
131: return (financialDocumentHundredDollarAmount == null) ? new Integer(
132: 0)
133: : new Integer(
134: financialDocumentHundredDollarAmount
135: .divide(
136: KFSConstants.CurrencyTypeAmounts.HUNDRED_DOLLAR_AMOUNT)
137: .intValue());
138: }
139:
140: /**
141: * This sets the count of hundred dollar bills present in the drawer
142: *
143: * @param count the number of hundred dollar bills present in the drawer
144: */
145: public void setHundredDollarCount(Integer count) {
146: if (count != null) {
147: this .financialDocumentHundredDollarAmount = new KualiDecimal(
148: count.intValue())
149: .multiply(KFSConstants.CurrencyTypeAmounts.HUNDRED_DOLLAR_AMOUNT);
150: }
151: }
152:
153: /**
154: * Gets the financialDocumentFiftyDollarAmount attribute.
155: *
156: * @return Returns the financialDocumentFiftyDollarAmount
157: */
158: public KualiDecimal getFinancialDocumentFiftyDollarAmount() {
159: return financialDocumentFiftyDollarAmount;
160: }
161:
162: /**
163: * Sets the financialDocumentFiftyDollarAmount attribute.
164: *
165: * @param financialDocumentFiftyDollarAmount The financialDocumentFiftyDollarAmount to set.
166: */
167: public void setFinancialDocumentFiftyDollarAmount(
168: KualiDecimal financialDocumentFiftyDollarAmount) {
169: this .financialDocumentFiftyDollarAmount = financialDocumentFiftyDollarAmount;
170: }
171:
172: /**
173: * Returns the actual count of fifty dollar bills
174: *
175: * @return the number of fifty dollar bills present in the drawer
176: */
177: public Integer getFiftyDollarCount() {
178: return (financialDocumentFiftyDollarAmount == null) ? new Integer(
179: 0)
180: : new Integer(
181: financialDocumentFiftyDollarAmount
182: .divide(
183: KFSConstants.CurrencyTypeAmounts.FIFTY_DOLLAR_AMOUNT)
184: .intValue());
185: }
186:
187: /**
188: * This sets the count of hundred dollar bills present in the drawer
189: *
190: * @param count the number of hundred dollar bills present in the drawer
191: */
192: public void setFiftyDollarCount(Integer count) {
193: if (count != null) {
194: this .financialDocumentFiftyDollarAmount = new KualiDecimal(
195: count.intValue())
196: .multiply(KFSConstants.CurrencyTypeAmounts.FIFTY_DOLLAR_AMOUNT);
197: }
198: }
199:
200: /**
201: * Gets the financialDocumentTwentyDollarAmount attribute.
202: *
203: * @return Returns the financialDocumentTwentyDollarAmount
204: */
205: public KualiDecimal getFinancialDocumentTwentyDollarAmount() {
206: return financialDocumentTwentyDollarAmount;
207: }
208:
209: /**
210: * Sets the financialDocumentTwentyDollarAmount attribute.
211: *
212: * @param financialDocumentTwentyDollarAmount The financialDocumentTwentyDollarAmount to set.
213: */
214: public void setFinancialDocumentTwentyDollarAmount(
215: KualiDecimal financialDocumentTwentyDollarAmount) {
216: this .financialDocumentTwentyDollarAmount = financialDocumentTwentyDollarAmount;
217: }
218:
219: /**
220: * Returns the actual count of twenty dollar bills
221: *
222: * @return the number of twenty dollar bills present in the drawer
223: */
224: public Integer getTwentyDollarCount() {
225: return (financialDocumentTwentyDollarAmount == null) ? new Integer(
226: 0)
227: : new Integer(
228: financialDocumentTwentyDollarAmount
229: .divide(
230: KFSConstants.CurrencyTypeAmounts.TWENTY_DOLLAR_AMOUNT)
231: .intValue());
232: }
233:
234: /**
235: * This sets the count of twenty dollar bills present in the drawer
236: *
237: * @param count the number of twenty dollar bills present in the drawer
238: */
239: public void setTwentyDollarCount(Integer count) {
240: if (count != null) {
241: this .financialDocumentTwentyDollarAmount = new KualiDecimal(
242: count.intValue())
243: .multiply(KFSConstants.CurrencyTypeAmounts.TWENTY_DOLLAR_AMOUNT);
244: }
245: }
246:
247: /**
248: * Gets the financialDocumentTenDollarAmount attribute.
249: *
250: * @return Returns the financialDocumentTenDollarAmount
251: */
252: public KualiDecimal getFinancialDocumentTenDollarAmount() {
253: return financialDocumentTenDollarAmount;
254: }
255:
256: /**
257: * Sets the financialDocumentTenDollarAmount attribute.
258: *
259: * @param financialDocumentTenDollarAmount The financialDocumentTenDollarAmount to set.
260: */
261: public void setFinancialDocumentTenDollarAmount(
262: KualiDecimal financialDocumentTenDollarAmount) {
263: this .financialDocumentTenDollarAmount = financialDocumentTenDollarAmount;
264: }
265:
266: /**
267: * Returns the actual count of ten dollar bills
268: *
269: * @return the number of ten dollar bills present in the drawer
270: */
271: public Integer getTenDollarCount() {
272: return (financialDocumentTenDollarAmount == null) ? new Integer(
273: 0)
274: : new Integer(
275: financialDocumentTenDollarAmount
276: .divide(
277: KFSConstants.CurrencyTypeAmounts.TEN_DOLLAR_AMOUNT)
278: .intValue());
279: }
280:
281: /**
282: * This sets the count of ten dollar bills present in the drawer
283: *
284: * @param count the number of ten dollar bills present in the drawer
285: */
286: public void setTenDollarCount(Integer count) {
287: if (count != null) {
288: this .financialDocumentTenDollarAmount = new KualiDecimal(
289: count.intValue())
290: .multiply(KFSConstants.CurrencyTypeAmounts.TEN_DOLLAR_AMOUNT);
291: }
292: }
293:
294: /**
295: * Gets the financialDocumentFiveDollarAmount attribute.
296: *
297: * @return Returns the financialDocumentFiveDollarAmount
298: */
299: public KualiDecimal getFinancialDocumentFiveDollarAmount() {
300: return financialDocumentFiveDollarAmount;
301: }
302:
303: /**
304: * Sets the financialDocumentFiveDollarAmount attribute.
305: *
306: * @param financialDocumentFiveDollarAmount The financialDocumentFiveDollarAmount to set.
307: */
308: public void setFinancialDocumentFiveDollarAmount(
309: KualiDecimal financialDocumentFiveDollarAmount) {
310: this .financialDocumentFiveDollarAmount = financialDocumentFiveDollarAmount;
311: }
312:
313: /**
314: * Returns the actual count of five dollar bills
315: *
316: * @return the number of five dollar bills present in the drawer
317: */
318: public Integer getFiveDollarCount() {
319: return (financialDocumentFiveDollarAmount == null) ? new Integer(
320: 0)
321: : new Integer(
322: financialDocumentFiveDollarAmount
323: .divide(
324: KFSConstants.CurrencyTypeAmounts.FIVE_DOLLAR_AMOUNT)
325: .intValue());
326: }
327:
328: /**
329: * This sets the count of five dollar bills present in the drawer
330: *
331: * @param count the number of five dollar bills present in the drawer
332: */
333: public void setFiveDollarCount(Integer count) {
334: if (count != null) {
335: this .financialDocumentFiveDollarAmount = new KualiDecimal(
336: count.intValue())
337: .multiply(KFSConstants.CurrencyTypeAmounts.FIVE_DOLLAR_AMOUNT);
338: }
339: }
340:
341: /**
342: * Gets the financialDocumentTwoDollarAmount attribute.
343: *
344: * @return Returns the financialDocumentTwoDollarAmount
345: */
346: public KualiDecimal getFinancialDocumentTwoDollarAmount() {
347: return financialDocumentTwoDollarAmount;
348: }
349:
350: /**
351: * Sets the financialDocumentTwoDollarAmount attribute.
352: *
353: * @param financialDocumentTwoDollarAmount The financialDocumentTwoDollarAmount to set.
354: */
355: public void setFinancialDocumentTwoDollarAmount(
356: KualiDecimal financialDocumentTwoDollarAmount) {
357: this .financialDocumentTwoDollarAmount = financialDocumentTwoDollarAmount;
358: }
359:
360: /**
361: * Returns the actual count of two dollar bills
362: *
363: * @return the number of two dollar bills present in the drawer
364: */
365: public Integer getTwoDollarCount() {
366: return (financialDocumentTwoDollarAmount == null) ? new Integer(
367: 0)
368: : new Integer(
369: financialDocumentTwoDollarAmount
370: .divide(
371: KFSConstants.CurrencyTypeAmounts.TWO_DOLLAR_AMOUNT)
372: .intValue());
373: }
374:
375: /**
376: * This sets the count of two dollar bills present in the drawer
377: *
378: * @param count the number of two dollar bills present in the drawer
379: */
380: public void setTwoDollarCount(Integer count) {
381: if (count != null) {
382: this .financialDocumentTwoDollarAmount = new KualiDecimal(
383: count.intValue())
384: .multiply(KFSConstants.CurrencyTypeAmounts.TWO_DOLLAR_AMOUNT);
385: }
386: }
387:
388: /**
389: * Gets the financialDocumentOneDollarAmount attribute.
390: *
391: * @return Returns the financialDocumentOneDollarAmount
392: */
393: public KualiDecimal getFinancialDocumentOneDollarAmount() {
394: return financialDocumentOneDollarAmount;
395: }
396:
397: /**
398: * Sets the financialDocumentOneDollarAmount attribute.
399: *
400: * @param financialDocumentOneDollarAmount The financialDocumentOneDollarAmount to set.
401: */
402: public void setFinancialDocumentOneDollarAmount(
403: KualiDecimal financialDocumentOneDollarAmount) {
404: this .financialDocumentOneDollarAmount = financialDocumentOneDollarAmount;
405: }
406:
407: /**
408: * Returns the actual count of one dollar bills
409: *
410: * @return the number of one dollar bills present in the drawer
411: */
412: public Integer getOneDollarCount() {
413: return (financialDocumentOneDollarAmount == null) ? new Integer(
414: 0)
415: : new Integer(
416: financialDocumentOneDollarAmount
417: .divide(
418: KFSConstants.CurrencyTypeAmounts.ONE_DOLLAR_AMOUNT)
419: .intValue());
420: }
421:
422: /**
423: * This sets the count of one dollar bills present in the drawer
424: *
425: * @param count the number of one dollar bills present in the drawer
426: */
427: public void setOneDollarCount(Integer count) {
428: if (count != null) {
429: this .financialDocumentOneDollarAmount = new KualiDecimal(
430: count.intValue())
431: .multiply(KFSConstants.CurrencyTypeAmounts.ONE_DOLLAR_AMOUNT);
432: }
433: }
434:
435: /**
436: * Gets the financialDocumentOtherDollarAmount attribute.
437: *
438: * @return Returns the financialDocumentOtherDollarAmount
439: */
440: public KualiDecimal getFinancialDocumentOtherDollarAmount() {
441: return financialDocumentOtherDollarAmount;
442: }
443:
444: /**
445: * Sets the financialDocumentOtherDollarAmount attribute.
446: *
447: * @param financialDocumentOtherDollarAmount The financialDocumentOtherDollarAmount to set.
448: */
449: public void setFinancialDocumentOtherDollarAmount(
450: KualiDecimal financialDocumentOtherDollarAmount) {
451: this .financialDocumentOtherDollarAmount = financialDocumentOtherDollarAmount;
452: }
453:
454: /**
455: * This method calculates the total amount represented by all the currency listed in this detail record
456: *
457: * @return total amount of this detail
458: */
459: public KualiDecimal getTotalAmount() {
460: KualiDecimal result = new KualiDecimal(0);
461: if (this .financialDocumentHundredDollarAmount != null) {
462: result = result
463: .add(this .financialDocumentHundredDollarAmount);
464: }
465: if (this .financialDocumentFiftyDollarAmount != null) {
466: result = result
467: .add(this .financialDocumentFiftyDollarAmount);
468: }
469: if (this .financialDocumentTwentyDollarAmount != null) {
470: result = result
471: .add(this .financialDocumentTwentyDollarAmount);
472: }
473: if (this .financialDocumentTenDollarAmount != null) {
474: result = result.add(this .financialDocumentTenDollarAmount);
475: }
476: if (this .financialDocumentFiveDollarAmount != null) {
477: result = result.add(this .financialDocumentFiveDollarAmount);
478: }
479: if (this .financialDocumentTwoDollarAmount != null) {
480: result = result.add(this .financialDocumentTwoDollarAmount);
481: }
482: if (this .financialDocumentOneDollarAmount != null) {
483: result = result.add(this .financialDocumentOneDollarAmount);
484: }
485: if (this .financialDocumentOtherDollarAmount != null) {
486: result = result
487: .add(this .financialDocumentOtherDollarAmount);
488: }
489: return result;
490: }
491:
492: /**
493: * This method sets all the amounts to zero
494: */
495: public void zeroOutAmounts() {
496: this .financialDocumentHundredDollarAmount = new KualiDecimal(0);
497: this .financialDocumentFiftyDollarAmount = new KualiDecimal(0);
498: this .financialDocumentTwentyDollarAmount = new KualiDecimal(0);
499: this .financialDocumentTenDollarAmount = new KualiDecimal(0);
500: this .financialDocumentFiveDollarAmount = new KualiDecimal(0);
501: this .financialDocumentTwoDollarAmount = new KualiDecimal(0);
502: this .financialDocumentOneDollarAmount = new KualiDecimal(0);
503: this .financialDocumentOtherDollarAmount = new KualiDecimal(0);
504: }
505:
506: /**
507: * This method sets all amounts that are null to zero
508: */
509: public void zeroOutUnpopulatedAmounts() {
510: if (financialDocumentHundredDollarAmount == null) {
511: this .financialDocumentHundredDollarAmount = new KualiDecimal(
512: 0);
513: }
514: if (financialDocumentFiftyDollarAmount == null) {
515: this .financialDocumentFiftyDollarAmount = new KualiDecimal(
516: 0);
517: }
518: if (financialDocumentTwentyDollarAmount == null) {
519: this .financialDocumentTwentyDollarAmount = new KualiDecimal(
520: 0);
521: }
522: if (financialDocumentTenDollarAmount == null) {
523: this .financialDocumentTenDollarAmount = new KualiDecimal(0);
524: }
525: if (financialDocumentFiveDollarAmount == null) {
526: this .financialDocumentFiveDollarAmount = new KualiDecimal(0);
527: }
528: if (financialDocumentTwoDollarAmount == null) {
529: this .financialDocumentTwoDollarAmount = new KualiDecimal(0);
530: }
531: if (financialDocumentOneDollarAmount == null) {
532: this .financialDocumentOneDollarAmount = new KualiDecimal(0);
533: }
534: if (financialDocumentOtherDollarAmount == null) {
535: this .financialDocumentOtherDollarAmount = new KualiDecimal(
536: 0);
537: }
538: }
539:
540: /**
541: * This method adds the amounts from the given currency detail record to this one
542: *
543: * @param detail the currency detail to add onto this
544: */
545: public void add(CurrencyDetail detail) {
546: if (detail.financialDocumentHundredDollarAmount != null) {
547: if (this .financialDocumentHundredDollarAmount == null) {
548: this .financialDocumentHundredDollarAmount = new KualiDecimal(
549: 0)
550: .add(detail.financialDocumentHundredDollarAmount);
551: } else {
552: this .financialDocumentHundredDollarAmount = this .financialDocumentHundredDollarAmount
553: .add(detail.financialDocumentHundredDollarAmount);
554: }
555: }
556: if (detail.financialDocumentFiftyDollarAmount != null) {
557: if (this .financialDocumentFiftyDollarAmount == null) {
558: this .financialDocumentFiftyDollarAmount = new KualiDecimal(
559: 0)
560: .add(detail.financialDocumentFiftyDollarAmount);
561: } else {
562: this .financialDocumentFiftyDollarAmount = this .financialDocumentFiftyDollarAmount
563: .add(detail.financialDocumentFiftyDollarAmount);
564: }
565: }
566: if (detail.financialDocumentTwentyDollarAmount != null) {
567: if (this .financialDocumentTwentyDollarAmount == null) {
568: this .financialDocumentTwentyDollarAmount = new KualiDecimal(
569: 0)
570: .add(detail.financialDocumentTwentyDollarAmount);
571: } else {
572: this .financialDocumentTwentyDollarAmount = this .financialDocumentTwentyDollarAmount
573: .add(detail.financialDocumentTwentyDollarAmount);
574: }
575: }
576: if (detail.financialDocumentTenDollarAmount != null) {
577: if (this .financialDocumentTenDollarAmount == null) {
578: this .financialDocumentTenDollarAmount = new KualiDecimal(
579: 0).add(detail.financialDocumentTenDollarAmount);
580: } else {
581: this .financialDocumentTenDollarAmount = this .financialDocumentTenDollarAmount
582: .add(detail.financialDocumentTenDollarAmount);
583: }
584: }
585: if (detail.financialDocumentFiveDollarAmount != null) {
586: if (this .financialDocumentFiveDollarAmount == null) {
587: this .financialDocumentFiveDollarAmount = new KualiDecimal(
588: 0)
589: .add(detail.financialDocumentFiveDollarAmount);
590: } else {
591: this .financialDocumentFiveDollarAmount = this .financialDocumentFiveDollarAmount
592: .add(detail.financialDocumentFiveDollarAmount);
593: }
594: }
595: if (detail.financialDocumentTwoDollarAmount != null) {
596: if (this .financialDocumentTwoDollarAmount == null) {
597: this .financialDocumentTwoDollarAmount = new KualiDecimal(
598: 0).add(detail.financialDocumentTwoDollarAmount);
599: } else {
600: this .financialDocumentTwoDollarAmount = this .financialDocumentTwoDollarAmount
601: .add(detail.financialDocumentTwoDollarAmount);
602: }
603: }
604: if (detail.financialDocumentOneDollarAmount != null) {
605: if (this .financialDocumentOneDollarAmount == null) {
606: this .financialDocumentOneDollarAmount = new KualiDecimal(
607: 0).add(detail.financialDocumentOneDollarAmount);
608: } else {
609: this .financialDocumentOneDollarAmount = this .financialDocumentOneDollarAmount
610: .add(detail.financialDocumentOneDollarAmount);
611: }
612: }
613: if (detail.financialDocumentOtherDollarAmount != null) {
614: if (this .financialDocumentOtherDollarAmount == null) {
615: this .financialDocumentOtherDollarAmount = new KualiDecimal(
616: 0)
617: .add(detail.financialDocumentOtherDollarAmount);
618: } else {
619: this .financialDocumentOtherDollarAmount = this .financialDocumentOtherDollarAmount
620: .add(detail.financialDocumentOtherDollarAmount);
621: }
622: }
623: }
624:
625: /**
626: * This method subtracts the given currency detail from this one
627: *
628: * @param detail the detail to subtract
629: */
630: public void subtract(CurrencyDetail detail) {
631: if (detail.financialDocumentHundredDollarAmount != null) {
632: if (this .financialDocumentHundredDollarAmount == null) {
633: this .financialDocumentHundredDollarAmount = new KualiDecimal(
634: 0)
635: .subtract(detail.financialDocumentHundredDollarAmount);
636: } else {
637: this .financialDocumentHundredDollarAmount = this .financialDocumentHundredDollarAmount
638: .subtract(detail.financialDocumentHundredDollarAmount);
639: }
640: }
641: if (detail.financialDocumentFiftyDollarAmount != null) {
642: if (this .financialDocumentFiftyDollarAmount == null) {
643: this .financialDocumentFiftyDollarAmount = new KualiDecimal(
644: 0)
645: .subtract(detail.financialDocumentFiftyDollarAmount);
646: } else {
647: this .financialDocumentFiftyDollarAmount = this .financialDocumentFiftyDollarAmount
648: .subtract(detail.financialDocumentFiftyDollarAmount);
649: }
650: }
651: if (detail.financialDocumentTwentyDollarAmount != null) {
652: if (this .financialDocumentTwentyDollarAmount == null) {
653: this .financialDocumentTwentyDollarAmount = new KualiDecimal(
654: 0)
655: .subtract(detail.financialDocumentTwentyDollarAmount);
656: } else {
657: this .financialDocumentTwentyDollarAmount = this .financialDocumentTwentyDollarAmount
658: .subtract(detail.financialDocumentTwentyDollarAmount);
659: }
660: }
661: if (detail.financialDocumentTenDollarAmount != null) {
662: if (this .financialDocumentTenDollarAmount == null) {
663: this .financialDocumentTenDollarAmount = new KualiDecimal(
664: 0)
665: .subtract(detail.financialDocumentTenDollarAmount);
666: } else {
667: this .financialDocumentTenDollarAmount = this .financialDocumentTenDollarAmount
668: .subtract(detail.financialDocumentTenDollarAmount);
669: }
670: }
671: if (detail.financialDocumentFiveDollarAmount != null) {
672: if (this .financialDocumentFiveDollarAmount == null) {
673: this .financialDocumentFiveDollarAmount = new KualiDecimal(
674: 0)
675: .subtract(detail.financialDocumentFiveDollarAmount);
676: } else {
677: this .financialDocumentFiveDollarAmount = this .financialDocumentFiveDollarAmount
678: .subtract(detail.financialDocumentFiveDollarAmount);
679: }
680: }
681: if (detail.financialDocumentTwoDollarAmount != null) {
682: if (this .financialDocumentTwoDollarAmount == null) {
683: this .financialDocumentTwoDollarAmount = new KualiDecimal(
684: 0)
685: .subtract(detail.financialDocumentTwoDollarAmount);
686: } else {
687: this .financialDocumentTwoDollarAmount = this .financialDocumentTwoDollarAmount
688: .subtract(detail.financialDocumentTwoDollarAmount);
689: }
690: }
691: if (detail.financialDocumentOneDollarAmount != null) {
692: if (this .financialDocumentOneDollarAmount == null) {
693: this .financialDocumentOneDollarAmount = new KualiDecimal(
694: 0)
695: .subtract(detail.financialDocumentOneDollarAmount);
696: } else {
697: this .financialDocumentOneDollarAmount = this .financialDocumentOneDollarAmount
698: .subtract(detail.financialDocumentOneDollarAmount);
699: }
700: }
701: if (detail.financialDocumentOtherDollarAmount != null) {
702: if (this .financialDocumentOtherDollarAmount == null) {
703: this .financialDocumentOtherDollarAmount = new KualiDecimal(
704: 0)
705: .subtract(detail.financialDocumentOtherDollarAmount);
706: } else {
707: this .financialDocumentOtherDollarAmount = this .financialDocumentOtherDollarAmount
708: .subtract(detail.financialDocumentOtherDollarAmount);
709: }
710: }
711: }
712:
713: /**
714: * Does this currency detail actually have any information in it?
715: *
716: * @return true if any field at all is not null and not zero, false if otherwise
717: */
718: public boolean isEmpty() {
719: return ((this .financialDocumentHundredDollarAmount == null || this .financialDocumentHundredDollarAmount
720: .equals(KualiDecimal.ZERO))
721: && (this .financialDocumentFiftyDollarAmount == null || this .financialDocumentFiftyDollarAmount
722: .equals(KualiDecimal.ZERO))
723: && (this .financialDocumentTwentyDollarAmount == null || this .financialDocumentTwentyDollarAmount
724: .equals(KualiDecimal.ZERO))
725: && (this .financialDocumentTenDollarAmount == null || this .financialDocumentTenDollarAmount
726: .equals(KualiDecimal.ZERO))
727: && (this .financialDocumentFiveDollarAmount == null || this .financialDocumentFiveDollarAmount
728: .equals(KualiDecimal.ZERO))
729: && (this .financialDocumentTwoDollarAmount == null || this .financialDocumentTwoDollarAmount
730: .equals(KualiDecimal.ZERO))
731: && (this .financialDocumentOneDollarAmount == null || this .financialDocumentOneDollarAmount
732: .equals(KualiDecimal.ZERO)) && (this .financialDocumentOtherDollarAmount == null || this .financialDocumentOtherDollarAmount
733: .equals(KualiDecimal.ZERO)));
734: }
735:
736: /**
737: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
738: */
739: protected LinkedHashMap toStringMapper() {
740: LinkedHashMap m = new LinkedHashMap();
741: m
742: .put(KFSPropertyConstants.DOCUMENT_NUMBER,
743: this .documentNumber);
744: m.put("financialDocumentTypeCode",
745: this .financialDocumentTypeCode);
746: m.put("cashieringRecordSource", this.cashieringRecordSource);
747: return m;
748: }
749: }
|