Search in sources :

Example 36 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountExtractPdpEntryServiceImplTest method cleanAccountingEntriesInDetailEntry_HandleOneCredit.

@Test
public void cleanAccountingEntriesInDetailEntry_HandleOneCredit() {
    PdpFeedDetailEntry detailEntry = PdpFeedDetailEntryFixture.DETAIL_TWO_POSITIVE_1_NEGATIVE.toPdpFeedDetailEntry();
    Map<DebitCreditTotal, KualiDecimal> totals = pdpEntryService.calculateTotals(detailEntry);
    assertEquals("The number of accounting entries should be 3", 3, detailEntry.getAccounting().size());
    assertTotals(totals, 15, -10);
    pdpEntryService.cleanAccountingEntriesInDetailEntry(detailEntry);
    totals = pdpEntryService.calculateTotals(detailEntry);
    assertEquals("The number of accounting entries should be 1", 1, detailEntry.getAccounting().size());
    assertTotals(totals, 5, 0);
}
Also used : DebitCreditTotal(edu.cornell.kfs.concur.batch.service.impl.ConcurStandardAccountExtractPdpEntryServiceImpl.DebitCreditTotal) PdpFeedDetailEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Test(org.junit.Test)

Example 37 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractFileFixture method buildConcurStandardAccountingExtractFile.

public static ConcurStandardAccountingExtractFile buildConcurStandardAccountingExtractFile(KualiDecimal[] debits, KualiDecimal[] credits, String employeeGroupId) {
    ConcurStandardAccountingExtractFile file = new ConcurStandardAccountingExtractFile();
    Date today = new Date(Calendar.getInstance().getTimeInMillis());
    file.setBatchDate(today);
    file.setRecordCount(new Integer(debits.length + credits.length));
    KualiDecimal journalTotal = KualiDecimal.ZERO;
    for (KualiDecimal debitAmount : debits) {
        journalTotal = journalTotal.add(debitAmount);
        file.getConcurStandardAccountingExtractDetailLines().add(buildConcurStandardAccountingExtractDetailLine(ConcurConstants.DEBIT, debitAmount, employeeGroupId));
    }
    for (KualiDecimal creditAmount : credits) {
        journalTotal = journalTotal.add(creditAmount);
        file.getConcurStandardAccountingExtractDetailLines().add(buildConcurStandardAccountingExtractDetailLine(ConcurConstants.CREDIT, creditAmount, employeeGroupId));
    }
    file.setJournalAmountTotal(journalTotal);
    return file;
}
Also used : ConcurStandardAccountingExtractFile(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractFile) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Date(java.sql.Date)

Example 38 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class CurrentFundsLookupableHelperServiceImpl method buildCosolidatedCurrentFundsCollection.

/**
 * Builds the current funds collection with consolidation option from an iterator
 *
 * @param iterator
 * @param pendingEntryOption the selected pending entry option
 * @return the consolidated current funds collection
 */
private Collection<AccountStatusCurrentFunds> buildCosolidatedCurrentFundsCollection(Collection collection, String pendingEntryOption) {
    Collection<AccountStatusCurrentFunds> retval = new ArrayList<AccountStatusCurrentFunds>();
    for (Object collectionEntry : collection) {
        if (collectionEntry.getClass().isArray()) {
            int i = 0;
            Object[] array = (Object[]) collectionEntry;
            AccountStatusCurrentFunds cf = new AccountStatusCurrentFunds();
            LOG.debug("element length " + array.length);
            for (Object element : array) {
                LOG.debug("I found this element " + element);
            }
            if (AccountStatusCurrentFunds.class.isAssignableFrom(getBusinessObjectClass())) {
                try {
                    cf = (AccountStatusCurrentFunds) getBusinessObjectClass().newInstance();
                } catch (Exception e) {
                    LOG.warn("Using " + AccountStatusCurrentFunds.class + " for results because I couldn't instantiate the " + getBusinessObjectClass());
                }
            } else {
                LOG.warn("Using " + AccountStatusCurrentFunds.class + " for results because I couldn't instantiate the " + getBusinessObjectClass());
            }
            cf.setUniversityFiscalYear(new Integer(array[i++].toString()));
            cf.setChartOfAccountsCode(array[i++].toString());
            cf.setAccountNumber(array[i++].toString());
            String subAccountNumber = Constant.CONSOLIDATED_SUB_ACCOUNT_NUMBER;
            cf.setSubAccountNumber(subAccountNumber);
            cf.setBalanceTypeCode(array[i++].toString());
            cf.setFinancialObjectCode(array[i++].toString());
            cf.setEmplid(array[i++].toString());
            cf.setPositionNumber(array[i++].toString());
            cf.setFinancialSubObjectCode(Constant.CONSOLIDATED_SUB_OBJECT_CODE);
            cf.setObjectTypeCode(Constant.CONSOLIDATED_OBJECT_TYPE_CODE);
            cf.setAccountLineAnnualBalanceAmount(new KualiDecimal(array[i++].toString()));
            cf.setBeginningBalanceLineAmount(new KualiDecimal(array[i++].toString()));
            cf.setContractsGrantsBeginningBalanceAmount(new KualiDecimal(array[i++].toString()));
            cf.setMonth1Amount(new KualiDecimal(array[i++].toString()));
            cf.setDummyBusinessObject(new TransientBalanceInquiryAttributes());
            cf.getDummyBusinessObject().setPendingEntryOption(pendingEntryOption);
            cf.setOutstandingEncum(getOutstandingEncum(cf));
            cf.getDummyBusinessObject().setPendingEntryOption(pendingEntryOption);
            cf.getDummyBusinessObject().setConsolidationOption(Constant.CONSOLIDATION);
            retval.add(cf);
        }
    }
    return retval;
}
Also used : AccountStatusCurrentFunds(org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds) TransientBalanceInquiryAttributes(org.kuali.kfs.gl.businessobject.TransientBalanceInquiryAttributes) ArrayList(java.util.ArrayList) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) LaborLedgerObject(org.kuali.kfs.integration.ld.LaborLedgerObject) LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject)

Example 39 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class PreEncumbranceAutoDisEncumberValidation method checkGenerationValidity.

private boolean checkGenerationValidity(PreEncumbranceSourceAccountingLine sourceLine) {
    boolean success = true;
    boolean isCGAccount = sourceLine.getAccount().getSubFundGroup().getFundGroupCode().equals("CG");
    Integer rowId = sourceLine.getSequenceNumber() - 1;
    // this will take the various information and ensure that the GL pending entries
    // that have yet to be generated will be within a valid time frame (not span into next FY)
    TreeMap<Date, KualiDecimal> datesAndValues = PreEncumbranceAccountingLineUtil.generateDatesAndAmounts(sourceLine.getAutoDisEncumberType(), sourceLine.getStartDate(), sourceLine.getEndDate(), Integer.parseInt(sourceLine.getPartialTransactionCount()), sourceLine.getAmount(), sourceLine.getPartialAmount(), rowId);
    Date finalReversalDate = datesAndValues.pollLastEntry().getKey();
    return success;
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Date(java.sql.Date)

Example 40 with KualiDecimal

use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.

the class YearEndJournalVoucherAccountingLinesBalanceValidation method validate.

/**
 * Returns true if credit/debit entries are in balance
 * @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
 */
public boolean validate(AttributedDocumentEvent event) {
    KualiDecimal creditAmount = getYearEndJournalVoucherDocumentForValidation().getCreditTotal();
    KualiDecimal debitAmount = getYearEndJournalVoucherDocumentForValidation().getDebitTotal();
    boolean balanced = debitAmount.equals(creditAmount);
    if (!balanced) {
        String[] errorParams = { creditAmount.toString(), debitAmount.toString() };
        GlobalVariables.getMessageMap().putError(SOURCE_ACCOUNTING_LINE_ERRORS, ERROR_DOCUMENT_BALANCE_CONSIDERING_CREDIT_AND_DEBIT_AMOUNTS, errorParams);
    }
    return balanced;
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Aggregations

KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)209 ArrayList (java.util.ArrayList)37 HashMap (java.util.HashMap)19 Test (org.junit.Test)19 List (java.util.List)15 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)15 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)14 BigDecimal (java.math.BigDecimal)13 Date (java.sql.Date)13 Iterator (java.util.Iterator)12 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)12 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)12 PaymentRequestItem (org.kuali.kfs.module.purap.businessobject.PaymentRequestItem)11 IOException (java.io.IOException)10 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)10 Map (java.util.Map)9 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)9 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)9 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)9 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)8