Search in sources :

Example 6 with KualiAccountingDocumentFormBase

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

the class CapitalAssetInformationActionBase method insertCapitalAssetInfo.

/**
 * 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 insertCapitalAssetInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("insertCapitalAssetInfo() - 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 7 with KualiAccountingDocumentFormBase

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

the class CuPreEncumbranceAction method route.

@Override
public ActionForward route(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
    String docNum = tmpForm.getDocId();
    PreEncumbranceDocument preEncDoc = SpringContext.getBean(BusinessObjectService.class).findBySinglePrimaryKey(PreEncumbranceDocument.class, docNum);
    if (preEncDoc == null) {
        GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(dot + "Save", KFSKeyConstants.ERROR_CUSTOM, "This Document needs to be saved before Submit");
    }
    ActionForward forward = super.route(mapping, form, request, response);
    checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getSourceAccountingLines());
    checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getTargetAccountingLines());
    return forward;
}
Also used : KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase) ActionForward(org.apache.struts.action.ActionForward) PreEncumbranceDocument(org.kuali.kfs.fp.document.PreEncumbranceDocument) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 8 with KualiAccountingDocumentFormBase

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

the class CuPreEncumbranceActionTest method setUp.

@Before
public void setUp() {
    preEncumbranceDocument = createMock(PreEncumbranceDocument.class);
    preEncumbranceDocument.setSourceAccountingLines(new ArrayList());
    kualiAccountingDocumentFormBase = createMock(KualiAccountingDocumentFormBase.class);
    kualiAccountingDocumentFormBase.setTabStates(new HashMap<>());
    kualiAccountingDocumentFormBase.setDocument(preEncumbranceDocument);
    cuPreEncumbranceAction = new CuPreEncumbranceAction();
}
Also used : ArrayList(java.util.ArrayList) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase) PreEncumbranceDocument(edu.cornell.kfs.fp.document.PreEncumbranceDocument) Before(org.junit.Before)

Example 9 with KualiAccountingDocumentFormBase

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

the class CapitalAssetInformationActionBase method redistributeModifyCapitalAssetAmount.

/**
 * redistributes the capital asset amount for the modify capital asset lines.
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return ActionForward
 * @throws Exception
 */
public ActionForward redistributeModifyCapitalAssetAmount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("redistributeModifyCapitalAssetAmount() - start");
    KualiDecimal remainingAmountToDistribute = KualiDecimal.ZERO;
    CapitalAccountingLinesFormBase calfb = (CapitalAccountingLinesFormBase) form;
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) calfb.getFinancialDocument();
    List<CapitalAccountingLines> selectedCapitalAccountingLines = new ArrayList<CapitalAccountingLines>();
    String distributionCode = calfb.getCapitalAccountingLine().getDistributionCode();
    remainingAmountToDistribute = getRemainingAmounToDistribute(selectedCapitalAccountingLines, form);
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    List<CapitalAssetInformation> capitalAssetInformation = this.getCurrentCapitalAssetInformationObject(kualiAccountingDocumentFormBase);
    // run the process to redistribute the accounting line amount to the capital assets.
    redistributeAmountsForAccountingsLineForModifyAssets(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
    redistributeIndividualAmountsForAccountingLinesForModifyAssets(selectedCapitalAccountingLines, capitalAssetInformation);
    // now process any capital assets that has distribution set to "by amount"
    redistributeAmountsForAccountingsLineForModifyAssetsByAmounts(selectedCapitalAccountingLines, capitalAssetInformation, remainingAmountToDistribute);
    // adjust any variance from capital accounting lines to the distributed accounting lines amounts....
    adjustCapitalAssetsAccountingLinesAmounts(selectedCapitalAccountingLines, capitalAssetInformation);
    processRemainingCapitalAssetInfo(form, capitalAssetInformation);
    // redistribute capital asset amount to its group accounting lines on refresh
    DistributeCapitalAssetAmountToGroupAccountingLines((KualiAccountingDocumentFormBase) form);
    checkCapitalAccountingLinesSelected(calfb);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
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)

Example 10 with KualiAccountingDocumentFormBase

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

the class CapitalAssetInformationActionBase method deleteCapitalAssetInfo.

/**
 * deletes the capital asset information
 */
public ActionForward deleteCapitalAssetInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    LOG.debug("deleteCapitalAssetInfoDetail() - 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);
    if (capitalAssetInformation.get(lineIndexForCapitalAssetInfo).getCapitalAssetInformationDetails() != null && capitalAssetInformation.get(lineIndexForCapitalAssetInfo).getCapitalAssetInformationDetails().size() > 0) {
        capitalAssetInformation.get(lineIndexForCapitalAssetInfo).getCapitalAssetInformationDetails().clear();
    }
    if (capitalAssetInformation.get(lineIndexForCapitalAssetInfo).getCapitalAssetAccountsGroupDetails() != null && capitalAssetInformation.get(lineIndexForCapitalAssetInfo).getCapitalAssetAccountsGroupDetails().size() > 0) {
        capitalAssetInformation.get(lineIndexForCapitalAssetInfo).getCapitalAssetAccountsGroupDetails().clear();
    }
    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)

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