Search in sources :

Example 1 with KualiAccountingDocumentFormBase

use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase 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 2 with KualiAccountingDocumentFormBase

use of org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase 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)

Example 3 with KualiAccountingDocumentFormBase

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

the class CapitalAssetInformationActionBase method copy.

/**
 * Overridden to guarantee that form of copied document is set to whatever the entry mode of the document is
 *
 * @see org.kuali.rice.kns.web.struts.action.KualiTransactionalDocumentActionBase#copy(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward copy(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) form;
    ;
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    List<CapitalAccountingLines> copiedCapitalAccountingLines = new ArrayList<>();
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        copiedCapitalAccountingLines.add(capitalAccountingLine);
    }
    capitalAccountingLines.clear();
    ActionForward forward = super.copy(mapping, form, request, response);
    caldb.setCapitalAccountingLines(copiedCapitalAccountingLines);
    // if the copied document has capital asset collection, remove the collection
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    AccountingDocument document = kualiAccountingDocumentFormBase.getFinancialDocument();
    if (document instanceof CapitalAssetEditable) {
        CapitalAssetEditable capitalAssetEditable = (CapitalAssetEditable) document;
        List<CapitalAssetInformation> capitalAssets = capitalAssetEditable.getCapitalAssetInformation();
        for (CapitalAssetInformation capitalAsset : capitalAssets) {
            Long capitalAssetNumber = capitalAsset.getCapitalAssetNumber();
            resetCapitalAssetInfo(capitalAsset);
            // because resetCapitalAssetInfo cleared the value.
            if (KFSConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR.equalsIgnoreCase(capitalAsset.getCapitalAssetActionIndicator())) {
                capitalAsset.setCapitalAssetNumber(capitalAssetNumber);
            }
            capitalAsset.setCapitalAssetProcessedIndicator(false);
        }
    }
    // setup the initial next sequence number column..
    KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
    setupIntialNextCapitalAssetLineNumber(kualiDocumentFormBase);
    checkCapitalAccountingLinesSelected(capitalAccountingLinesFormBase);
    return forward;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) ArrayList(java.util.ArrayList) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase) ActionForward(org.apache.struts.action.ActionForward) CapitalAssetEditable(org.kuali.kfs.fp.document.CapitalAssetEditable) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Example 4 with KualiAccountingDocumentFormBase

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

the class CapitalAssetInformationActionBase method addCapitalAssetTagLocationInfo.

/**
 * inserts capital asset information into capital assets list.
 * Also recalculates the system control and system control remaining amounts.
 * Puts a global error message if the user does not enter capital asset quantity.
 * If the quantity is > 1, it will insert that many tag/location detail records for this
 * capital asset item.
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return action forward string
 * @throws Exception
 */
public ActionForward addCapitalAssetTagLocationInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("addCapitalAssetTagLocationInfo() - start");
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    if (capitalAssetInformation == null) {
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    int addIndex = getSelectedLine(request);
    if (capitalAssetInformation.get(addIndex).getCapitalAssetQuantity() == null || capitalAssetInformation.get(addIndex).getCapitalAssetQuantity() <= 0) {
        GlobalVariables.getMessageMap().putError(KFSConstants.EDIT_CAPITAL_ASSET_INFORMATION_ERRORS, KFSKeyConstants.ERROR_DOCUMENT_CAPITAL_ASSET_QUANTITY_REQUIRED);
    } else {
        this.addCapitalAssetInfoDetailLines(capitalAssetInformation.get(addIndex));
    }
    // 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 5 with KualiAccountingDocumentFormBase

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

the class CapitalAssetInformationActionBase method uncheckCapitalAccountingLinesSelected.

/**
 * unchecks the capital accounting lines select when there are no capital assets created yet.
 *
 * @param calfb
 */
protected void uncheckCapitalAccountingLinesSelected(CapitalAccountingLinesFormBase calfb) {
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    KualiAccountingDocumentFormBase kadfb = calfb;
    List<CapitalAssetInformation> currentCapitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kadfb);
    List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<CapitalAccountingLines>();
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        if (capitalAccountingLine.isSelectLine() && !capitalAccountingLine.isAmountDistributed()) {
            calfb.setSystemControlAmount(calfb.getSystemControlAmount().add(capitalAccountingLine.getAmount()));
            selectedCapitalAccountingLines.add(capitalAccountingLine);
        }
    }
    CapitalAssetInformation existingCapitalAsset = capitalAssetCreated(selectedCapitalAccountingLines, currentCapitalAssetInformation);
    for (CapitalAccountingLines capitalAccountingLine : selectedCapitalAccountingLines) {
        if (ObjectUtils.isNull(existingCapitalAsset)) {
            capitalAccountingLine.setSelectLine(false);
        }
    }
}
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) 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