Search in sources :

Example 1 with RecurringDisbursementVoucherDetail

use of edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail in project cu-kfs by CU-CommunityApps.

the class RecurringDisbursementVoucherDocumentServiceImpl method cancelSavedDisbursementVouchers.

@Override
public Set<String> cancelSavedDisbursementVouchers(RecurringDisbursementVoucherDocument recurringDisbursementVoucherDocument, final String cancelMessage) {
    Set<String> canceledDVs = new HashSet<String>();
    for (RecurringDisbursementVoucherDetail detail : recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails()) {
        if (isDVCancelable(detail.getDvDocumentNumber())) {
            cancelDVAsSystemUser(cancelMessage, detail.getDvDocumentNumber());
            canceledDVs.add(detail.getDvDocumentNumber());
        }
    }
    noteChangeOnRecurringDV(recurringDisbursementVoucherDocument, "The following disbursement vouchers were canceled: ", canceledDVs);
    return canceledDVs;
}
Also used : RecurringDisbursementVoucherDetail(edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail) HashSet(java.util.HashSet)

Example 2 with RecurringDisbursementVoucherDetail

use of edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail in project cu-kfs by CU-CommunityApps.

the class RecurringDisbursementVoucherDocumentServiceImpl method getDetailtem.

private RecurringDisbursementVoucherDetail getDetailtem(List<RecurringDisbursementVoucherDetail> details, Date date) {
    for (RecurringDisbursementVoucherDetail detail : details) {
        if (detail.getDvCheckDate().equals(date)) {
            return detail;
        }
    }
    RecurringDisbursementVoucherDetail detail = new RecurringDisbursementVoucherDetail(date, KualiDecimal.ZERO, "");
    details.add(detail);
    return detail;
}
Also used : RecurringDisbursementVoucherDetail(edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail)

Example 3 with RecurringDisbursementVoucherDetail

use of edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail in project cu-kfs by CU-CommunityApps.

the class RecurringDisbursementVoucherDocumentServiceImpl method generateDisbursementDocumentsFromRecurringDV.

@Override
public List<DisbursementVoucherDocument> generateDisbursementDocumentsFromRecurringDV(RecurringDisbursementVoucherDocument recurringDV) throws WorkflowException {
    List<DisbursementVoucherDocument> generatedDVs = new ArrayList<DisbursementVoucherDocument>();
    int rowId = 0;
    for (Object accountingLine : recurringDV.getSourceAccountingLines()) {
        ScheduledSourceAccountingLine scheduledAccountingLine = (ScheduledSourceAccountingLine) accountingLine;
        TreeMap<Date, KualiDecimal> datesAndAmounts = getScheduledAccountingLineService().generateDatesAndAmounts(scheduledAccountingLine, rowId);
        for (Date date : datesAndAmounts.keySet()) {
            KualiDecimal amount = datesAndAmounts.get(date);
            CuDisbursementVoucherDocument disbursementVoucherDocument = getCuDisbursementVoucherDocument(generatedDVs, recurringDV, date);
            disbursementVoucherDocument.setDisbVchrCheckTotalAmount(calculateDVCheckAmount(amount, disbursementVoucherDocument));
            RecurringDisbursementVoucherDetail dvDetail = getDetailtem(recurringDV.getRecurringDisbursementVoucherDetails(), date);
            dvDetail.setDvDocumentNumber(disbursementVoucherDocument.getDocumentNumber());
            disbursementVoucherDocument.setDisbVchrCheckStubText(dvDetail.getDvCheckStub());
            SourceAccountingLine line = buildSourceAccountingLine(scheduledAccountingLine);
            line.setAmount(amount);
            disbursementVoucherDocument.addSourceAccountingLine(line);
        }
        rowId++;
    }
    saveDisbursementVouchers(generatedDVs, recurringDV);
    return generatedDVs;
}
Also used : CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) ArrayList(java.util.ArrayList) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) RecurringDisbursementVoucherDetail(edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail) ScheduledSourceAccountingLine(edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) ScheduledSourceAccountingLine(edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine) RecurringDisbursementVoucherDocument(edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument) CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) Date(java.sql.Date)

Example 4 with RecurringDisbursementVoucherDetail

use of edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail in project cu-kfs by CU-CommunityApps.

the class RecurringDisbursementVoucherDocumentServiceImpl method findPdpStatuses.

@Override
public List<RecurringDisbursementVoucherPDPStatus> findPdpStatuses(RecurringDisbursementVoucherDocument recurringDV) {
    List<RecurringDisbursementVoucherPDPStatus> pdpStatuses = new ArrayList<RecurringDisbursementVoucherPDPStatus>();
    for (RecurringDisbursementVoucherDetail detail : recurringDV.getRecurringDisbursementVoucherDetails()) {
        if (StringUtils.isNotEmpty(detail.getDvDocumentNumber())) {
            DisbursementVoucherDocument disbursementVoucherDocument;
            try {
                disbursementVoucherDocument = (DisbursementVoucherDocument) getDocumentService().getByDocumentHeaderId(detail.getDvDocumentNumber());
            } catch (WorkflowException e) {
                LOG.error("findPdpStatuses: There was a problem getting DV from the recurring DV detail: " + e);
                throw new RuntimeException(e);
            }
            pdpStatuses.add(buildRecurringDisbursementVoucherPDPStatus(disbursementVoucherDocument));
        }
    }
    Collections.sort(pdpStatuses);
    return pdpStatuses;
}
Also used : RecurringDisbursementVoucherPDPStatus(edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherPDPStatus) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) ArrayList(java.util.ArrayList) RecurringDisbursementVoucherDetail(edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail) RecurringDisbursementVoucherDocument(edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument) CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)

Example 5 with RecurringDisbursementVoucherDetail

use of edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail in project cu-kfs by CU-CommunityApps.

the class RecurringDisbursementVoucherDocumentServiceImpl method cancelDisbursementVouchersFinalizedNotExtracted.

@Override
public Set<String> cancelDisbursementVouchersFinalizedNotExtracted(RecurringDisbursementVoucherDocument recurringDisbursementVoucherDocument, String cancelMessage) {
    Set<String> canceledDVs = new HashSet<String>();
    for (RecurringDisbursementVoucherDetail detail : recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails()) {
        String dvDocumentNumber = detail.getDvDocumentNumber();
        if (!isDVCancelable(dvDocumentNumber)) {
            CuDisbursementVoucherDocument dv;
            try {
                dv = (CuDisbursementVoucherDocument) getDocumentService().getByDocumentHeaderId(detail.getDvDocumentNumber());
                if (isDvCancelableFromApprovedNotExtracted(dv)) {
                    Date cancelDate = new Date(Calendar.getInstance().getTimeInMillis());
                    dv.setCancelDate(cancelDate);
                    CuDisbursementVoucherDocument cancledDV = (CuDisbursementVoucherDocument) getDocumentService().saveDocument(dv);
                    getCuDisbursementVoucherExtractionHelperService().getPaymentSourceHelperService().handleEntryCancellation(cancledDV, getCuDisbursementVoucherExtractionHelperService());
                    canceledDVs.add(cancledDV.getDocumentNumber());
                }
            } catch (WorkflowException e) {
                throw new RuntimeException(e);
            }
        }
    }
    noteChangeOnRecurringDV(recurringDisbursementVoucherDocument, "The following disbursement vouchers were canceled after it was approved but before payments were created: ", canceledDVs);
    return canceledDVs;
}
Also used : CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) RecurringDisbursementVoucherDetail(edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail) Date(java.sql.Date) HashSet(java.util.HashSet)

Aggregations

RecurringDisbursementVoucherDetail (edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail)6 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)3 Date (java.sql.Date)3 ScheduledSourceAccountingLine (edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine)2 RecurringDisbursementVoucherDocument (edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)2 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)2 RecurringDisbursementVoucherPDPStatus (edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherPDPStatus)1 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)1