0001: /*
0002: * Copyright 2005-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.document;
0018:
0019: import java.sql.Date;
0020: import java.sql.Timestamp;
0021: import java.util.ArrayList;
0022: import java.util.Calendar;
0023: import java.util.List;
0024: import java.util.Map;
0025:
0026: import org.apache.commons.lang.StringUtils;
0027: import org.kuali.core.bo.DocumentHeader;
0028: import org.kuali.core.bo.user.UniversalUser;
0029: import org.kuali.core.document.AmountTotaling;
0030: import org.kuali.core.document.Copyable;
0031: import org.kuali.core.service.BusinessObjectService;
0032: import org.kuali.core.service.DateTimeService;
0033: import org.kuali.core.service.KualiConfigurationService;
0034: import org.kuali.core.service.KualiRuleService;
0035: import org.kuali.core.service.PersistenceService;
0036: import org.kuali.core.util.GlobalVariables;
0037: import org.kuali.core.util.KualiDecimal;
0038: import org.kuali.core.util.ObjectUtils;
0039: import org.kuali.kfs.KFSConstants;
0040: import org.kuali.kfs.KFSKeyConstants;
0041: import org.kuali.kfs.bo.AccountingLineParser;
0042: import org.kuali.kfs.bo.GeneralLedgerPendingEntry;
0043: import org.kuali.kfs.context.SpringContext;
0044: import org.kuali.kfs.document.AccountingDocumentBase;
0045: import org.kuali.kfs.service.ParameterService;
0046: import org.kuali.module.chart.bo.ChartUser;
0047: import org.kuali.module.chart.service.ObjectTypeService;
0048: import org.kuali.module.financial.bo.BasicFormatWithLineDescriptionAccountingLineParser;
0049: import org.kuali.module.financial.bo.DisbursementVoucherDocumentationLocation;
0050: import org.kuali.module.financial.bo.DisbursementVoucherNonEmployeeTravel;
0051: import org.kuali.module.financial.bo.DisbursementVoucherNonResidentAlienTax;
0052: import org.kuali.module.financial.bo.DisbursementVoucherPayeeDetail;
0053: import org.kuali.module.financial.bo.DisbursementVoucherPreConferenceDetail;
0054: import org.kuali.module.financial.bo.DisbursementVoucherPreConferenceRegistrant;
0055: import org.kuali.module.financial.bo.DisbursementVoucherWireTransfer;
0056: import org.kuali.module.financial.bo.Payee;
0057: import org.kuali.module.financial.lookup.keyvalues.DisbursementVoucherDocumentationLocationValuesFinder;
0058: import org.kuali.module.financial.lookup.keyvalues.PaymentMethodValuesFinder;
0059: import org.kuali.module.financial.rules.DisbursementVoucherDocumentRule;
0060: import org.kuali.module.financial.rules.DisbursementVoucherRuleConstants;
0061: import org.kuali.module.financial.service.DisbursementVoucherTaxService;
0062: import org.kuali.module.financial.service.FlexibleOffsetAccountService;
0063:
0064: import edu.iu.uis.eden.exception.WorkflowException;
0065:
0066: /**
0067: * This is the business object that represents the DisbursementVoucher document in Kuali.
0068: */
0069: public class DisbursementVoucherDocument extends AccountingDocumentBase
0070: implements Copyable, AmountTotaling {
0071: public final static String DISBURSEMENT_VOUCHER_DOCUMENT_TYPE = "DV";
0072:
0073: private Integer finDocNextRegistrantLineNbr;
0074: private String disbVchrContactPersonName;
0075: private String disbVchrContactPhoneNumber;
0076: private String disbVchrContactEmailId;
0077: private Date disbursementVoucherDueDate;
0078: private boolean disbVchrAttachmentCode;
0079: private boolean disbVchrSpecialHandlingCode;
0080: private KualiDecimal disbVchrCheckTotalAmount;
0081: private boolean disbVchrForeignCurrencyInd;
0082: private String disbursementVoucherDocumentationLocationCode;
0083: private String disbVchrCheckStubText;
0084: private boolean dvCheckStubOverflowCode;
0085: private String campusCode;
0086: private String disbVchrPayeeTaxControlCode;
0087: private boolean disbVchrPayeeChangedInd;
0088: private String disbursementVoucherCheckNbr;
0089: private Timestamp disbursementVoucherCheckDate;
0090: private boolean disbVchrPayeeW9CompleteCode;
0091: private String disbVchrPaymentMethodCode;
0092: private boolean exceptionIndicator;
0093: private Date extractDate;
0094: private Date paidDate;
0095: private Date cancelDate;
0096:
0097: private DocumentHeader financialDocument;
0098: private DisbursementVoucherDocumentationLocation disbVchrDocumentationLoc;
0099: private DisbursementVoucherNonEmployeeTravel dvNonEmployeeTravel;
0100: private DisbursementVoucherNonResidentAlienTax dvNonResidentAlienTax;
0101: private DisbursementVoucherPayeeDetail dvPayeeDetail;
0102: private DisbursementVoucherPreConferenceDetail dvPreConferenceDetail;
0103: private DisbursementVoucherWireTransfer dvWireTransfer;
0104:
0105: /**
0106: * Default no-arg constructor.
0107: */
0108: public DisbursementVoucherDocument() {
0109: super ();
0110: exceptionIndicator = false;
0111: finDocNextRegistrantLineNbr = new Integer(1);
0112: dvNonEmployeeTravel = new DisbursementVoucherNonEmployeeTravel();
0113: dvNonResidentAlienTax = new DisbursementVoucherNonResidentAlienTax();
0114: dvPayeeDetail = new DisbursementVoucherPayeeDetail();
0115: dvPreConferenceDetail = new DisbursementVoucherPreConferenceDetail();
0116: dvWireTransfer = new DisbursementVoucherWireTransfer();
0117: disbVchrCheckTotalAmount = new KualiDecimal(0);
0118: }
0119:
0120: /**
0121: * @see org.kuali.kfs.document.AccountingDocumentBase#getPendingLedgerEntriesForSufficientFundsChecking()
0122: */
0123: @Override
0124: public List<GeneralLedgerPendingEntry> getPendingLedgerEntriesForSufficientFundsChecking() {
0125: List<GeneralLedgerPendingEntry> ples = new ArrayList();
0126:
0127: KualiConfigurationService kualiConfigurationService = SpringContext
0128: .getBean(KualiConfigurationService.class);
0129: FlexibleOffsetAccountService flexibleOffsetAccountService = SpringContext
0130: .getBean(FlexibleOffsetAccountService.class);
0131:
0132: ObjectTypeService objectTypeService = (ObjectTypeService) SpringContext
0133: .getBean(ObjectTypeService.class);
0134:
0135: for (GeneralLedgerPendingEntry ple : this
0136: .getGeneralLedgerPendingEntries()) {
0137: List<String> expenseObjectTypes = objectTypeService
0138: .getExpenseObjectTypes(ple
0139: .getUniversityFiscalYear());
0140: if (expenseObjectTypes.contains(ple
0141: .getFinancialObjectTypeCode())) {
0142: // is an expense object type, keep checking
0143: ple.refreshNonUpdateableReferences();
0144: if (ple.getAccount()
0145: .isPendingAcctSufficientFundsIndicator()
0146: && ple
0147: .getAccount()
0148: .getAccountSufficientFundsCode()
0149: .equals(
0150: KFSConstants.SF_TYPE_CASH_AT_ACCOUNT)) {
0151: // is a cash account
0152: if (flexibleOffsetAccountService
0153: .getByPrimaryIdIfEnabled(ple
0154: .getChartOfAccountsCode(), ple
0155: .getAccountNumber(), ple.getChart()
0156: .getFinancialCashObjectCode()) == null
0157: && flexibleOffsetAccountService
0158: .getByPrimaryIdIfEnabled(
0159: ple
0160: .getChartOfAccountsCode(),
0161: ple.getAccountNumber(),
0162: ple
0163: .getChart()
0164: .getFinAccountsPayableObjectCode()) == null) {
0165: // does not have a flexible offset for cash or liability, set the object code to cash and add to list of
0166: // PLEs to check for SF
0167:
0168: ple = (GeneralLedgerPendingEntry) ObjectUtils
0169: .deepCopy(ple);
0170: ple.setFinancialObjectCode(ple.getChart()
0171: .getFinancialCashObjectCode());
0172: ple
0173: .setTransactionDebitCreditCode(ple
0174: .getTransactionDebitCreditCode()
0175: .equals(
0176: KFSConstants.GL_DEBIT_CODE) ? KFSConstants.GL_CREDIT_CODE
0177: : KFSConstants.GL_DEBIT_CODE);
0178: ples.add(ple);
0179: }
0180:
0181: } else {
0182: // is not a cash account, process as normal
0183: ples.add(ple);
0184: }
0185: }
0186: }
0187:
0188: return ples;
0189: }
0190:
0191: /**
0192: * Gets the finDocNextRegistrantLineNbr attribute.
0193: *
0194: * @return Returns the finDocNextRegistrantLineNbr
0195: */
0196: public Integer getFinDocNextRegistrantLineNbr() {
0197: return finDocNextRegistrantLineNbr;
0198: }
0199:
0200: /**
0201: * Sets the finDocNextRegistrantLineNbr attribute.
0202: *
0203: * @param finDocNextRegistrantLineNbr The finDocNextRegistrantLineNbr to set.
0204: */
0205: public void setFinDocNextRegistrantLineNbr(
0206: Integer finDocNextRegistrantLineNbr) {
0207: this .finDocNextRegistrantLineNbr = finDocNextRegistrantLineNbr;
0208: }
0209:
0210: /**
0211: * Gets the disbVchrContactPersonName attribute.
0212: *
0213: * @return Returns the disbVchrContactPersonName
0214: */
0215: public String getDisbVchrContactPersonName() {
0216: return disbVchrContactPersonName;
0217: }
0218:
0219: /**
0220: * Sets the disbVchrContactPersonName attribute.
0221: *
0222: * @param disbVchrContactPersonName The disbVchrContactPersonName to set.
0223: */
0224: public void setDisbVchrContactPersonName(
0225: String disbVchrContactPersonName) {
0226: this .disbVchrContactPersonName = disbVchrContactPersonName;
0227: }
0228:
0229: /**
0230: * Gets the disbVchrContactPhoneNumber attribute.
0231: *
0232: * @return Returns the disbVchrContactPhoneNumber
0233: */
0234: public String getDisbVchrContactPhoneNumber() {
0235: return disbVchrContactPhoneNumber;
0236: }
0237:
0238: /**
0239: * Sets the disbVchrContactPhoneNumber attribute.
0240: *
0241: * @param disbVchrContactPhoneNumber The disbVchrContactPhoneNumber to set.
0242: */
0243: public void setDisbVchrContactPhoneNumber(
0244: String disbVchrContactPhoneNumber) {
0245: this .disbVchrContactPhoneNumber = disbVchrContactPhoneNumber;
0246: }
0247:
0248: /**
0249: * Gets the disbVchrContactEmailId attribute.
0250: *
0251: * @return Returns the disbVchrContactEmailId
0252: */
0253: public String getDisbVchrContactEmailId() {
0254: return disbVchrContactEmailId;
0255: }
0256:
0257: /**
0258: * Sets the disbVchrContactEmailId attribute.
0259: *
0260: * @param disbVchrContactEmailId The disbVchrContactEmailId to set.
0261: */
0262: public void setDisbVchrContactEmailId(String disbVchrContactEmailId) {
0263: this .disbVchrContactEmailId = disbVchrContactEmailId;
0264: }
0265:
0266: /**
0267: * Gets the disbursementVoucherDueDate attribute.
0268: *
0269: * @return Returns the disbursementVoucherDueDate
0270: */
0271: public Date getDisbursementVoucherDueDate() {
0272: return disbursementVoucherDueDate;
0273: }
0274:
0275: /**
0276: * Sets the disbursementVoucherDueDate attribute.
0277: *
0278: * @param disbursementVoucherDueDate The disbursementVoucherDueDate to set.
0279: */
0280: public void setDisbursementVoucherDueDate(
0281: Date disbursementVoucherDueDate) {
0282: this .disbursementVoucherDueDate = disbursementVoucherDueDate;
0283: }
0284:
0285: /**
0286: * Gets the disbVchrAttachmentCode attribute.
0287: *
0288: * @return Returns the disbVchrAttachmentCode
0289: */
0290: public boolean isDisbVchrAttachmentCode() {
0291: return disbVchrAttachmentCode;
0292: }
0293:
0294: /**
0295: * Sets the disbVchrAttachmentCode attribute.
0296: *
0297: * @param disbVchrAttachmentCode The disbVchrAttachmentCode to set.
0298: */
0299: public void setDisbVchrAttachmentCode(boolean disbVchrAttachmentCode) {
0300: this .disbVchrAttachmentCode = disbVchrAttachmentCode;
0301: }
0302:
0303: /**
0304: * Gets the disbVchrSpecialHandlingCode attribute.
0305: *
0306: * @return Returns the disbVchrSpecialHandlingCode
0307: */
0308: public boolean isDisbVchrSpecialHandlingCode() {
0309: return disbVchrSpecialHandlingCode;
0310: }
0311:
0312: /**
0313: * Sets the disbVchrSpecialHandlingCode attribute.
0314: *
0315: * @param disbVchrSpecialHandlingCode The disbVchrSpecialHandlingCode to set.
0316: */
0317: public void setDisbVchrSpecialHandlingCode(
0318: boolean disbVchrSpecialHandlingCode) {
0319: this .disbVchrSpecialHandlingCode = disbVchrSpecialHandlingCode;
0320: }
0321:
0322: /**
0323: * Gets the disbVchrCheckTotalAmount attribute.
0324: *
0325: * @return Returns the disbVchrCheckTotalAmount
0326: */
0327: public KualiDecimal getDisbVchrCheckTotalAmount() {
0328: return disbVchrCheckTotalAmount;
0329: }
0330:
0331: /**
0332: * Sets the disbVchrCheckTotalAmount attribute.
0333: *
0334: * @param disbVchrCheckTotalAmount The disbVchrCheckTotalAmount to set.
0335: */
0336: public void setDisbVchrCheckTotalAmount(
0337: KualiDecimal disbVchrCheckTotalAmount) {
0338: if (disbVchrCheckTotalAmount != null) {
0339: this .disbVchrCheckTotalAmount = disbVchrCheckTotalAmount;
0340: }
0341: }
0342:
0343: /**
0344: * Gets the disbVchrForeignCurrencyInd attribute.
0345: *
0346: * @return Returns the disbVchrForeignCurrencyInd
0347: */
0348: public boolean isDisbVchrForeignCurrencyInd() {
0349: return disbVchrForeignCurrencyInd;
0350: }
0351:
0352: /**
0353: * Sets the disbVchrForeignCurrencyInd attribute.
0354: *
0355: * @param disbVchrForeignCurrencyInd The disbVchrForeignCurrencyInd to set.
0356: */
0357: public void setDisbVchrForeignCurrencyInd(
0358: boolean disbVchrForeignCurrencyInd) {
0359: this .disbVchrForeignCurrencyInd = disbVchrForeignCurrencyInd;
0360: }
0361:
0362: /**
0363: * Gets the disbursementVoucherDocumentationLocationCode attribute.
0364: *
0365: * @return Returns the disbursementVoucherDocumentationLocationCode
0366: */
0367: public String getDisbursementVoucherDocumentationLocationCode() {
0368: return disbursementVoucherDocumentationLocationCode;
0369: }
0370:
0371: /**
0372: * Sets the disbursementVoucherDocumentationLocationCode attribute.
0373: *
0374: * @param disbursementVoucherDocumentationLocationCode The disbursementVoucherDocumentationLocationCode to set.
0375: */
0376: public void setDisbursementVoucherDocumentationLocationCode(
0377: String disbursementVoucherDocumentationLocationCode) {
0378: this .disbursementVoucherDocumentationLocationCode = disbursementVoucherDocumentationLocationCode;
0379: }
0380:
0381: /**
0382: * Gets the disbVchrCheckStubText attribute.
0383: *
0384: * @return Returns the disbVchrCheckStubText
0385: */
0386: public String getDisbVchrCheckStubText() {
0387: return disbVchrCheckStubText;
0388: }
0389:
0390: /**
0391: * Sets the disbVchrCheckStubText attribute.
0392: *
0393: * @param disbVchrCheckStubText The disbVchrCheckStubText to set.
0394: */
0395: public void setDisbVchrCheckStubText(String disbVchrCheckStubText) {
0396: this .disbVchrCheckStubText = disbVchrCheckStubText;
0397: }
0398:
0399: /**
0400: * Gets the dvCheckStubOverflowCode attribute.
0401: *
0402: * @return Returns the dvCheckStubOverflowCode
0403: */
0404: public boolean getDvCheckStubOverflowCode() {
0405: return dvCheckStubOverflowCode;
0406: }
0407:
0408: /**
0409: * Sets the dvCheckStubOverflowCode attribute.
0410: *
0411: * @param dvCheckStubOverflowCode The dvCheckStubOverflowCode to set.
0412: */
0413: public void setDvCheckStubOverflowCode(
0414: boolean dvCheckStubOverflowCode) {
0415: this .dvCheckStubOverflowCode = dvCheckStubOverflowCode;
0416: }
0417:
0418: /**
0419: * Gets the campusCode attribute.
0420: *
0421: * @return Returns the campusCode
0422: */
0423: public String getCampusCode() {
0424: return campusCode;
0425: }
0426:
0427: /**
0428: * Sets the campusCode attribute.
0429: *
0430: * @param campusCode The campusCode to set.
0431: */
0432: public void setCampusCode(String campusCode) {
0433: this .campusCode = campusCode;
0434: }
0435:
0436: /**
0437: * Gets the disbVchrPayeeTaxControlCode attribute.
0438: *
0439: * @return Returns the disbVchrPayeeTaxControlCode
0440: */
0441: public String getDisbVchrPayeeTaxControlCode() {
0442: return disbVchrPayeeTaxControlCode;
0443: }
0444:
0445: /**
0446: * Sets the disbVchrPayeeTaxControlCode attribute.
0447: *
0448: * @param disbVchrPayeeTaxControlCode The disbVchrPayeeTaxControlCode to set.
0449: */
0450: public void setDisbVchrPayeeTaxControlCode(
0451: String disbVchrPayeeTaxControlCode) {
0452: this .disbVchrPayeeTaxControlCode = disbVchrPayeeTaxControlCode;
0453: }
0454:
0455: /**
0456: * Gets the disbVchrPayeeChangedInd attribute.
0457: *
0458: * @return Returns the disbVchrPayeeChangedInd
0459: */
0460: public boolean isDisbVchrPayeeChangedInd() {
0461: return disbVchrPayeeChangedInd;
0462: }
0463:
0464: /**
0465: * Sets the disbVchrPayeeChangedInd attribute.
0466: *
0467: * @param disbVchrPayeeChangedInd The disbVchrPayeeChangedInd to set.
0468: */
0469: public void setDisbVchrPayeeChangedInd(
0470: boolean disbVchrPayeeChangedInd) {
0471: this .disbVchrPayeeChangedInd = disbVchrPayeeChangedInd;
0472: }
0473:
0474: /**
0475: * Gets the disbursementVoucherCheckNbr attribute.
0476: *
0477: * @return Returns the disbursementVoucherCheckNbr
0478: */
0479: public String getDisbursementVoucherCheckNbr() {
0480: return disbursementVoucherCheckNbr;
0481: }
0482:
0483: /**
0484: * Sets the disbursementVoucherCheckNbr attribute.
0485: *
0486: * @param disbursementVoucherCheckNbr The disbursementVoucherCheckNbr to set.
0487: */
0488: public void setDisbursementVoucherCheckNbr(
0489: String disbursementVoucherCheckNbr) {
0490: this .disbursementVoucherCheckNbr = disbursementVoucherCheckNbr;
0491: }
0492:
0493: /**
0494: * Gets the disbursementVoucherCheckDate attribute.
0495: *
0496: * @return Returns the disbursementVoucherCheckDate
0497: */
0498: public Timestamp getDisbursementVoucherCheckDate() {
0499: return disbursementVoucherCheckDate;
0500: }
0501:
0502: /**
0503: * Sets the disbursementVoucherCheckDate attribute.
0504: *
0505: * @param disbursementVoucherCheckDate The disbursementVoucherCheckDate to set.
0506: */
0507: public void setDisbursementVoucherCheckDate(
0508: Timestamp disbursementVoucherCheckDate) {
0509: this .disbursementVoucherCheckDate = disbursementVoucherCheckDate;
0510: }
0511:
0512: /**
0513: * Gets the disbVchrPayeeW9CompleteCode attribute.
0514: *
0515: * @return Returns the disbVchrPayeeW9CompleteCode
0516: */
0517: public boolean getDisbVchrPayeeW9CompleteCode() {
0518: return disbVchrPayeeW9CompleteCode;
0519: }
0520:
0521: /**
0522: * Sets the disbVchrPayeeW9CompleteCode attribute.
0523: *
0524: * @param disbVchrPayeeW9CompleteCode The disbVchrPayeeW9CompleteCode to set.
0525: */
0526: public void setDisbVchrPayeeW9CompleteCode(
0527: boolean disbVchrPayeeW9CompleteCode) {
0528: this .disbVchrPayeeW9CompleteCode = disbVchrPayeeW9CompleteCode;
0529: }
0530:
0531: /**
0532: * Gets the disbVchrPaymentMethodCode attribute.
0533: *
0534: * @return Returns the disbVchrPaymentMethodCode
0535: */
0536: public String getDisbVchrPaymentMethodCode() {
0537: return disbVchrPaymentMethodCode;
0538: }
0539:
0540: /**
0541: * Sets the disbVchrPaymentMethodCode attribute.
0542: *
0543: * @param disbVchrPaymentMethodCode The disbVchrPaymentMethodCode to set.
0544: */
0545: public void setDisbVchrPaymentMethodCode(
0546: String disbVchrPaymentMethodCode) {
0547: this .disbVchrPaymentMethodCode = disbVchrPaymentMethodCode;
0548: }
0549:
0550: /**
0551: * Gets the financialDocument attribute.
0552: *
0553: * @return Returns the financialDocument
0554: */
0555: public DocumentHeader getFinancialDocument() {
0556: return financialDocument;
0557: }
0558:
0559: /**
0560: * Sets the financialDocument attribute.
0561: *
0562: * @param financialDocument The financialDocument to set.
0563: * @deprecated
0564: */
0565: public void setFinancialDocument(DocumentHeader financialDocument) {
0566: this .financialDocument = financialDocument;
0567: }
0568:
0569: /**
0570: * Gets the disbVchrDocumentationLoc attribute.
0571: *
0572: * @return Returns the disbVchrDocumentationLoc
0573: */
0574: public DisbursementVoucherDocumentationLocation getDisbVchrDocumentationLoc() {
0575: return disbVchrDocumentationLoc;
0576: }
0577:
0578: /**
0579: * Sets the disbVchrDocumentationLoc attribute.
0580: *
0581: * @param disbVchrDocumentationLoc The disbVchrDocumentationLoc to set.
0582: * @deprecated
0583: */
0584: public void setDisbVchrDocumentationLoc(
0585: DisbursementVoucherDocumentationLocation disbVchrDocumentationLoc) {
0586: this .disbVchrDocumentationLoc = disbVchrDocumentationLoc;
0587: }
0588:
0589: /**
0590: * @return Returns the dvNonEmployeeTravel.
0591: */
0592: public DisbursementVoucherNonEmployeeTravel getDvNonEmployeeTravel() {
0593: return dvNonEmployeeTravel;
0594: }
0595:
0596: /**
0597: * @param dvNonEmployeeTravel The dvNonEmployeeTravel to set.
0598: */
0599: public void setDvNonEmployeeTravel(
0600: DisbursementVoucherNonEmployeeTravel dvNonEmployeeTravel) {
0601: this .dvNonEmployeeTravel = dvNonEmployeeTravel;
0602: }
0603:
0604: /**
0605: * @return Returns the dvNonResidentAlienTax.
0606: */
0607: public DisbursementVoucherNonResidentAlienTax getDvNonResidentAlienTax() {
0608: return dvNonResidentAlienTax;
0609: }
0610:
0611: /**
0612: * @param dvNonResidentAlienTax The dvNonResidentAlienTax to set.
0613: */
0614: public void setDvNonResidentAlienTax(
0615: DisbursementVoucherNonResidentAlienTax dvNonResidentAlienTax) {
0616: this .dvNonResidentAlienTax = dvNonResidentAlienTax;
0617: }
0618:
0619: /**
0620: * @return Returns the dvPayeeDetail.
0621: */
0622: public DisbursementVoucherPayeeDetail getDvPayeeDetail() {
0623: return dvPayeeDetail;
0624: }
0625:
0626: /**
0627: * @param dvPayeeDetail The dvPayeeDetail to set.
0628: */
0629: public void setDvPayeeDetail(
0630: DisbursementVoucherPayeeDetail dvPayeeDetail) {
0631: this .dvPayeeDetail = dvPayeeDetail;
0632: }
0633:
0634: /**
0635: * @return Returns the dvPreConferenceDetail.
0636: */
0637: public DisbursementVoucherPreConferenceDetail getDvPreConferenceDetail() {
0638: return dvPreConferenceDetail;
0639: }
0640:
0641: /**
0642: * @param dvPreConferenceDetail The dvPreConferenceDetail to set.
0643: */
0644: public void setDvPreConferenceDetail(
0645: DisbursementVoucherPreConferenceDetail dvPreConferenceDetail) {
0646: this .dvPreConferenceDetail = dvPreConferenceDetail;
0647: }
0648:
0649: /**
0650: * @return Returns the dvWireTransfer.
0651: */
0652: public DisbursementVoucherWireTransfer getDvWireTransfer() {
0653: return dvWireTransfer;
0654: }
0655:
0656: /**
0657: * @param dvWireTransfer The dvWireTransfer to set.
0658: */
0659: public void setDvWireTransfer(
0660: DisbursementVoucherWireTransfer dvWireTransfer) {
0661: this .dvWireTransfer = dvWireTransfer;
0662: }
0663:
0664: /**
0665: * @return Returns the exceptionIndicator.
0666: */
0667: public boolean isExceptionIndicator() {
0668: return exceptionIndicator;
0669: }
0670:
0671: /**
0672: * @param exceptionIndicator The exceptionIndicator to set.
0673: */
0674: public void setExceptionIndicator(boolean exceptionIndicator) {
0675: this .exceptionIndicator = exceptionIndicator;
0676: }
0677:
0678: /**
0679: * Gets the cancelDate attribute.
0680: * @return Returns the cancelDate.
0681: */
0682: public Date getCancelDate() {
0683: return cancelDate;
0684: }
0685:
0686: /**
0687: * Sets the cancelDate attribute value.
0688: * @param cancelDate The cancelDate to set.
0689: */
0690: public void setCancelDate(Date cancelDate) {
0691: this .cancelDate = cancelDate;
0692: }
0693:
0694: /**
0695: * Gets the extractDate attribute.
0696: * @return Returns the extractDate.
0697: */
0698: public Date getExtractDate() {
0699: return extractDate;
0700: }
0701:
0702: /**
0703: * Sets the extractDate attribute value.
0704: * @param extractDate The extractDate to set.
0705: */
0706: public void setExtractDate(Date extractDate) {
0707: this .extractDate = extractDate;
0708: }
0709:
0710: /**
0711: * Gets the paidDate attribute.
0712: * @return Returns the paidDate.
0713: */
0714: public Date getPaidDate() {
0715: return paidDate;
0716: }
0717:
0718: /**
0719: * Sets the paidDate attribute value.
0720: * @param paidDate The paidDate to set.
0721: */
0722: public void setPaidDate(Date paidDate) {
0723: this .paidDate = paidDate;
0724: }
0725:
0726: /**
0727: * Based on which pdp dates are present (extract, paid, canceled), determines a String for the status
0728: * @return a String representation of the status
0729: */
0730: public String getDisbursementVoucherPdpStatus() {
0731: if (cancelDate != null) {
0732: return "Canceled";
0733: } else if (paidDate != null) {
0734: return "Paid";
0735: } else if (extractDate != null) {
0736: return "Extracted";
0737: } else {
0738: return "Pre-Extraction";
0739: }
0740: }
0741:
0742: /**
0743: * Pretends to set the PDP status for this document
0744: * @param status the status to pretend to set
0745: */
0746: public void setDisbursementVoucherPdpStatus(String status) {
0747: // don't do nothing, 'cause this ain't a real field
0748: }
0749:
0750: /**
0751: * Adds a dv pre paid registran line
0752: *
0753: * @param line
0754: */
0755: public void addDvPrePaidRegistrantLine(
0756: DisbursementVoucherPreConferenceRegistrant line) {
0757: line
0758: .setFinancialDocumentLineNumber(getFinDocNextRegistrantLineNbr());
0759: this .getDvPreConferenceDetail().getDvPreConferenceRegistrants()
0760: .add(line);
0761: this .finDocNextRegistrantLineNbr = new Integer(
0762: getFinDocNextRegistrantLineNbr().intValue() + 1);
0763: }
0764:
0765: /**
0766: * Returns the name associated with the payment method code
0767: *
0768: * @return String
0769: */
0770: public String getDisbVchrPaymentMethodName() {
0771: return new PaymentMethodValuesFinder()
0772: .getKeyLabel(disbVchrPaymentMethodCode);
0773: }
0774:
0775: public void setDisbVchrPaymentMethodName(String method) {
0776: }
0777:
0778: /**
0779: * Returns the name associated with the documentation location name
0780: *
0781: * @return String
0782: */
0783: public String getDisbursementVoucherDocumentationLocationName() {
0784: return new DisbursementVoucherDocumentationLocationValuesFinder()
0785: .getKeyLabel(disbursementVoucherDocumentationLocationCode);
0786: }
0787:
0788: public void setDisbursementVoucherDocumentationLocationName(
0789: String name) {
0790: }
0791:
0792: /**
0793: * Convenience method to set dv payee detail fields based on a given Payee.
0794: *
0795: * @param payee
0796: */
0797: public void templatePayee(Payee payee) {
0798: if (payee == null) {
0799: return;
0800: }
0801:
0802: this .getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(
0803: DisbursementVoucherRuleConstants.DV_PAYEE_TYPE_PAYEE);
0804: this .getDvPayeeDetail().setDisbVchrPayeeIdNumber(
0805: payee.getPayeeIdNumber());
0806: this .getDvPayeeDetail().setDisbVchrPayeePersonName(
0807: payee.getPayeePersonName());
0808: this .getDvPayeeDetail().setDisbVchrPayeeLine1Addr(
0809: payee.getPayeeLine1Addr());
0810: this .getDvPayeeDetail().setDisbVchrPayeeLine2Addr(
0811: payee.getPayeeLine2Addr());
0812: this .getDvPayeeDetail().setDisbVchrPayeeCityName(
0813: payee.getPayeeCityName());
0814: this .getDvPayeeDetail().setDisbVchrPayeeStateCode(
0815: payee.getPayeeStateCode());
0816: this .getDvPayeeDetail().setDisbVchrPayeeZipCode(
0817: payee.getPayeeZipCode());
0818: this .getDvPayeeDetail().setDisbVchrPayeeCountryCode(
0819: payee.getPayeeCountryCode());
0820: this .getDvPayeeDetail().setDisbVchrPayeeEmployeeCode(
0821: payee.isPayeeEmployeeCode());
0822: this .getDvPayeeDetail().setDisbVchrAlienPaymentCode(
0823: payee.isAlienPaymentCode());
0824: this .getDvPayeeDetail().setDvPayeeRevolvingFundCode(
0825: payee.isPayeeRevolvingFundCode());
0826:
0827: this .disbVchrPayeeTaxControlCode = payee
0828: .getPayeeTaxControlCode();
0829: this .disbVchrPayeeW9CompleteCode = payee
0830: .isPayeeW9CompleteCode();
0831: }
0832:
0833: /**
0834: * Convenience method to set dv payee detail fields based on a given Employee.
0835: *
0836: * @param employee
0837: */
0838: public void templateEmployee(UniversalUser employee) {
0839: if (employee == null) {
0840: return;
0841: }
0842:
0843: this
0844: .getDvPayeeDetail()
0845: .setDisbursementVoucherPayeeTypeCode(
0846: DisbursementVoucherRuleConstants.DV_PAYEE_TYPE_EMPLOYEE);
0847: this .getDvPayeeDetail().setDisbVchrPayeeIdNumber(
0848: employee.getPersonUniversalIdentifier());
0849: this .getDvPayeeDetail().setDisbVchrPayeePersonName(
0850: employee.getPersonName());
0851: this .getDvPayeeDetail().setDisbVchrPayeeLine1Addr(
0852: employee.getCampusCode() + "-"
0853: + employee.getPrimaryDepartmentCode());
0854: this .getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
0855: this .getDvPayeeDetail().setDisbVchrPayeeCityName(
0856: employee.getCampus().getCampusName() + " CAMPUS");
0857: this .getDvPayeeDetail().setDisbVchrPayeeStateCode("");
0858: this .getDvPayeeDetail().setDisbVchrPayeeZipCode("");
0859: this .getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
0860: this .getDvPayeeDetail().setDisbVchrPayeeEmployeeCode(false);
0861: this .getDvPayeeDetail().setDisbVchrAlienPaymentCode(false);
0862: this .getDvPayeeDetail().setDvPayeeRevolvingFundCode(false);
0863:
0864: this .disbVchrPayeeTaxControlCode = "";
0865: this .disbVchrPayeeW9CompleteCode = true;
0866: }
0867:
0868: /**
0869: * @see org.kuali.core.document.Document#prepareForSave()
0870: */
0871: @Override
0872: public void prepareForSave() {
0873: if (this instanceof AmountTotaling) {
0874: getDocumentHeader().setFinancialDocumentTotalAmount(
0875: ((AmountTotaling) this ).getTotalDollarAmount());
0876: }
0877:
0878: if (dvWireTransfer != null) {
0879: dvWireTransfer.setDocumentNumber(this .documentNumber);
0880: }
0881:
0882: if (dvNonResidentAlienTax != null) {
0883: dvNonResidentAlienTax
0884: .setDocumentNumber(this .documentNumber);
0885: }
0886:
0887: dvPayeeDetail.setDocumentNumber(this .documentNumber);
0888:
0889: if (dvNonEmployeeTravel != null) {
0890: dvNonEmployeeTravel.setDocumentNumber(this .documentNumber);
0891: dvNonEmployeeTravel
0892: .setTotalTravelAmount(dvNonEmployeeTravel
0893: .getTotalTravelAmount());
0894: }
0895:
0896: if (dvPreConferenceDetail != null) {
0897: dvPreConferenceDetail
0898: .setDocumentNumber(this .documentNumber);
0899: dvPreConferenceDetail
0900: .setDisbVchrConferenceTotalAmt(dvPreConferenceDetail
0901: .getDisbVchrConferenceTotalAmt());
0902: }
0903: }
0904:
0905: /**
0906: * Clears information that might have been entered for sub tables, but because of changes to the document is longer needed and
0907: * should not be persisted.
0908: */
0909: private void cleanDocumentData() {
0910: // TODO: warren: this method ain't called!!! maybe this should be called by prepare for save above
0911: if (!DisbursementVoucherRuleConstants.PAYMENT_METHOD_WIRE
0912: .equals(this .getDisbVchrPaymentMethodCode())
0913: && !DisbursementVoucherRuleConstants.PAYMENT_METHOD_DRAFT
0914: .equals(this .getDisbVchrPaymentMethodCode())) {
0915: SpringContext.getBean(BusinessObjectService.class).delete(
0916: dvWireTransfer);
0917: dvWireTransfer = null;
0918: }
0919:
0920: if (!dvPayeeDetail.isDisbVchrAlienPaymentCode()) {
0921: SpringContext.getBean(BusinessObjectService.class).delete(
0922: dvNonResidentAlienTax);
0923: dvNonResidentAlienTax = null;
0924: }
0925:
0926: DisbursementVoucherDocumentRule dvDocRule = (DisbursementVoucherDocumentRule) SpringContext
0927: .getBean(KualiRuleService.class)
0928: .getBusinessRulesInstance(this ,
0929: DisbursementVoucherDocumentRule.class);
0930:
0931: if (!dvDocRule.isTravelNonEmplPaymentReason(this )) {
0932: SpringContext.getBean(BusinessObjectService.class).delete(
0933: dvNonEmployeeTravel);
0934: dvNonEmployeeTravel = null;
0935: }
0936:
0937: if (!dvDocRule.isTravelPrepaidPaymentReason(this )) {
0938: SpringContext.getBean(BusinessObjectService.class).delete(
0939: dvPreConferenceDetail);
0940: dvPreConferenceDetail = null;
0941: }
0942: }
0943:
0944: /**
0945: * @see org.kuali.kfs.document.AccountingDocumentBase#toCopy()
0946: */
0947: @Override
0948: public void toCopy() throws WorkflowException {
0949: super .toCopy();
0950: initiateDocument();
0951:
0952: // clear fields
0953: setDisbVchrContactPhoneNumber("");
0954: setDisbVchrContactEmailId("");
0955: getDvPayeeDetail().setDisbVchrPayeePersonName("");
0956: getDvPayeeDetail().setDisbVchrPayeeLine1Addr("");
0957: getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
0958: getDvPayeeDetail().setDisbVchrPayeeCityName("");
0959: getDvPayeeDetail().setDisbVchrPayeeStateCode("");
0960: getDvPayeeDetail().setDisbVchrPayeeZipCode("");
0961: getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
0962: getDvPayeeDetail().setDisbVchrAlienPaymentCode(false);
0963: setDisbVchrPayeeTaxControlCode("");
0964:
0965: // clear nra
0966: SpringContext.getBean(DisbursementVoucherTaxService.class)
0967: .clearNRATaxLines(this );
0968: setDvNonResidentAlienTax(new DisbursementVoucherNonResidentAlienTax());
0969:
0970: // clear waive wire
0971: getDvWireTransfer()
0972: .setDisbursementVoucherWireTransferFeeWaiverIndicator(
0973: false);
0974:
0975: // check payee id number to see if still valid, if so retrieve their last information and set in the detail inform.
0976: if (getDvPayeeDetail().isPayee()
0977: && !StringUtils.isBlank(getDvPayeeDetail()
0978: .getDisbVchrPayeeIdNumber())) {
0979: Payee payee = new Payee();
0980: payee.setPayeeIdNumber(getDvPayeeDetail()
0981: .getDisbVchrPayeeIdNumber());
0982: Map keys = SpringContext.getBean(PersistenceService.class)
0983: .getPrimaryKeyFieldValues(payee);
0984: payee = (Payee) SpringContext.getBean(
0985: BusinessObjectService.class).findByPrimaryKey(
0986: Payee.class, keys);
0987: if (payee == null) {
0988: getDvPayeeDetail().setDisbVchrPayeeIdNumber("");
0989: GlobalVariables
0990: .getMessageList()
0991: .add(
0992: KFSKeyConstants.WARNING_DV_PAYEE_NONEXISTANT_CLEARED);
0993: } else {
0994: templatePayee(payee);
0995: }
0996: }
0997:
0998: // employee
0999: if (getDvPayeeDetail().isEmployee()
1000: && !StringUtils.isBlank(getDvPayeeDetail()
1001: .getDisbVchrPayeeIdNumber())) {
1002: UniversalUser employee = new UniversalUser();
1003: employee.setPersonUniversalIdentifier(getDvPayeeDetail()
1004: .getDisbVchrPayeeIdNumber());
1005: employee = (UniversalUser) SpringContext.getBean(
1006: BusinessObjectService.class).retrieve(employee);
1007: if (employee == null) {
1008: getDvPayeeDetail().setDisbVchrPayeeIdNumber("");
1009: GlobalVariables
1010: .getMessageList()
1011: .add(
1012: KFSKeyConstants.WARNING_DV_PAYEE_NONEXISTANT_CLEARED);
1013: } else {
1014: templateEmployee(employee);
1015: }
1016: }
1017:
1018: }
1019:
1020: /**
1021: * generic, shared logic used to iniate a dv document
1022: */
1023: public void initiateDocument() {
1024: UniversalUser currentUser = GlobalVariables.getUserSession()
1025: .getUniversalUser();
1026: setDisbVchrContactPersonName(currentUser.getPersonName());
1027: setCampusCode(((ChartUser) currentUser
1028: .getModuleUser(ChartUser.MODULE_ID)).getOrganization()
1029: .getOrganizationPhysicalCampusCode());
1030:
1031: // due date
1032: Calendar calendar = SpringContext
1033: .getBean(DateTimeService.class).getCurrentCalendar();
1034: calendar.add(Calendar.DAY_OF_MONTH, 1);
1035: setDisbursementVoucherDueDate(new Date(calendar
1036: .getTimeInMillis()));
1037:
1038: // default doc location
1039: if (StringUtils
1040: .isBlank(getDisbursementVoucherDocumentationLocationCode())) {
1041: setDisbursementVoucherDocumentationLocationCode(SpringContext
1042: .getBean(ParameterService.class)
1043: .getParameterValue(
1044: DisbursementVoucherDocument.class,
1045: DisbursementVoucherRuleConstants.DEFAULT_DOC_LOCATION_PARM_NM));
1046: }
1047: }
1048:
1049: /**
1050: * @see org.kuali.core.document.DocumentBase#buildListOfDeletionAwareLists()
1051: */
1052: @Override
1053: public List buildListOfDeletionAwareLists() {
1054: List managedLists = super .buildListOfDeletionAwareLists();
1055:
1056: if (dvNonEmployeeTravel != null) {
1057: managedLists.add(dvNonEmployeeTravel
1058: .getDvNonEmployeeExpenses());
1059: managedLists.add(dvNonEmployeeTravel
1060: .getDvPrePaidEmployeeExpenses());
1061: }
1062:
1063: if (dvPreConferenceDetail != null) {
1064: managedLists.add(dvPreConferenceDetail
1065: .getDvPreConferenceRegistrants());
1066: }
1067:
1068: return managedLists;
1069: }
1070:
1071: /**
1072: * @see org.kuali.kfs.document.AccountingDocumentBase#getAccountingLineParser()
1073: */
1074: @Override
1075: public AccountingLineParser getAccountingLineParser() {
1076: return new BasicFormatWithLineDescriptionAccountingLineParser();
1077: }
1078:
1079: /**
1080: * Returns check total.
1081: *
1082: * @see org.kuali.kfs.document.AccountingDocumentBase#getTotalDollarAmount()
1083: * @return KualiDecimal
1084: */
1085: @Override
1086: public KualiDecimal getTotalDollarAmount() {
1087: return this.getDisbVchrCheckTotalAmount();
1088: }
1089: }
|