Search in sources :

Example 1 with PurchasingDocument

use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method selectNotCurrentYearByDocument.

public ActionForward selectNotCurrentYearByDocument(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
    PurchasingDocument document = (PurchasingDocument) purchasingForm.getDocument();
    CapitalAssetSystem system = document.getPurchasingCapitalAssetSystems().get(getSelectedLine(request));
    if (system != null) {
        system.setCapitalAssetNotReceivedCurrentFiscalYearIndicator(true);
        system.setCapitalAssetTypeCode(SpringContext.getBean(PurchasingService.class).getDefaultAssetTypeCodeNotThisFiscalYear());
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 2 with PurchasingDocument

use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method useOffCampusAssetLocationBuildingByDocument.

public ActionForward useOffCampusAssetLocationBuildingByDocument(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase baseForm = (PurchasingFormBase) form;
    PurchasingDocument document = (PurchasingDocument) baseForm.getDocument();
    String fullParameter = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE);
    String systemIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL);
    String assetLocationIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL);
    CapitalAssetSystem system = document.getPurchasingCapitalAssetSystems().get(Integer.parseInt(systemIndex));
    if ("new".equals(assetLocationIndex)) {
        useOffCampusAssetLocationBuilding(baseForm.getNewPurchasingCapitalAssetLocationLine());
    } else {
        useOffCampusAssetLocationBuilding(system.getCapitalAssetLocations().get(Integer.parseInt(assetLocationIndex)));
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 3 with PurchasingDocument

use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method addItemCapitalAssetByItem.

public ActionForward addItemCapitalAssetByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    // get specific asset item
    PurchasingCapitalAssetItem assetItem = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request));
    ItemCapitalAsset asset = assetItem.getNewPurchasingItemCapitalAssetLine();
    boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingItemCapitalAssetEvent("", purDocument, asset));
    if (rulePassed) {
        // grab system as well and attach asset number
        CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
        asset = assetItem.getAndResetNewPurchasingItemCapitalAssetLine();
        asset.setCapitalAssetSystemIdentifier(system.getCapitalAssetSystemIdentifier());
        if (capitalAssetSystemHasAssetItem(system, asset)) {
            GlobalVariables.getMessageMap().putError(PurapConstants.CAPITAL_ASSET_TAB_ERRORS, PurapKeyConstants.ERROR_CAPITAL_ASSET_DUPLICATE_ASSET);
        } else {
            system.getItemCapitalAssets().add(asset);
        }
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : KualiRuleService(org.kuali.kfs.krad.service.KualiRuleService) PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) ItemCapitalAsset(org.kuali.kfs.integration.purap.ItemCapitalAsset) AttributedAddPurchasingItemCapitalAssetEvent(org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingItemCapitalAssetEvent) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 4 with PurchasingDocument

use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method calculate.

@Override
public ActionForward calculate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
    PurchasingDocument purDoc = (PurchasingDocument) purchasingForm.getDocument();
    boolean defaultUseTaxIndicatorValue = SpringContext.getBean(PurchasingService.class).getDefaultUseTaxIndicatorValue(purDoc);
    SpringContext.getBean(PurapService.class).updateUseTaxIndicator(purDoc, defaultUseTaxIndicatorValue);
    SpringContext.getBean(PurapService.class).calculateTax(purDoc);
    // call prorateDiscountTradeIn
    SpringContext.getBean(PurapService.class).prorateForTradeInAndFullOrderDiscount(purDoc);
    // recalculate the amounts and percents on the accounting line.
    SpringContext.getBean(PurapAccountingService.class).updateAccountAmounts(purDoc);
    customCalculate(purDoc);
    PurchasingFormBase formBase = (PurchasingFormBase) form;
    formBase.setInitialZipCode(purDoc.getDeliveryPostalCode());
    formBase.setCalculated(true);
    purDoc.setCalculated(true);
    KNSGlobalVariables.getMessageList().clear();
    return super.calculate(mapping, form, request, response);
}
Also used : PurapService(org.kuali.kfs.module.purap.document.service.PurapService) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) PurchasingService(org.kuali.kfs.module.purap.document.service.PurchasingService) PurapAccountingService(org.kuali.kfs.module.purap.service.PurapAccountingService)

Example 5 with PurchasingDocument

use of org.kuali.kfs.module.purap.document.PurchasingDocument in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method deleteCapitalAssetLocationByItem.

public ActionForward deleteCapitalAssetLocationByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    String fullParameter = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE);
    String assetItemIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL);
    String locationIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL);
    // get specific asset item and grab system as well and attach asset number
    PurchasingCapitalAssetItem assetItem = purDocument.getPurchasingCapitalAssetItems().get(Integer.parseInt(assetItemIndex));
    CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
    system.getCapitalAssetLocations().remove(Integer.parseInt(locationIndex));
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Aggregations

PurchasingDocument (org.kuali.kfs.module.purap.document.PurchasingDocument)42 CapitalAssetSystem (org.kuali.kfs.integration.purap.CapitalAssetSystem)14 PurchasingCapitalAssetItem (org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem)10 KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)7 PurapService (org.kuali.kfs.module.purap.document.service.PurapService)6 PurchasingService (org.kuali.kfs.module.purap.document.service.PurchasingService)5 ItemCapitalAsset (org.kuali.kfs.integration.purap.ItemCapitalAsset)4 MessageMap (org.kuali.kfs.krad.util.MessageMap)4 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)4 ActionForward (org.apache.struts.action.ActionForward)3 Map (java.util.Map)2 CapitalAssetLocation (org.kuali.kfs.integration.purap.CapitalAssetLocation)2 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)2 PurchasingCapitalAssetSystemBase (org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetSystemBase)2 PurchaseOrderAmendmentDocument (org.kuali.kfs.module.purap.document.PurchaseOrderAmendmentDocument)2 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)2 PurchasingDocumentBase (org.kuali.kfs.module.purap.document.PurchasingDocumentBase)2 AttributedAddPurchasingAccountsPayableItemEvent (org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingAccountsPayableItemEvent)2 AttributedAddPurchasingCapitalAssetLocationEvent (org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingCapitalAssetLocationEvent)2 AttributedAddPurchasingItemCapitalAssetEvent (org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingItemCapitalAssetEvent)2