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;
}
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;
}
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();
}
}
}
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));
}
}
}
}
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;
}
Aggregations