1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.fp.document.validation.impl;
17
18 import org.kuali.ole.fp.document.CashReceiptDocument;
19 import org.kuali.ole.fp.document.CashReceiptFamilyBase;
20 import org.kuali.ole.sys.OLEConstants;
21 import org.kuali.ole.sys.OLEKeyConstants;
22 import org.kuali.ole.sys.document.validation.RouteNodeValidation;
23 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
24 import org.kuali.rice.krad.util.GlobalVariables;
25
26 public class CashReceiptCashManagerValidation extends RouteNodeValidation {
27
28 private CashReceiptFamilyBase cashReceiptDocumentForValidation;
29
30 @Override
31 public boolean validate(AttributedDocumentEvent event) {
32
33 CashReceiptDocument crDoc = (CashReceiptDocument) getCashReceiptDocumentForValidation();
34 if ((crDoc.getTotalDollarAmount().compareTo(crDoc.getTotalConfirmedCashAmount().add(crDoc.getTotalConfirmedCheckAmount()).add(crDoc.getTotalConfirmedCoinAmount()))) != 0) {
35 GlobalVariables.getMessageMap().putError(OLEConstants.GLOBAL_ERRORS, OLEKeyConstants.CashReceipt.ERROR_CONFIRMED_TOTAL, crDoc.getTotalDollarAmount().toString());
36 return false;
37 }
38
39 return true;
40
41 }
42
43 public CashReceiptFamilyBase getCashReceiptDocumentForValidation() {
44 return cashReceiptDocumentForValidation;
45 }
46
47 public void setCashReceiptDocumentForValidation(CashReceiptFamilyBase cashReceiptDocumentForValidation) {
48 this.cashReceiptDocumentForValidation = cashReceiptDocumentForValidation;
49 }
50
51
52 }