Search in sources :

Example 36 with CapitalAssetInformation

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

the class CapitalAssetInformationActionBase method checkSelectForCapitalAccountingLines.

/**
 * checks "select" check box on capital accounting lines if there are
 * corresponding capital asset records.
 *
 * @param calfb
 */
protected void checkSelectForCapitalAccountingLines(CapitalAccountingLinesFormBase calfb) {
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    KualiAccountingDocumentFormBase kadfb = calfb;
    List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        if (currentCapitalAssetInformation.size() <= 0) {
            capitalAccountingLine.setSelectLine(false);
        } else {
            CapitalAssetInformation existingCapitalAsset = getCapitalAssetCreated(capitalAccountingLine, currentCapitalAssetInformation);
            if (ObjectUtils.isNotNull(existingCapitalAsset)) {
                capitalAccountingLine.setSelectLine(true);
            } else {
                capitalAccountingLine.setSelectLine(false);
            }
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Example 37 with CapitalAssetInformation

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

the class CapitalAssetInformationActionBase method createNewCapitalAsset.

/**
 * helper method to add accounting details for this new capital asset record
 *
 * @param capitalAccountingLines
 * @param currentCapitalAssetInformation
 * @param documentNumber
 * @param actionType
 * @param nextCapitalAssetLineNumber
 */
protected void createNewCapitalAsset(List<CapitalAccountingLines> capitalAccountingLines, List<CapitalAssetInformation> currentCapitalAssetInformation, String documentNumber, String actionType, Integer nextCapitalAssetLineNumber) {
    CapitalAssetInformation capitalAsset = new CapitalAssetInformation();
    capitalAsset.setCapitalAssetLineAmount(KualiDecimal.ZERO);
    capitalAsset.setDocumentNumber(documentNumber);
    capitalAsset.setCapitalAssetLineNumber(nextCapitalAssetLineNumber);
    capitalAsset.setCapitalAssetActionIndicator(actionType);
    capitalAsset.setCapitalAssetProcessedIndicator(false);
    // now setup the account line information associated with this capital asset
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        capitalAsset.setDistributionAmountCode(capitalAccountingLine.getDistributionAmountCode());
        createCapitalAssetAccountingLinesDetails(capitalAccountingLine, capitalAsset);
    }
    currentCapitalAssetInformation.add(capitalAsset);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines)

Example 38 with CapitalAssetInformation

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

the class CapitalAssetInformationActionBase method getCurrentCapitalAssetInformationObject.

/**
 * get the capital asset information object currently associated with the document
 */
protected List<CapitalAssetInformation> getCurrentCapitalAssetInformationObject(KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase) {
    LOG.debug("getCurrentCapitalAssetInformationObject() - start");
    CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) kualiAccountingDocumentFormBase.getFinancialDocument();
    if (!(capitalAssetInformationDocumentBase instanceof CapitalAssetEditable)) {
        return null;
    }
    List<CapitalAssetInformation> capitalAssetInformation = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
    return capitalAssetInformation;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAssetInformationDocumentBase(org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase) CapitalAssetEditable(org.kuali.kfs.fp.document.CapitalAssetEditable)

Example 39 with CapitalAssetInformation

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

the class CapitalAssetInformationActionBase method adjustAccountingLinesAmounts.

/**
 * for each capital account line, compares its amounts to the accounting lines
 * on capital assets and adjusts its accounting lines amounts for any variances.
 *
 * @param capitalAcctLine
 * @param capitalAssetInformation
 */
protected void adjustAccountingLinesAmounts(CapitalAccountingLines capitalAcctLine, List<CapitalAssetInformation> capitalAssetInformation) {
    CapitalAssetAccountsGroupDetails lastAcctLine = null;
    KualiDecimal totalAccountsAmount = KualiDecimal.ZERO;
    for (CapitalAssetInformation capitalAsset : capitalAssetInformation) {
        if (capitalAsset.getCapitalAssetLineAmount().compareTo(getAccountingLinesTotalAmount(capitalAsset)) != 0) {
            List<CapitalAssetAccountsGroupDetails> groupAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails();
            for (CapitalAssetAccountsGroupDetails groupAccountLine : groupAccountLines) {
                if (groupAccountLine.getCapitalAssetLineNumber().compareTo(capitalAsset.getCapitalAssetLineNumber()) == 0 && groupAccountLine.getSequenceNumber().compareTo(capitalAcctLine.getSequenceNumber()) == 0 && groupAccountLine.getFinancialDocumentLineTypeCode().equals(KFSConstants.SOURCE.equals(capitalAcctLine.getLineType()) ? KFSConstants.SOURCE_ACCT_LINE_TYPE_CODE : KFSConstants.TARGET_ACCT_LINE_TYPE_CODE) && groupAccountLine.getChartOfAccountsCode().equals(capitalAcctLine.getChartOfAccountsCode()) && groupAccountLine.getAccountNumber().equals(capitalAcctLine.getAccountNumber()) && groupAccountLine.getFinancialObjectCode().equals(capitalAcctLine.getFinancialObjectCode())) {
                    totalAccountsAmount = totalAccountsAmount.add(groupAccountLine.getAmount());
                    lastAcctLine = groupAccountLine;
                }
            }
        }
    }
    KualiDecimal variance = capitalAcctLine.getAmount().subtract(totalAccountsAmount);
    if (variance.isNonZero() && ObjectUtils.isNotNull(lastAcctLine)) {
        lastAcctLine.setAmount(lastAcctLine.getAmount().add(variance));
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 40 with CapitalAssetInformation

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

the class GlLineServiceImpl method setupMissingCapitalAssetInformation.

/**
 * Setup shell Capital Asset Information where it doesn't already exist (for
 * example for a PRNC that is in Process and has already generated some
 * capital asset information in a previous processing)
 *
 * @param entry
 */
@Override
public void setupMissingCapitalAssetInformation(String documentNumber) {
    List<CapitalAccountingLines> capitalAccountingLines;
    // get all related entries and create capital asset record for each
    Collection<GeneralLedgerEntry> glEntries = findAllGeneralLedgerEntry(documentNumber);
    Collection<CapitalAssetInformation> allCapitalAssetInformation = findAllCapitalAssetInformation(documentNumber);
    int nextCapitalAssetLineNumber = findMaximumCapitalAssetLineNumber(allCapitalAssetInformation) + 1;
    for (GeneralLedgerEntry glEntry : glEntries) {
        // check if it has capital Asset Info
        List<CapitalAssetInformation> entryCapitalAssetInfo = findCapitalAssetInformationForGLLineMatchLineType(glEntry);
        if (entryCapitalAssetInfo.isEmpty()) {
            capitalAccountingLines = new ArrayList<CapitalAccountingLines>();
            createCapitalAccountingLine(capitalAccountingLines, glEntry, null);
            createNewCapitalAsset(capitalAccountingLines, documentNumber, null, nextCapitalAssetLineNumber);
            nextCapitalAssetLineNumber++;
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) GeneralLedgerEntry(org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)

Aggregations

CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)46 KualiAccountingDocumentFormBase (org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)18 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)15 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)14 ArrayList (java.util.ArrayList)12 CapitalAccountingLinesDocumentBase (org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)11 CapitalAssetInformationDocumentBase (org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)6 HashMap (java.util.HashMap)4 CapitalAssetAccountsGroupDetails (org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)4 GeneralLedgerEntry (org.kuali.kfs.module.cam.businessobject.GeneralLedgerEntry)4 CapitalAssetEditable (org.kuali.kfs.fp.document.CapitalAssetEditable)3 NonTransactional (org.kuali.kfs.sys.service.NonTransactional)3 CapitalAssetInformationDetailExtendedAttribute (edu.cornell.kfs.fp.businessobject.CapitalAssetInformationDetailExtendedAttribute)2 List (java.util.List)2 CapitalAssetInformationDetail (org.kuali.kfs.fp.businessobject.CapitalAssetInformationDetail)2 AssetPaymentAssetDetail (org.kuali.kfs.module.cam.businessobject.AssetPaymentAssetDetail)2 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)2 ProcurementCardTransactionExtendedAttribute (edu.cornell.kfs.fp.businessobject.ProcurementCardTransactionExtendedAttribute)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1