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