Search in sources :

Example 1 with CapitalAssetInformationDocumentBase

use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method deleteCapitalAssetLines.

/**
 * Removes any matching accounting line in capital asset records
 * whenever an accounting line is removed.
 *
 * @param financialDocumentForm
 * @param accountingLine
 */
protected void deleteCapitalAssetLines(KualiAccountingDocumentFormBase financialDocumentForm, AccountingLine accountingLine) {
    CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) financialDocumentForm.getFinancialDocument();
    List<CapitalAssetInformation> removalCaiList = new ArrayList<CapitalAssetInformation>();
    List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
    for (CapitalAssetInformation capitalAsset : capitalAssets) {
        removeDistributedAccountingLine(capitalAsset, accountingLine);
        if (capitalAsset.getCapitalAssetAccountsGroupDetails().size() == 0) {
            capitalAsset.getCapitalAssetInformationDetails().clear();
            removalCaiList.add(capitalAsset);
        }
    }
    // if the removal list is not empty, remove these bunch of capital asset records for that accounting line.
    if (ObjectUtils.isNotNull(removalCaiList)) {
        capitalAssets.removeAll(removalCaiList);
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAssetInformationDocumentBase(org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase) ArrayList(java.util.ArrayList)

Example 2 with CapitalAssetInformationDocumentBase

use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method getNextCapitalAssetLineNumber.

/**
 * @param kualiAccountingDocumentFormBase
 * @return
 */
protected Integer getNextCapitalAssetLineNumber(KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase) {
    int nextCapitalAssetLineNumber = 1;
    CapitalAssetInformationDocumentBase caidb = (CapitalAssetInformationDocumentBase) kualiAccountingDocumentFormBase.getFinancialDocument();
    nextCapitalAssetLineNumber = caidb.getNextCapitalAssetLineNumber();
    caidb.setNextCapitalAssetLineNumber(nextCapitalAssetLineNumber + 1);
    return nextCapitalAssetLineNumber;
}
Also used : CapitalAssetInformationDocumentBase(org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)

Example 3 with CapitalAssetInformationDocumentBase

use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method checkCreateAssetsExist.

/**
 * @param capitalAccountingLinesFormBase
 * @return true if a capital asset with capital asset action indicator = 'C' else false;
 */
protected boolean checkCreateAssetsExist(CapitalAccountingLinesFormBase capitalAccountingLinesFormBase) {
    boolean exists = false;
    CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
    List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
    for (CapitalAssetInformation capitalAsset : capitalAssets) {
        if (KFSConstants.CapitalAssets.CAPITAL_ASSET_CREATE_ACTION_INDICATOR.equals(capitalAsset.getCapitalAssetActionIndicator())) {
            return true;
        }
    }
    return exists;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAssetInformationDocumentBase(org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)

Example 4 with CapitalAssetInformationDocumentBase

use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method checkModifyAssetsExist.

/**
 * @param capitalAccountingLinesFormBase
 * @return true if a capital asset with capital asset action indicator = 'C' else false;
 */
protected boolean checkModifyAssetsExist(CapitalAccountingLinesFormBase capitalAccountingLinesFormBase) {
    boolean exists = false;
    CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
    List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
    for (CapitalAssetInformation capitalAsset : capitalAssets) {
        if (KFSConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR.equals(capitalAsset.getCapitalAssetActionIndicator())) {
            return true;
        }
    }
    return exists;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAssetInformationDocumentBase(org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)

Example 5 with CapitalAssetInformationDocumentBase

use of org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method getRemainingAmounToDistribute.

/**
 * Calculates the remaining amount to distribute by taking selecte capital accounting lines
 * and subtracting the allocated capital asset accounting lines amounts totals.
 *
 * @param selectedCapitalAccountingLines
 * @param form
 * @return remainingAmountToDistribute
 */
protected KualiDecimal getRemainingAmounToDistribute(List<CapitalAccountingLines> selectedCapitalAccountingLines, ActionForm form) {
    KualiDecimal remainingAmountToDistribute = KualiDecimal.ZERO;
    KualiDecimal capitalAccountsAmountToDistribute = KualiDecimal.ZERO;
    KualiDecimal capitalAssetsAllocatedAmount = KualiDecimal.ZERO;
    CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
    CapitalAssetInformationDocumentBase capitalAssetInformationDocumentBase = (CapitalAssetInformationDocumentBase) calfb.getFinancialDocument();
    List<CapitalAssetInformation> capitalAssets = capitalAssetInformationDocumentBase.getCapitalAssetInformation();
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
            selectedCapitalAccountingLines.add(capitalAccountingLine);
            capitalAccountsAmountToDistribute = capitalAccountsAmountToDistribute.add(capitalAccountingLine.getAmount());
            capitalAssetsAllocatedAmount = capitalAssetsAllocatedAmount.add(getCapitalAssetsAmountAllocated(capitalAssets, capitalAccountingLine));
        }
    }
    remainingAmountToDistribute = capitalAccountsAmountToDistribute.subtract(capitalAssetsAllocatedAmount);
    return remainingAmountToDistribute;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAssetInformationDocumentBase(org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)

Aggregations

CapitalAssetInformationDocumentBase (org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)7 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)6 ArrayList (java.util.ArrayList)1 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)1 CapitalAccountingLinesDocumentBase (org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)1 CapitalAssetEditable (org.kuali.kfs.fp.document.CapitalAssetEditable)1 KualiAccountingDocumentFormBase (org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)1 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)1