Search in sources :

Example 26 with DisbursementVoucherDocument

use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherDaoOjb method getDocument.

/**
 * @see org.kuali.kfs.fp.dataaccess.DisbursementVoucherDao#getDocument(java.lang.String)
 */
public DisbursementVoucherDocument getDocument(String fdocNbr) {
    LOG.debug("getDocument() started");
    Criteria criteria = new Criteria();
    criteria.addEqualTo("documentNumber", fdocNbr);
    return (DisbursementVoucherDocument) getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(getDisbursementVoucherDocumentClass(), criteria));
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 27 with DisbursementVoucherDocument

use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.

the class RecurringDisbursementVoucherSearchDaoJdbc method findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods.

@Override
public Collection<String> findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods(Date currentFisalPeriodEndDate) {
    final Date currentFisalPeriodEndDateForSql = currentFisalPeriodEndDate;
    Collection<DisbursementVoucherDocument> dvsFound = null;
    return getJdbcTemplate().execute(new ConnectionCallback<Collection<String>>() {

        public Collection<String> doInConnection(Connection con) throws SQLException {
            PreparedStatement selectStatement = null;
            ResultSet queryResultSet = null;
            List<String> finalResults = new ArrayList<String>();
            try {
                String selectStatementSql = getSavedDvsSpawnedByRecurringDvForCurrentAndPastFiscalPeriodsSelectSql(currentFisalPeriodEndDateForSql);
                LOG.info("findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods: SQL Statement to obtain saved DVs spawned by RCDV for current and past fiscal period follows.");
                LOG.info("findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods: *************************************");
                LOG.info("findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods: " + selectStatementSql);
                LOG.info("findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods: *************************************");
                selectStatement = con.prepareStatement(selectStatementSql);
                queryResultSet = selectStatement.executeQuery();
                while (queryResultSet.next()) {
                    String dvDocId = queryResultSet.getString(1);
                    String dvDueDate = queryResultSet.getString(2);
                    finalResults.add(dvDocId);
                    LOG.info("findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods: Found DV DocID=" + dvDocId + "=  DVCheckDateSameAsDueDate=" + dvDueDate + "=");
                }
                queryResultSet.close();
            } finally {
                if (queryResultSet != null) {
                    try {
                        queryResultSet.close();
                    } catch (SQLException e) {
                        LOG.error("findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods: Could not close ResultSet");
                    }
                }
                if (selectStatement != null) {
                    try {
                        selectStatement.close();
                    } catch (SQLException e) {
                        LOG.error("findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods: Could not close selection PreparedStatement");
                    }
                }
            }
            return finalResults;
        }
    });
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) Collection(java.util.Collection) PreparedStatement(java.sql.PreparedStatement) ArrayList(java.util.ArrayList) List(java.util.List) Date(java.sql.Date) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 28 with DisbursementVoucherDocument

use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherBankCodeValidation method validate.

public boolean validate(AttributedDocumentEvent event) {
    LOG.debug("validate start");
    DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) getAccountingDocumentForValidation();
    boolean isValid = CuBankCodeValidation.validate(dvDocument, dvDocument.getDisbVchrBankCode(), KFSPropertyConstants.DISB_VCHR_BANK_CODE, false, true);
    return isValid;
}
Also used : DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 29 with DisbursementVoucherDocument

use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherPayeeStateAndCountryValidation method validate.

@Override
public boolean validate(AttributedDocumentEvent event) {
    boolean isValid = true;
    DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) accountingDocumentForValidation;
    DisbursementVoucherPayeeDetail payeeDetail = dvDocument.getDvPayeeDetail();
    GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.DOCUMENT);
    // Verify that state code and country code are not both blank.
    if (StringUtils.isBlank(payeeDetail.getDisbVchrPayeeStateCode()) && StringUtils.isBlank(payeeDetail.getDisbVchrPayeeCountryCode())) {
        GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(KFSConstants.GENERAL_PAYMENT_TAB_ERRORS, CUKFSKeyConstants.ERROR_DOCUMENT_DV_BLANK_STATE_AND_COUNTRY);
        isValid = false;
    }
    if (dvDocument instanceof RecurringDisbursementVoucherDocument) {
        String payeeTypeCode = payeeDetail.getDisbursementVoucherPayeeTypeCode();
        String paymentReasonCode = payeeDetail.getDisbVchrPaymentReasonCode();
        Integer vendorHeaderId = payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger();
        if (getCuDisbursementVoucherTaxService().isForeignVendorAndTaxReviewRequired(payeeTypeCode, paymentReasonCode, vendorHeaderId)) {
            GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(KFSConstants.GENERAL_PAYMENT_TAB_ERRORS, CUKFSKeyConstants.ERROR_RCDV_NO_FOREIGN_VENDORS);
            isValid = false;
        }
    }
    GlobalVariables.getMessageMap().removeFromErrorPath(KFSPropertyConstants.DOCUMENT);
    return isValid;
}
Also used : RecurringDisbursementVoucherDocument(edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument) DisbursementVoucherPayeeDetail(org.kuali.kfs.fp.businessobject.DisbursementVoucherPayeeDetail) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument) RecurringDisbursementVoucherDocument(edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument)

Example 30 with DisbursementVoucherDocument

use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.

the class DisbursementVoucherAction method calculateTravelMileageAmount.

/**
 * Calculates the travel mileage amount.
 */
public ActionForward calculateTravelMileageAmount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    DisbursementVoucherForm dvForm = (DisbursementVoucherForm) form;
    DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) dvForm.getDocument();
    if (dvDocument.getDvNonEmployeeTravel().getDvPersonalCarMileageAmount() == null) {
        LOG.error("Total Mileage must be given");
        GlobalVariables.getMessageMap().putError("DVNonEmployeeTravelErrors", KFSKeyConstants.ERROR_REQUIRED, "Total Mileage");
    }
    if (dvDocument.getDvNonEmployeeTravel().getDvPerdiemStartDttmStamp() == null) {
        LOG.error("Travel Start Date must be given");
        GlobalVariables.getMessageMap().putError("DVNonEmployeeTravelErrors", KFSKeyConstants.ERROR_REQUIRED, "Travel Start Date");
    }
    if (!GlobalVariables.getMessageMap().hasErrors()) {
        // call service to calculate mileage amount
        KualiDecimal mileageAmount = SpringContext.getBean(DisbursementVoucherTravelService.class).calculateMileageAmount(dvDocument.getDvNonEmployeeTravel().getDvPersonalCarMileageAmount(), dvDocument.getDvNonEmployeeTravel().getDvPerdiemStartDttmStamp());
        dvDocument.getDvNonEmployeeTravel().setDisbVchrMileageCalculatedAmt(mileageAmount);
        dvDocument.getDvNonEmployeeTravel().setDisbVchrPersonalCarAmount(mileageAmount);
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : DisbursementVoucherTravelService(org.kuali.kfs.fp.document.service.DisbursementVoucherTravelService) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Aggregations

DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)44 RecurringDisbursementVoucherDocument (edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument)10 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)8 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)7 ArrayList (java.util.ArrayList)6 List (java.util.List)4 DisbursementVoucherNonEmployeeTravel (org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeTravel)4 DisbursementVoucherPayeeDetail (org.kuali.kfs.fp.businessobject.DisbursementVoucherPayeeDetail)4 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)4 Date (java.sql.Date)3 DisbursementVoucherNonEmployeeExpense (org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense)3 DisbursementVoucherTaxService (org.kuali.kfs.fp.document.service.DisbursementVoucherTaxService)3 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)3 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)3 BatchDisbursementVoucherDocument (com.rsmart.kuali.kfs.fp.document.BatchDisbursementVoucherDocument)2 CuDisbursementVoucherPayeeDetail (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetail)2 RecurringDisbursementVoucherDetail (edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail)2 HashMap (java.util.HashMap)2 DisbursementVoucherPreConferenceRegistrant (org.kuali.kfs.fp.businessobject.DisbursementVoucherPreConferenceRegistrant)2 DisbursementVoucherTravelService (org.kuali.kfs.fp.document.service.DisbursementVoucherTravelService)2