Search in sources :

Example 36 with DisbursementVoucherDocument

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

Example 37 with DisbursementVoucherDocument

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);
}
Also used : PaymentSourceExtractionService(org.kuali.kfs.sys.batch.service.PaymentSourceExtractionService) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 38 with DisbursementVoucherDocument

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);
}
Also used : DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 39 with DisbursementVoucherDocument

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);
    }
}
Also used : PersonService(org.kuali.rice.kim.api.identity.PersonService) Person(org.kuali.rice.kim.api.identity.Person) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 40 with DisbursementVoucherDocument

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);
}
Also used : DictionaryValidationService(org.kuali.kfs.kns.service.DictionaryValidationService) DisbursementVoucherNonEmployeeExpense(org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense) 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