1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.ole.fp.businessobject;
18
19 import java.util.HashMap;
20 import java.util.LinkedHashMap;
21 import java.util.Map;
22
23 import org.apache.commons.lang.StringUtils;
24 import org.kuali.ole.sys.OLEConstants;
25 import org.kuali.ole.sys.context.SpringContext;
26 import org.kuali.rice.core.api.util.type.KualiDecimal;
27 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
28 import org.kuali.rice.krad.service.KualiModuleService;
29 import org.kuali.rice.krad.service.ModuleService;
30 import org.kuali.rice.location.api.LocationConstants;
31 import org.kuali.rice.location.framework.campus.CampusEbo;
32
33
34
35
36
37 public class CashDrawer extends PersistableBusinessObjectBase {
38 private String campusCode;
39 private String statusCode;
40
41 private KualiDecimal cashDrawerTotalAmount;
42
43 private KualiDecimal financialDocumentHundredDollarAmount;
44 private KualiDecimal financialDocumentFiftyDollarAmount;
45 private KualiDecimal financialDocumentTwentyDollarAmount;
46 private KualiDecimal financialDocumentTenDollarAmount;
47 private KualiDecimal financialDocumentFiveDollarAmount;
48 private KualiDecimal financialDocumentTwoDollarAmount;
49 private KualiDecimal financialDocumentOneDollarAmount;
50 private KualiDecimal financialDocumentOtherDollarAmount;
51
52 private KualiDecimal financialDocumentHundredCentAmount;
53 private KualiDecimal financialDocumentFiftyCentAmount;
54 private KualiDecimal financialDocumentTwentyFiveCentAmount;
55 private KualiDecimal financialDocumentTenCentAmount;
56 private KualiDecimal financialDocumentFiveCentAmount;
57 private KualiDecimal financialDocumentOneCentAmount;
58 private KualiDecimal financialDocumentOtherCentAmount;
59
60 private KualiDecimal financialDocumentMiscellaneousAdvanceAmount;
61
62 private String referenceFinancialDocumentNumber;
63 private CampusEbo campus;
64
65
66
67
68 public CashDrawer() {
69
70 }
71
72
73
74
75
76
77 public boolean isOpen() {
78 return StringUtils.equals(OLEConstants.CashDrawerConstants.STATUS_OPEN, statusCode);
79 }
80
81
82
83
84
85
86 public boolean isClosed() {
87 return (statusCode == null || StringUtils.equals(OLEConstants.CashDrawerConstants.STATUS_CLOSED, statusCode) || referenceFinancialDocumentNumber == null);
88 }
89
90
91
92
93
94
95 public boolean isLocked() {
96 return StringUtils.equals(OLEConstants.CashDrawerConstants.STATUS_LOCKED, statusCode);
97 }
98
99
100
101
102
103
104
105 public String getCampusCode() {
106 return campusCode;
107 }
108
109
110
111
112
113
114 public void setCampusCode(String campusCode) {
115 this.campusCode = campusCode;
116 }
117
118
119
120
121
122
123
124 public String getStatusCode() {
125 return statusCode;
126 }
127
128
129
130
131
132
133 public void setStatusCode(String financialDocumentOpenDepositCode) {
134 this.statusCode = financialDocumentOpenDepositCode;
135 }
136
137
138
139
140
141
142
143 public KualiDecimal getCashDrawerTotalAmount() {
144 return cashDrawerTotalAmount;
145 }
146
147
148
149
150
151
152 public void setCashDrawerTotalAmount(KualiDecimal cashDrawerTotalAmount) {
153 this.cashDrawerTotalAmount = cashDrawerTotalAmount;
154 }
155
156
157
158
159
160
161
162 public KualiDecimal getFinancialDocumentHundredDollarAmount() {
163 return financialDocumentHundredDollarAmount;
164 }
165
166
167
168
169
170
171 public void setFinancialDocumentHundredDollarAmount(KualiDecimal financialDocumentHundredDollarAmount) {
172 this.financialDocumentHundredDollarAmount = financialDocumentHundredDollarAmount;
173 }
174
175
176
177
178
179
180 public Integer getHundredDollarCount() {
181 return (financialDocumentHundredDollarAmount != null) ? new Integer(financialDocumentHundredDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.HUNDRED_DOLLAR_AMOUNT).intValue()) : new Integer(0);
182 }
183
184
185
186
187
188
189 public void setHundredDollarCount(Integer count) {
190 if (count != null) {
191 this.financialDocumentHundredDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.HUNDRED_DOLLAR_AMOUNT);
192 }
193 }
194
195
196
197
198
199
200 public KualiDecimal getFinancialDocumentFiftyDollarAmount() {
201 return financialDocumentFiftyDollarAmount;
202 }
203
204
205
206
207
208
209 public void setFinancialDocumentFiftyDollarAmount(KualiDecimal financialDocumentFiftyDollarAmount) {
210 this.financialDocumentFiftyDollarAmount = financialDocumentFiftyDollarAmount;
211 }
212
213
214
215
216
217
218 public Integer getFiftyDollarCount() {
219 return (financialDocumentFiftyDollarAmount != null) ? new Integer(financialDocumentFiftyDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.FIFTY_DOLLAR_AMOUNT).intValue()) : new Integer(0);
220 }
221
222
223
224
225
226
227 public void setFiftyDollarCount(Integer count) {
228 if (count != null) {
229 this.financialDocumentFiftyDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.FIFTY_DOLLAR_AMOUNT);
230 }
231 }
232
233
234
235
236
237
238 public KualiDecimal getFinancialDocumentTwentyDollarAmount() {
239 return financialDocumentTwentyDollarAmount;
240 }
241
242
243
244
245
246
247 public void setFinancialDocumentTwentyDollarAmount(KualiDecimal financialDocumentTwentyDollarAmount) {
248 this.financialDocumentTwentyDollarAmount = financialDocumentTwentyDollarAmount;
249 }
250
251
252
253
254
255
256 public Integer getTwentyDollarCount() {
257 return (financialDocumentTwentyDollarAmount != null) ? new Integer(financialDocumentTwentyDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.TWENTY_DOLLAR_AMOUNT).intValue()) : new Integer(0);
258 }
259
260
261
262
263
264
265 public void setTwentyDollarCount(Integer count) {
266 if (count != null) {
267 this.financialDocumentTwentyDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.TWENTY_DOLLAR_AMOUNT);
268 }
269 }
270
271
272
273
274
275
276 public KualiDecimal getFinancialDocumentTenDollarAmount() {
277 return financialDocumentTenDollarAmount;
278 }
279
280
281
282
283
284
285 public void setFinancialDocumentTenDollarAmount(KualiDecimal financialDocumentTenDollarAmount) {
286 this.financialDocumentTenDollarAmount = financialDocumentTenDollarAmount;
287 }
288
289
290
291
292
293
294 public Integer getTenDollarCount() {
295 return (financialDocumentTenDollarAmount != null) ? new Integer(financialDocumentTenDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.TEN_DOLLAR_AMOUNT).intValue()) : new Integer(0);
296 }
297
298
299
300
301
302
303 public void setTenDollarCount(Integer count) {
304 if (count != null) {
305 this.financialDocumentTenDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.TEN_DOLLAR_AMOUNT);
306 }
307 }
308
309
310
311
312
313
314 public KualiDecimal getFinancialDocumentFiveDollarAmount() {
315 return financialDocumentFiveDollarAmount;
316 }
317
318
319
320
321
322
323 public void setFinancialDocumentFiveDollarAmount(KualiDecimal financialDocumentFiveDollarAmount) {
324 this.financialDocumentFiveDollarAmount = financialDocumentFiveDollarAmount;
325 }
326
327
328
329
330
331
332 public Integer getFiveDollarCount() {
333 return (financialDocumentFiveDollarAmount != null) ? new Integer(financialDocumentFiveDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.FIVE_DOLLAR_AMOUNT).intValue()) : new Integer(0);
334 }
335
336
337
338
339
340
341 public void setFiveDollarCount(Integer count) {
342 if (count != null) {
343 this.financialDocumentFiveDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.FIVE_DOLLAR_AMOUNT);
344 }
345 }
346
347
348
349
350
351
352 public KualiDecimal getFinancialDocumentTwoDollarAmount() {
353 return financialDocumentTwoDollarAmount;
354 }
355
356
357
358
359
360
361 public void setFinancialDocumentTwoDollarAmount(KualiDecimal financialDocumentTwoDollarAmount) {
362 this.financialDocumentTwoDollarAmount = financialDocumentTwoDollarAmount;
363 }
364
365
366
367
368
369
370 public Integer getTwoDollarCount() {
371 return (financialDocumentTwoDollarAmount != null) ? new Integer(financialDocumentTwoDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.TWO_DOLLAR_AMOUNT).intValue()) : new Integer(0);
372 }
373
374
375
376
377
378
379 public void setTwoDollarCount(Integer count) {
380 if (count != null) {
381 this.financialDocumentTwoDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.TWO_DOLLAR_AMOUNT);
382 }
383 }
384
385
386
387
388
389
390 public KualiDecimal getFinancialDocumentOneDollarAmount() {
391 return financialDocumentOneDollarAmount;
392 }
393
394
395
396
397
398
399 public void setFinancialDocumentOneDollarAmount(KualiDecimal financialDocumentOneDollarAmount) {
400 this.financialDocumentOneDollarAmount = financialDocumentOneDollarAmount;
401 }
402
403
404
405
406
407
408 public Integer getOneDollarCount() {
409 return (financialDocumentOneDollarAmount != null) ? new Integer(financialDocumentOneDollarAmount.divide(OLEConstants.CurrencyTypeAmounts.ONE_DOLLAR_AMOUNT).intValue()) : new Integer(0);
410 }
411
412
413
414
415
416
417 public void setOneDollarCount(Integer count) {
418 if (count != null) {
419 this.financialDocumentOneDollarAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CurrencyTypeAmounts.ONE_DOLLAR_AMOUNT);
420 }
421 }
422
423
424
425
426
427
428 public KualiDecimal getFinancialDocumentOtherDollarAmount() {
429 return financialDocumentOtherDollarAmount;
430 }
431
432
433
434
435
436
437 public void setFinancialDocumentOtherDollarAmount(KualiDecimal financialDocumentOtherDollarAmount) {
438 this.financialDocumentOtherDollarAmount = financialDocumentOtherDollarAmount;
439 }
440
441
442
443
444
445
446
447 public KualiDecimal getFinancialDocumentFiftyCentAmount() {
448 return financialDocumentFiftyCentAmount;
449 }
450
451
452
453
454
455
456 public void setFinancialDocumentFiftyCentAmount(KualiDecimal financialDocumentFiftyCentAmount) {
457 this.financialDocumentFiftyCentAmount = financialDocumentFiftyCentAmount;
458 }
459
460
461
462
463
464
465 public Integer getFiftyCentCount() {
466 return (financialDocumentFiftyCentAmount != null) ? new Integer(financialDocumentFiftyCentAmount.divide(OLEConstants.CoinTypeAmounts.FIFTY_CENT_AMOUNT).intValue()) : new Integer(0);
467 }
468
469
470
471
472
473
474
475 public void setFiftyCentCount(Integer count) {
476 if (count != null) {
477 financialDocumentFiftyCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.FIFTY_CENT_AMOUNT);
478 }
479 }
480
481
482
483
484
485
486 public KualiDecimal getFinancialDocumentTwentyFiveCentAmount() {
487 return financialDocumentTwentyFiveCentAmount;
488 }
489
490
491
492
493
494
495 public void setFinancialDocumentTwentyFiveCentAmount(KualiDecimal financialDocumentTwentyFiveCentAmount) {
496 this.financialDocumentTwentyFiveCentAmount = financialDocumentTwentyFiveCentAmount;
497 }
498
499
500
501
502
503
504 public Integer getTwentyFiveCentCount() {
505 return (financialDocumentTwentyFiveCentAmount != null) ? new Integer(financialDocumentTwentyFiveCentAmount.divide(OLEConstants.CoinTypeAmounts.TWENTY_FIVE_CENT_AMOUNT).intValue()) : new Integer(0);
506 }
507
508
509
510
511
512
513 public void setTwentyFiveCentCount(Integer count) {
514 if (count != null) {
515 financialDocumentTwentyFiveCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.TWENTY_FIVE_CENT_AMOUNT);
516 }
517 }
518
519
520
521
522
523
524 public KualiDecimal getFinancialDocumentTenCentAmount() {
525 return financialDocumentTenCentAmount;
526 }
527
528
529
530
531
532
533 public void setFinancialDocumentTenCentAmount(KualiDecimal financialDocumentTenCentAmount) {
534 this.financialDocumentTenCentAmount = financialDocumentTenCentAmount;
535 }
536
537
538
539
540
541
542 public Integer getTenCentCount() {
543 return (financialDocumentTenCentAmount != null) ? new Integer(financialDocumentTenCentAmount.divide(OLEConstants.CoinTypeAmounts.TEN_CENT_AMOUNT).intValue()) : new Integer(0);
544 }
545
546
547
548
549
550
551 public void setTenCentCount(Integer count) {
552 if (count != null) {
553 financialDocumentTenCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.TEN_CENT_AMOUNT);
554 }
555 }
556
557
558
559
560
561
562 public KualiDecimal getFinancialDocumentFiveCentAmount() {
563 return financialDocumentFiveCentAmount;
564 }
565
566
567
568
569
570
571 public void setFinancialDocumentFiveCentAmount(KualiDecimal financialDocumentFiveCentAmount) {
572 this.financialDocumentFiveCentAmount = financialDocumentFiveCentAmount;
573 }
574
575
576
577
578
579
580 public Integer getFiveCentCount() {
581 return (financialDocumentFiveCentAmount != null) ? new Integer(financialDocumentFiveCentAmount.divide(OLEConstants.CoinTypeAmounts.FIVE_CENT_AMOUNT).intValue()) : new Integer(0);
582 }
583
584
585
586
587
588
589 public void setFiveCentCount(Integer count) {
590 if (count != null) {
591 financialDocumentFiveCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.FIVE_CENT_AMOUNT);
592 }
593 }
594
595
596
597
598
599
600 public KualiDecimal getFinancialDocumentOneCentAmount() {
601 return financialDocumentOneCentAmount;
602 }
603
604
605
606
607
608
609 public void setFinancialDocumentOneCentAmount(KualiDecimal financialDocumentOneCentAmount) {
610 this.financialDocumentOneCentAmount = financialDocumentOneCentAmount;
611 }
612
613
614
615
616
617
618 public Integer getOneCentCount() {
619 return (financialDocumentOneCentAmount != null) ? new Integer(financialDocumentOneCentAmount.divide(OLEConstants.CoinTypeAmounts.ONE_CENT_AMOUNT).intValue()) : new Integer(0);
620 }
621
622
623
624
625
626
627 public void setOneCentCount(Integer count) {
628 if (count != null) {
629 financialDocumentOneCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.ONE_CENT_AMOUNT);
630 }
631 }
632
633
634
635
636
637
638 public KualiDecimal getFinancialDocumentOtherCentAmount() {
639 return financialDocumentOtherCentAmount;
640 }
641
642
643
644
645
646
647 public void setFinancialDocumentOtherCentAmount(KualiDecimal financialDocumentOtherCentAmount) {
648 this.financialDocumentOtherCentAmount = financialDocumentOtherCentAmount;
649 }
650
651
652
653
654
655
656
657 public KualiDecimal getFinancialDocumentHundredCentAmount() {
658 return financialDocumentHundredCentAmount;
659 }
660
661
662
663
664
665
666 public void setFinancialDocumentHundredCentAmount(KualiDecimal financialDocumentHundredCentAmount) {
667 this.financialDocumentHundredCentAmount = financialDocumentHundredCentAmount;
668 }
669
670
671
672
673
674
675 public Integer getHundredCentCount() {
676 return (financialDocumentHundredCentAmount != null) ? new Integer(financialDocumentHundredCentAmount.divide(OLEConstants.CoinTypeAmounts.HUNDRED_CENT_AMOUNT).intValue()) : new Integer(0);
677 }
678
679
680
681
682
683
684 public void setHundredCentCount(Integer count) {
685 if (count != null) {
686 financialDocumentHundredCentAmount = new KualiDecimal(count.intValue()).multiply(OLEConstants.CoinTypeAmounts.HUNDRED_CENT_AMOUNT);
687 }
688 }
689
690
691
692
693
694
695 public KualiDecimal getFinancialDocumentMiscellaneousAdvanceAmount() {
696 return financialDocumentMiscellaneousAdvanceAmount;
697 }
698
699
700
701
702
703
704 public void setFinancialDocumentMiscellaneousAdvanceAmount(KualiDecimal financialDocumentMiscellaneousAdvanceAmount) {
705 this.financialDocumentMiscellaneousAdvanceAmount = financialDocumentMiscellaneousAdvanceAmount;
706 }
707
708
709
710
711
712
713
714 public String getReferenceFinancialDocumentNumber() {
715 return referenceFinancialDocumentNumber;
716 }
717
718
719
720
721
722
723 public void setReferenceFinancialDocumentNumber(String referenceFinancialDocumentNumber) {
724 this.referenceFinancialDocumentNumber = referenceFinancialDocumentNumber;
725 }
726
727
728
729
730
731
732 public KualiDecimal getCurrencyTotalAmount() {
733 KualiDecimal result = KualiDecimal.ZERO;
734 if (this.financialDocumentHundredDollarAmount != null) {
735 result = result.add(this.financialDocumentHundredDollarAmount);
736 }
737 if (this.financialDocumentFiftyDollarAmount != null) {
738 result = result.add(this.financialDocumentFiftyDollarAmount);
739 }
740 if (this.financialDocumentTwentyDollarAmount != null) {
741 result = result.add(this.financialDocumentTwentyDollarAmount);
742 }
743 if (this.financialDocumentTenDollarAmount != null) {
744 result = result.add(this.financialDocumentTenDollarAmount);
745 }
746 if (this.financialDocumentFiveDollarAmount != null) {
747 result = result.add(this.financialDocumentFiveDollarAmount);
748 }
749 if (this.financialDocumentTwoDollarAmount != null) {
750 result = result.add(this.financialDocumentTwoDollarAmount);
751 }
752 if (this.financialDocumentOneDollarAmount != null) {
753 result = result.add(this.financialDocumentOneDollarAmount);
754 }
755 if (this.financialDocumentOtherDollarAmount != null) {
756 result = result.add(this.financialDocumentOtherDollarAmount);
757 }
758 return result;
759 }
760
761
762
763
764
765
766 public KualiDecimal getCoinTotalAmount() {
767 KualiDecimal result = KualiDecimal.ZERO;
768 if (this.financialDocumentHundredCentAmount != null) {
769 result = result.add(this.financialDocumentHundredCentAmount);
770 }
771 if (this.financialDocumentFiftyCentAmount != null) {
772 result = result.add(this.financialDocumentFiftyCentAmount);
773 }
774 if (this.financialDocumentTwentyFiveCentAmount != null) {
775 result = result.add(this.financialDocumentTwentyFiveCentAmount);
776 }
777 if (this.financialDocumentTenCentAmount != null) {
778 result = result.add(this.financialDocumentTenCentAmount);
779 }
780 if (this.financialDocumentFiveCentAmount != null) {
781 result = result.add(this.financialDocumentFiveCentAmount);
782 }
783 if (this.financialDocumentOneCentAmount != null) {
784 result = result.add(this.financialDocumentOneCentAmount);
785 }
786 if (this.financialDocumentOtherCentAmount != null) {
787 result = result.add(this.financialDocumentOtherCentAmount);
788 }
789 return result;
790 }
791
792
793
794
795
796
797 public KualiDecimal getTotalAmount() {
798 return this.getCurrencyTotalAmount().add(this.getCoinTotalAmount());
799 }
800
801
802
803
804
805
806 public void addCurrency(CurrencyDetail detail) {
807 if (detail.getFinancialDocumentHundredDollarAmount() != null) {
808 if (financialDocumentHundredDollarAmount == null) {
809 financialDocumentHundredDollarAmount = new KualiDecimal(detail.getFinancialDocumentHundredDollarAmount().bigDecimalValue());
810 }
811 else {
812 financialDocumentHundredDollarAmount = financialDocumentHundredDollarAmount.add(detail.getFinancialDocumentHundredDollarAmount());
813 }
814 }
815 if (detail.getFinancialDocumentFiftyDollarAmount() != null) {
816 if (financialDocumentFiftyDollarAmount == null) {
817 financialDocumentFiftyDollarAmount = new KualiDecimal(detail.getFinancialDocumentFiftyDollarAmount().bigDecimalValue());
818 }
819 else {
820 financialDocumentFiftyDollarAmount = financialDocumentFiftyDollarAmount.add(detail.getFinancialDocumentFiftyDollarAmount());
821 }
822 }
823 if (detail.getFinancialDocumentTwentyDollarAmount() != null) {
824 if (financialDocumentTwentyDollarAmount == null) {
825 financialDocumentTwentyDollarAmount = new KualiDecimal(detail.getFinancialDocumentTwentyDollarAmount().bigDecimalValue());
826 }
827 else {
828 financialDocumentTwentyDollarAmount = financialDocumentTwentyDollarAmount.add(detail.getFinancialDocumentTwentyDollarAmount());
829 }
830 }
831 if (detail.getFinancialDocumentTenDollarAmount() != null) {
832 if (financialDocumentTenDollarAmount == null) {
833 financialDocumentTenDollarAmount = new KualiDecimal(detail.getFinancialDocumentTenDollarAmount().bigDecimalValue());
834 }
835 else {
836 financialDocumentTenDollarAmount = financialDocumentTenDollarAmount.add(detail.getFinancialDocumentTenDollarAmount());
837 }
838 }
839 if (detail.getFinancialDocumentFiveDollarAmount() != null) {
840 if (financialDocumentFiveDollarAmount == null) {
841 financialDocumentFiveDollarAmount = new KualiDecimal(detail.getFinancialDocumentFiveDollarAmount().bigDecimalValue());
842 }
843 else {
844 financialDocumentFiveDollarAmount = financialDocumentFiveDollarAmount.add(detail.getFinancialDocumentFiveDollarAmount());
845 }
846 }
847 if (detail.getFinancialDocumentTwoDollarAmount() != null) {
848 if (financialDocumentTwoDollarAmount == null) {
849 financialDocumentTwoDollarAmount = new KualiDecimal(detail.getFinancialDocumentTwoDollarAmount().bigDecimalValue());
850 }
851 else {
852 financialDocumentTwoDollarAmount = financialDocumentTwoDollarAmount.add(detail.getFinancialDocumentTwoDollarAmount());
853 }
854 }
855 if (detail.getFinancialDocumentOneDollarAmount() != null) {
856 if (financialDocumentOneDollarAmount == null) {
857 financialDocumentOneDollarAmount = new KualiDecimal(detail.getFinancialDocumentOneDollarAmount().bigDecimalValue());
858 }
859 else {
860 financialDocumentOneDollarAmount = financialDocumentOneDollarAmount.add(detail.getFinancialDocumentOneDollarAmount());
861 }
862 }
863 if (detail.getFinancialDocumentOtherDollarAmount() != null) {
864 if (financialDocumentOtherDollarAmount == null) {
865 financialDocumentOtherDollarAmount = new KualiDecimal(detail.getFinancialDocumentOtherDollarAmount().bigDecimalValue());
866 }
867 else {
868 financialDocumentOtherDollarAmount = financialDocumentOtherDollarAmount.add(detail.getFinancialDocumentOtherDollarAmount());
869 }
870 }
871 }
872
873
874
875
876
877
878 public void addCoin(CoinDetail detail) {
879 if (detail.getFinancialDocumentHundredCentAmount() != null) {
880 if (getFinancialDocumentHundredCentAmount() == null) {
881 setFinancialDocumentHundredCentAmount(new KualiDecimal(detail.getFinancialDocumentHundredCentAmount().bigDecimalValue()));
882 }
883 else {
884 setFinancialDocumentHundredCentAmount(getFinancialDocumentHundredCentAmount().add(detail.getFinancialDocumentHundredCentAmount()));
885 }
886 }
887 if (detail.getFinancialDocumentFiftyCentAmount() != null) {
888 if (getFinancialDocumentFiftyCentAmount() == null) {
889 setFinancialDocumentFiftyCentAmount(new KualiDecimal(detail.getFinancialDocumentFiftyCentAmount().bigDecimalValue()));
890 }
891 else {
892 setFinancialDocumentFiftyCentAmount(getFinancialDocumentFiftyCentAmount().add(detail.getFinancialDocumentFiftyCentAmount()));
893 }
894 }
895 if (detail.getFinancialDocumentTwentyFiveCentAmount() != null) {
896 if (getFinancialDocumentTwentyFiveCentAmount() == null) {
897 setFinancialDocumentTwentyFiveCentAmount(new KualiDecimal(detail.getFinancialDocumentTwentyFiveCentAmount().bigDecimalValue()));
898 }
899 else {
900 setFinancialDocumentTwentyFiveCentAmount(getFinancialDocumentTwentyFiveCentAmount().add(detail.getFinancialDocumentTwentyFiveCentAmount()));
901 }
902 }
903 if (detail.getFinancialDocumentTenCentAmount() != null) {
904 if (getFinancialDocumentTenCentAmount() == null) {
905 setFinancialDocumentTenCentAmount(new KualiDecimal(detail.getFinancialDocumentTenCentAmount().bigDecimalValue()));
906 }
907 else {
908 setFinancialDocumentTenCentAmount(getFinancialDocumentTenCentAmount().add(detail.getFinancialDocumentTenCentAmount()));
909 }
910 }
911 if (detail.getFinancialDocumentFiveCentAmount() != null) {
912 if (getFinancialDocumentFiveCentAmount() == null) {
913 setFinancialDocumentFiveCentAmount(new KualiDecimal(detail.getFinancialDocumentFiveCentAmount().bigDecimalValue()));
914 }
915 else {
916 setFinancialDocumentFiveCentAmount(getFinancialDocumentFiveCentAmount().add(detail.getFinancialDocumentFiveCentAmount()));
917 }
918 }
919 if (detail.getFinancialDocumentOneCentAmount() != null) {
920 if (getFinancialDocumentOneCentAmount() == null) {
921 setFinancialDocumentOneCentAmount(new KualiDecimal(detail.getFinancialDocumentOneCentAmount().bigDecimalValue()));
922 }
923 else {
924 setFinancialDocumentOneCentAmount(getFinancialDocumentOneCentAmount().add(detail.getFinancialDocumentOneCentAmount()));
925 }
926 }
927 if (detail.getFinancialDocumentOtherCentAmount() != null) {
928 if (getFinancialDocumentOtherCentAmount() == null) {
929 setFinancialDocumentOtherCentAmount(new KualiDecimal(detail.getFinancialDocumentOtherCentAmount().bigDecimalValue()));
930 }
931 else {
932 setFinancialDocumentOtherCentAmount(getFinancialDocumentOtherCentAmount().add(detail.getFinancialDocumentOtherCentAmount()));
933 }
934 }
935 }
936
937
938
939
940
941
942 public void removeCurrency(CurrencyDetail detail) {
943 if (detail.getFinancialDocumentHundredDollarAmount() != null) {
944 if (this.getFinancialDocumentHundredDollarAmount() == null || detail.getFinancialDocumentHundredDollarAmount().isGreaterThan(this.getFinancialDocumentHundredDollarAmount())) {
945 throw new IllegalArgumentException("The requested amount of hundred dollar bills exceeds the amount in the cash drawer");
946 }
947 else {
948 setFinancialDocumentHundredDollarAmount(getFinancialDocumentHundredDollarAmount().subtract(detail.getFinancialDocumentHundredDollarAmount()));
949 }
950 }
951 if (detail.getFinancialDocumentFiftyDollarAmount() != null) {
952 if (this.getFinancialDocumentFiftyDollarAmount() == null || detail.getFinancialDocumentFiftyDollarAmount().isGreaterThan(this.getFinancialDocumentFiftyDollarAmount())) {
953 throw new IllegalArgumentException("The requested amount of fifty dollar bills exceeds the amount in the cash drawer");
954 }
955 else {
956 setFinancialDocumentFiftyDollarAmount(getFinancialDocumentFiftyDollarAmount().subtract(detail.getFinancialDocumentFiftyDollarAmount()));
957 }
958 }
959 if (detail.getFinancialDocumentTwentyDollarAmount() != null) {
960 if (this.getFinancialDocumentTwentyDollarAmount() == null || detail.getFinancialDocumentTwentyDollarAmount().isGreaterThan(this.getFinancialDocumentTwentyDollarAmount())) {
961 throw new IllegalArgumentException("The requested amount of twenty dollar bills exceeds the amount in the cash drawer");
962 }
963 else {
964 setFinancialDocumentTwentyDollarAmount(getFinancialDocumentTwentyDollarAmount().subtract(detail.getFinancialDocumentTwentyDollarAmount()));
965 }
966 }
967 if (detail.getFinancialDocumentTenDollarAmount() != null) {
968 if (this.getFinancialDocumentTenDollarAmount() == null || detail.getFinancialDocumentTenDollarAmount().isGreaterThan(this.getFinancialDocumentTenDollarAmount())) {
969 throw new IllegalArgumentException("The requested amount of ten dollar bills exceeds the amount in the cash drawer");
970 }
971 else {
972 setFinancialDocumentTenDollarAmount(getFinancialDocumentTenDollarAmount().subtract(detail.getFinancialDocumentTenDollarAmount()));
973 }
974 }
975 if (detail.getFinancialDocumentFiveDollarAmount() != null) {
976 if (this.getFinancialDocumentFiveDollarAmount() == null || detail.getFinancialDocumentFiveDollarAmount().isGreaterThan(this.getFinancialDocumentFiveDollarAmount())) {
977 throw new IllegalArgumentException("The requested amount of five dollar bills exceeds the amount in the cash drawer");
978 }
979 else {
980 setFinancialDocumentFiveDollarAmount(getFinancialDocumentFiveDollarAmount().subtract(detail.getFinancialDocumentFiveDollarAmount()));
981 }
982 }
983 if (detail.getFinancialDocumentTwoDollarAmount() != null) {
984 if (this.getFinancialDocumentTwoDollarAmount() == null || detail.getFinancialDocumentTwoDollarAmount().isGreaterThan(this.getFinancialDocumentTwoDollarAmount())) {
985 throw new IllegalArgumentException("The requested amount of two dollar bills exceeds the amount in the cash drawer");
986 }
987 else {
988 setFinancialDocumentTwoDollarAmount(getFinancialDocumentTwoDollarAmount().subtract(detail.getFinancialDocumentTwoDollarAmount()));
989 }
990 }
991 if (detail.getFinancialDocumentOneDollarAmount() != null) {
992 if (this.getFinancialDocumentOneDollarAmount() == null || detail.getFinancialDocumentOneDollarAmount().isGreaterThan(this.getFinancialDocumentOneDollarAmount())) {
993 throw new IllegalArgumentException("The requested amount of one dollar bills exceeds the amount in the cash drawer");
994 }
995 else {
996 setFinancialDocumentOneDollarAmount(getFinancialDocumentOneDollarAmount().subtract(detail.getFinancialDocumentOneDollarAmount()));
997 }
998 }
999 if (detail.getFinancialDocumentOtherDollarAmount() != null) {
1000 if (this.getFinancialDocumentOtherDollarAmount() == null || detail.getFinancialDocumentOtherDollarAmount().isGreaterThan(this.getFinancialDocumentOtherDollarAmount())) {
1001 throw new IllegalArgumentException("The requested other dollar amount exceeds the amount in the cash drawer");
1002 }
1003 else {
1004 setFinancialDocumentOtherDollarAmount(getFinancialDocumentOtherDollarAmount().subtract(detail.getFinancialDocumentOtherDollarAmount()));
1005 }
1006 }
1007 }
1008
1009
1010
1011
1012
1013
1014 public void removeCoin(CoinDetail detail) {
1015 if (detail.getFinancialDocumentHundredCentAmount() != null) {
1016 if (this.getFinancialDocumentHundredCentAmount() == null || detail.getFinancialDocumentHundredCentAmount().isGreaterThan(this.getFinancialDocumentHundredCentAmount())) {
1017 throw new IllegalArgumentException("The requested amount of hundred cent pieces exceeds the amount in the cash drawer");
1018 }
1019 else {
1020 setFinancialDocumentHundredCentAmount(getFinancialDocumentHundredCentAmount().subtract(detail.getFinancialDocumentHundredCentAmount()));
1021 }
1022 }
1023 if (detail.getFinancialDocumentFiftyCentAmount() != null) {
1024 if (this.getFinancialDocumentFiftyCentAmount() == null || detail.getFinancialDocumentFiftyCentAmount().isGreaterThan(this.getFinancialDocumentFiftyCentAmount())) {
1025 throw new IllegalArgumentException("The requested amount of fifty cent pieces exceeds the amount in the cash drawer");
1026 }
1027 else {
1028 setFinancialDocumentFiftyCentAmount(getFinancialDocumentFiftyCentAmount().subtract(detail.getFinancialDocumentFiftyCentAmount()));
1029 }
1030 }
1031 if (detail.getFinancialDocumentTwentyFiveCentAmount() != null) {
1032 if (this.getFinancialDocumentTwentyFiveCentAmount() == null || detail.getFinancialDocumentTwentyFiveCentAmount().isGreaterThan(this.getFinancialDocumentTwentyFiveCentAmount())) {
1033 throw new IllegalArgumentException("The requested amount of twenty five cent pieces exceeds the amount in the cash drawer");
1034 }
1035 else {
1036 setFinancialDocumentTwentyFiveCentAmount(getFinancialDocumentTwentyFiveCentAmount().subtract(detail.getFinancialDocumentTwentyFiveCentAmount()));
1037 }
1038 }
1039 if (detail.getFinancialDocumentTenCentAmount() != null) {
1040 if (this.getFinancialDocumentTenCentAmount() == null || detail.getFinancialDocumentTenCentAmount().isGreaterThan(this.getFinancialDocumentTenCentAmount())) {
1041 throw new IllegalArgumentException("The requested amount of ten cent pieces exceeds the amount in the cash drawer");
1042 }
1043 else {
1044 setFinancialDocumentTenCentAmount(getFinancialDocumentTenCentAmount().subtract(detail.getFinancialDocumentTenCentAmount()));
1045 }
1046 }
1047 if (detail.getFinancialDocumentFiveCentAmount() != null) {
1048 if (this.getFinancialDocumentFiveCentAmount() == null || detail.getFinancialDocumentFiveCentAmount().isGreaterThan(this.getFinancialDocumentFiveCentAmount())) {
1049 throw new IllegalArgumentException("The requested amount of five cent pieces exceeds the amount in the cash drawer");
1050 }
1051 else {
1052 setFinancialDocumentFiveCentAmount(getFinancialDocumentFiveCentAmount().subtract(detail.getFinancialDocumentFiveCentAmount()));
1053 }
1054 }
1055 if (detail.getFinancialDocumentOneCentAmount() != null) {
1056 if (this.getFinancialDocumentOneCentAmount() == null || detail.getFinancialDocumentOneCentAmount().isGreaterThan(this.getFinancialDocumentOneCentAmount())) {
1057 throw new IllegalArgumentException("The requested amount of one cent pieces exceeds the amount in the cash drawer");
1058 }
1059 else {
1060 setFinancialDocumentOneCentAmount(getFinancialDocumentOneCentAmount().subtract(detail.getFinancialDocumentOneCentAmount()));
1061 }
1062 }
1063 if (detail.getFinancialDocumentOtherCentAmount() != null) {
1064 if (this.getFinancialDocumentOtherCentAmount() == null || detail.getFinancialDocumentOtherCentAmount().isGreaterThan(this.getFinancialDocumentOtherCentAmount())) {
1065 throw new IllegalArgumentException("The requested other cent amount exceeds the amount in the cash drawer");
1066 }
1067 else {
1068 setFinancialDocumentOtherCentAmount(getFinancialDocumentOtherCentAmount().subtract(detail.getFinancialDocumentOtherCentAmount()));
1069 }
1070 }
1071 }
1072
1073
1074
1075
1076
1077
1078 public CampusEbo getCampus() {
1079 if ( StringUtils.isBlank(campusCode) ) {
1080 campus = null;
1081 } else {
1082 if ( campus == null || !StringUtils.equals( campus.getCode(),campusCode) ) {
1083 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CampusEbo.class);
1084 if ( moduleService != null ) {
1085 Map<String,Object> keys = new HashMap<String, Object>(1);
1086 keys.put(LocationConstants.PrimaryKeyConstants.CODE, campusCode);
1087 campus = moduleService.getExternalizableBusinessObject(CampusEbo.class, keys);
1088 } else {
1089 throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class. Unable to proceed." );
1090 }
1091 }
1092 }
1093
1094 return campus;
1095 }
1096
1097
1098
1099
1100 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
1101 @SuppressWarnings("rawtypes")
1102 LinkedHashMap m = new LinkedHashMap();
1103 m.put("campusCode", this.campusCode);
1104 return m;
1105 }
1106 }