use of edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherAccountingLineTotalsValidation method isAccountingLineEndDateValid.
private boolean isAccountingLineEndDateValid(RecurringDisbursementVoucherDocument recurringDV) {
boolean valid = true;
int counter = 0;
Date maximumScheduledAccountingLineEndDate = getScheduledAccountingLineService().getMaximumScheduledAccountingLineEndDate();
SimpleDateFormat dateFormater = new SimpleDateFormat(KFSConstants.MONTH_DAY_YEAR_DATE_FORMAT);
for (Object accountingLine : recurringDV.getSourceAccountingLines()) {
ScheduledSourceAccountingLine scheduledAccountingLine = (ScheduledSourceAccountingLine) accountingLine;
scheduledAccountingLine.setEndDate(getScheduledAccountingLineService().generateEndDate(scheduledAccountingLine));
if (maximumScheduledAccountingLineEndDate.before(scheduledAccountingLine.getEndDate())) {
valid = false;
GlobalVariables.getMessageMap().putError(buildTransactionCountFieldName(counter), CUKFSKeyConstants.ERROR_RCDV_END_DATE_PASSED_MAX_END_DATE, dateFormater.format(scheduledAccountingLine.getEndDate()), dateFormater.format(maximumScheduledAccountingLineEndDate));
}
counter++;
}
return valid;
}
use of edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherAccountingLineTotalsValidation method doesAccountingLineTotalEqualDVTotalDollarAmount.
private boolean doesAccountingLineTotalEqualDVTotalDollarAmount(RecurringDisbursementVoucherDocument recurringDV) {
KualiDecimal calculatedTotal = KualiDecimal.ZERO;
for (Object accountingLine : recurringDV.getSourceAccountingLines()) {
ScheduledSourceAccountingLine scheduledAccountingLine = (ScheduledSourceAccountingLine) accountingLine;
calculatedTotal = calculatedTotal.add(scheduledAccountingLine.getAmount());
}
return calculatedTotal.equals(recurringDV.getTotalDollarAmount());
}
use of edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine 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.ScheduledSourceAccountingLine in project cu-kfs by CU-CommunityApps.
the class RecurringDisbursementVoucherDocumentServiceImpl method buildSourceAccountingLine.
private SourceAccountingLine buildSourceAccountingLine(ScheduledSourceAccountingLine scheduledAccountingLine) {
SourceAccountingLine line = new SourceAccountingLine();
line.setAccountExpiredOverride(scheduledAccountingLine.getAccountExpiredOverride());
line.setAccountExpiredOverrideNeeded(scheduledAccountingLine.getAccountExpiredOverrideNeeded());
line.setAccountNumber(scheduledAccountingLine.getAccountNumber());
line.setChartOfAccountsCode(scheduledAccountingLine.getChartOfAccountsCode());
line.setDebitCreditCode(scheduledAccountingLine.getDebitCreditCode());
line.setEncumbranceUpdateCode(scheduledAccountingLine.getEncumbranceUpdateCode());
line.setFinancialDocumentLineDescription(scheduledAccountingLine.getFinancialDocumentLineDescription());
line.setFinancialDocumentLineTypeCode(scheduledAccountingLine.getFinancialDocumentLineTypeCode());
line.setFinancialObjectCode(scheduledAccountingLine.getFinancialObjectCode());
line.setFinancialSubObjectCode(scheduledAccountingLine.getFinancialSubObjectCode());
line.setNonFringeAccountOverride(scheduledAccountingLine.getNonFringeAccountOverride());
line.setNonFringeAccountOverrideNeeded(scheduledAccountingLine.getNonFringeAccountOverrideNeeded());
line.setOrganizationReferenceId(scheduledAccountingLine.getOrganizationReferenceId());
line.setPostingYear(scheduledAccountingLine.getPostingYear());
line.setProjectCode(scheduledAccountingLine.getProjectCode());
line.setReferenceNumber(scheduledAccountingLine.getReferenceNumber());
line.setReferenceTypeCode(scheduledAccountingLine.getReferenceTypeCode());
line.setSalesTaxRequired(scheduledAccountingLine.isSalesTaxRequired());
line.setSubAccountNumber(scheduledAccountingLine.getSubAccountNumber());
return line;
}
use of edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine in project cu-kfs by CU-CommunityApps.
the class RecurringDisbursementVoucherDocumentServiceImpl method updateRecurringDisbursementVoucherDetails.
@Override
public void updateRecurringDisbursementVoucherDetails(RecurringDisbursementVoucherDocument recurringDisbursementVoucherDocument) {
if (recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails() == null || recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails().isEmpty()) {
recurringDisbursementVoucherDocument.setRecurringDisbursementVoucherDetails(new ArrayList<RecurringDisbursementVoucherDetail>());
} else {
resetAmounts(recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails());
}
int rowId = 0;
for (Object accountingLine : recurringDisbursementVoucherDocument.getSourceAccountingLines()) {
ScheduledSourceAccountingLine scheduledAccountingLine = (ScheduledSourceAccountingLine) accountingLine;
TreeMap<Date, KualiDecimal> datesAndAmounts = getScheduledAccountingLineService().generateDatesAndAmounts(scheduledAccountingLine, rowId);
for (Date date : datesAndAmounts.keySet()) {
KualiDecimal amount = datesAndAmounts.get(date);
RecurringDisbursementVoucherDetail detail = getDetailtem(recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails(), date);
detail.setDvCheckAmount(amount.add(detail.getDvCheckAmount()));
detail.setRecurringDVDocumentNumber(recurringDisbursementVoucherDocument.getDocumentNumber());
if (StringUtils.isEmpty(detail.getDvCheckStub())) {
detail.setDvCheckStub(recurringDisbursementVoucherDocument.getDisbVchrCheckStubText());
}
}
rowId++;
}
recurringDisbursementVoucherDocument.setRecurringDisbursementVoucherDetails(removeZeroAmounts(recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails()));
Collections.sort(recurringDisbursementVoucherDocument.getRecurringDisbursementVoucherDetails());
}
Aggregations