Search in sources :

Example 1 with DisbursementVoucherPreConferenceDetail

use of org.kuali.kfs.fp.businessobject.DisbursementVoucherPreConferenceDetail in project cu-kfs by CU-CommunityApps.

the class RecurringDisbursementVoucherDocumentServiceImpl method buildCuDisbursementVoucherDocument.

private CuDisbursementVoucherDocument buildCuDisbursementVoucherDocument(RecurringDisbursementVoucherDocument recurringDV) throws WorkflowException {
    CuDisbursementVoucherDocument dv = (CuDisbursementVoucherDocument) getDocumentService().getNewDocument(CuDisbursementVoucherDocument.class);
    dv.setDisbVchrContactPersonName(recurringDV.getDisbVchrContactPersonName());
    dv.setDisbVchrContactPhoneNumber(recurringDV.getDisbVchrContactPhoneNumber());
    dv.setDisbVchrContactEmailId(recurringDV.getDisbVchrContactEmailId());
    dv.setDisbVchrAttachmentCode(recurringDV.isDisbVchrAttachmentCode());
    dv.setDisbVchrSpecialHandlingCode(recurringDV.isDisbVchrSpecialHandlingCode());
    dv.setDisbVchrForeignCurrencyInd(recurringDV.isDisbVchrForeignCurrencyInd());
    dv.setDisbursementVoucherDocumentationLocationCode(recurringDV.getDisbursementVoucherDocumentationLocationCode());
    dv.setDisbVchrCheckStubText(recurringDV.getDisbVchrCheckStubText());
    dv.setDvCheckStubOverflowCode(recurringDV.getDvCheckStubOverflowCode());
    dv.setCampusCode(recurringDV.getCampusCode());
    dv.setDisbVchrPayeeTaxControlCode(recurringDV.getDisbVchrPayeeTaxControlCode());
    dv.setDisbVchrPayeeChangedInd(recurringDV.isDisbVchrPayeeChangedInd());
    dv.setExceptionIndicator(recurringDV.isExceptionIndicator());
    dv.setDisbursementVoucherPdpStatus(recurringDV.getDisbursementVoucherPdpStatus());
    dv.setDisbVchrBankCode(recurringDV.getDisbVchrBankCode());
    dv.setPayeeAssigned(recurringDV.isPayeeAssigned());
    dv.setEditW9W8BENbox(recurringDV.isEditW9W8BENbox());
    dv.setDisbVchrPdpBankCode(recurringDV.getDisbVchrPdpBankCode());
    dv.setImmediatePaymentIndicator(recurringDV.isImmediatePaymentIndicator());
    dv.setDisbExcptAttachedIndicator(recurringDV.isDisbExcptAttachedIndicator());
    dv.setDisbVchrPayeeW9CompleteCode(recurringDV.getDisbVchrPayeeW9CompleteCode());
    dv.setDisbVchrPaymentMethodCode(recurringDV.getDisbVchrPaymentMethodCode());
    CuDisbursementVoucherPayeeDetail payeeDetail = (CuDisbursementVoucherPayeeDetail) ObjectUtils.deepCopy(recurringDV.getDvPayeeDetail());
    payeeDetail.setDocumentNumber(dv.getDocumentNumber());
    dv.setDvPayeeDetail(payeeDetail);
    PaymentSourceWireTransfer wireTransfer = (PaymentSourceWireTransfer) ObjectUtils.deepCopy(recurringDV.getWireTransfer());
    wireTransfer.setDocumentNumber(dv.getDocumentNumber());
    dv.setWireTransfer(wireTransfer);
    DisbursementVoucherNonEmployeeTravel nonEmployeeTravel = (DisbursementVoucherNonEmployeeTravel) ObjectUtils.deepCopy(recurringDV.getDvNonEmployeeTravel());
    nonEmployeeTravel.setDocumentNumber(dv.getDocumentNumber());
    dv.setDvNonEmployeeTravel(nonEmployeeTravel);
    DisbursementVoucherNonResidentAlienTax nonAlienTax = (DisbursementVoucherNonResidentAlienTax) ObjectUtils.deepCopy(recurringDV.getDvNonResidentAlienTax());
    nonAlienTax.setDocumentNumber(dv.getDocumentNumber());
    dv.setDvNonResidentAlienTax(nonAlienTax);
    DisbursementVoucherPreConferenceDetail conferenceDetail = (DisbursementVoucherPreConferenceDetail) ObjectUtils.deepCopy(recurringDV.getDvPreConferenceDetail());
    conferenceDetail.setDocumentNumber(dv.getDocumentNumber());
    dv.setDvPreConferenceDetail(conferenceDetail);
    return dv;
}
Also used : CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) DisbursementVoucherNonEmployeeTravel(org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeTravel) DisbursementVoucherPreConferenceDetail(org.kuali.kfs.fp.businessobject.DisbursementVoucherPreConferenceDetail) PaymentSourceWireTransfer(org.kuali.kfs.sys.businessobject.PaymentSourceWireTransfer) CuDisbursementVoucherPayeeDetail(edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetail) DisbursementVoucherNonResidentAlienTax(org.kuali.kfs.fp.businessobject.DisbursementVoucherNonResidentAlienTax)

Example 2 with DisbursementVoucherPreConferenceDetail

use of org.kuali.kfs.fp.businessobject.DisbursementVoucherPreConferenceDetail in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherExtractionHelperServiceImpl method buildPaymentDetail.

protected PaymentDetail buildPaymentDetail(DisbursementVoucherDocument document, Date processRunDate) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("buildPaymentDetail() started");
    }
    final String maxNoteLinesParam = getParameterService().getParameterValueAsString(KfsParameterConstants.PRE_DISBURSEMENT_ALL.class, PdpParameterConstants.MAX_NOTE_LINES);
    int maxNoteLines;
    try {
        maxNoteLines = Integer.parseInt(maxNoteLinesParam);
    } catch (NumberFormatException nfe) {
        throw new IllegalArgumentException("Invalid Max Notes Lines parameter, value: " + maxNoteLinesParam + " cannot be converted to an integer");
    }
    PaymentDetail pd = new PaymentDetail();
    if (StringUtils.isNotEmpty(document.getDocumentHeader().getOrganizationDocumentNumber())) {
        pd.setOrganizationDocNbr(document.getDocumentHeader().getOrganizationDocumentNumber());
    }
    pd.setCustPaymentDocNbr(document.getDocumentNumber());
    pd.setInvoiceDate(new java.sql.Date(processRunDate.getTime()));
    pd.setOrigInvoiceAmount(document.getDisbVchrCheckTotalAmount());
    pd.setInvTotDiscountAmount(KualiDecimal.ZERO);
    pd.setInvTotOtherCreditAmount(KualiDecimal.ZERO);
    pd.setInvTotOtherDebitAmount(KualiDecimal.ZERO);
    pd.setInvTotShipAmount(KualiDecimal.ZERO);
    pd.setNetPaymentAmount(document.getDisbVchrCheckTotalAmount());
    pd.setPrimaryCancelledPayment(Boolean.FALSE);
    pd.setFinancialDocumentTypeCode(DisbursementVoucherConstants.DOCUMENT_TYPE_CHECKACH);
    pd.setFinancialSystemOriginCode(KFSConstants.ORIGIN_CODE_KUALI);
    // Handle accounts
    for (SourceAccountingLine sal : (List<? extends SourceAccountingLine>) document.getSourceAccountingLines()) {
        PaymentAccountDetail pad = new PaymentAccountDetail();
        pad.setFinChartCode(sal.getChartOfAccountsCode());
        pad.setAccountNbr(sal.getAccountNumber());
        if (StringUtils.isNotEmpty(sal.getSubAccountNumber())) {
            pad.setSubAccountNbr(sal.getSubAccountNumber());
        } else {
            pad.setSubAccountNbr(KFSConstants.getDashSubAccountNumber());
        }
        pad.setFinObjectCode(sal.getFinancialObjectCode());
        if (StringUtils.isNotEmpty(sal.getFinancialSubObjectCode())) {
            pad.setFinSubObjectCode(sal.getFinancialSubObjectCode());
        } else {
            pad.setFinSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
        }
        if (StringUtils.isNotEmpty(sal.getOrganizationReferenceId())) {
            pad.setOrgReferenceId(sal.getOrganizationReferenceId());
        }
        if (StringUtils.isNotEmpty(sal.getProjectCode())) {
            pad.setProjectCode(sal.getProjectCode());
        } else {
            pad.setProjectCode(KFSConstants.getDashProjectCode());
        }
        pad.setAccountNetAmount(sal.getAmount());
        pd.addAccountDetail(pad);
    }
    // Handle notes
    DisbursementVoucherPayeeDetail dvpd = document.getDvPayeeDetail();
    int line = 0;
    PaymentNoteText pnt = new PaymentNoteText();
    pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
    pnt.setCustomerNoteText(CuDisbursementVoucherConstants.DV_EXTRACT_NOTE_PREFIX_PREPARER + document.getDisbVchrContactPersonName() + " " + document.getDisbVchrContactPhoneNumber());
    pd.addNote(pnt);
    String dvSpecialHandlingPersonName = null;
    String dvSpecialHandlingLine1Address = null;
    String dvSpecialHandlingLine2Address = null;
    String dvSpecialHandlingCity = null;
    String dvSpecialHandlingState = null;
    String dvSpecialHandlingZip = null;
    dvSpecialHandlingPersonName = dvpd.getDisbVchrSpecialHandlingPersonName();
    dvSpecialHandlingLine1Address = dvpd.getDisbVchrSpecialHandlingLine1Addr();
    dvSpecialHandlingLine2Address = dvpd.getDisbVchrSpecialHandlingLine2Addr();
    dvSpecialHandlingCity = dvpd.getDisbVchrSpecialHandlingCityName();
    dvSpecialHandlingState = dvpd.getDisbVchrSpecialHandlingStateCode();
    dvSpecialHandlingZip = dvpd.getDisbVchrSpecialHandlingZipCode();
    if (StringUtils.isNotEmpty(dvSpecialHandlingPersonName)) {
        pnt = new PaymentNoteText();
        pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
        pnt.setCustomerNoteText("Send Check To: " + dvSpecialHandlingPersonName);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating special handling person name note: " + pnt.getCustomerNoteText());
        }
        pd.addNote(pnt);
    }
    if (StringUtils.isNotEmpty(dvSpecialHandlingLine1Address)) {
        pnt = new PaymentNoteText();
        pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
        pnt.setCustomerNoteText(CuDisbursementVoucherConstants.DV_EXTRACT_NOTE_PREFIX_SPECIAL_HANDLING_ADDRESS1 + dvSpecialHandlingLine1Address);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating special handling address 1 note: " + pnt.getCustomerNoteText());
        }
        pd.addNote(pnt);
    }
    if (StringUtils.isNotEmpty(dvSpecialHandlingLine2Address)) {
        pnt = new PaymentNoteText();
        pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
        pnt.setCustomerNoteText(CuDisbursementVoucherConstants.DV_EXTRACT_NOTE_PREFIX_SPECIAL_HANDLING_ADDRESS2 + dvSpecialHandlingLine2Address);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating special handling address 2 note: " + pnt.getCustomerNoteText());
        }
        pd.addNote(pnt);
    }
    if (StringUtils.isNotEmpty(dvSpecialHandlingCity)) {
        pnt = new PaymentNoteText();
        pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
        pnt.setCustomerNoteText(CuDisbursementVoucherConstants.DV_EXTRACT_NOTE_PREFIX_SPECIAL_HANDLING_ADDRESS3 + dvSpecialHandlingCity + ", " + dvSpecialHandlingState + " " + dvSpecialHandlingZip);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating special handling city note: " + pnt.getCustomerNoteText());
        }
        pd.addNote(pnt);
    }
    if (document.isDisbVchrAttachmentCode()) {
        pnt = new PaymentNoteText();
        pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
        pnt.setCustomerNoteText("Attachment Included");
        if (LOG.isDebugEnabled()) {
            LOG.debug("create attachment note: " + pnt.getCustomerNoteText());
        }
        pd.addNote(pnt);
    }
    String paymentReasonCode = dvpd.getDisbVchrPaymentReasonCode();
    if (/*REFACTORME*/
    getParameterEvaluatorService().getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.NONEMPLOYEE_TRAVEL_PAY_REASONS_PARM_NM, paymentReasonCode).evaluationSucceeds()) {
        DisbursementVoucherNonEmployeeTravel dvnet = document.getDvNonEmployeeTravel();
        pnt = new PaymentNoteText();
        pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
        pnt.setCustomerNoteText("Reimbursement associated with " + dvnet.getDisbVchrServicePerformedDesc());
        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating non employee travel notes: " + pnt.getCustomerNoteText());
        }
        pd.addNote(pnt);
        pnt = new PaymentNoteText();
        pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
        pnt.setCustomerNoteText("The total per diem amount for your daily expenses is " + dvnet.getDisbVchrPerdiemActualAmount());
        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating non employee travel notes: " + pnt.getCustomerNoteText());
        }
        pd.addNote(pnt);
        if (dvnet.getDisbVchrPersonalCarAmount() != null && dvnet.getDisbVchrPersonalCarAmount().compareTo(KualiDecimal.ZERO) != 0) {
            pnt = new PaymentNoteText();
            pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
            pnt.setCustomerNoteText("The total dollar amount for your vehicle mileage is " + dvnet.getDisbVchrPersonalCarAmount());
            if (LOG.isDebugEnabled()) {
                LOG.debug("Creating non employee travel vehicle note: " + pnt.getCustomerNoteText());
            }
            pd.addNote(pnt);
            for (DisbursementVoucherNonEmployeeExpense exp : (List<DisbursementVoucherNonEmployeeExpense>) dvnet.getDvNonEmployeeExpenses()) {
                if (line < (maxNoteLines - 8)) {
                    pnt = new PaymentNoteText();
                    pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
                    pnt.setCustomerNoteText(exp.getDisbVchrExpenseCompanyName() + " " + exp.getDisbVchrExpenseAmount());
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Creating non employee travel expense note: " + pnt.getCustomerNoteText());
                    }
                    pd.addNote(pnt);
                }
            }
        }
    } else if (/*REFACTORME*/
    getParameterEvaluatorService().getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.PREPAID_TRAVEL_PAYMENT_REASONS_PARM_NM, paymentReasonCode).evaluationSucceeds()) {
        pnt = new PaymentNoteText();
        pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
        pnt.setCustomerNoteText("Payment is for the following individuals/charges:");
        pd.addNote(pnt);
        if (LOG.isDebugEnabled()) {
            LOG.info("Creating prepaid travel note note: " + pnt.getCustomerNoteText());
        }
        DisbursementVoucherPreConferenceDetail dvpcd = document.getDvPreConferenceDetail();
        for (DisbursementVoucherPreConferenceRegistrant dvpcr : (List<DisbursementVoucherPreConferenceRegistrant>) dvpcd.getDvPreConferenceRegistrants()) {
            if (line < (maxNoteLines - 8)) {
                pnt = new PaymentNoteText();
                pnt.setCustomerNoteLineNbr(new KualiInteger(line++));
                pnt.setCustomerNoteText(dvpcr.getDvConferenceRegistrantName() + " " + dvpcr.getDisbVchrExpenseAmount());
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Creating pre-paid conference registrants note: " + pnt.getCustomerNoteText());
                }
                pd.addNote(pnt);
            }
        }
    }
    // Get the original, raw form, note text from the DV document.
    final String text = document.getDisbVchrCheckStubText();
    if (!StringUtils.isBlank(text)) {
        pd.addNotes(getPaymentSourceHelperService().buildNotesForCheckStubText(text, line));
    }
    return pd;
}
Also used : DisbursementVoucherNonEmployeeTravel(org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeTravel) DisbursementVoucherPreConferenceDetail(org.kuali.kfs.fp.businessobject.DisbursementVoucherPreConferenceDetail) KualiInteger(org.kuali.rice.core.api.util.type.KualiInteger) KfsParameterConstants(org.kuali.kfs.sys.service.impl.KfsParameterConstants) DisbursementVoucherNonEmployeeExpense(org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense) DisbursementVoucherPayeeDetail(org.kuali.kfs.fp.businessobject.DisbursementVoucherPayeeDetail) CuDisbursementVoucherPayeeDetail(edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetail) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) DisbursementVoucherPreConferenceRegistrant(org.kuali.kfs.fp.businessobject.DisbursementVoucherPreConferenceRegistrant) Date(java.sql.Date) PaymentDetail(org.kuali.kfs.pdp.businessobject.PaymentDetail) PaymentNoteText(org.kuali.kfs.pdp.businessobject.PaymentNoteText) ArrayList(java.util.ArrayList) List(java.util.List) RecurringDisbursementVoucherDocument(edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument) CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) PaymentAccountDetail(org.kuali.kfs.pdp.businessobject.PaymentAccountDetail)

Aggregations

CuDisbursementVoucherPayeeDetail (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetail)2 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)2 DisbursementVoucherNonEmployeeTravel (org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeTravel)2 DisbursementVoucherPreConferenceDetail (org.kuali.kfs.fp.businessobject.DisbursementVoucherPreConferenceDetail)2 RecurringDisbursementVoucherDocument (edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument)1 Date (java.sql.Date)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DisbursementVoucherNonEmployeeExpense (org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense)1 DisbursementVoucherNonResidentAlienTax (org.kuali.kfs.fp.businessobject.DisbursementVoucherNonResidentAlienTax)1 DisbursementVoucherPayeeDetail (org.kuali.kfs.fp.businessobject.DisbursementVoucherPayeeDetail)1 DisbursementVoucherPreConferenceRegistrant (org.kuali.kfs.fp.businessobject.DisbursementVoucherPreConferenceRegistrant)1 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)1 PaymentAccountDetail (org.kuali.kfs.pdp.businessobject.PaymentAccountDetail)1 PaymentDetail (org.kuali.kfs.pdp.businessobject.PaymentDetail)1 PaymentNoteText (org.kuali.kfs.pdp.businessobject.PaymentNoteText)1 PaymentSourceWireTransfer (org.kuali.kfs.sys.businessobject.PaymentSourceWireTransfer)1 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)1 KfsParameterConstants (org.kuali.kfs.sys.service.impl.KfsParameterConstants)1 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)1