Search in sources :

Example 1 with ScheduledSourceAccountingLine

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;
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) ScheduledSourceAccountingLine(edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine) Date(java.sql.Date)

Example 2 with ScheduledSourceAccountingLine

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());
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ScheduledSourceAccountingLine(edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine)

Example 3 with ScheduledSourceAccountingLine

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

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;
}
Also used : ScheduledSourceAccountingLine(edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine)

Example 5 with ScheduledSourceAccountingLine

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());
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) RecurringDisbursementVoucherDetail(edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail) ScheduledSourceAccountingLine(edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine) Date(java.sql.Date)

Aggregations

ScheduledSourceAccountingLine (edu.cornell.kfs.fp.businessobject.ScheduledSourceAccountingLine)6 Date (java.sql.Date)4 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)3 RecurringDisbursementVoucherDetail (edu.cornell.kfs.fp.businessobject.RecurringDisbursementVoucherDetail)2 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)2 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)1 RecurringDisbursementVoucherDocument (edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument)1 ScheduledAccountingLineServiceImpl (edu.cornell.kfs.fp.service.impl.ScheduledAccountingLineServiceImpl)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)1