use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class DisbursementVoucherAction method calculateTravelPerDiem.
/**
* Calculates the travel per diem amount.
*/
public ActionForward calculateTravelPerDiem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DisbursementVoucherForm dvForm = (DisbursementVoucherForm) form;
try {
// call service to calculate per diem
DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) dvForm.getDocument();
KualiDecimal perDiemAmount = SpringContext.getBean(DisbursementVoucherTravelService.class).calculatePerDiemAmount(dvDocument.getDvNonEmployeeTravel().getDvPerdiemStartDttmStamp(), dvDocument.getDvNonEmployeeTravel().getDvPerdiemEndDttmStamp(), dvDocument.getDvNonEmployeeTravel().getDisbVchrPerdiemRate());
dvDocument.getDvNonEmployeeTravel().setDisbVchrPerdiemCalculatedAmt(perDiemAmount);
dvDocument.getDvNonEmployeeTravel().setDisbVchrPerdiemActualAmount(perDiemAmount);
} catch (RuntimeException e) {
String errorMessage = e.getMessage();
if (StringUtils.isBlank(errorMessage)) {
errorMessage = "The per diem amount could not be calculated. Please ensure all required per diem fields are filled in before attempting to calculate the per diem amount.";
}
LOG.error("Error in calculating travel per diem: " + errorMessage);
GlobalVariables.getMessageMap().putError("DVNonEmployeeTravelErrors", KFSKeyConstants.ERROR_CUSTOM, errorMessage);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class DisbursementVoucherAction method extractNow.
/**
* Extracts the DV as immediate payment upon user's request after it routes to FINAL.
*/
public ActionForward extractNow(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DisbursementVoucherForm dvForm = (DisbursementVoucherForm) form;
DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) dvForm.getDocument();
PaymentSourceExtractionService disbursementVoucherExtractService = DisbursementVoucherDocument.getDisbursementVoucherExtractService();
dvDocument.setImmediatePaymentIndicator(true);
disbursementVoucherExtractService.extractSingleImmediatePayment(dvDocument);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class DisbursementVoucherAction method deletePreConfRegistrantLine.
/**
* Deletes a pre conference registrant line.
*/
public ActionForward deletePreConfRegistrantLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DisbursementVoucherForm dvForm = (DisbursementVoucherForm) form;
DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) dvForm.getDocument();
int deleteIndex = getLineToDelete(request);
dvDocument.getDvPreConferenceDetail().getDvPreConferenceRegistrants().remove(deleteIndex);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class DisbursementVoucherAction method setupPayeeAsEmployee.
/**
* setup the payee as an employee with the given id number
*/
protected void setupPayeeAsEmployee(DisbursementVoucherForm dvForm, String payeeIdNumber) {
Person person = SpringContext.getBean(PersonService.class).getPersonByEmployeeId(payeeIdNumber);
if (person != null) {
((DisbursementVoucherDocument) dvForm.getDocument()).templateEmployee(person);
dvForm.setTempPayeeIdNumber(payeeIdNumber);
dvForm.setOldPayeeType(KFSConstants.PaymentPayeeTypes.EMPLOYEE);
} else {
LOG.error("Exception while attempting to retrieve universal user by universal user id " + payeeIdNumber);
}
}
use of org.kuali.kfs.fp.document.DisbursementVoucherDocument in project cu-kfs by CU-CommunityApps.
the class DisbursementVoucherAction method addNonEmployeeExpenseLine.
/**
* Adds a new employee travel expense line.
*/
public ActionForward addNonEmployeeExpenseLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DisbursementVoucherForm dvForm = (DisbursementVoucherForm) form;
DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) dvForm.getDocument();
DisbursementVoucherNonEmployeeExpense newExpenseLine = dvForm.getNewNonEmployeeExpenseLine();
// validate line
GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.NEW_NONEMPLOYEE_EXPENSE_LINE);
SpringContext.getBean(DictionaryValidationService.class).validateBusinessObject(newExpenseLine);
// Ensure all fields are filled in before attempting to add a new expense line
if (StringUtils.isBlank(newExpenseLine.getDisbVchrPrePaidExpenseCode())) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.DISB_VCHR_EXPENSE_CODE, KFSKeyConstants.ERROR_DV_EXPENSE_CODE);
}
if (StringUtils.isBlank(newExpenseLine.getDisbVchrPrePaidExpenseCompanyName())) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.DISB_VCHR_EXPENSE_COMPANY_NAME, KFSKeyConstants.ERROR_DV_EXPENSE_COMPANY_NAME);
}
if (ObjectUtils.isNull(newExpenseLine.getDisbVchrExpenseAmount())) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.DISB_VCHR_EXPENSE_AMOUNT, KFSKeyConstants.ERROR_DV_EXPENSE_AMOUNT);
}
GlobalVariables.getMessageMap().removeFromErrorPath(KFSPropertyConstants.NEW_NONEMPLOYEE_EXPENSE_LINE);
// current one.
if (!GlobalVariables.getMessageMap().hasErrors()) {
newExpenseLine.setDocumentNumber(dvDocument.getDocumentNumber());
dvDocument.getDvNonEmployeeTravel().addDvNonEmployeeExpenseLine(newExpenseLine);
DisbursementVoucherNonEmployeeExpense newNewNonEmployeeExpenseLine = new DisbursementVoucherNonEmployeeExpense();
newNewNonEmployeeExpenseLine.setFinancialDocumentLineNumber(newExpenseLine.getFinancialDocumentLineNumber() + 1);
dvForm.setNewNonEmployeeExpenseLine(newNewNonEmployeeExpenseLine);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations