Search in sources :

Example 11 with KualiAccountingDocumentFormBase

use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method processRemainingCapitalAssetInfo.

/**
 * process any remaining capital asset info in the list to check and calculate the
 * remaining distributed amount.  Also checks to make sure if "select Lines" is to be
 * checked on/off
 *
 * @param form
 * @param capitalAssetInformation
 */
protected void processRemainingCapitalAssetInfo(ActionForm form, List<CapitalAssetInformation> capitalAssetInformation) {
    CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
    // recalculate the amount remaining to be distributed and save the value on the form
    calculateRemainingDistributedAmount(calfb, capitalAssetInformation);
    // set the amountDistributed property to true if the total amount of all the capital assets
    // for a given capital accounting line is greater or equal to the line amount.
    checkCapitalAccountingLinesSelected(calfb);
    // redistribute each capital asset amount to its group accounting lines...
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    DistributeCapitalAssetAmountToGroupAccountingLines(kualiAccountingDocumentFormBase);
    setTabStatesForCapitalAssets(form);
}
Also used : KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Example 12 with KualiAccountingDocumentFormBase

use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method deleteCapitalAssetInfoDetailLine.

/**
 * delete a detail line from the capital asset information
 */
public ActionForward deleteCapitalAssetInfoDetailLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("deleteCapitalAssetInfoDetailLine() - start");
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    if (capitalAssetInformation == null) {
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    int lineIndexForCapitalAssetInfo = this.getLineToDelete(request);
    capitalAssetInformation.get(0).getCapitalAssetInformationDetails().remove(lineIndexForCapitalAssetInfo - 1);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Example 13 with KualiAccountingDocumentFormBase

use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method deleteCapitalAssetModify.

/**
 * deletes the capital asset information
 */
public ActionForward deleteCapitalAssetModify(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("deleteCapitalAssetModify() - start");
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    if (capitalAssetInformation == null) {
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    int lineIndexForCapitalAssetInfo = this.getLineToDelete(request);
    capitalAssetInformation.remove(lineIndexForCapitalAssetInfo);
    // 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)

Example 14 with KualiAccountingDocumentFormBase

use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method setupIntialNextCapitalAssetLineNumber.

/**
 * setups the next capital asset line number
 *
 * @param kualiDocumentFormBase
 */
protected void setupIntialNextCapitalAssetLineNumber(KualiDocumentFormBase kualiDocumentFormBase) {
    KualiAccountingDocumentFormBase kadfb = (KualiAccountingDocumentFormBase) kualiDocumentFormBase;
    CapitalAssetInformationDocumentBase caidb = (CapitalAssetInformationDocumentBase) kadfb.getFinancialDocument();
    List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
    for (CapitalAssetInformation capitalAsset : currentCapitalAssetInformation) {
        if (capitalAsset.getCapitalAssetLineNumber() > caidb.getNextCapitalAssetLineNumber()) {
            caidb.setNextCapitalAssetLineNumber(capitalAsset.getCapitalAssetLineNumber());
        }
    }
    caidb.setNextCapitalAssetLineNumber(caidb.getNextCapitalAssetLineNumber() + 1);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAssetInformationDocumentBase(org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Example 15 with KualiAccountingDocumentFormBase

use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method checkCapitalAccountingLinesSelected.

/**
 * sets the capital accounting lines select and amount distributed values to true if
 * there are capital asset records for a given capital accounting line. The system control
 * amount and system control remaining amounts are calculated here.
 *
 * @param calfb
 */
protected void checkCapitalAccountingLinesSelected(CapitalAccountingLinesFormBase calfb) {
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    KualiAccountingDocumentFormBase kadfb = calfb;
    List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
    SpringContext.getBean(CapitalAssetManagementModuleService.class).filterNonCapitalAssets(currentCapitalAssetInformation);
    calfb.setCreatedAssetsControlAmount(KualiDecimal.ZERO);
    calfb.setSystemControlAmount(KualiDecimal.ZERO);
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        if (capitalAccountingLine.isSelectLine()) {
            calfb.setSystemControlAmount(calfb.getSystemControlAmount().add(capitalAccountingLine.getAmount()));
        }
        if (currentCapitalAssetInformation.size() <= 0) {
            capitalAccountingLine.setAccountLinePercent(null);
            capitalAccountingLine.setAmountDistributed(false);
            capitalAccountingLine.setSelectLine(false);
        } else {
            CapitalAssetInformation existingCapitalAsset = getCapitalAssetCreated(capitalAccountingLine, currentCapitalAssetInformation);
            if (ObjectUtils.isNotNull(existingCapitalAsset)) {
                // There is a CapitalAssetInformation matching the current accounting line.
                capitalAccountingLine.setSelectLine(true);
            } else {
                capitalAccountingLine.setAccountLinePercent(null);
                capitalAccountingLine.setSelectLine(false);
            }
        }
        if (capitalAccountingLineAmountDistributed(capitalAccountingLine, currentCapitalAssetInformation)) {
            // all the money from this accounting line is distributed among the assets
            capitalAccountingLine.setAmountDistributed(true);
        } else {
            capitalAccountingLine.setAmountDistributed(false);
        }
    }
    KualiDecimal capitalAssetsTotal = KualiDecimal.ZERO;
    // get amount allocated so far....or the system control remainder amount field.
    for (CapitalAssetInformation capitalAsset : currentCapitalAssetInformation) {
        capitalAssetsTotal = capitalAssetsTotal.add(capitalAsset.getCapitalAssetLineAmount());
    }
    calfb.setCreatedAssetsControlAmount(calfb.getSystemControlAmount().subtract(capitalAssetsTotal));
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) CapitalAssetManagementModuleService(org.kuali.kfs.integration.cam.CapitalAssetManagementModuleService) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Aggregations

KualiAccountingDocumentFormBase (org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)22 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)18 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)9 CapitalAccountingLinesDocumentBase (org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)9 ArrayList (java.util.ArrayList)8 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)4 ActionForward (org.apache.struts.action.ActionForward)2 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)2 PreEncumbranceDocument (edu.cornell.kfs.fp.document.PreEncumbranceDocument)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Before (org.junit.Before)1 CapitalAssetAccountsGroupDetails (org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails)1 CapitalAssetEditable (org.kuali.kfs.fp.document.CapitalAssetEditable)1 CapitalAssetInformationDocumentBase (org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)1 PreEncumbranceDocument (org.kuali.kfs.fp.document.PreEncumbranceDocument)1 CapitalAssetManagementModuleService (org.kuali.kfs.integration.cam.CapitalAssetManagementModuleService)1 Asset (org.kuali.kfs.integration.cam.businessobject.Asset)1 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)1