0001: /*
0002: * Copyright 2006-2007 The Kuali Foundation.
0003: *
0004: * Licensed under the Educational Community License, Version 1.0 (the "License");
0005: * you may not use this file except in compliance with the License.
0006: * You may obtain a copy of the License at
0007: *
0008: * http://www.opensource.org/licenses/ecl1.php
0009: *
0010: * Unless required by applicable law or agreed to in writing, software
0011: * distributed under the License is distributed on an "AS IS" BASIS,
0012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013: * See the License for the specific language governing permissions and
0014: * limitations under the License.
0015: */
0016:
0017: package org.kuali.module.financial.bo;
0018:
0019: import java.util.LinkedHashMap;
0020:
0021: import org.apache.commons.lang.StringUtils;
0022: import org.kuali.core.bo.PersistableBusinessObjectBase;
0023: import org.kuali.core.util.KualiDecimal;
0024: import org.kuali.kfs.KFSConstants;
0025:
0026: /**
0027: * This class represents a cash drawer used in cash management document. It contains amounts for
0028: * different types of denominations for currency and coin.
0029: */
0030: public class CashDrawer extends PersistableBusinessObjectBase {
0031: private String workgroupName;
0032: private String statusCode;
0033:
0034: private KualiDecimal cashDrawerTotalAmount;
0035:
0036: private KualiDecimal financialDocumentHundredDollarAmount;
0037: private KualiDecimal financialDocumentFiftyDollarAmount;
0038: private KualiDecimal financialDocumentTwentyDollarAmount;
0039: private KualiDecimal financialDocumentTenDollarAmount;
0040: private KualiDecimal financialDocumentFiveDollarAmount;
0041: private KualiDecimal financialDocumentTwoDollarAmount;
0042: private KualiDecimal financialDocumentOneDollarAmount;
0043: private KualiDecimal financialDocumentOtherDollarAmount;
0044:
0045: private KualiDecimal financialDocumentHundredCentAmount;
0046: private KualiDecimal financialDocumentFiftyCentAmount;
0047: private KualiDecimal financialDocumentTwentyFiveCentAmount;
0048: private KualiDecimal financialDocumentTenCentAmount;
0049: private KualiDecimal financialDocumentFiveCentAmount;
0050: private KualiDecimal financialDocumentOneCentAmount;
0051: private KualiDecimal financialDocumentOtherCentAmount;
0052:
0053: private KualiDecimal financialDocumentMiscellaneousAdvanceAmount;
0054:
0055: private String referenceFinancialDocumentNumber;
0056:
0057: /**
0058: * Default constructor.
0059: */
0060: public CashDrawer() {
0061:
0062: }
0063:
0064: /**
0065: * This method returns true if the cash drawer is open.
0066: *
0067: * @return boolean
0068: */
0069: public boolean isOpen() {
0070: return StringUtils.equals(
0071: KFSConstants.CashDrawerConstants.STATUS_OPEN,
0072: statusCode);
0073: }
0074:
0075: /**
0076: * This method returns true if the cash drawer is closed.
0077: *
0078: * @return boolean
0079: */
0080: public boolean isClosed() {
0081: return (statusCode == null
0082: || StringUtils.equals(
0083: KFSConstants.CashDrawerConstants.STATUS_CLOSED,
0084: statusCode) || referenceFinancialDocumentNumber == null);
0085: }
0086:
0087: /**
0088: * This method returns true if the cash drawer is locked.
0089: *
0090: * @return boolean
0091: */
0092: public boolean isLocked() {
0093: return StringUtils.equals(
0094: KFSConstants.CashDrawerConstants.STATUS_LOCKED,
0095: statusCode);
0096: }
0097:
0098: /**
0099: * Gets the workgroupName attribute.
0100: *
0101: * @return Returns the workgroupName
0102: */
0103: public String getWorkgroupName() {
0104: return workgroupName;
0105: }
0106:
0107: /**
0108: * Sets the workgroupName attribute.
0109: *
0110: * @param workgroupName The workgroupName to set.
0111: */
0112: public void setWorkgroupName(String workgroupName) {
0113: this .workgroupName = workgroupName;
0114: }
0115:
0116: /**
0117: * Gets the statusCode attribute.
0118: *
0119: * @return Returns the statusCode
0120: */
0121: public String getStatusCode() {
0122: return statusCode;
0123: }
0124:
0125: /**
0126: * Sets the statusCode attribute.
0127: *
0128: * @param financialDocumentOpenDepositCode The statusCode to set.
0129: */
0130: public void setStatusCode(String financialDocumentOpenDepositCode) {
0131: this .statusCode = financialDocumentOpenDepositCode;
0132: }
0133:
0134: /**
0135: * Gets the cashDrawerTotalAmount attribute.
0136: *
0137: * @return Returns the cashDrawerTotalAmount
0138: */
0139: public KualiDecimal getCashDrawerTotalAmount() {
0140: return cashDrawerTotalAmount;
0141: }
0142:
0143: /**
0144: * Sets the cashDrawerTotalAmount attribute.
0145: *
0146: * @param cashDrawerTotalAmount The cashDrawerTotalAmount to set.
0147: */
0148: public void setCashDrawerTotalAmount(
0149: KualiDecimal cashDrawerTotalAmount) {
0150: this .cashDrawerTotalAmount = cashDrawerTotalAmount;
0151: }
0152:
0153: /**
0154: * Gets the financialDocumentHundredDollarAmount attribute.
0155: *
0156: * @return Returns the financialDocumentHundredDollarAmount
0157: */
0158: public KualiDecimal getFinancialDocumentHundredDollarAmount() {
0159: return financialDocumentHundredDollarAmount;
0160: }
0161:
0162: /**
0163: * Sets the financialDocumentHundredDollarAmount attribute.
0164: *
0165: * @param financialDocumentHundredDollarAmount The financialDocumentHundredDollarAmount to set.
0166: */
0167: public void setFinancialDocumentHundredDollarAmount(
0168: KualiDecimal financialDocumentHundredDollarAmount) {
0169: this .financialDocumentHundredDollarAmount = financialDocumentHundredDollarAmount;
0170: }
0171:
0172: /**
0173: * Returns the actual count of hundred dollar bills
0174: *
0175: * @return the number of hundred dollar bills present in the drawer
0176: */
0177: public Integer getHundredDollarCount() {
0178: return (financialDocumentHundredDollarAmount != null) ? new Integer(
0179: financialDocumentHundredDollarAmount
0180: .divide(
0181: KFSConstants.CurrencyTypeAmounts.HUNDRED_DOLLAR_AMOUNT)
0182: .intValue())
0183: : new Integer(0);
0184: }
0185:
0186: /**
0187: * This sets the count of hundred dollar bills present in the drawer
0188: *
0189: * @param count the number of hundred dollar bills present in the drawer
0190: */
0191: public void setHundredDollarCount(Integer count) {
0192: if (count != null) {
0193: this .financialDocumentHundredDollarAmount = new KualiDecimal(
0194: count.intValue())
0195: .multiply(KFSConstants.CurrencyTypeAmounts.HUNDRED_DOLLAR_AMOUNT);
0196: }
0197: }
0198:
0199: /**
0200: * Gets the financialDocumentFiftyDollarAmount attribute.
0201: *
0202: * @return Returns the financialDocumentFiftyDollarAmount
0203: */
0204: public KualiDecimal getFinancialDocumentFiftyDollarAmount() {
0205: return financialDocumentFiftyDollarAmount;
0206: }
0207:
0208: /**
0209: * Sets the financialDocumentFiftyDollarAmount attribute.
0210: *
0211: * @param financialDocumentFiftyDollarAmount The financialDocumentFiftyDollarAmount to set.
0212: */
0213: public void setFinancialDocumentFiftyDollarAmount(
0214: KualiDecimal financialDocumentFiftyDollarAmount) {
0215: this .financialDocumentFiftyDollarAmount = financialDocumentFiftyDollarAmount;
0216: }
0217:
0218: /**
0219: * Returns the actual count of fifty dollar bills
0220: *
0221: * @return the number of fifty dollar bills present in the drawer
0222: */
0223: public Integer getFiftyDollarCount() {
0224: return (financialDocumentFiftyDollarAmount != null) ? new Integer(
0225: financialDocumentFiftyDollarAmount
0226: .divide(
0227: KFSConstants.CurrencyTypeAmounts.FIFTY_DOLLAR_AMOUNT)
0228: .intValue())
0229: : new Integer(0);
0230: }
0231:
0232: /**
0233: * This sets the count of hundred dollar bills present in the drawer
0234: *
0235: * @param count the number of hundred dollar bills present in the drawer
0236: */
0237: public void setFiftyDollarCount(Integer count) {
0238: if (count != null) {
0239: this .financialDocumentFiftyDollarAmount = new KualiDecimal(
0240: count.intValue())
0241: .multiply(KFSConstants.CurrencyTypeAmounts.FIFTY_DOLLAR_AMOUNT);
0242: }
0243: }
0244:
0245: /**
0246: * Gets the financialDocumentTwentyDollarAmount attribute.
0247: *
0248: * @return Returns the financialDocumentTwentyDollarAmount
0249: */
0250: public KualiDecimal getFinancialDocumentTwentyDollarAmount() {
0251: return financialDocumentTwentyDollarAmount;
0252: }
0253:
0254: /**
0255: * Sets the financialDocumentTwentyDollarAmount attribute.
0256: *
0257: * @param financialDocumentTwentyDollarAmount The financialDocumentTwentyDollarAmount to set.
0258: */
0259: public void setFinancialDocumentTwentyDollarAmount(
0260: KualiDecimal financialDocumentTwentyDollarAmount) {
0261: this .financialDocumentTwentyDollarAmount = financialDocumentTwentyDollarAmount;
0262: }
0263:
0264: /**
0265: * Returns the actual count of twenty dollar bills
0266: *
0267: * @return the number of twenty dollar bills present in the drawer
0268: */
0269: public Integer getTwentyDollarCount() {
0270: return (financialDocumentTwentyDollarAmount != null) ? new Integer(
0271: financialDocumentTwentyDollarAmount
0272: .divide(
0273: KFSConstants.CurrencyTypeAmounts.TWENTY_DOLLAR_AMOUNT)
0274: .intValue())
0275: : new Integer(0);
0276: }
0277:
0278: /**
0279: * This sets the count of twenty dollar bills present in the drawer
0280: *
0281: * @param count the number of twenty dollar bills present in the drawer
0282: */
0283: public void setTwentyDollarCount(Integer count) {
0284: if (count != null) {
0285: this .financialDocumentTwentyDollarAmount = new KualiDecimal(
0286: count.intValue())
0287: .multiply(KFSConstants.CurrencyTypeAmounts.TWENTY_DOLLAR_AMOUNT);
0288: }
0289: }
0290:
0291: /**
0292: * Gets the financialDocumentTenDollarAmount attribute.
0293: *
0294: * @return Returns the financialDocumentTenDollarAmount
0295: */
0296: public KualiDecimal getFinancialDocumentTenDollarAmount() {
0297: return financialDocumentTenDollarAmount;
0298: }
0299:
0300: /**
0301: * Sets the financialDocumentTenDollarAmount attribute.
0302: *
0303: * @param financialDocumentTenDollarAmount The financialDocumentTenDollarAmount to set.
0304: */
0305: public void setFinancialDocumentTenDollarAmount(
0306: KualiDecimal financialDocumentTenDollarAmount) {
0307: this .financialDocumentTenDollarAmount = financialDocumentTenDollarAmount;
0308: }
0309:
0310: /**
0311: * Returns the actual count of ten dollar bills
0312: *
0313: * @return the number of ten dollar bills present in the drawer
0314: */
0315: public Integer getTenDollarCount() {
0316: return (financialDocumentTenDollarAmount != null) ? new Integer(
0317: financialDocumentTenDollarAmount
0318: .divide(
0319: KFSConstants.CurrencyTypeAmounts.TEN_DOLLAR_AMOUNT)
0320: .intValue())
0321: : new Integer(0);
0322: }
0323:
0324: /**
0325: * This sets the count of ten dollar bills present in the drawer
0326: *
0327: * @param count the number of ten dollar bills present in the drawer
0328: */
0329: public void setTenDollarCount(Integer count) {
0330: if (count != null) {
0331: this .financialDocumentTenDollarAmount = new KualiDecimal(
0332: count.intValue())
0333: .multiply(KFSConstants.CurrencyTypeAmounts.TEN_DOLLAR_AMOUNT);
0334: }
0335: }
0336:
0337: /**
0338: * Gets the financialDocumentFiveDollarAmount attribute.
0339: *
0340: * @return Returns the financialDocumentFiveDollarAmount
0341: */
0342: public KualiDecimal getFinancialDocumentFiveDollarAmount() {
0343: return financialDocumentFiveDollarAmount;
0344: }
0345:
0346: /**
0347: * Sets the financialDocumentFiveDollarAmount attribute.
0348: *
0349: * @param financialDocumentFiveDollarAmount The financialDocumentFiveDollarAmount to set.
0350: */
0351: public void setFinancialDocumentFiveDollarAmount(
0352: KualiDecimal financialDocumentFiveDollarAmount) {
0353: this .financialDocumentFiveDollarAmount = financialDocumentFiveDollarAmount;
0354: }
0355:
0356: /**
0357: * Returns the actual count of five dollar bills
0358: *
0359: * @return the number of five dollar bills present in the drawer
0360: */
0361: public Integer getFiveDollarCount() {
0362: return (financialDocumentFiveDollarAmount != null) ? new Integer(
0363: financialDocumentFiveDollarAmount
0364: .divide(
0365: KFSConstants.CurrencyTypeAmounts.FIVE_DOLLAR_AMOUNT)
0366: .intValue())
0367: : new Integer(0);
0368: }
0369:
0370: /**
0371: * This sets the count of five dollar bills present in the drawer
0372: *
0373: * @param count the number of five dollar bills present in the drawer
0374: */
0375: public void setFiveDollarCount(Integer count) {
0376: if (count != null) {
0377: this .financialDocumentFiveDollarAmount = new KualiDecimal(
0378: count.intValue())
0379: .multiply(KFSConstants.CurrencyTypeAmounts.FIVE_DOLLAR_AMOUNT);
0380: }
0381: }
0382:
0383: /**
0384: * Gets the financialDocumentTwoDollarAmount attribute.
0385: *
0386: * @return Returns the financialDocumentTwoDollarAmount
0387: */
0388: public KualiDecimal getFinancialDocumentTwoDollarAmount() {
0389: return financialDocumentTwoDollarAmount;
0390: }
0391:
0392: /**
0393: * Sets the financialDocumentTwoDollarAmount attribute.
0394: *
0395: * @param financialDocumentTwoDollarAmount The financialDocumentTwoDollarAmount to set.
0396: */
0397: public void setFinancialDocumentTwoDollarAmount(
0398: KualiDecimal financialDocumentTwoDollarAmount) {
0399: this .financialDocumentTwoDollarAmount = financialDocumentTwoDollarAmount;
0400: }
0401:
0402: /**
0403: * Returns the actual count of two dollar bills
0404: *
0405: * @return the number of two dollar bills present in the drawer
0406: */
0407: public Integer getTwoDollarCount() {
0408: return (financialDocumentTwoDollarAmount != null) ? new Integer(
0409: financialDocumentTwoDollarAmount
0410: .divide(
0411: KFSConstants.CurrencyTypeAmounts.TWO_DOLLAR_AMOUNT)
0412: .intValue())
0413: : new Integer(0);
0414: }
0415:
0416: /**
0417: * This sets the count of two dollar bills present in the drawer
0418: *
0419: * @param count the number of two dollar bills present in the drawer
0420: */
0421: public void setTwoDollarCount(Integer count) {
0422: if (count != null) {
0423: this .financialDocumentTwoDollarAmount = new KualiDecimal(
0424: count.intValue())
0425: .multiply(KFSConstants.CurrencyTypeAmounts.TWO_DOLLAR_AMOUNT);
0426: }
0427: }
0428:
0429: /**
0430: * Gets the financialDocumentOneDollarAmount attribute.
0431: *
0432: * @return Returns the financialDocumentOneDollarAmount
0433: */
0434: public KualiDecimal getFinancialDocumentOneDollarAmount() {
0435: return financialDocumentOneDollarAmount;
0436: }
0437:
0438: /**
0439: * Sets the financialDocumentOneDollarAmount attribute.
0440: *
0441: * @param financialDocumentOneDollarAmount The financialDocumentOneDollarAmount to set.
0442: */
0443: public void setFinancialDocumentOneDollarAmount(
0444: KualiDecimal financialDocumentOneDollarAmount) {
0445: this .financialDocumentOneDollarAmount = financialDocumentOneDollarAmount;
0446: }
0447:
0448: /**
0449: * Returns the actual count of one dollar bills
0450: *
0451: * @return the number of one dollar bills present in the drawer
0452: */
0453: public Integer getOneDollarCount() {
0454: return (financialDocumentOneDollarAmount != null) ? new Integer(
0455: financialDocumentOneDollarAmount
0456: .divide(
0457: KFSConstants.CurrencyTypeAmounts.ONE_DOLLAR_AMOUNT)
0458: .intValue())
0459: : new Integer(0);
0460: }
0461:
0462: /**
0463: * This sets the count of one dollar bills present in the drawer
0464: *
0465: * @param count the number of one dollar bills present in the drawer
0466: */
0467: public void setOneDollarCount(Integer count) {
0468: if (count != null) {
0469: this .financialDocumentOneDollarAmount = new KualiDecimal(
0470: count.intValue())
0471: .multiply(KFSConstants.CurrencyTypeAmounts.ONE_DOLLAR_AMOUNT);
0472: }
0473: }
0474:
0475: /**
0476: * Gets the financialDocumentOtherDollarAmount attribute.
0477: *
0478: * @return Returns the financialDocumentOtherDollarAmount
0479: */
0480: public KualiDecimal getFinancialDocumentOtherDollarAmount() {
0481: return financialDocumentOtherDollarAmount;
0482: }
0483:
0484: /**
0485: * Sets the financialDocumentOtherDollarAmount attribute.
0486: *
0487: * @param financialDocumentOtherDollarAmount The financialDocumentOtherDollarAmount to set.
0488: */
0489: public void setFinancialDocumentOtherDollarAmount(
0490: KualiDecimal financialDocumentOtherDollarAmount) {
0491: this .financialDocumentOtherDollarAmount = financialDocumentOtherDollarAmount;
0492: }
0493:
0494: /**
0495: * Gets the financialDocumentFiftyCentAmount attribute.
0496: *
0497: * @return Returns the financialDocumentFiftyCentAmount
0498: */
0499: public KualiDecimal getFinancialDocumentFiftyCentAmount() {
0500: return financialDocumentFiftyCentAmount;
0501: }
0502:
0503: /**
0504: * Sets the financialDocumentFiftyCentAmount attribute.
0505: *
0506: * @param financialDocumentFiftyCentAmount The financialDocumentFiftyCentAmount to set.
0507: */
0508: public void setFinancialDocumentFiftyCentAmount(
0509: KualiDecimal financialDocumentFiftyCentAmount) {
0510: this .financialDocumentFiftyCentAmount = financialDocumentFiftyCentAmount;
0511: }
0512:
0513: /**
0514: * Returns the number of half-cent coins in the drawer
0515: *
0516: * @return the count of half cent coins in the drawer
0517: */
0518: public Integer getFiftyCentCount() {
0519: return (financialDocumentFiftyCentAmount != null) ? new Integer(
0520: financialDocumentFiftyCentAmount.divide(
0521: KFSConstants.CoinTypeAmounts.FIFTY_CENT_AMOUNT)
0522: .intValue())
0523: : new Integer(0);
0524: }
0525:
0526: /**
0527: * 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
0528: * "bub"
0529: *
0530: * @param count the number of fifty cent coins present in the drawer
0531: */
0532: public void setFiftyCentCount(Integer count) {
0533: if (count != null) {
0534: financialDocumentFiftyCentAmount = new KualiDecimal(count
0535: .intValue())
0536: .multiply(KFSConstants.CoinTypeAmounts.FIFTY_CENT_AMOUNT);
0537: }
0538: }
0539:
0540: /**
0541: * Gets the financialDocumentTwentyFiveCentAmount attribute.
0542: *
0543: * @return Returns the financialDocumentTwentyFiveCentAmount
0544: */
0545: public KualiDecimal getFinancialDocumentTwentyFiveCentAmount() {
0546: return financialDocumentTwentyFiveCentAmount;
0547: }
0548:
0549: /**
0550: * Sets the financialDocumentTwentyFiveCentAmount attribute.
0551: *
0552: * @param financialDocumentTwentyFiveCentAmount The financialDocumentTwentyFiveCentAmount to set.
0553: */
0554: public void setFinancialDocumentTwentyFiveCentAmount(
0555: KualiDecimal financialDocumentTwentyFiveCentAmount) {
0556: this .financialDocumentTwentyFiveCentAmount = financialDocumentTwentyFiveCentAmount;
0557: }
0558:
0559: /**
0560: * Returns the number of quarters in the drawer
0561: *
0562: * @return the count of quarters in the drawer
0563: */
0564: public Integer getTwentyFiveCentCount() {
0565: return (financialDocumentTwentyFiveCentAmount != null) ? new Integer(
0566: financialDocumentTwentyFiveCentAmount
0567: .divide(
0568: KFSConstants.CoinTypeAmounts.TWENTY_FIVE_CENT_AMOUNT)
0569: .intValue())
0570: : new Integer(0);
0571: }
0572:
0573: /**
0574: * Sets the number of quarters in the drawer
0575: *
0576: * @param count the number of quarters present in the drawer
0577: */
0578: public void setTwentyFiveCentCount(Integer count) {
0579: if (count != null) {
0580: financialDocumentTwentyFiveCentAmount = new KualiDecimal(
0581: count.intValue())
0582: .multiply(KFSConstants.CoinTypeAmounts.TWENTY_FIVE_CENT_AMOUNT);
0583: }
0584: }
0585:
0586: /**
0587: * Gets the financialDocumentTenCentAmount attribute.
0588: *
0589: * @return Returns the financialDocumentTenCentAmount
0590: */
0591: public KualiDecimal getFinancialDocumentTenCentAmount() {
0592: return financialDocumentTenCentAmount;
0593: }
0594:
0595: /**
0596: * Sets the financialDocumentTenCentAmount attribute.
0597: *
0598: * @param financialDocumentTenCentAmount The financialDocumentTenCentAmount to set.
0599: */
0600: public void setFinancialDocumentTenCentAmount(
0601: KualiDecimal financialDocumentTenCentAmount) {
0602: this .financialDocumentTenCentAmount = financialDocumentTenCentAmount;
0603: }
0604:
0605: /**
0606: * Returns the number of dimes in the drawer
0607: *
0608: * @return the count of dimes in the drawer
0609: */
0610: public Integer getTenCentCount() {
0611: return (financialDocumentTenCentAmount != null) ? new Integer(
0612: financialDocumentTenCentAmount.divide(
0613: KFSConstants.CoinTypeAmounts.TEN_CENT_AMOUNT)
0614: .intValue()) : new Integer(0);
0615: }
0616:
0617: /**
0618: * Sets the number of dimes in the drawer
0619: *
0620: * @param count the number of dimes present in the drawer
0621: */
0622: public void setTenCentCount(Integer count) {
0623: if (count != null) {
0624: financialDocumentTenCentAmount = new KualiDecimal(count
0625: .intValue())
0626: .multiply(KFSConstants.CoinTypeAmounts.TEN_CENT_AMOUNT);
0627: }
0628: }
0629:
0630: /**
0631: * Gets the financialDocumentFiveCentAmount attribute.
0632: *
0633: * @return Returns the financialDocumentFiveCentAmount
0634: */
0635: public KualiDecimal getFinancialDocumentFiveCentAmount() {
0636: return financialDocumentFiveCentAmount;
0637: }
0638:
0639: /**
0640: * Sets the financialDocumentFiveCentAmount attribute.
0641: *
0642: * @param financialDocumentFiveCentAmount The financialDocumentFiveCentAmount to set.
0643: */
0644: public void setFinancialDocumentFiveCentAmount(
0645: KualiDecimal financialDocumentFiveCentAmount) {
0646: this .financialDocumentFiveCentAmount = financialDocumentFiveCentAmount;
0647: }
0648:
0649: /**
0650: * Returns the number of nickels in the drawer
0651: *
0652: * @return the count of nickels in the drawer
0653: */
0654: public Integer getFiveCentCount() {
0655: return (financialDocumentFiveCentAmount != null) ? new Integer(
0656: financialDocumentFiveCentAmount.divide(
0657: KFSConstants.CoinTypeAmounts.FIVE_CENT_AMOUNT)
0658: .intValue()) : new Integer(0);
0659: }
0660:
0661: /**
0662: * Sets the number of nickels in the drawer
0663: *
0664: * @param count the number of nickels present in the drawer
0665: */
0666: public void setFiveCentCount(Integer count) {
0667: if (count != null) {
0668: financialDocumentFiveCentAmount = new KualiDecimal(count
0669: .intValue())
0670: .multiply(KFSConstants.CoinTypeAmounts.FIVE_CENT_AMOUNT);
0671: }
0672: }
0673:
0674: /**
0675: * Gets the financialDocumentOneCentAmount attribute.
0676: *
0677: * @return Returns the financialDocumentOneCentAmount
0678: */
0679: public KualiDecimal getFinancialDocumentOneCentAmount() {
0680: return financialDocumentOneCentAmount;
0681: }
0682:
0683: /**
0684: * Sets the financialDocumentOneCentAmount attribute.
0685: *
0686: * @param financialDocumentOneCentAmount The financialDocumentOneCentAmount to set.
0687: */
0688: public void setFinancialDocumentOneCentAmount(
0689: KualiDecimal financialDocumentOneCentAmount) {
0690: this .financialDocumentOneCentAmount = financialDocumentOneCentAmount;
0691: }
0692:
0693: /**
0694: * Returns the number of pennies in the drawer
0695: *
0696: * @return the count of pennies in the drawer
0697: */
0698: public Integer getOneCentCount() {
0699: return (financialDocumentOneCentAmount != null) ? new Integer(
0700: financialDocumentOneCentAmount.divide(
0701: KFSConstants.CoinTypeAmounts.ONE_CENT_AMOUNT)
0702: .intValue()) : new Integer(0);
0703: }
0704:
0705: /**
0706: * Sets the number of pennies in the drawer
0707: *
0708: * @param count the number of pennies present in the drawer
0709: */
0710: public void setOneCentCount(Integer count) {
0711: if (count != null) {
0712: financialDocumentOneCentAmount = new KualiDecimal(count
0713: .intValue())
0714: .multiply(KFSConstants.CoinTypeAmounts.ONE_CENT_AMOUNT);
0715: }
0716: }
0717:
0718: /**
0719: * Gets the financialDocumentOtherCentAmount attribute.
0720: *
0721: * @return Returns the financialDocumentOtherCentAmount
0722: */
0723: public KualiDecimal getFinancialDocumentOtherCentAmount() {
0724: return financialDocumentOtherCentAmount;
0725: }
0726:
0727: /**
0728: * Sets the financialDocumentOtherCentAmount attribute.
0729: *
0730: * @param financialDocumentOtherCentAmount The financialDocumentOtherCentAmount to set.
0731: */
0732: public void setFinancialDocumentOtherCentAmount(
0733: KualiDecimal financialDocumentOtherCentAmount) {
0734: this .financialDocumentOtherCentAmount = financialDocumentOtherCentAmount;
0735: }
0736:
0737: /**
0738: * Gets the financialDocumentHundredCentAmount attribute.
0739: *
0740: * @return Returns the financialDocumentHundredCentAmount
0741: */
0742: public KualiDecimal getFinancialDocumentHundredCentAmount() {
0743: return financialDocumentHundredCentAmount;
0744: }
0745:
0746: /**
0747: * Sets the financialDocumentHundredCentAmount attribute.
0748: *
0749: * @param financialDocumentHundredCentAmount The financialDocumentHundredCentAmount to set.
0750: */
0751: public void setFinancialDocumentHundredCentAmount(
0752: KualiDecimal financialDocumentHundredCentAmount) {
0753: this .financialDocumentHundredCentAmount = financialDocumentHundredCentAmount;
0754: }
0755:
0756: /**
0757: * Returns the number of dollar coins--Sacajawea, Susan B. Anthony, or otherwise--in the drawer
0758: *
0759: * @return the count of dollar coins in the drawer
0760: */
0761: public Integer getHundredCentCount() {
0762: return (financialDocumentHundredCentAmount != null) ? new Integer(
0763: financialDocumentHundredCentAmount
0764: .divide(
0765: KFSConstants.CoinTypeAmounts.HUNDRED_CENT_AMOUNT)
0766: .intValue())
0767: : new Integer(0);
0768: }
0769:
0770: /**
0771: * Sets the number of hundred cent coins in the drawer
0772: *
0773: * @param count the number of hundred cent coins present in the drawer
0774: */
0775: public void setHundredCentCount(Integer count) {
0776: if (count != null) {
0777: financialDocumentHundredCentAmount = new KualiDecimal(count
0778: .intValue())
0779: .multiply(KFSConstants.CoinTypeAmounts.HUNDRED_CENT_AMOUNT);
0780: }
0781: }
0782:
0783: /**
0784: * Gets the financialDocumentMiscellaneousAdvanceAmount attribute.
0785: *
0786: * @return Returns the financialDocumentMiscellaneousAdvanceAmount
0787: */
0788: public KualiDecimal getFinancialDocumentMiscellaneousAdvanceAmount() {
0789: return financialDocumentMiscellaneousAdvanceAmount;
0790: }
0791:
0792: /**
0793: * Sets the financialDocumentMiscellaneousAdvanceAmount attribute.
0794: *
0795: * @param financialDocumentMiscellaneousAdvanceAmount The financialDocumentMiscellaneousAdvanceAmount to set.
0796: */
0797: public void setFinancialDocumentMiscellaneousAdvanceAmount(
0798: KualiDecimal financialDocumentMiscellaneousAdvanceAmount) {
0799: this .financialDocumentMiscellaneousAdvanceAmount = financialDocumentMiscellaneousAdvanceAmount;
0800: }
0801:
0802: /**
0803: * Gets the referenceFinancialDocumentNumber attribute.
0804: *
0805: * @return Returns the referenceFinancialDocumentNumber
0806: */
0807: public String getReferenceFinancialDocumentNumber() {
0808: return referenceFinancialDocumentNumber;
0809: }
0810:
0811: /**
0812: * Sets the referenceFinancialDocumentNumber attribute.
0813: *
0814: * @param referenceFinancialDocumentNumber The referenceFinancialDocumentNumber to set.
0815: */
0816: public void setReferenceFinancialDocumentNumber(
0817: String referenceFinancialDocumentNumber) {
0818: this .referenceFinancialDocumentNumber = referenceFinancialDocumentNumber;
0819: }
0820:
0821: /**
0822: * This method calculates the total amount of currency in the cash drawer
0823: *
0824: * @return the total amount of currency
0825: */
0826: public KualiDecimal getCurrencyTotalAmount() {
0827: KualiDecimal result = new KualiDecimal(0);
0828: if (this .financialDocumentHundredDollarAmount != null) {
0829: result = result
0830: .add(this .financialDocumentHundredDollarAmount);
0831: }
0832: if (this .financialDocumentFiftyDollarAmount != null) {
0833: result = result
0834: .add(this .financialDocumentFiftyDollarAmount);
0835: }
0836: if (this .financialDocumentTwentyDollarAmount != null) {
0837: result = result
0838: .add(this .financialDocumentTwentyDollarAmount);
0839: }
0840: if (this .financialDocumentTenDollarAmount != null) {
0841: result = result.add(this .financialDocumentTenDollarAmount);
0842: }
0843: if (this .financialDocumentFiveDollarAmount != null) {
0844: result = result.add(this .financialDocumentFiveDollarAmount);
0845: }
0846: if (this .financialDocumentTwoDollarAmount != null) {
0847: result = result.add(this .financialDocumentTwoDollarAmount);
0848: }
0849: if (this .financialDocumentOneDollarAmount != null) {
0850: result = result.add(this .financialDocumentOneDollarAmount);
0851: }
0852: if (this .financialDocumentOtherDollarAmount != null) {
0853: result = result
0854: .add(this .financialDocumentOtherDollarAmount);
0855: }
0856: return result;
0857: }
0858:
0859: /**
0860: * This method calculates the total amount of coin in the cash drawer
0861: *
0862: * @return the total amount of coin
0863: */
0864: public KualiDecimal getCoinTotalAmount() {
0865: KualiDecimal result = new KualiDecimal(0);
0866: if (this .financialDocumentHundredCentAmount != null) {
0867: result = result
0868: .add(this .financialDocumentHundredCentAmount);
0869: }
0870: if (this .financialDocumentFiftyCentAmount != null) {
0871: result = result.add(this .financialDocumentFiftyCentAmount);
0872: }
0873: if (this .financialDocumentTwentyFiveCentAmount != null) {
0874: result = result
0875: .add(this .financialDocumentTwentyFiveCentAmount);
0876: }
0877: if (this .financialDocumentTenCentAmount != null) {
0878: result = result.add(this .financialDocumentTenCentAmount);
0879: }
0880: if (this .financialDocumentFiveCentAmount != null) {
0881: result = result.add(this .financialDocumentFiveCentAmount);
0882: }
0883: if (this .financialDocumentOneCentAmount != null) {
0884: result = result.add(this .financialDocumentOneCentAmount);
0885: }
0886: if (this .financialDocumentOtherCentAmount != null) {
0887: result = result.add(this .financialDocumentOtherCentAmount);
0888: }
0889: return result;
0890: }
0891:
0892: /**
0893: * This calculates the total amount of money currently in the cash drawer
0894: *
0895: * @return the amount currently in the cash drawer
0896: */
0897: public KualiDecimal getTotalAmount() {
0898: return this .getCurrencyTotalAmount().add(
0899: this .getCoinTotalAmount());
0900: }
0901:
0902: /**
0903: * This method adds currency to the cash drawer
0904: *
0905: * @param detail the record indicating how much of each denomination of currency to add
0906: */
0907: public void addCurrency(CurrencyDetail detail) {
0908: if (detail.getFinancialDocumentHundredDollarAmount() != null) {
0909: if (financialDocumentHundredDollarAmount == null) {
0910: financialDocumentHundredDollarAmount = new KualiDecimal(
0911: detail
0912: .getFinancialDocumentHundredDollarAmount()
0913: .bigDecimalValue());
0914: } else {
0915: financialDocumentHundredDollarAmount = financialDocumentHundredDollarAmount
0916: .add(detail
0917: .getFinancialDocumentHundredDollarAmount());
0918: }
0919: }
0920: if (detail.getFinancialDocumentFiftyDollarAmount() != null) {
0921: if (financialDocumentFiftyDollarAmount == null) {
0922: financialDocumentFiftyDollarAmount = new KualiDecimal(
0923: detail.getFinancialDocumentFiftyDollarAmount()
0924: .bigDecimalValue());
0925: } else {
0926: financialDocumentFiftyDollarAmount = financialDocumentFiftyDollarAmount
0927: .add(detail
0928: .getFinancialDocumentFiftyDollarAmount());
0929: }
0930: }
0931: if (detail.getFinancialDocumentTwentyDollarAmount() != null) {
0932: if (financialDocumentTwentyDollarAmount == null) {
0933: financialDocumentTwentyDollarAmount = new KualiDecimal(
0934: detail.getFinancialDocumentTwentyDollarAmount()
0935: .bigDecimalValue());
0936: } else {
0937: financialDocumentTwentyDollarAmount = financialDocumentTwentyDollarAmount
0938: .add(detail
0939: .getFinancialDocumentTwentyDollarAmount());
0940: }
0941: }
0942: if (detail.getFinancialDocumentTenDollarAmount() != null) {
0943: if (financialDocumentTenDollarAmount == null) {
0944: financialDocumentTenDollarAmount = new KualiDecimal(
0945: detail.getFinancialDocumentTenDollarAmount()
0946: .bigDecimalValue());
0947: } else {
0948: financialDocumentTenDollarAmount = financialDocumentTenDollarAmount
0949: .add(detail
0950: .getFinancialDocumentTenDollarAmount());
0951: }
0952: }
0953: if (detail.getFinancialDocumentFiveDollarAmount() != null) {
0954: if (financialDocumentFiveDollarAmount == null) {
0955: financialDocumentFiveDollarAmount = new KualiDecimal(
0956: detail.getFinancialDocumentFiveDollarAmount()
0957: .bigDecimalValue());
0958: } else {
0959: financialDocumentFiveDollarAmount = financialDocumentFiveDollarAmount
0960: .add(detail
0961: .getFinancialDocumentFiveDollarAmount());
0962: }
0963: }
0964: if (detail.getFinancialDocumentTwoDollarAmount() != null) {
0965: if (financialDocumentTwoDollarAmount == null) {
0966: financialDocumentTwoDollarAmount = new KualiDecimal(
0967: detail.getFinancialDocumentTwoDollarAmount()
0968: .bigDecimalValue());
0969: } else {
0970: financialDocumentTwoDollarAmount = financialDocumentTwoDollarAmount
0971: .add(detail
0972: .getFinancialDocumentTwoDollarAmount());
0973: }
0974: }
0975: if (detail.getFinancialDocumentOneDollarAmount() != null) {
0976: if (financialDocumentOneDollarAmount == null) {
0977: financialDocumentOneDollarAmount = new KualiDecimal(
0978: detail.getFinancialDocumentOneDollarAmount()
0979: .bigDecimalValue());
0980: } else {
0981: financialDocumentOneDollarAmount = financialDocumentOneDollarAmount
0982: .add(detail
0983: .getFinancialDocumentOneDollarAmount());
0984: }
0985: }
0986: if (detail.getFinancialDocumentOtherDollarAmount() != null) {
0987: if (financialDocumentOtherDollarAmount == null) {
0988: financialDocumentOtherDollarAmount = new KualiDecimal(
0989: detail.getFinancialDocumentOtherDollarAmount()
0990: .bigDecimalValue());
0991: } else {
0992: financialDocumentOtherDollarAmount = financialDocumentOtherDollarAmount
0993: .add(detail
0994: .getFinancialDocumentOtherDollarAmount());
0995: }
0996: }
0997: }
0998:
0999: /**
1000: * This method puts coin into the cash drawer
1001: *
1002: * @param detail the record indicating how much coin of each denomiation to add
1003: */
1004: public void addCoin(CoinDetail detail) {
1005: if (detail.getFinancialDocumentHundredCentAmount() != null) {
1006: if (getFinancialDocumentHundredCentAmount() == null) {
1007: setFinancialDocumentHundredCentAmount(new KualiDecimal(
1008: detail.getFinancialDocumentHundredCentAmount()
1009: .bigDecimalValue()));
1010: } else {
1011: setFinancialDocumentHundredCentAmount(getFinancialDocumentHundredCentAmount()
1012: .add(
1013: detail
1014: .getFinancialDocumentHundredCentAmount()));
1015: }
1016: }
1017: if (detail.getFinancialDocumentFiftyCentAmount() != null) {
1018: if (getFinancialDocumentFiftyCentAmount() == null) {
1019: setFinancialDocumentFiftyCentAmount(new KualiDecimal(
1020: detail.getFinancialDocumentFiftyCentAmount()
1021: .bigDecimalValue()));
1022: } else {
1023: setFinancialDocumentFiftyCentAmount(getFinancialDocumentFiftyCentAmount()
1024: .add(
1025: detail
1026: .getFinancialDocumentFiftyCentAmount()));
1027: }
1028: }
1029: if (detail.getFinancialDocumentTwentyFiveCentAmount() != null) {
1030: if (getFinancialDocumentTwentyFiveCentAmount() == null) {
1031: setFinancialDocumentTwentyFiveCentAmount(new KualiDecimal(
1032: detail
1033: .getFinancialDocumentTwentyFiveCentAmount()
1034: .bigDecimalValue()));
1035: } else {
1036: setFinancialDocumentTwentyFiveCentAmount(getFinancialDocumentTwentyFiveCentAmount()
1037: .add(
1038: detail
1039: .getFinancialDocumentTwentyFiveCentAmount()));
1040: }
1041: }
1042: if (detail.getFinancialDocumentTenCentAmount() != null) {
1043: if (getFinancialDocumentTenCentAmount() == null) {
1044: setFinancialDocumentTenCentAmount(new KualiDecimal(
1045: detail.getFinancialDocumentTenCentAmount()
1046: .bigDecimalValue()));
1047: } else {
1048: setFinancialDocumentTenCentAmount(getFinancialDocumentTenCentAmount()
1049: .add(detail.getFinancialDocumentTenCentAmount()));
1050: }
1051: }
1052: if (detail.getFinancialDocumentFiveCentAmount() != null) {
1053: if (getFinancialDocumentFiveCentAmount() == null) {
1054: setFinancialDocumentFiveCentAmount(new KualiDecimal(
1055: detail.getFinancialDocumentFiveCentAmount()
1056: .bigDecimalValue()));
1057: } else {
1058: setFinancialDocumentFiveCentAmount(getFinancialDocumentFiveCentAmount()
1059: .add(
1060: detail
1061: .getFinancialDocumentFiveCentAmount()));
1062: }
1063: }
1064: if (detail.getFinancialDocumentOneCentAmount() != null) {
1065: if (getFinancialDocumentOneCentAmount() == null) {
1066: setFinancialDocumentOneCentAmount(new KualiDecimal(
1067: detail.getFinancialDocumentOneCentAmount()
1068: .bigDecimalValue()));
1069: } else {
1070: setFinancialDocumentOneCentAmount(getFinancialDocumentOneCentAmount()
1071: .add(detail.getFinancialDocumentOneCentAmount()));
1072: }
1073: }
1074: if (detail.getFinancialDocumentOtherCentAmount() != null) {
1075: if (getFinancialDocumentOtherCentAmount() == null) {
1076: setFinancialDocumentOtherCentAmount(new KualiDecimal(
1077: detail.getFinancialDocumentOtherCentAmount()
1078: .bigDecimalValue()));
1079: } else {
1080: setFinancialDocumentOtherCentAmount(getFinancialDocumentOtherCentAmount()
1081: .add(
1082: detail
1083: .getFinancialDocumentOtherCentAmount()));
1084: }
1085: }
1086: }
1087:
1088: /**
1089: * This method removes currency amounts from the cash drawer
1090: *
1091: * @param detail the record indicating how much currency of each denomination to remove
1092: */
1093: public void removeCurrency(CurrencyDetail detail) {
1094: if (detail.getFinancialDocumentHundredDollarAmount() != null) {
1095: if (this .getFinancialDocumentHundredDollarAmount() == null
1096: || detail
1097: .getFinancialDocumentHundredDollarAmount()
1098: .isGreaterThan(
1099: this
1100: .getFinancialDocumentHundredDollarAmount())) {
1101: throw new IllegalArgumentException(
1102: "The requested amount of hundred dollar bills exceeds the amount in the cash drawer");
1103: } else {
1104: setFinancialDocumentHundredDollarAmount(getFinancialDocumentHundredDollarAmount()
1105: .subtract(
1106: detail
1107: .getFinancialDocumentHundredDollarAmount()));
1108: }
1109: }
1110: if (detail.getFinancialDocumentFiftyDollarAmount() != null) {
1111: if (this .getFinancialDocumentFiftyDollarAmount() == null
1112: || detail
1113: .getFinancialDocumentFiftyDollarAmount()
1114: .isGreaterThan(
1115: this
1116: .getFinancialDocumentFiftyDollarAmount())) {
1117: throw new IllegalArgumentException(
1118: "The requested amount of fifty dollar bills exceeds the amount in the cash drawer");
1119: } else {
1120: setFinancialDocumentFiftyDollarAmount(getFinancialDocumentFiftyDollarAmount()
1121: .subtract(
1122: detail
1123: .getFinancialDocumentFiftyDollarAmount()));
1124: }
1125: }
1126: if (detail.getFinancialDocumentTwentyDollarAmount() != null) {
1127: if (this .getFinancialDocumentTwentyDollarAmount() == null
1128: || detail
1129: .getFinancialDocumentTwentyDollarAmount()
1130: .isGreaterThan(
1131: this
1132: .getFinancialDocumentTwentyDollarAmount())) {
1133: throw new IllegalArgumentException(
1134: "The requested amount of twenty dollar bills exceeds the amount in the cash drawer");
1135: } else {
1136: setFinancialDocumentTwentyDollarAmount(getFinancialDocumentTwentyDollarAmount()
1137: .subtract(
1138: detail
1139: .getFinancialDocumentTwentyDollarAmount()));
1140: }
1141: }
1142: if (detail.getFinancialDocumentTenDollarAmount() != null) {
1143: if (this .getFinancialDocumentTenDollarAmount() == null
1144: || detail
1145: .getFinancialDocumentTenDollarAmount()
1146: .isGreaterThan(
1147: this
1148: .getFinancialDocumentTenDollarAmount())) {
1149: throw new IllegalArgumentException(
1150: "The requested amount of ten dollar bills exceeds the amount in the cash drawer");
1151: } else {
1152: setFinancialDocumentTenDollarAmount(getFinancialDocumentTenDollarAmount()
1153: .subtract(
1154: detail
1155: .getFinancialDocumentTenDollarAmount()));
1156: }
1157: }
1158: if (detail.getFinancialDocumentFiveDollarAmount() != null) {
1159: if (this .getFinancialDocumentFiveDollarAmount() == null
1160: || detail
1161: .getFinancialDocumentFiveDollarAmount()
1162: .isGreaterThan(
1163: this
1164: .getFinancialDocumentFiveDollarAmount())) {
1165: throw new IllegalArgumentException(
1166: "The requested amount of five dollar bills exceeds the amount in the cash drawer");
1167: } else {
1168: setFinancialDocumentFiveDollarAmount(getFinancialDocumentFiveDollarAmount()
1169: .subtract(
1170: detail
1171: .getFinancialDocumentFiveDollarAmount()));
1172: }
1173: }
1174: if (detail.getFinancialDocumentTwoDollarAmount() != null) {
1175: if (this .getFinancialDocumentTwoDollarAmount() == null
1176: || detail
1177: .getFinancialDocumentTwoDollarAmount()
1178: .isGreaterThan(
1179: this
1180: .getFinancialDocumentTwoDollarAmount())) {
1181: throw new IllegalArgumentException(
1182: "The requested amount of two dollar bills exceeds the amount in the cash drawer");
1183: } else {
1184: setFinancialDocumentTwoDollarAmount(getFinancialDocumentTwoDollarAmount()
1185: .subtract(
1186: detail
1187: .getFinancialDocumentTwoDollarAmount()));
1188: }
1189: }
1190: if (detail.getFinancialDocumentOneDollarAmount() != null) {
1191: if (this .getFinancialDocumentOneDollarAmount() == null
1192: || detail
1193: .getFinancialDocumentOneDollarAmount()
1194: .isGreaterThan(
1195: this
1196: .getFinancialDocumentOneDollarAmount())) {
1197: throw new IllegalArgumentException(
1198: "The requested amount of one dollar bills exceeds the amount in the cash drawer");
1199: } else {
1200: setFinancialDocumentOneDollarAmount(getFinancialDocumentOneDollarAmount()
1201: .subtract(
1202: detail
1203: .getFinancialDocumentOneDollarAmount()));
1204: }
1205: }
1206: if (detail.getFinancialDocumentOtherDollarAmount() != null) {
1207: if (this .getFinancialDocumentOtherDollarAmount() == null
1208: || detail
1209: .getFinancialDocumentOtherDollarAmount()
1210: .isGreaterThan(
1211: this
1212: .getFinancialDocumentOtherDollarAmount())) {
1213: throw new IllegalArgumentException(
1214: "The requested other dollar amount exceeds the amount in the cash drawer");
1215: } else {
1216: setFinancialDocumentOtherDollarAmount(getFinancialDocumentOtherDollarAmount()
1217: .subtract(
1218: detail
1219: .getFinancialDocumentOtherDollarAmount()));
1220: }
1221: }
1222: }
1223:
1224: /**
1225: * This method takes coin out of the cash drawer
1226: *
1227: * @param detail the record indicating how much coin of each denomination to remove
1228: */
1229: public void removeCoin(CoinDetail detail) {
1230: if (detail.getFinancialDocumentHundredCentAmount() != null) {
1231: if (this .getFinancialDocumentHundredCentAmount() == null
1232: || detail
1233: .getFinancialDocumentHundredCentAmount()
1234: .isGreaterThan(
1235: this
1236: .getFinancialDocumentHundredCentAmount())) {
1237: throw new IllegalArgumentException(
1238: "The requested amount of hundred cent pieces exceeds the amount in the cash drawer");
1239: } else {
1240: setFinancialDocumentHundredCentAmount(getFinancialDocumentHundredCentAmount()
1241: .subtract(
1242: detail
1243: .getFinancialDocumentHundredCentAmount()));
1244: }
1245: }
1246: if (detail.getFinancialDocumentFiftyCentAmount() != null) {
1247: if (this .getFinancialDocumentFiftyCentAmount() == null
1248: || detail
1249: .getFinancialDocumentFiftyCentAmount()
1250: .isGreaterThan(
1251: this
1252: .getFinancialDocumentFiftyCentAmount())) {
1253: throw new IllegalArgumentException(
1254: "The requested amount of fifty cent pieces exceeds the amount in the cash drawer");
1255: } else {
1256: setFinancialDocumentFiftyCentAmount(getFinancialDocumentFiftyCentAmount()
1257: .subtract(
1258: detail
1259: .getFinancialDocumentFiftyCentAmount()));
1260: }
1261: }
1262: if (detail.getFinancialDocumentTwentyFiveCentAmount() != null) {
1263: if (this .getFinancialDocumentTwentyFiveCentAmount() == null
1264: || detail
1265: .getFinancialDocumentTwentyFiveCentAmount()
1266: .isGreaterThan(
1267: this
1268: .getFinancialDocumentTwentyFiveCentAmount())) {
1269: throw new IllegalArgumentException(
1270: "The requested amount of twenty five cent pieces exceeds the amount in the cash drawer");
1271: } else {
1272: setFinancialDocumentTwentyFiveCentAmount(getFinancialDocumentTwentyFiveCentAmount()
1273: .subtract(
1274: detail
1275: .getFinancialDocumentTwentyFiveCentAmount()));
1276: }
1277: }
1278: if (detail.getFinancialDocumentTenCentAmount() != null) {
1279: if (this .getFinancialDocumentTenCentAmount() == null
1280: || detail
1281: .getFinancialDocumentTenCentAmount()
1282: .isGreaterThan(
1283: this
1284: .getFinancialDocumentTenCentAmount())) {
1285: throw new IllegalArgumentException(
1286: "The requested amount of ten cent pieces exceeds the amount in the cash drawer");
1287: } else {
1288: setFinancialDocumentTenCentAmount(getFinancialDocumentTenCentAmount()
1289: .subtract(
1290: detail
1291: .getFinancialDocumentTenCentAmount()));
1292: }
1293: }
1294: if (detail.getFinancialDocumentFiveCentAmount() != null) {
1295: if (this .getFinancialDocumentFiveCentAmount() == null
1296: || detail
1297: .getFinancialDocumentFiveCentAmount()
1298: .isGreaterThan(
1299: this
1300: .getFinancialDocumentFiveCentAmount())) {
1301: throw new IllegalArgumentException(
1302: "The requested amount of five cent pieces exceeds the amount in the cash drawer");
1303: } else {
1304: setFinancialDocumentFiveCentAmount(getFinancialDocumentFiveCentAmount()
1305: .subtract(
1306: detail
1307: .getFinancialDocumentFiveCentAmount()));
1308: }
1309: }
1310: if (detail.getFinancialDocumentOneCentAmount() != null) {
1311: if (this .getFinancialDocumentOneCentAmount() == null
1312: || detail
1313: .getFinancialDocumentOneCentAmount()
1314: .isGreaterThan(
1315: this
1316: .getFinancialDocumentOneCentAmount())) {
1317: throw new IllegalArgumentException(
1318: "The requested amount of one cent pieces exceeds the amount in the cash drawer");
1319: } else {
1320: setFinancialDocumentOneCentAmount(getFinancialDocumentOneCentAmount()
1321: .subtract(
1322: detail
1323: .getFinancialDocumentOneCentAmount()));
1324: }
1325: }
1326: if (detail.getFinancialDocumentOtherCentAmount() != null) {
1327: if (this .getFinancialDocumentOtherCentAmount() == null
1328: || detail
1329: .getFinancialDocumentOtherCentAmount()
1330: .isGreaterThan(
1331: this
1332: .getFinancialDocumentOtherCentAmount())) {
1333: throw new IllegalArgumentException(
1334: "The requested other cent amount exceeds the amount in the cash drawer");
1335: } else {
1336: setFinancialDocumentOtherCentAmount(getFinancialDocumentOtherCentAmount()
1337: .subtract(
1338: detail
1339: .getFinancialDocumentOtherCentAmount()));
1340: }
1341: }
1342: }
1343:
1344: /**
1345: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
1346: */
1347: protected LinkedHashMap toStringMapper() {
1348: LinkedHashMap m = new LinkedHashMap();
1349: m.put("workgroupName", this.workgroupName);
1350: return m;
1351: }
1352: }
|