View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package org.kuali.kfs.fp.businessobject;
21  
22  import java.util.LinkedHashMap;
23  
24  import org.kuali.kfs.sys.KFSConstants;
25  import org.kuali.kfs.sys.KFSPropertyConstants;
26  import org.kuali.rice.core.api.util.type.KualiDecimal;
27  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
28  
29  /**
30   * This class contains the coin breakdown for coin inserted into a cash drawer
31   */
32  public class CoinDetail extends PersistableBusinessObjectBase {
33  
34      private String documentNumber;
35      private String financialDocumentTypeCode;
36      private String cashieringStatus;
37  
38      private KualiDecimal financialDocumentFiftyCentAmount = KualiDecimal.ZERO;
39      private KualiDecimal financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO;
40      private KualiDecimal financialDocumentTenCentAmount = KualiDecimal.ZERO;
41      private KualiDecimal financialDocumentFiveCentAmount = KualiDecimal.ZERO;
42      private KualiDecimal financialDocumentOneCentAmount = KualiDecimal.ZERO;
43      private KualiDecimal financialDocumentOtherCentAmount = KualiDecimal.ZERO;
44      private KualiDecimal financialDocumentHundredCentAmount = KualiDecimal.ZERO;
45  
46      /**
47       * Default constructor.
48       */
49      public CoinDetail() {
50      }
51  
52      /**
53       * Constructs a new CoinDetail with the given documentNumber, financialDocumentTypeCode, and cashieringStatus.
54       * with all amount fields default to zero.
55       */
56      public CoinDetail(String documentNumber, String financialDocumentTypeCode, String cashieringStatus) {
57          this();
58          this.documentNumber = documentNumber;
59          this.financialDocumentTypeCode = financialDocumentTypeCode;
60          this.cashieringStatus = cashieringStatus;
61      }
62  
63      /**
64       * Constructs a new CoinDetail by copying the coin amounts from the given CashDrawer, ignoring other non-amount fields.
65       */
66      public CoinDetail(CashDrawer cashDrawer) {
67          this();
68          financialDocumentHundredCentAmount = cashDrawer.getFinancialDocumentHundredCentAmount();
69          financialDocumentFiftyCentAmount = cashDrawer.getFinancialDocumentFiftyCentAmount();
70          financialDocumentTwentyFiveCentAmount = cashDrawer.getFinancialDocumentTwentyFiveCentAmount();
71          financialDocumentTenCentAmount = cashDrawer.getFinancialDocumentTenCentAmount();
72          financialDocumentFiveCentAmount = cashDrawer.getFinancialDocumentFiveCentAmount();
73          financialDocumentOneCentAmount = cashDrawer.getFinancialDocumentOneCentAmount();
74          financialDocumentOtherCentAmount = cashDrawer.getFinancialDocumentOtherCentAmount();
75      }
76  
77      /**
78       * Constructs a new CoinDetail as a complete copy of the given CoinDetail.
79       */
80      public CoinDetail(CoinDetail coinDetail) {
81          this();
82          documentNumber = coinDetail.getDocumentNumber();
83          financialDocumentTypeCode = coinDetail.getFinancialDocumentTypeCode();
84          cashieringStatus = coinDetail.getCashieringStatus();
85          financialDocumentHundredCentAmount = coinDetail.getFinancialDocumentHundredCentAmount();
86          financialDocumentFiftyCentAmount = coinDetail.getFinancialDocumentFiftyCentAmount();
87          financialDocumentTwentyFiveCentAmount = coinDetail.getFinancialDocumentTwentyFiveCentAmount();
88          financialDocumentTenCentAmount = coinDetail.getFinancialDocumentTenCentAmount();
89          financialDocumentFiveCentAmount = coinDetail.getFinancialDocumentFiveCentAmount();
90          financialDocumentOneCentAmount = coinDetail.getFinancialDocumentOneCentAmount();
91          financialDocumentOtherCentAmount = coinDetail.getFinancialDocumentOtherCentAmount();
92      }
93  
94      /**
95       * Sets the non-amount primary key fields with the given documentNumber, financialDocumentTypeCode, and cashieringStatus.
96       */
97      public void setKeys(String documentNumber, String financialDocumentTypeCode, String cashieringStatus) {
98          this.documentNumber = documentNumber;
99          this.financialDocumentTypeCode = financialDocumentTypeCode;
100         this.cashieringStatus = cashieringStatus;
101     }
102 
103     /**
104      * Copies all amounts from the given CoinDetail to this CoinDetail.
105      */
106     public void copyAmounts(CoinDetail coinDetail) {
107         financialDocumentHundredCentAmount = coinDetail.getFinancialDocumentHundredCentAmount();
108         financialDocumentFiftyCentAmount = coinDetail.getFinancialDocumentFiftyCentAmount();
109         financialDocumentTwentyFiveCentAmount = coinDetail.getFinancialDocumentTwentyFiveCentAmount();
110         financialDocumentTenCentAmount = coinDetail.getFinancialDocumentTenCentAmount();
111         financialDocumentFiveCentAmount = coinDetail.getFinancialDocumentFiveCentAmount();
112         financialDocumentOneCentAmount = coinDetail.getFinancialDocumentOneCentAmount();
113         financialDocumentOtherCentAmount = coinDetail.getFinancialDocumentOtherCentAmount();
114     }
115 
116     /**
117      * Gets the documentNumber attribute.
118      *
119      * @return Returns the documentNumber
120      */
121     public String getDocumentNumber() {
122         return documentNumber;
123     }
124 
125     /**
126      * Sets the documentNumber attribute.
127      *
128      * @param documentNumber The documentNumber to set.
129      */
130     public void setDocumentNumber(String documentNumber) {
131         this.documentNumber = documentNumber;
132     }
133 
134     /**
135      * Gets the financialDocumentTypeCode attribute.
136      *
137      * @return Returns the financialDocumentTypeCode
138      */
139     public String getFinancialDocumentTypeCode() {
140         return financialDocumentTypeCode;
141     }
142 
143     /**
144      * Sets the financialDocumentTypeCode attribute.
145      *
146      * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
147      */
148     public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) {
149         this.financialDocumentTypeCode = financialDocumentTypeCode;
150     }
151 
152     /**
153      * Gets the cashieringStatus attribute.
154      *
155      * @return Returns the cashieringStatus
156      */
157     public String getCashieringStatus() {
158         return cashieringStatus;
159     }
160 
161     /**
162      * Sets the cashieringStatus attribute.
163      *
164      * @param cashieringStatus The cashieringStatus to set.
165      */
166     public void setCashieringStatus(String financialDocumentColumnTypeCode) {
167         this.cashieringStatus = financialDocumentColumnTypeCode;
168     }
169 
170     /**
171      * Gets the financialDocumentFiftyCentAmount attribute.
172      *
173      * @return Returns the financialDocumentFiftyCentAmount
174      */
175     public KualiDecimal getFinancialDocumentFiftyCentAmount() {
176         return financialDocumentFiftyCentAmount;
177     }
178 
179     /**
180      * Sets the financialDocumentFiftyCentAmount attribute.
181      *
182      * @param financialDocumentFiftyCentAmount The financialDocumentFiftyCentAmount to set.
183      */
184     public void setFinancialDocumentFiftyCentAmount(KualiDecimal financialDocumentFiftyCentAmount) {
185         this.financialDocumentFiftyCentAmount = financialDocumentFiftyCentAmount;
186     }
187 
188     /**
189      * Returns the number of half-cent coins in the drawer
190      *
191      * @return the count of half cent coins in the drawer
192      */
193     public Integer getFiftyCentCount() {
194         return (financialDocumentFiftyCentAmount == null) ? new Integer(0) : new Integer(financialDocumentFiftyCentAmount.divide(KFSConstants.CoinTypeAmounts.FIFTY_CENT_AMOUNT).intValue());
195     }
196 
197     /**
198      * Sets the number of fifty cent coins in the drawer. This is useful if, you know, you're in da club, with, say a bottle full of
199      * "bub"
200      *
201      * @param count the number of fifty cent coins present in the drawer
202      */
203     public void setFiftyCentCount(Integer count) {
204         if (count != null) {
205             financialDocumentFiftyCentAmount = new KualiDecimal(count.intValue()).multiply(KFSConstants.CoinTypeAmounts.FIFTY_CENT_AMOUNT);
206         }
207     }
208 
209     /**
210      * Gets the financialDocumentTwentyFiveCentAmount attribute.
211      *
212      * @return Returns the financialDocumentTwentyFiveCentAmount
213      */
214     public KualiDecimal getFinancialDocumentTwentyFiveCentAmount() {
215         return financialDocumentTwentyFiveCentAmount;
216     }
217 
218     /**
219      * Sets the financialDocumentTwentyFiveCentAmount attribute.
220      *
221      * @param financialDocumentTwentyFiveCentAmount The financialDocumentTwentyFiveCentAmount to set.
222      */
223     public void setFinancialDocumentTwentyFiveCentAmount(KualiDecimal financialDocumentTwentyFiveCentAmount) {
224         this.financialDocumentTwentyFiveCentAmount = financialDocumentTwentyFiveCentAmount;
225     }
226 
227     /**
228      * Returns the number of quarters in the drawer
229      *
230      * @return the count of quarters in the drawer
231      */
232     public Integer getTwentyFiveCentCount() {
233         return (financialDocumentTwentyFiveCentAmount == null) ? new Integer(0) : new Integer(financialDocumentTwentyFiveCentAmount.divide(KFSConstants.CoinTypeAmounts.TWENTY_FIVE_CENT_AMOUNT).intValue());
234     }
235 
236     /**
237      * Sets the number of quarters in the drawer
238      *
239      * @param count the number of quarters present in the drawer
240      */
241     public void setTwentyFiveCentCount(Integer count) {
242         if (count != null) {
243             financialDocumentTwentyFiveCentAmount = new KualiDecimal(count.intValue()).multiply(KFSConstants.CoinTypeAmounts.TWENTY_FIVE_CENT_AMOUNT);
244         }
245     }
246 
247     /**
248      * Gets the financialDocumentTenCentAmount attribute.
249      *
250      * @return Returns the financialDocumentTenCentAmount
251      */
252     public KualiDecimal getFinancialDocumentTenCentAmount() {
253         return financialDocumentTenCentAmount;
254     }
255 
256     /**
257      * Sets the financialDocumentTenCentAmount attribute.
258      *
259      * @param financialDocumentTenCentAmount The financialDocumentTenCentAmount to set.
260      */
261     public void setFinancialDocumentTenCentAmount(KualiDecimal financialDocumentTenCentAmount) {
262         this.financialDocumentTenCentAmount = financialDocumentTenCentAmount;
263     }
264 
265     /**
266      * Returns the number of dimes in the drawer
267      *
268      * @return the count of dimes in the drawer
269      */
270     public Integer getTenCentCount() {
271         return (financialDocumentTenCentAmount == null) ? new Integer(0) : new Integer(financialDocumentTenCentAmount.divide(KFSConstants.CoinTypeAmounts.TEN_CENT_AMOUNT).intValue());
272     }
273 
274     /**
275      * Sets the number of dimes in the drawer
276      *
277      * @param count the number of dimes present in the drawer
278      */
279     public void setTenCentCount(Integer count) {
280         if (count != null) {
281             financialDocumentTenCentAmount = new KualiDecimal(count.intValue()).multiply(KFSConstants.CoinTypeAmounts.TEN_CENT_AMOUNT);
282         }
283     }
284 
285     /**
286      * Gets the financialDocumentFiveCentAmount attribute.
287      *
288      * @return Returns the financialDocumentFiveCentAmount
289      */
290     public KualiDecimal getFinancialDocumentFiveCentAmount() {
291         return financialDocumentFiveCentAmount;
292     }
293 
294     /**
295      * Sets the financialDocumentFiveCentAmount attribute.
296      *
297      * @param financialDocumentFiveCentAmount The financialDocumentFiveCentAmount to set.
298      */
299     public void setFinancialDocumentFiveCentAmount(KualiDecimal financialDocumentFiveCentAmount) {
300         this.financialDocumentFiveCentAmount = financialDocumentFiveCentAmount;
301     }
302 
303     /**
304      * Returns the number of nickels in the drawer
305      *
306      * @return the count of nickels in the drawer
307      */
308     public Integer getFiveCentCount() {
309         return (financialDocumentFiveCentAmount == null) ? new Integer(0) : new Integer(financialDocumentFiveCentAmount.divide(KFSConstants.CoinTypeAmounts.FIVE_CENT_AMOUNT).intValue());
310     }
311 
312     /**
313      * Sets the number of nickels in the drawer
314      *
315      * @param count the number of nickels present in the drawer
316      */
317     public void setFiveCentCount(Integer count) {
318         if (count != null) {
319             financialDocumentFiveCentAmount = new KualiDecimal(count.intValue()).multiply(KFSConstants.CoinTypeAmounts.FIVE_CENT_AMOUNT);
320         }
321     }
322 
323     /**
324      * Gets the financialDocumentOneCentAmount attribute.
325      *
326      * @return Returns the financialDocumentOneCentAmount
327      */
328     public KualiDecimal getFinancialDocumentOneCentAmount() {
329         return financialDocumentOneCentAmount;
330     }
331 
332     /**
333      * Sets the financialDocumentOneCentAmount attribute.
334      *
335      * @param financialDocumentOneCentAmount The financialDocumentOneCentAmount to set.
336      */
337     public void setFinancialDocumentOneCentAmount(KualiDecimal financialDocumentOneCentAmount) {
338         this.financialDocumentOneCentAmount = financialDocumentOneCentAmount;
339     }
340 
341     /**
342      * Returns the number of pennies in the drawer
343      *
344      * @return the count of pennies in the drawer
345      */
346     public Integer getOneCentCount() {
347         return (financialDocumentOneCentAmount == null) ? new Integer(0) : new Integer(financialDocumentOneCentAmount.divide(KFSConstants.CoinTypeAmounts.ONE_CENT_AMOUNT).intValue());
348     }
349 
350     /**
351      * Sets the number of pennies in the drawer
352      *
353      * @param count the number of pennies present in the drawer
354      */
355     public void setOneCentCount(Integer count) {
356         if (count != null) {
357             financialDocumentOneCentAmount = new KualiDecimal(count).multiply(KFSConstants.CoinTypeAmounts.ONE_CENT_AMOUNT);
358         }
359     }
360 
361     /**
362      * Gets the financialDocumentOtherCentAmount attribute.
363      *
364      * @return Returns the financialDocumentOtherCentAmount
365      */
366     public KualiDecimal getFinancialDocumentOtherCentAmount() {
367         return financialDocumentOtherCentAmount;
368     }
369 
370     /**
371      * Sets the financialDocumentOtherCentAmount attribute.
372      *
373      * @param financialDocumentOtherCentAmount The financialDocumentOtherCentAmount to set.
374      */
375     public void setFinancialDocumentOtherCentAmount(KualiDecimal financialDocumentOtherCentAmount) {
376         this.financialDocumentOtherCentAmount = financialDocumentOtherCentAmount;
377     }
378 
379 
380     /**
381      * Gets the financialDocumentHundredCentAmount attribute.
382      *
383      * @return Returns the financialDocumentHundredCentAmount
384      */
385     public KualiDecimal getFinancialDocumentHundredCentAmount() {
386         return financialDocumentHundredCentAmount;
387     }
388 
389     /**
390      * Sets the financialDocumentHundredCentAmount attribute.
391      *
392      * @param financialDocumentHundredCentAmount The financialDocumentHundredCentAmount to set.
393      */
394     public void setFinancialDocumentHundredCentAmount(KualiDecimal financialDocumentHundredCentAmount) {
395         this.financialDocumentHundredCentAmount = financialDocumentHundredCentAmount;
396     }
397 
398     /**
399      * Returns the number of dollar coins--Sacajawea, Susan B. Anthony, or otherwise--in the drawer
400      *
401      * @return the count of dollar coins in the drawer
402      */
403     public Integer getHundredCentCount() {
404         return (financialDocumentHundredCentAmount == null) ? new Integer(0) : new Integer(financialDocumentHundredCentAmount.divide(KFSConstants.CoinTypeAmounts.HUNDRED_CENT_AMOUNT).intValue());
405     }
406 
407     /**
408      * Sets the number of hundred cent coins in the drawer
409      *
410      * @param count the number of hundred cent coins present in the drawer
411      */
412     public void setHundredCentCount(Integer count) {
413         if (count != null) {
414             financialDocumentHundredCentAmount = new KualiDecimal(count.intValue()).multiply(KFSConstants.CoinTypeAmounts.HUNDRED_CENT_AMOUNT);
415         }
416     }
417 
418 
419     /**
420      * Returns the total amount represented by this coin detail record.
421      *
422      * @return total amount of this detail
423      */
424     public KualiDecimal getTotalAmount() {
425         KualiDecimal result = KualiDecimal.ZERO;
426         if (this.financialDocumentHundredCentAmount != null) {
427             result = result.add(this.financialDocumentHundredCentAmount);
428         }
429         if (this.financialDocumentFiftyCentAmount != null) {
430             result = result.add(this.financialDocumentFiftyCentAmount);
431         }
432         if (this.financialDocumentTwentyFiveCentAmount != null) {
433             result = result.add(this.financialDocumentTwentyFiveCentAmount);
434         }
435         if (this.financialDocumentTenCentAmount != null) {
436             result = result.add(this.financialDocumentTenCentAmount);
437         }
438         if (this.financialDocumentFiveCentAmount != null) {
439             result = result.add(this.financialDocumentFiveCentAmount);
440         }
441         if (this.financialDocumentOneCentAmount != null) {
442             result = result.add(this.financialDocumentOneCentAmount);
443         }
444         if (this.financialDocumentOtherCentAmount != null) {
445             result = result.add(this.financialDocumentOtherCentAmount);
446         }
447         return result;
448     }
449 
450     /**
451      * This method sets all amounts in this record to zero
452      */
453     public void zeroOutAmounts() {
454         this.financialDocumentHundredCentAmount = KualiDecimal.ZERO;
455         this.financialDocumentFiftyCentAmount = KualiDecimal.ZERO;
456         this.financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO;
457         this.financialDocumentTenCentAmount = KualiDecimal.ZERO;
458         this.financialDocumentFiveCentAmount = KualiDecimal.ZERO;
459         this.financialDocumentOneCentAmount = KualiDecimal.ZERO;
460         this.financialDocumentOtherCentAmount = KualiDecimal.ZERO;
461     }
462 
463     /**
464      * This method sets all amounts that are null to zero
465      */
466     public void zeroOutUnpopulatedAmounts() {
467         if (this.financialDocumentHundredCentAmount == null) {
468             this.financialDocumentHundredCentAmount = KualiDecimal.ZERO;
469         }
470         if (this.financialDocumentFiftyCentAmount == null) {
471             this.financialDocumentFiftyCentAmount = KualiDecimal.ZERO;
472         }
473         if (this.financialDocumentTwentyFiveCentAmount == null) {
474             this.financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO;
475         }
476         if (this.financialDocumentTenCentAmount == null) {
477             this.financialDocumentTenCentAmount = KualiDecimal.ZERO;
478         }
479         if (this.financialDocumentFiveCentAmount == null) {
480             this.financialDocumentFiveCentAmount = KualiDecimal.ZERO;
481         }
482         if (this.financialDocumentOneCentAmount == null) {
483             this.financialDocumentOneCentAmount = KualiDecimal.ZERO;
484         }
485         if (this.financialDocumentOtherCentAmount == null) {
486             this.financialDocumentOtherCentAmount = KualiDecimal.ZERO;
487         }
488     }
489 
490     public void add(CoinDetail detail) {
491         if (detail.financialDocumentHundredCentAmount != null) {
492             if (this.financialDocumentHundredCentAmount == null) {
493                 this.financialDocumentHundredCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentHundredCentAmount);
494             }
495             else {
496                 this.financialDocumentHundredCentAmount = this.financialDocumentHundredCentAmount.add(detail.financialDocumentHundredCentAmount);
497             }
498         }
499         if (detail.financialDocumentFiftyCentAmount != null) {
500             if (this.financialDocumentFiftyCentAmount == null) {
501                 this.financialDocumentFiftyCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentFiftyCentAmount);
502             }
503             else {
504                 this.financialDocumentFiftyCentAmount = this.financialDocumentFiftyCentAmount.add(detail.financialDocumentFiftyCentAmount);
505             }
506         }
507         if (detail.financialDocumentTwentyFiveCentAmount != null) {
508             if (this.financialDocumentTwentyFiveCentAmount == null) {
509                 this.financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentTwentyFiveCentAmount);
510             }
511             else {
512                 this.financialDocumentTwentyFiveCentAmount = this.financialDocumentTwentyFiveCentAmount.add(detail.financialDocumentTwentyFiveCentAmount);
513             }
514         }
515         if (detail.financialDocumentTenCentAmount != null) {
516             if (this.financialDocumentTenCentAmount == null) {
517                 this.financialDocumentTenCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentTenCentAmount);
518             }
519             else {
520                 this.financialDocumentTenCentAmount = this.financialDocumentTenCentAmount.add(detail.financialDocumentTenCentAmount);
521             }
522         }
523         if (detail.financialDocumentFiveCentAmount != null) {
524             if (this.financialDocumentFiveCentAmount == null) {
525                 this.financialDocumentFiveCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentFiveCentAmount);
526             }
527             else {
528                 this.financialDocumentFiveCentAmount = this.financialDocumentFiveCentAmount.add(detail.financialDocumentFiveCentAmount);
529             }
530         }
531         if (detail.financialDocumentOneCentAmount != null) {
532             if (this.financialDocumentOneCentAmount == null) {
533                 this.financialDocumentOneCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentOneCentAmount);
534             }
535             else {
536                 this.financialDocumentOneCentAmount = this.financialDocumentOneCentAmount.add(detail.financialDocumentOneCentAmount);
537             }
538         }
539         if (detail.financialDocumentOtherCentAmount != null) {
540             if (this.financialDocumentOtherCentAmount == null) {
541                 this.financialDocumentOtherCentAmount = KualiDecimal.ZERO.add(detail.financialDocumentOtherCentAmount);
542             }
543             else {
544                 this.financialDocumentOtherCentAmount = this.financialDocumentOtherCentAmount.add(detail.financialDocumentOtherCentAmount);
545             }
546         }
547     }
548 
549     public void subtract(CoinDetail detail) {
550         if (detail.financialDocumentHundredCentAmount != null) {
551             if (this.financialDocumentHundredCentAmount == null) {
552                 this.financialDocumentHundredCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentHundredCentAmount);
553             }
554             else {
555                 this.financialDocumentHundredCentAmount = this.financialDocumentHundredCentAmount.subtract(detail.financialDocumentHundredCentAmount);
556             }
557         }
558         if (detail.financialDocumentFiftyCentAmount != null) {
559             if (this.financialDocumentFiftyCentAmount == null) {
560                 this.financialDocumentFiftyCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentFiftyCentAmount);
561             }
562             else {
563                 this.financialDocumentFiftyCentAmount = this.financialDocumentFiftyCentAmount.subtract(detail.financialDocumentFiftyCentAmount);
564             }
565         }
566         if (detail.financialDocumentTwentyFiveCentAmount != null) {
567             if (this.financialDocumentTwentyFiveCentAmount == null) {
568                 this.financialDocumentTwentyFiveCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentTwentyFiveCentAmount);
569             }
570             else {
571                 this.financialDocumentTwentyFiveCentAmount = this.financialDocumentTwentyFiveCentAmount.subtract(detail.financialDocumentTwentyFiveCentAmount);
572             }
573         }
574         if (detail.financialDocumentTenCentAmount != null) {
575             if (this.financialDocumentTenCentAmount == null) {
576                 this.financialDocumentTenCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentTenCentAmount);
577             }
578             else {
579                 this.financialDocumentTenCentAmount = this.financialDocumentTenCentAmount.subtract(detail.financialDocumentTenCentAmount);
580             }
581         }
582         if (detail.financialDocumentFiveCentAmount != null) {
583             if (this.financialDocumentFiveCentAmount == null) {
584                 this.financialDocumentFiveCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentFiveCentAmount);
585             }
586             else {
587                 this.financialDocumentFiveCentAmount = this.financialDocumentFiveCentAmount.subtract(detail.financialDocumentFiveCentAmount);
588             }
589         }
590         if (detail.financialDocumentOneCentAmount != null) {
591             if (this.financialDocumentOneCentAmount == null) {
592                 this.financialDocumentOneCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentOneCentAmount);
593             }
594             else {
595                 this.financialDocumentOneCentAmount = this.financialDocumentOneCentAmount.subtract(detail.financialDocumentOneCentAmount);
596             }
597         }
598         if (detail.financialDocumentOtherCentAmount != null) {
599             if (this.financialDocumentOtherCentAmount == null) {
600                 this.financialDocumentOtherCentAmount = KualiDecimal.ZERO.subtract(detail.financialDocumentOtherCentAmount);
601             }
602             else {
603                 this.financialDocumentOtherCentAmount = this.financialDocumentOtherCentAmount.subtract(detail.financialDocumentOtherCentAmount);
604             }
605         }
606     }
607 
608     /**
609      * Is this coin detail empty of any value?
610      *
611      * @return true if any field at all is neither null nor the amount is zero
612      */
613     public boolean isEmpty() {
614         return ((this.financialDocumentHundredCentAmount == null || this.financialDocumentHundredCentAmount.equals(KualiDecimal.ZERO)) &&
615                 (this.financialDocumentFiftyCentAmount == null || this.financialDocumentFiftyCentAmount.equals(KualiDecimal.ZERO)) &&
616                 (this.financialDocumentTwentyFiveCentAmount == null || this.financialDocumentTwentyFiveCentAmount.equals(KualiDecimal.ZERO)) &&
617                 (this.financialDocumentTenCentAmount == null || this.financialDocumentTenCentAmount.equals(KualiDecimal.ZERO)) &&
618                 (this.financialDocumentFiveCentAmount == null || this.financialDocumentFiveCentAmount.equals(KualiDecimal.ZERO)) &&
619                 (this.financialDocumentOneCentAmount == null || this.financialDocumentOneCentAmount.equals(KualiDecimal.ZERO)) &&
620                 (this.financialDocumentOtherCentAmount == null || this.financialDocumentOtherCentAmount.equals(KualiDecimal.ZERO)));
621     }
622 
623     /**
624      * Checks if this CoinDetail contains any negative amount field.
625      * @return true if any amount is negative
626      */
627     public boolean hasNegativeAmount() {
628         return ((financialDocumentHundredCentAmount != null && financialDocumentHundredCentAmount.isNegative()) ||
629                 (financialDocumentFiftyCentAmount != null && financialDocumentFiftyCentAmount.isNegative()) ||
630                 (financialDocumentTwentyFiveCentAmount != null && financialDocumentTwentyFiveCentAmount.isNegative()) ||
631                 (financialDocumentTenCentAmount != null && financialDocumentTenCentAmount.isNegative()) ||
632                 (financialDocumentFiveCentAmount != null && financialDocumentFiveCentAmount.isNegative()) ||
633                 (financialDocumentOneCentAmount != null && financialDocumentOneCentAmount.isNegative()) ||
634                 (financialDocumentOtherCentAmount != null && financialDocumentOtherCentAmount.isNegative()));
635     }
636 
637     /**
638      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
639      */
640     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
641         LinkedHashMap m = new LinkedHashMap();
642         m.put(KFSPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
643         m.put("financialDocumentTypeCode", this.financialDocumentTypeCode);
644         m.put("cashieringStatus", this.cashieringStatus);
645         return m;
646     }
647 }