use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingAccountsPayableDocumentBase method getTotalPreTaxDollarAmountWithExclusions.
/**
* Computes the total dollar amount with the specified item types and possibly below the line items excluded.
*
* @param excludedTypes the types of items to be excluded.
* @param includeBelowTheLine indicates whether below the line items shall be included.
* @return the total dollar amount with the specified item types excluded.
*/
public KualiDecimal getTotalPreTaxDollarAmountWithExclusions(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 extendedPrice = item.getExtendedPrice();
KualiDecimal itemTotal = (extendedPrice != null) ? extendedPrice : KualiDecimal.ZERO;
total = total.add(itemTotal);
}
}
return total;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingDocumentBase method deleteItem.
/**
* @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument#deleteItem(int lineNum)
*/
@Override
public void deleteItem(int lineNum) {
// remove associated asset items
PurApItem item = items.get(lineNum);
if (ObjectUtils.isNotNull(item) && item.getItemIdentifier() != null) {
PurchasingCapitalAssetItem purchasingCapitalAssetItem = getPurchasingCapitalAssetItemByItemIdentifier(item.getItemIdentifier());
if (ObjectUtils.isNotNull(purchasingCapitalAssetItem)) {
getPurchasingCapitalAssetItems().remove(purchasingCapitalAssetItem);
}
// no more capital asset items, clear cap asset fields
if (getPurchasingCapitalAssetItems().size() == 0) {
clearCapitalAssetFields();
}
}
super.deleteItem(lineNum);
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingAddItemValidation method validate.
public boolean validate(AttributedDocumentEvent event) {
boolean valid = true;
GlobalVariables.getMessageMap().addToErrorPath(PurapPropertyConstants.NEW_PURCHASING_ITEM_LINE);
// refresh itemType
PurApItem refreshedItem = getItemForValidation();
refreshedItem.refreshReferenceObject("itemType");
super.setItemForValidation(refreshedItem);
valid &= super.validate(event);
valid &= validateItemUnitPrice(getItemForValidation());
valid &= validateUnitOfMeasure(getItemForValidation());
if (getItemForValidation().getItemType().isLineItemIndicator()) {
valid &= validateItemDescription(getItemForValidation());
valid &= validateItemQuantity(getItemForValidation());
commodityCodeValidation.setItemForValidation(getItemForValidation());
valid &= commodityCodeValidation.validate(event);
// KFSPTS-2096
valid &= validateMixItemType(getItemForValidation(), (PurchasingAccountsPayableDocument) event.getDocument());
}
GlobalVariables.getMessageMap().removeFromErrorPath(PurapPropertyConstants.NEW_PURCHASING_ITEM_LINE);
return valid;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingAddItemValidation method validateMixItemType.
private boolean validateMixItemType(PurApItem newItem, PurchasingAccountsPayableDocument purapDocument) {
boolean valid = true;
if (StringUtils.isNotBlank(newItem.getItemTypeCode())) {
String itemTypeCode = newItem.getItemTypeCode();
for (PurApItem item : purapDocument.getItems()) {
if (StringUtils.isNotBlank(item.getItemTypeCode()) && !itemTypeCode.equalsIgnoreCase(item.getItemTypeCode()) && (CUPurapConstants.ItemTypeCodes.ITEM_TYPE_SERVICE_CODE.equalsIgnoreCase(item.getItemTypeCode()) || CUPurapConstants.ItemTypeCodes.ITEM_TYPE_ITEM_CODE.equalsIgnoreCase(item.getItemTypeCode()))) {
GlobalVariables.getMessageMap().addToErrorPath(PurapPropertyConstants.NEW_PURCHASING_ITEM_LINE);
GlobalVariables.getMessageMap().putError(CUPurapPropertyConstants.ITEM_TYPE_CODE, CUPurapKeyConstants.PURAP_MIX_ITEM_QTY_NONQTY);
valid &= false;
GlobalVariables.getMessageMap().removeFromErrorPath(PurapPropertyConstants.NEW_PURCHASING_ITEM_LINE);
break;
}
}
}
return valid;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingImportItemValidation method validate.
@Override
public boolean validate(AttributedDocumentEvent event) {
boolean valid = true;
PurApItem refreshedItem = getItemForValidation();
refreshedItem.refreshReferenceObject("itemType");
super.setItemForValidation(refreshedItem);
valid &= super.validate(event);
GlobalVariables.getMessageMap().addToErrorPath(PurapConstants.ITEM_TAB_ERROR_PROPERTY);
if (getItemForValidation().getItemType().isLineItemIndicator()) {
valid &= validateItemDescription(getItemForValidation());
commodityCodeValidation.setItemForValidation(getItemForValidation());
valid &= commodityCodeValidation.validate(event);
}
valid &= validateItemUnitPrice(getItemForValidation());
valid &= validateUnitOfMeasureCodeExists(getItemForValidation());
GlobalVariables.getMessageMap().removeFromErrorPath(PurapConstants.ITEM_TAB_ERROR_PROPERTY);
return valid;
}
Aggregations