Search in sources :

Example 6 with PurchasingDocument

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

the class PurchasingActionBase method approve.

/**
 * Overrides the superclass method so that it will also do proration for trade in and full order discount when the user clicks
 * on the approve button.
 *
 * @see org.kuali.kfs.kns.web.struts.action.KualiDocumentActionBase#approve(org.apache.struts.action.ActionMapping,
 *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward approve(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    PurchasingDocument purDoc = (PurchasingDocument) purchasingForm.getDocument();
    if (isAttachmentSizeExceedSqLimit(form, "approve") || isReasonToChangeRequired(form)) {
        return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }
    boolean isCreatingReasonNote = isCreatingReasonNote(form);
    if (isCreatingReasonNote) {
        // save here, so it can be picked up in b2b
        SpringContext.getBean(NoteService.class).saveNoteList(purDoc.getNotes());
    }
    // call prorateDiscountTradeIn
    SpringContext.getBean(PurapService.class).prorateForTradeInAndFullOrderDiscount(purDoc);
    ActionForward forward = super.approve(mapping, form, request, response);
    if (GlobalVariables.getMessageMap().hasNoErrors() && isCreatingReasonNote) {
        createReasonNote(form);
    }
    return forward;
}
Also used : PurapService(org.kuali.kfs.module.purap.document.service.PurapService) NoteService(org.kuali.kfs.krad.service.NoteService) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) ActionForward(org.apache.struts.action.ActionForward)

Example 7 with PurchasingDocument

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

the class PurchasingActionBase method downItem.

/**
 * Moves the selected item down one position (These two methods up/down could easily be consolidated. For now, it seems more
 * straightforward to keep them separate.)
 *
 * @param mapping An ActionMapping
 * @param form An ActionForm
 * @param request The HttpServletRequest
 * @param response The HttpServletResponse
 * @return An ActionForward
 * @throws Exception
 */
public ActionForward downItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    int line = getSelectedLine(request);
    purDocument.itemSwap(line, line + 1);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument)

Example 8 with PurchasingDocument

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

the class PurchasingActionBase method addCapitalAssetLocationByItem.

public ActionForward addCapitalAssetLocationByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    CapitalAssetLocation location = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request)).getPurchasingCapitalAssetSystem().getNewPurchasingCapitalAssetLocationLine();
    boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingCapitalAssetLocationEvent("", purDocument, location));
    if (rulePassed) {
        // get specific asset item and grab system as well and attach asset location
        PurchasingCapitalAssetItem assetItem = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request));
        CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
        location.setCapitalAssetSystemIdentifier(system.getCapitalAssetSystemIdentifier());
        system.getCapitalAssetLocations().add(location);
        // now reset the location as all the rules are passed successfully
        purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request)).getPurchasingCapitalAssetSystem().resetNewPurchasingCapitalAssetLocationLine();
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : KualiRuleService(org.kuali.kfs.krad.service.KualiRuleService) AttributedAddPurchasingCapitalAssetLocationEvent(org.kuali.kfs.module.purap.document.validation.event.AttributedAddPurchasingCapitalAssetLocationEvent) CapitalAssetLocation(org.kuali.kfs.integration.purap.CapitalAssetLocation) PurchasingCapitalAssetItem(org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem) PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument) CapitalAssetSystem(org.kuali.kfs.integration.purap.CapitalAssetSystem)

Example 9 with PurchasingDocument

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

the class PurchasingActionBase method upItem.

/**
 * Moves the selected item up one position.
 *
 * @param mapping An ActionMapping
 * @param form An ActionForm
 * @param request The HttpServletRequest
 * @param response The HttpServletResponse
 * @return An ActionForward
 * @throws Exception
 */
public ActionForward upItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
    PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
    int line = getSelectedLine(request);
    purDocument.itemSwap(line, line - 1);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PurchasingDocument(org.kuali.kfs.module.purap.document.PurchasingDocument)

Example 10 with PurchasingDocument

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

the class PurchasingActionBase method clearNotCurrentYearByDocument.

public ActionForward clearNotCurrentYearByDocument(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(false);
        system.setCapitalAssetTypeCode("");
    }
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : 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