Example usage for java.sql Date after

List of usage examples for java.sql Date after

Introduction

In this page you can find the example usage for java.sql Date after.

Prototype

public boolean after(Date when) 

Source Link

Document

Tests if this date is after the specified date.

Usage

From source file:org.kuali.ole.select.document.OleDisbursementVoucherDocument.java

/**
 * Convenience method to set dv payee detail fields based on a given vendor.
 *
 * @param vendor//from   w ww  . j  a v  a 2 s.c  o  m
 */
@Override
public void templateVendor(VendorDetail vendor, VendorAddress vendorAddress) {
    if (vendor == null) {
        return;
    }
    if (this.getDocumentHeader().getDocumentTemplateNumber() == null) {
        this.setPaymentMethodId(vendor.getPaymentMethodId());
    }
    this.getDvPayeeDetail()
            .setDisbursementVoucherPayeeTypeCode(DisbursementVoucherConstants.DV_PAYEE_TYPE_VENDOR);
    this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(vendor.getVendorNumber());
    this.getDvPayeeDetail().setDisbVchrPayeePersonName(vendor.getVendorName());

    this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(vendor.getVendorHeader().getVendorForeignIndicator());

    if (ObjectUtils.isNull(vendorAddress)
            || ObjectUtils.isNull(vendorAddress.getVendorAddressGeneratedIdentifier())) {
        for (VendorAddress addr : vendor.getVendorAddresses()) {
            if (addr.isVendorDefaultAddressIndicator()) {
                vendorAddress = addr;
                break;
            }
        }
    }

    if (ObjectUtils.isNotNull(vendorAddress)
            && ObjectUtils.isNotNull(vendorAddress.getVendorAddressGeneratedIdentifier())) {
        this.getDvPayeeDetail().setDisbVchrVendorAddressIdNumber(
                vendorAddress.getVendorAddressGeneratedIdentifier().toString());
        this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(vendorAddress.getVendorLine1Address());
        this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(vendorAddress.getVendorLine2Address());
        this.getDvPayeeDetail().setDisbVchrPayeeCityName(vendorAddress.getVendorCityName());
        this.getDvPayeeDetail().setDisbVchrPayeeStateCode(vendorAddress.getVendorStateCode());
        this.getDvPayeeDetail().setDisbVchrPayeeZipCode(vendorAddress.getVendorZipCode());
        this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(vendorAddress.getVendorCountryCode());
    } else {
        this.getDvPayeeDetail().setDisbVchrVendorAddressIdNumber("");
        this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr("");
        this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
        this.getDvPayeeDetail().setDisbVchrPayeeCityName("");
        this.getDvPayeeDetail().setDisbVchrPayeeStateCode("");
        this.getDvPayeeDetail().setDisbVchrPayeeZipCode("");
        this.getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
    }

    //        this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(vendor.getVendorHeader().getVendorForeignIndicator());
    this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(
            VendorConstants.VendorTypes.SUBJECT_PAYMENT.equals(vendor.getVendorHeader().getVendorTypeCode()));
    this.getDvPayeeDetail().setDisbVchrEmployeePaidOutsidePayrollCode(
            getVendorService().isVendorInstitutionEmployee(vendor.getVendorHeaderGeneratedIdentifier()));

    this.getDvPayeeDetail().setHasMultipleVendorAddresses(1 < vendor.getVendorAddresses().size());

    boolean w9AndW8Checked = false;
    if ((ObjectUtils.isNotNull(vendor.getVendorHeader().getVendorW9ReceivedIndicator())
            && vendor.getVendorHeader().getVendorW9ReceivedIndicator() == true)
            || (ObjectUtils.isNotNull(vendor.getVendorHeader().getVendorW8BenReceivedIndicator())
                    && vendor.getVendorHeader().getVendorW8BenReceivedIndicator() == true)) {

        w9AndW8Checked = true;
    }

    //    this.disbVchrPayeeW9CompleteCode = vendor.getVendorHeader().getVendorW8BenReceivedIndicator()  == null ? false : vendor.getVendorHeader().getVendorW8BenReceivedIndicator();
    this.disbVchrPayeeW9CompleteCode = w9AndW8Checked;

    Date vendorFederalWithholdingTaxBeginDate = vendor.getVendorHeader()
            .getVendorFederalWithholdingTaxBeginningDate();
    Date vendorFederalWithholdingTaxEndDate = vendor.getVendorHeader().getVendorFederalWithholdingTaxEndDate();
    java.util.Date today = getDateTimeService().getCurrentDate();
    if ((vendorFederalWithholdingTaxBeginDate != null && vendorFederalWithholdingTaxBeginDate.before(today))
            && (vendorFederalWithholdingTaxEndDate == null
                    || vendorFederalWithholdingTaxEndDate.after(today))) {
        this.disbVchrPayeeTaxControlCode = DisbursementVoucherConstants.TAX_CONTROL_CODE_BEGIN_WITHHOLDING;
    }

    // if vendor is foreign, default alien payment code to true
    if (getVendorService().isVendorForeign(vendor.getVendorHeaderGeneratedIdentifier())) {
        getDvPayeeDetail().setDisbVchrAlienPaymentCode(true);
    }
}