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));
}
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;
}
});
}
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;
}
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;
}
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);
}
Aggregations