Search in sources :

Example 11 with CapitalAccountingLinesDocumentBase

use of org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase 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 12 with CapitalAccountingLinesDocumentBase

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

the class CapitalAssetInformationActionBase method setTabStatesForCapitalAssets.

/**
 * sets the capital assets screens for create and modify and accounting lines
 * for capitalization screen as open. If accounting lines for capitalizataion list is
 * not empty then set "Accounting Lines for Capitalization" tab to open else set to close.
 * If capital asset with capital asset action indicator = 'C' then set "Create Capital Asset"
 * tab to open else set to close
 * If capital asset with capital asset action indicator = 'M' then set "Modify Capital Asset"
 * tab to open else set to close
 *
 * @param form
 */
protected void setTabStatesForCapitalAssets(ActionForm form) {
    KualiForm kualiForm = (KualiForm) form;
    CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) form;
    Map<String, String> tabStates = kualiForm.getTabStates();
    Map<String, String> newTabStates = new HashMap<String, String>();
    CapitalAssetInformationFormBase capitalAssetInformationFormBase = (CapitalAssetInformationFormBase) form;
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAssetInformationFormBase.getFinancialDocument();
    // generated tab key for the three tabs
    String tabIdForAccountingLinesForCapitalization = WebUtils.generateTabKey(KFSConstants.CapitalAssets.ACCOUNTING_LINES_FOR_CAPITALIZATION_TAB_TITLE);
    String tabIdForCreateCapitalAsset = WebUtils.generateTabKey(KFSConstants.CapitalAssets.CREATE_CAPITAL_ASSETS_TAB_TITLE);
    String tabIdForModifyCapitalAsset = WebUtils.generateTabKey(KFSConstants.CapitalAssets.MODIFY_CAPITAL_ASSETS_TAB_TITLE);
    tabStates.remove(tabIdForAccountingLinesForCapitalization);
    tabStates.remove(tabIdForCreateCapitalAsset);
    tabStates.remove(tabIdForModifyCapitalAsset);
    // if there are any capital accounting lines for capitalization exists then
    if (caldb.getCapitalAccountingLines().size() > 0 || caldb.isCapitalAccountingLinesExist()) {
        tabStates.put(tabIdForAccountingLinesForCapitalization, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_OPEN);
    } else {
        tabStates.put(tabIdForAccountingLinesForCapitalization, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_CLOSE);
    }
    if (checkCreateAssetsExist(capitalAccountingLinesFormBase)) {
        tabStates.put(tabIdForCreateCapitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_OPEN);
    } else {
        tabStates.put(tabIdForCreateCapitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_CLOSE);
    }
    if (checkModifyAssetsExist(capitalAccountingLinesFormBase)) {
        tabStates.put(tabIdForModifyCapitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_OPEN);
    } else {
        tabStates.put(tabIdForModifyCapitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_TAB_STATE_CLOSE);
    }
    kualiForm.setTabStates(tabStates);
}
Also used : HashMap(java.util.HashMap) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase) KualiForm(org.kuali.kfs.kns.web.struts.form.KualiForm)

Example 13 with CapitalAccountingLinesDocumentBase

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

the class CapitalAssetInformationActionBase method calculatePercentsForSelectedCapitalAccountingLines.

/**
 * calculates the percents for the selected capital accounting lines only
 *
 * @param calfb
 */
protected void calculatePercentsForSelectedCapitalAccountingLines(CapitalAccountingLinesFormBase calfb) {
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    KualiDecimal totalCapitalLinesSelectedAmount = (calculateTotalCapitalLinesSelectedAmount(capitalAccountingLines)).abs();
    if (totalCapitalLinesSelectedAmount.isNonZero()) {
        for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
            if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
                capitalAccountingLine.setAccountLinePercent(capitalAccountingLine.getAmount().abs().divide(totalCapitalLinesSelectedAmount).multiply(new KualiDecimal(100), true));
            }
        }
    }
}
Also used : CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)

Aggregations

CapitalAccountingLinesDocumentBase (org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase)13 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)12 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)11 KualiAccountingDocumentFormBase (org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)9 ArrayList (java.util.ArrayList)8 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)6 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)1 Set (java.util.Set)1 ActionForward (org.apache.struts.action.ActionForward)1 CapitalAssetEditable (org.kuali.kfs.fp.document.CapitalAssetEditable)1 CapitalAssetInformationDocumentBase (org.kuali.kfs.fp.document.CapitalAssetInformationDocumentBase)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 KualiForm (org.kuali.kfs.kns.web.struts.form.KualiForm)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 AccountingDocument (org.kuali.kfs.sys.document.AccountingDocument)1 SegmentedLookupResultsService (org.kuali.kfs.sys.service.SegmentedLookupResultsService)1