Search in sources :

Example 21 with PurApItem

use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.

the class PurchaseOrderDocument method getTotalDollarAmount.

/**
 * Gets the total dollar amount for this Purchase Order.
 *
 * @param includeInactive indicates whether inactive items shall be included.
 * @param includeBelowTheLine indicates whether below the line items shall be included.
 * @return the total dollar amount for this Purchase Order.
 */
public KualiDecimal getTotalDollarAmount(boolean includeInactive, boolean includeBelowTheLine) {
    KualiDecimal total = new KualiDecimal(BigDecimal.ZERO);
    for (PurApItem item : (List<PurApItem>) getItems()) {
        if (item.getPurapDocument() == null) {
            item.setPurapDocument(this);
        }
        ItemType it = item.getItemType();
        if ((includeBelowTheLine || it.isLineItemIndicator()) && (includeInactive || PurApItemUtils.checkItemActive(item))) {
            KualiDecimal totalAmount = item.getTotalAmount();
            KualiDecimal itemTotal = (totalAmount != null) ? totalAmount : KualiDecimal.ZERO;
            total = total.add(itemTotal);
        }
    }
    return total;
}
Also used : PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) ItemType(org.kuali.kfs.module.purap.businessobject.ItemType) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ArrayList(java.util.ArrayList) List(java.util.List)

Example 22 with PurApItem

use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.

the class PurchaseOrderDocument method getAccountsForAwardRouting.

public List<Account> getAccountsForAwardRouting() {
    List<Account> accounts = new ArrayList<Account>();
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
            if (isObjectCodeAllowedForAwardRouting(accountingLine, parameterService)) {
                if (ObjectUtils.isNull(accountingLine.getAccount())) {
                    accountingLine.refreshReferenceObject("account");
                }
                if (accountingLine.getAccount() != null && !accounts.contains(accountingLine.getAccount())) {
                    accounts.add(accountingLine.getAccount());
                }
            }
        }
    }
    return accounts;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) PurchaseOrderAccount(org.kuali.kfs.module.purap.businessobject.PurchaseOrderAccount) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 23 with PurApItem

use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.

the class PurchasingAccountsPayableDocumentBase method fixItemReferences.

/**
 * This method fixes the item references in this document if it's new
 */
@Override
public void fixItemReferences() {
    // fix item and account references in case this is a new doc (since they will be lost)
    if (ObjectUtils.isNull(this.purapDocumentIdentifier)) {
        for (PurApItem item : (List<PurApItem>) this.getItems()) {
            item.setPurapDocument(this);
            item.fixAccountReferences();
        }
    }
}
Also used : PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) List(java.util.List) ArrayList(java.util.ArrayList)

Example 24 with PurApItem

use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.

the class PurchasingAccountsPayableDocumentBase method renumberItems.

/**
 * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument#renumberItems(int start)
 */
@Override
public void renumberItems(int start) {
    for (int i = start; i < items.size(); i++) {
        PurApItem item = items.get(i);
        item.refreshReferenceObject(PurapPropertyConstants.ITEM_TYPE);
        // only set the item line number for above the line items
        if (item.getItemType().isLineItemIndicator()) {
            // KFSPTS-1719/KFSUPGRADE-485 :  skip this for non-qty order
            if (!(item instanceof PaymentRequestItem && ((PaymentRequestItem) item).getPurchaseOrderItem() != null && ((PaymentRequestItem) item).getPurchaseOrderItem().isNoQtyItem())) {
                item.setItemLineNumber(new Integer(i + 1));
            }
        }
    }
}
Also used : PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem)

Example 25 with PurApItem

use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.

the class PurchasingAccountsPayableDocumentBase method getTotalTaxAmountWithExclusions.

@Override
public KualiDecimal getTotalTaxAmountWithExclusions(String[] excludedTypes, boolean includeBelowTheLine) {
    if (excludedTypes == null) {
        excludedTypes = new String[] {};
    }
    KualiDecimal total = new KualiDecimal(BigDecimal.ZERO);
    for (PurApItem item : (List<PurApItem>) getItems()) {
        item.refreshReferenceObject(PurapPropertyConstants.ITEM_TYPE);
        ItemType it = item.getItemType();
        if ((includeBelowTheLine || it.isLineItemIndicator()) && !ArrayUtils.contains(excludedTypes, it.getItemTypeCode())) {
            KualiDecimal taxAmount = item.getItemTaxAmount();
            KualiDecimal itemTotal = (taxAmount != null) ? taxAmount : KualiDecimal.ZERO;
            total = total.add(itemTotal);
        }
    }
    return total;
}
Also used : PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) ItemType(org.kuali.kfs.module.purap.businessobject.ItemType) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)45 PurApAccountingLine (org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)17 ArrayList (java.util.ArrayList)15 List (java.util.List)15 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)10 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)7 PurchasingAccountsPayableDocument (org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument)5 PurchasingDocument (org.kuali.kfs.module.purap.document.PurchasingDocument)5 KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)4 ItemType (org.kuali.kfs.module.purap.businessobject.ItemType)4 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)4 PurchasingItemBase (org.kuali.kfs.module.purap.businessobject.PurchasingItemBase)4 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)4 BigDecimal (java.math.BigDecimal)3 HashSet (java.util.HashSet)3 PurApAccountingLineBase (org.kuali.kfs.module.purap.businessobject.PurApAccountingLineBase)3 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)3 PurchaseOrderAmendmentDocument (org.kuali.kfs.module.purap.document.PurchaseOrderAmendmentDocument)3 PurchasingAccountsPayableDocumentBase (org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase)3 WorkflowDocument (org.kuali.rice.kew.api.WorkflowDocument)3