Search in sources :

Example 6 with CapitalAssetInformation

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

the class GlLineServiceImpl method findCapitalAssetInformationForGLLineMatchLineType.

/**
 * Finds capital asset information for a given GL entry by matching also on the accounting line type.
 *
 * @param entry
 * @return matching capital asset info
 */
private List<CapitalAssetInformation> findCapitalAssetInformationForGLLineMatchLineType(GeneralLedgerEntry entry) {
    Map<String, String> primaryKeys = new HashMap<String, String>();
    primaryKeys.put(CamsPropertyConstants.CapitalAssetInformation.DOCUMENT_NUMBER, entry.getDocumentNumber());
    List<CapitalAssetInformation> assetInformation = (List<CapitalAssetInformation>) businessObjectService.findMatchingOrderBy(CapitalAssetInformation.class, primaryKeys, CamsPropertyConstants.CapitalAssetInformation.ACTION_INDICATOR, true);
    List<CapitalAssetInformation> matchingAssets = new ArrayList<CapitalAssetInformation>();
    for (CapitalAssetInformation capitalAsset : assetInformation) {
        addToCapitalAssetsMatchingLineType(matchingAssets, capitalAsset, entry);
    }
    return matchingAssets;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 7 with CapitalAssetInformation

use of org.kuali.kfs.fp.businessobject.CapitalAssetInformation 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 8 with CapitalAssetInformation

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

the class CapitalAssetInformationActionBase method clearCapitalAssetModify.

/**
 * clear up the modify capital asset information.  The amount field is reset to 0
 * Processes any remaining capital assets so that it recalculates the system control
 * and system control remaining amounts.
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return action forward string
 * @throws Exception
 */
public ActionForward clearCapitalAssetModify(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("clearCapitalAssetModify() - start");
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    if (capitalAssetInformation == null) {
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    int clearIndex = getSelectedLine(request);
    capitalAssetInformation.get(clearIndex).setCapitalAssetLineAmount(KualiDecimal.ZERO);
    // zero out the amount distribute on the accounting lines...
    for (CapitalAssetAccountsGroupDetails groupAccountLine : capitalAssetInformation.get(clearIndex).getCapitalAssetAccountsGroupDetails()) {
        groupAccountLine.setAmount(KualiDecimal.ZERO);
    }
    // now process the remaining capital asset records
    processRemainingCapitalAssetInfo(form, capitalAssetInformation);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase) CapitalAssetAccountsGroupDetails(org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)

Example 9 with CapitalAssetInformation

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

the class CapitalAssetInformationActionBase method DistributeCapitalAssetAmountToGroupAccountingLines.

/**
 * This method redistributes the capital asset amount to its group accounting lines
 * based on the accounting line's percent.  Takes each capital assets amount and
 * distributes to the capital asset group accounting lines.
 *
 * @param kualiAccountingDocumentFormBase
 */
protected void DistributeCapitalAssetAmountToGroupAccountingLines(KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase) {
    CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) kualiAccountingDocumentFormBase;
    checkSelectForCapitalAccountingLines(capitalAccountingLinesFormBase);
    checkCapitalAccountingLinesSelected(capitalAccountingLinesFormBase);
    calculatePercentsForSelectedCapitalAccountingLines(capitalAccountingLinesFormBase);
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
    String distributionAmountCode = capitalAccountingLinesFormBase.getCapitalAccountingLine().getDistributionCode();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<CapitalAccountingLines>();
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
            capitalAccountingLine.setDistributionAmountCode(distributionAmountCode);
            selectedCapitalAccountingLines.add(capitalAccountingLine);
        }
    }
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    for (CapitalAssetInformation capitalAsset : capitalAssetInformation) {
        // redistribute the capital asset modify amount to the group accounting lines based on amount.
        if (!capitalAssetAmountAlreadyDistributedToGroupAccountingLines(capitalAsset)) {
            redistributeToGroupAccountingLinesFromAssetsByAmounts(selectedCapitalAccountingLines, capitalAsset);
        }
    }
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) ArrayList(java.util.ArrayList) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)

Example 10 with CapitalAssetInformation

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

the class CapitalAssetInformationActionBase method clearCapitalAssetInfo.

/**
 * Clear the capital asset information that the user has entered
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return action forward string
 * @throws Exception
 */
public ActionForward clearCapitalAssetInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("clearCapitalAssetInfo() - start");
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    if (capitalAssetInformation == null) {
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    int clearIndex = getSelectedLine(request);
    this.resetCapitalAssetInfo(capitalAssetInformation.get(clearIndex));
    // now process the remaining capital asset records
    processRemainingCapitalAssetInfo(form, capitalAssetInformation);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

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