Search in sources :

Example 16 with CapitalAssetAccountsGroupDetails

use of org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails in project cu-kfs by CU-CommunityApps.

the class GlLineServiceImpl method deactivateGLEntries.

protected void deactivateGLEntries(GeneralLedgerEntry entry, Document document, Integer capitalAssetLineNumber) {
    // now deactivate the gl line..
    CapitalAssetInformation capitalAssetInformation = findCapitalAssetInformation(entry.getDocumentNumber(), capitalAssetLineNumber);
    if (ObjectUtils.isNotNull(capitalAssetInformation)) {
        List<CapitalAssetAccountsGroupDetails> groupAccountingLines = capitalAssetInformation.getCapitalAssetAccountsGroupDetails();
        Collection<GeneralLedgerEntry> documentGlEntries = findAllGeneralLedgerEntry(entry.getDocumentNumber());
        for (CapitalAssetAccountsGroupDetails accountingLine : groupAccountingLines) {
            // find the matching GL entry for this accounting line.
            Collection<GeneralLedgerEntry> glEntries = findMatchingGeneralLedgerEntries(documentGlEntries, accountingLine);
            for (GeneralLedgerEntry glEntry : glEntries) {
                KualiDecimal lineAmount = accountingLine.getAmount();
                // update submitted amount on the gl entry and save the results.
                createGeneralLedgerEntryAsset(glEntry, document, capitalAssetLineNumber);
                updateTransactionSumbitGlEntryAmount(glEntry, lineAmount);
            }
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) GeneralLedgerEntry(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 17 with CapitalAssetAccountsGroupDetails

use of org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails in project cu-kfs by CU-CommunityApps.

the class GlLineServiceImpl method addToCapitalAssetsMatchingLineType.

/**
 * Compares the gl line to the group accounting lines in each capital asset and
 * when finds a match, adds the capital asset to the list of matching assets. It also checks the accounting line type against the GL line credit/debit code.
 *
 * @param matchingAssets
 * @param capitalAsset
 * @param entry
 * @param capitalAssetLineType
 */
protected void addToCapitalAssetsMatchingLineType(List<CapitalAssetInformation> matchingAssets, CapitalAssetInformation capitalAsset, GeneralLedgerEntry entry) {
    List<CapitalAssetAccountsGroupDetails> groupAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails();
    for (CapitalAssetAccountsGroupDetails groupAccountLine : groupAccountLines) {
        if (groupAccountLine.getDocumentNumber().equals(entry.getDocumentNumber()) && groupAccountLine.getChartOfAccountsCode().equals(entry.getChartOfAccountsCode()) && groupAccountLine.getAccountNumber().equals(entry.getAccountNumber()) && groupAccountLine.getFinancialObjectCode().equals(entry.getFinancialObjectCode())) {
            // check that debit matches target acct lines and credit matches
            // source accounting lines
            boolean isGroupLineSource = StringUtils.equals(groupAccountLine.getFinancialDocumentLineTypeCode(), KFSConstants.SOURCE_ACCT_LINE_TYPE_CODE);
            boolean isGroupLineTarget = StringUtils.equals(groupAccountLine.getFinancialDocumentLineTypeCode(), KFSConstants.TARGET_ACCT_LINE_TYPE_CODE);
            boolean isGLEntryCredit = StringUtils.equals(entry.getTransactionDebitCreditCode(), KFSConstants.GL_CREDIT_CODE);
            boolean isGLEntryDebit = StringUtils.equals(entry.getTransactionDebitCreditCode(), KFSConstants.GL_DEBIT_CODE);
            boolean isErrorCorrection = groupAccountLine.getAmount().isNegative();
            logAddToCapitalAssetsMatchingLineTypeDetails(isGroupLineSource, isGroupLineTarget, isGLEntryCredit, isGLEntryDebit, isErrorCorrection, groupAccountLine, entry);
            if ((isGroupLineSource && isGLEntryCredit) || (isGroupLineTarget && isGLEntryDebit) || (isErrorCorrection && isGroupLineSource && isGLEntryDebit) || (isErrorCorrection && isGroupLineTarget && isGLEntryCredit)) {
                matchingAssets.add(capitalAsset);
                break;
            }
        }
    }
}
Also used : CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 18 with CapitalAssetAccountsGroupDetails

use of org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails in project cu-kfs by CU-CommunityApps.

the class GlLineServiceImpl method getNextAccountingLineNumber.

/**
 * calculates the next accounting line number for accounts details for each capital asset.
 * Goes through the current records and gets the last accounting line number.
 *
 * @param capitalAsset
 * @return nextAccountingLineNumber
 */
protected Integer getNextAccountingLineNumber(CapitalAccountingLines capitalAccountingLine, CapitalAssetInformation capitalAsset) {
    Integer nextAccountingLineNumber = 0;
    List<CapitalAssetAccountsGroupDetails> capitalAssetAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails();
    for (CapitalAssetAccountsGroupDetails capitalAssetAccountLine : capitalAssetAccountLines) {
        nextAccountingLineNumber = capitalAssetAccountLine.getCapitalAssetAccountLineNumber();
    }
    return ++nextAccountingLineNumber;
}
Also used : CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Aggregations

CapitalAssetAccountsGroupDetails (org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)18 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)8 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)4 BigDecimal (java.math.BigDecimal)2 GeneralLedgerEntry (org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)2 ArrayList (java.util.ArrayList)1 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)1 AssetPaymentDetail (org.kuali.kfs.module.cam.businessobject.AssetPaymentDetail)1 KualiAccountingDocumentFormBase (org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)1