001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * Created on Aug 2, 2004
018: *
019: */
020: package org.kuali.module.pdp.form.paymentsearch;
021:
022: import javax.servlet.http.HttpServletRequest;
023:
024: import org.apache.struts.action.ActionErrors;
025: import org.apache.struts.action.ActionForm;
026: import org.apache.struts.action.ActionMapping;
027: import org.apache.struts.action.ActionMessage;
028: import org.kuali.module.pdp.bo.PaymentDetailSearch;
029: import org.kuali.module.pdp.utilities.DateHandler;
030: import org.kuali.module.pdp.utilities.GeneralUtilities;
031:
032: /**
033: * @author delyea
034: */
035: public class PaymentDetailSearchForm extends ActionForm {
036: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
037: .getLogger(PaymentDetailSearchForm.class);
038:
039: private Boolean advancedSearch;
040: private String custPaymentDocNbr;
041: private String invoiceNbr;
042: private String purchaseOrderNbr;
043: private String payeeName;
044: private String payeeId;
045: private String payeeIdTypeCd;
046: private String disbursementTypeCode;
047: private String paymentStatusCode;
048: private String netPaymentAmount;
049: private String beginDisbursementDate;
050: private String endDisbursementDate;
051: private String beginPaymentDate;
052: private String endPaymentDate;
053: private String disbursementNbr;
054: private String oldDisbursementNbr; // for cancel/reissue disbNbrs showing correctly in list
055: private String pymtAttachment;
056: private String pymtSpecialHandling;
057: private String processImmediate;
058: private String requisitionNbr;
059: private String customerInstitutionNumber;
060: private String processId;
061: private String paymentId;
062: private String chartCode;
063: private String orgCode;
064: private String subUnitCode;
065:
066: /**
067: * @param advancedSearch
068: */
069: public PaymentDetailSearchForm() {
070: this .advancedSearch = new Boolean(false);
071: }
072:
073: public PaymentDetailSearch getPaymentDetailSearch() {
074: PaymentDetailSearch pds = new PaymentDetailSearch();
075:
076: pds.setCustPaymentDocNbr(this .getCustPaymentDocNbr());
077: pds.setDisbursementNbr(GeneralUtilities
078: .convertStringToInteger(this .getDisbursementNbr()));
079: pds.setDisbursementTypeCode(this .getDisbursementTypeCode());
080: pds.setInvoiceNbr(this .getInvoiceNbr());
081: pds.setNetPaymentAmount(GeneralUtilities
082: .convertStringToBigDecimal(this .getNetPaymentAmount()));
083: pds.setPayeeId(this .getPayeeId());
084: pds.setPayeeIdTypeCd(this .getPayeeIdTypeCd());
085: pds.setPayeeName(this .getPayeeName());
086: pds.setPaymentStatusCode(this .getPaymentStatusCode());
087: pds.setPurchaseOrderNbr(this .getPurchaseOrderNbr());
088: pds.setPymtAttachment(this .getPymtAttachment());
089: pds.setPymtSpecialHandling(this .getPymtSpecialHandling());
090: pds.setProcessImmediate(this .getProcessImmediate());
091: pds.setBeginDisbursementDate(GeneralUtilities
092: .convertStringToDate(this .getBeginDisbursementDate()));
093: pds.setEndDisbursementDate(GeneralUtilities
094: .convertStringToDate(this .getEndDisbursementDate()));
095: pds.setBeginPaymentDate(GeneralUtilities
096: .convertStringToDate(this .getBeginPaymentDate()));
097: pds.setEndPaymentDate(GeneralUtilities.convertStringToDate(this
098: .getEndPaymentDate()));
099: pds.setRequisitionNbr(this .getRequisitionNbr());
100: pds.setCustomerInstitutionNumber(this
101: .getCustomerInstitutionNumber());
102: pds.setProcessId(GeneralUtilities.convertStringToInteger(this
103: .getProcessId()));
104: pds.setPaymentId(GeneralUtilities.convertStringToInteger(this
105: .getPaymentId()));
106: pds.setChartCode(this .getChartCode());
107: pds.setOrgCode(this .getOrgCode());
108: pds.setSubUnitCode(this .getSubUnitCode());
109:
110: return pds;
111: }
112:
113: public void clearForm() {
114: this .setCustPaymentDocNbr("");
115: this .disbursementNbr = "";
116: // this.setDisbursementNbr("");
117: this .setDisbursementTypeCode("");
118: this .setInvoiceNbr("");
119: this .setNetPaymentAmount("");
120: this .setPayeeId("");
121: this .setPayeeIdTypeCd("");
122: this .setPayeeName("");
123: this .setPaymentStatusCode("");
124: this .setPurchaseOrderNbr("");
125: this .setPymtAttachment("");
126: this .setPymtSpecialHandling("");
127: this .setProcessImmediate("");
128: this .setBeginDisbursementDate("");
129: this .setEndDisbursementDate("");
130: this .setBeginPaymentDate("");
131: this .setEndPaymentDate("");
132: this .advancedSearch = new Boolean(false);
133: this .setRequisitionNbr("");
134: this .setCustomerInstitutionNumber("");
135: this .setProcessId("");
136: this .setPaymentId("");
137: this .setChartCode("");
138: this .setOrgCode("");
139: this .setSubUnitCode("");
140: }
141:
142: public ActionErrors validate(ActionMapping mapping,
143: HttpServletRequest request) {
144: LOG.debug("Entered validate().");
145: // create instance of ActionErrors to send errors to user
146: ActionErrors actionErrors = new ActionErrors();
147: String buttonPressed = GeneralUtilities
148: .whichButtonWasPressed(request);
149:
150: if (buttonPressed.startsWith("btnSearch")) {
151: if ((GeneralUtilities.isStringEmpty(this .custPaymentDocNbr))
152: && (GeneralUtilities.isStringEmpty(this .invoiceNbr))
153: && (GeneralUtilities
154: .isStringEmpty(this .purchaseOrderNbr))
155: && (GeneralUtilities.isStringEmpty(this .processId))
156: && (GeneralUtilities.isStringEmpty(this .paymentId))
157: && (GeneralUtilities.isStringEmpty(this .payeeName))
158: && (GeneralUtilities.isStringEmpty(this .payeeId))
159: && (GeneralUtilities
160: .isStringEmpty(this .payeeIdTypeCd))
161: && (GeneralUtilities
162: .isStringEmpty(this .disbursementTypeCode))
163: && (GeneralUtilities
164: .isStringEmpty(this .paymentStatusCode))
165: && (GeneralUtilities
166: .isStringEmpty(this .netPaymentAmount))
167: && (GeneralUtilities
168: .isStringEmpty(this .beginDisbursementDate))
169: && (GeneralUtilities
170: .isStringEmpty(this .endDisbursementDate))
171: && (GeneralUtilities
172: .isStringEmpty(this .beginPaymentDate))
173: && (GeneralUtilities
174: .isStringEmpty(this .endPaymentDate))
175: && (GeneralUtilities
176: .isStringEmpty(this .disbursementNbr))
177: && (GeneralUtilities.isStringEmpty(this .chartCode))
178: && (GeneralUtilities.isStringEmpty(this .orgCode))
179: && (GeneralUtilities
180: .isStringEmpty(this .subUnitCode))
181: && (GeneralUtilities
182: .isStringEmpty(this .requisitionNbr))
183: && (GeneralUtilities
184: .isStringEmpty(this .customerInstitutionNumber))
185: && (GeneralUtilities
186: .isStringEmpty(this .pymtAttachment))
187: && (GeneralUtilities
188: .isStringEmpty(this .processImmediate))
189: && (GeneralUtilities
190: .isStringEmpty(this .pymtSpecialHandling))) {
191:
192: actionErrors
193: .add(
194: "errors",
195: new ActionMessage(
196: "paymentDetailSearchForm.criteria.noneEntered"));
197: } else {
198:
199: if (!(GeneralUtilities.isStringEmpty(this .chartCode))) {
200: this .chartCode = this .chartCode.toUpperCase();
201: }
202: if (!(GeneralUtilities.isStringEmpty(this .orgCode))) {
203: this .orgCode = this .orgCode.toUpperCase();
204: }
205: if (!(GeneralUtilities.isStringEmpty(this .subUnitCode))) {
206: this .subUnitCode = this .subUnitCode.toUpperCase();
207: }
208: if (!(GeneralUtilities
209: .isStringEmpty(this .beginPaymentDate))) {
210: actionErrors = DateHandler.validDate(actionErrors,
211: "errors", this .beginPaymentDate);
212: }
213: if (!(GeneralUtilities
214: .isStringEmpty(this .endPaymentDate))) {
215: actionErrors = DateHandler.validDate(actionErrors,
216: "errors", this .endPaymentDate);
217: }
218: if (!(GeneralUtilities
219: .isStringEmpty(this .beginDisbursementDate))) {
220: actionErrors = DateHandler.validDate(actionErrors,
221: "errors", this .beginDisbursementDate);
222: }
223: if (!(GeneralUtilities
224: .isStringEmpty(this .endDisbursementDate))) {
225: actionErrors = DateHandler.validDate(actionErrors,
226: "errors", this .endDisbursementDate);
227: }
228: if ((!(GeneralUtilities
229: .isStringEmpty(this .disbursementNbr)))
230: && (!(GeneralUtilities
231: .isStringAllNumbers(this .disbursementNbr)))) {
232: actionErrors
233: .add(
234: "errors",
235: new ActionMessage(
236: "paymentDetailSearchForm.disbursementNbr.invalid"));
237: }
238: if ((!(GeneralUtilities.isStringEmpty(this .processId)))
239: && (!(GeneralUtilities
240: .isStringAllNumbers(this .processId)))) {
241: actionErrors
242: .add(
243: "errors",
244: new ActionMessage(
245: "paymentDetailSearchForm.processId.invalid"));
246: }
247: if ((!(GeneralUtilities.isStringEmpty(this .paymentId)))
248: && (!(GeneralUtilities
249: .isStringAllNumbers(this .paymentId)))) {
250: actionErrors
251: .add(
252: "errors",
253: new ActionMessage(
254: "paymentDetailSearchForm.paymentId.invalid"));
255: }
256: if ((!(GeneralUtilities
257: .isStringEmpty(this .netPaymentAmount)))
258: && (!(GeneralUtilities
259: .isStringAllNumbersOrASingleCharacter(
260: this .netPaymentAmount, '.')))) {
261: actionErrors
262: .add(
263: "errors",
264: new ActionMessage(
265: "paymentDetailSearchForm.netPaymentAmount.invalid"));
266: }
267: if ((!(GeneralUtilities.isStringEmpty(this .payeeId)))
268: && (GeneralUtilities
269: .isStringEmpty(this .payeeIdTypeCd))) {
270: actionErrors
271: .add(
272: "errors",
273: new ActionMessage(
274: "paymentDetailSearchForm.payeeIdTypeCd.nullWithPayeeId"));
275: }
276: if ((GeneralUtilities.isStringEmpty(this .payeeId))
277: && (!(GeneralUtilities
278: .isStringEmpty(this .payeeIdTypeCd)))) {
279: actionErrors
280: .add(
281: "errors",
282: new ActionMessage(
283: "paymentDetailSearchForm.payeeId.nullWithPayeeIdTypeCd"));
284: }
285:
286: if (!(GeneralUtilities
287: .isStringEmpty(this .custPaymentDocNbr))) {
288: if (this .custPaymentDocNbr.length() < 2) {
289: actionErrors
290: .add(
291: "errors",
292: new ActionMessage(
293: "paymentDetailSearchForm.custPaymentDocNbr.lessThan2Chars"));
294: }
295: }
296: if (!(GeneralUtilities.isStringEmpty(this .invoiceNbr))) {
297: if (this .invoiceNbr.length() < 2) {
298: actionErrors
299: .add(
300: "errors",
301: new ActionMessage(
302: "paymentDetailSearchForm.invoiceNbr.lessThan2Chars"));
303: }
304: }
305: if (!(GeneralUtilities
306: .isStringEmpty(this .requisitionNbr))) {
307: if (this .requisitionNbr.length() < 2) {
308: actionErrors
309: .add(
310: "errors",
311: new ActionMessage(
312: "paymentDetailSearchForm.requisitionNbr.lessThan2Chars"));
313: }
314: }
315: if (!(GeneralUtilities
316: .isStringEmpty(this .purchaseOrderNbr))) {
317: if (this .purchaseOrderNbr.length() < 2) {
318: actionErrors
319: .add(
320: "errors",
321: new ActionMessage(
322: "paymentDetailSearchForm.purchaseOrderNbr.lessThan2Chars"));
323: }
324: }
325: if (!(GeneralUtilities.isStringEmpty(this .payeeName))) {
326: if (this .payeeName.length() < 2) {
327: actionErrors
328: .add(
329: "errors",
330: new ActionMessage(
331: "paymentDetailSearchForm.payeeName.lessThan2Chars"));
332: }
333: }
334: }
335:
336: if (actionErrors.size() > 0) {
337: // Individual Search Variables in Session
338: request.getSession().removeAttribute(
339: "indivSearchResults");
340: request.getSession().removeAttribute(
341: "PaymentDetailSearchFormSession");
342:
343: // Batch Search Variables in Session
344: request.getSession().removeAttribute(
345: "batchSearchResults");
346: request.getSession().removeAttribute(
347: "batchIndivSearchResults");
348: request.getSession().removeAttribute("BatchDetail");
349: request.getSession().removeAttribute(
350: "BatchSearchFormSession");
351:
352: }
353: }
354:
355: LOG.debug("Exiting validate() There were "
356: + actionErrors.size() + " ActionMessages found.");
357: return actionErrors;
358: }
359:
360: /**
361: * @return Returns the custPaymentDocNbr.
362: */
363: public String getCustPaymentDocNbr() {
364: return custPaymentDocNbr;
365: }
366:
367: /**
368: * @return Returns the disbursementNbr.
369: */
370: public String getDisbursementNbr() {
371: return disbursementNbr;
372: }
373:
374: /**
375: * @return Returns the invoiceNbr.
376: */
377: public String getInvoiceNbr() {
378: return invoiceNbr;
379: }
380:
381: /**
382: * @return Returns the netPaymentAmount.
383: */
384: public String getNetPaymentAmount() {
385: return netPaymentAmount;
386: }
387:
388: /**
389: * @return Returns the payeeId.
390: */
391: public String getPayeeId() {
392: return payeeId;
393: }
394:
395: /**
396: * @return Returns the payeeIdTypeCd.
397: */
398: public String getPayeeIdTypeCd() {
399: return payeeIdTypeCd;
400: }
401:
402: /**
403: * @return Returns the payeeName.
404: */
405: public String getPayeeName() {
406: return payeeName;
407: }
408:
409: /**
410: * @return Returns the purchaseOrderNbr.
411: */
412: public String getPurchaseOrderNbr() {
413: return purchaseOrderNbr;
414: }
415:
416: /**
417: * @return Returns the pymtAttachment.
418: */
419: public String getPymtAttachment() {
420: return pymtAttachment;
421: }
422:
423: /**
424: * @param custPaymentDocNbr The custPaymentDocNbr to set.
425: */
426: public void setCustPaymentDocNbr(String custPaymentDocNbr) {
427: this .custPaymentDocNbr = custPaymentDocNbr;
428: }
429:
430: /**
431: * @param disbursementNbr The disbursementNbr to set.
432: */
433: public void setDisbursementNbr(String disbursementNbr) {
434: this .disbursementNbr = disbursementNbr;
435: if (!(GeneralUtilities.isStringEmpty(disbursementNbr))) {
436: setOldDisbursementNbr(disbursementNbr);
437: }
438: }
439:
440: /**
441: * @param invoiceNbr The invoiceNbr to set.
442: */
443: public void setInvoiceNbr(String invoiceNbr) {
444: this .invoiceNbr = invoiceNbr;
445: }
446:
447: /**
448: * @param netPaymentAmount The netPaymentAmount to set.
449: */
450: public void setNetPaymentAmount(String netPaymentAmount) {
451: this .netPaymentAmount = netPaymentAmount;
452: }
453:
454: /**
455: * @param payeeId The payeeId to set.
456: */
457: public void setPayeeId(String payeeId) {
458: this .payeeId = payeeId;
459: }
460:
461: /**
462: * @param payeeIdTypeCd The payeeIdTypeCd to set.
463: */
464: public void setPayeeIdTypeCd(String payeeIdTypeCd) {
465: this .payeeIdTypeCd = payeeIdTypeCd;
466: }
467:
468: /**
469: * @param payeeName The payeeName to set.
470: */
471: public void setPayeeName(String payeeName) {
472: this .payeeName = payeeName;
473: }
474:
475: /**
476: * @param purchaseOrderNbr The purchaseOrderNbr to set.
477: */
478: public void setPurchaseOrderNbr(String purchaseOrderNbr) {
479: this .purchaseOrderNbr = purchaseOrderNbr;
480: }
481:
482: /**
483: * @param pymtAttachment The pymtAttachment to set.
484: */
485: public void setPymtAttachment(String pymtAttachment) {
486: this .pymtAttachment = pymtAttachment;
487: }
488:
489: /**
490: * @return Returns the disbursementTypeCode.
491: */
492: public String getDisbursementTypeCode() {
493: return disbursementTypeCode;
494: }
495:
496: /**
497: * @return Returns the paymentStatusCode.
498: */
499: public String getPaymentStatusCode() {
500: return paymentStatusCode;
501: }
502:
503: /**
504: * @param disbursementTypeCode The disbursementTypeCode to set.
505: */
506: public void setDisbursementTypeCode(String disbursementTypeCode) {
507: this .disbursementTypeCode = disbursementTypeCode;
508: }
509:
510: /**
511: * @param paymentStatusCode The paymentStatusCode to set.
512: */
513: public void setPaymentStatusCode(String paymentStatusCode) {
514: this .paymentStatusCode = paymentStatusCode;
515: }
516:
517: /**
518: * @return Returns the advancedSearch.
519: */
520: public Boolean getAdvancedSearch() {
521: return advancedSearch;
522: }
523:
524: /**
525: * @param advancedSearch The advancedSearch to set.
526: */
527: public void setAdvancedSearch(Boolean advancedSearch) {
528: this .advancedSearch = advancedSearch;
529: }
530:
531: /**
532: * @param advancedSearch The advancedSearch to set.
533: */
534: public void changeAdvancedSearch() {
535: if (advancedSearch.booleanValue()) {
536: this .advancedSearch = new Boolean(false);
537: } else {
538: this .advancedSearch = new Boolean(true);
539: }
540: }
541:
542: /**
543: * @return Returns the chartCode.
544: */
545: public String getChartCode() {
546: return chartCode;
547: }
548:
549: /**
550: * @return Returns the orgCode.
551: */
552: public String getOrgCode() {
553: return orgCode;
554: }
555:
556: /**
557: * @return Returns the subUnitCode.
558: */
559: public String getSubUnitCode() {
560: return subUnitCode;
561: }
562:
563: /**
564: * @param chartCode The chartCode to set.
565: */
566: public void setChartCode(String chartCode) {
567: this .chartCode = chartCode;
568: }
569:
570: /**
571: * @param orgCode The orgCode to set.
572: */
573: public void setOrgCode(String orgCode) {
574: this .orgCode = orgCode;
575: }
576:
577: /**
578: * @param subUnitCode The subUnitCode to set.
579: */
580: public void setSubUnitCode(String subUnitCode) {
581: this .subUnitCode = subUnitCode;
582: }
583:
584: /**
585: * @return Returns the beginDisbursementDate.
586: */
587: public String getBeginDisbursementDate() {
588: return beginDisbursementDate;
589: }
590:
591: /**
592: * @return Returns the beginPaymentDate.
593: */
594: public String getBeginPaymentDate() {
595: return beginPaymentDate;
596: }
597:
598: /**
599: * @return Returns the endDisbursementDate.
600: */
601: public String getEndDisbursementDate() {
602: return endDisbursementDate;
603: }
604:
605: /**
606: * @return Returns the endPaymentDate.
607: */
608: public String getEndPaymentDate() {
609: return endPaymentDate;
610: }
611:
612: /**
613: * @param beginDisbursementDate The beginDisbursementDate to set.
614: */
615: public void setBeginDisbursementDate(String beginDisbursementDate) {
616: this .beginDisbursementDate = beginDisbursementDate;
617: }
618:
619: /**
620: * @param beginPaymentDate The beginPaymentDate to set.
621: */
622: public void setBeginPaymentDate(String beginPaymentDate) {
623: this .beginPaymentDate = beginPaymentDate;
624: }
625:
626: /**
627: * @param endDisbursementDate The endDisbursementDate to set.
628: */
629: public void setEndDisbursementDate(String endDisbursementDate) {
630: this .endDisbursementDate = endDisbursementDate;
631: }
632:
633: /**
634: * @param endPaymentDate The endPaymentDate to set.
635: */
636: public void setEndPaymentDate(String endPaymentDate) {
637: this .endPaymentDate = endPaymentDate;
638: }
639:
640: /**
641: * @return Returns the iuIdForCustomer.
642: */
643: public String getCustomerInstitutionNumber() {
644: return customerInstitutionNumber;
645: }
646:
647: /**
648: * @return Returns the requisitionNbr.
649: */
650: public String getRequisitionNbr() {
651: return requisitionNbr;
652: }
653:
654: /**
655: * @param iuIdForCustomer The iuIdForCustomer to set.
656: */
657: public void setCustomerInstitutionNumber(String iuIdForCustomer) {
658: this .customerInstitutionNumber = iuIdForCustomer;
659: }
660:
661: /**
662: * @param requisitionNbr The requisitionNbr to set.
663: */
664: public void setRequisitionNbr(String requisitionNbr) {
665: this .requisitionNbr = requisitionNbr;
666: }
667:
668: /**
669: * @return Returns the processId.
670: */
671: public String getProcessId() {
672: return processId;
673: }
674:
675: /**
676: * @param procId The processId to set.
677: */
678: public void setProcessId(String processId) {
679: this .processId = processId;
680: }
681:
682: /**
683: * @return Returns the pymtSpecialHandling.
684: */
685: public String getPymtSpecialHandling() {
686: return pymtSpecialHandling;
687: }
688:
689: /**
690: * @param pymtSpecialHandling The pymtSpecialHandling to set.
691: */
692: public void setPymtSpecialHandling(String pymtSpecialHandling) {
693: this .pymtSpecialHandling = pymtSpecialHandling;
694: }
695:
696: /**
697: * @return Returns the paymentId.
698: */
699: public String getPaymentId() {
700: return paymentId;
701: }
702:
703: /**
704: * @param paymentId The paymentId to set.
705: */
706: public void setPaymentId(String paymentId) {
707: this .paymentId = paymentId;
708: }
709:
710: public String getProcessImmediate() {
711: return processImmediate;
712: }
713:
714: public void setProcessImmediate(String processImmediate) {
715: this .processImmediate = processImmediate;
716: }
717:
718: public String getOldDisbursementNbr() {
719: return oldDisbursementNbr;
720: }
721:
722: public void setOldDisbursementNbr(String oldDisbursementNbr) {
723: this.oldDisbursementNbr = oldDisbursementNbr;
724: }
725: }
|