Search in sources :

Example 26 with CapitalAssetInformation

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

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

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

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

Example 30 with CapitalAssetInformation

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

the class CapitalAssetInformationActionBase method redistributeCostEquallyForModifiedAssets.

/**
 * @param form
 */
protected void redistributeCostEquallyForModifiedAssets(ActionForm form) {
    KualiDecimal remainingAmountToDistribute = KualiDecimal.ZERO;
    CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    String distributionCode = calfb.getCapitalAccountingLine().getDistributionCode();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<>();
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
            selectedCapitalAccountingLines.add(capitalAccountingLine);
            remainingAmountToDistribute = remainingAmountToDistribute.add(capitalAccountingLine.getAmount());
        }
    }
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    redistributeAmountsForAccountingsLineForModifyAssets(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
    // now process any capital assets that has distribution set to "by amount"
    redistributeAmountsForAccountingsLineForModifyAssetsByAmounts(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) ArrayList(java.util.ArrayList) 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

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