Search in sources :

Example 1 with PurApAccountingLine

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

the class CuRequisitionDocument method isAwardReviewRequired.

protected boolean isAwardReviewRequired() {
    boolean requiresAwardReview = false;
    this.getAccountsForRouting();
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    // If the award amount is less than the threshold, then there's no reason to review the object codes, return false
    if (!isAwardAmountGreaterThanThreshold()) {
        return requiresAwardReview;
    }
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
            requiresAwardReview = isObjectCodeAllowedForAwardRouting(accountingLine, parameterService);
            // level.
            if (requiresAwardReview) {
                return requiresAwardReview;
            }
        }
    }
    return requiresAwardReview;
}
Also used : ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with PurApAccountingLine

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

the class PurchaseOrderDocument method isAwardReviewRequired.

protected boolean isAwardReviewRequired() {
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    boolean objectCodeAllowed = true;
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
            objectCodeAllowed = isObjectCodeAllowedForAwardRouting(accountingLine, parameterService);
            // level.
            if (objectCodeAllowed) {
                return objectCodeAllowed;
            }
        }
    }
    return objectCodeAllowed;
}
Also used : 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) List(java.util.List)

Example 3 with PurApAccountingLine

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

the class PurchaseOrderDocument method getCustomDocumentTitle.

/**
 * Returns a custom document title based on the workflow document title.
 * Depending on what route level the document is currently in, various info may be added to the documents title.
 *
 * @return - Customized document title text dependent upon route level.
 */
protected String getCustomDocumentTitle() {
    String poNumber = getPurapDocumentIdentifier().toString();
    String cmCode = getContractManagerCode().toString();
    String vendorName = StringUtils.trimToEmpty(getVendorName());
    String totalAmount = getTotalDollarAmount().toString();
    PurApAccountingLine accountingLine = getFirstAccount();
    String chartAcctCode = accountingLine != null ? accountingLine.getChartOfAccountsCode() : "";
    String accountNumber = accountingLine != null ? accountingLine.getAccountNumber() : "";
    String chartCode = getChartOfAccountsCode();
    String orgCode = getOrganizationCode();
    String deliveryCampus = getDeliveryCampus() != null ? getDeliveryCampus().getCampus().getShortName() : "";
    String documentTitle = "";
    Set<String> nodeNames = this.getFinancialSystemDocumentHeader().getWorkflowDocument().getCurrentNodeNames();
    String routeLevel = "";
    if (CollectionUtils.isNotEmpty(nodeNames) && nodeNames.size() >= 1) {
        routeLevel = nodeNames.iterator().next();
    }
    if (StringUtils.equals(getApplicationDocumentStatus(), PurchaseOrderStatuses.APPDOC_OPEN)) {
        documentTitle = super.getDocumentTitle();
    } else if (routeLevel.equals(PurchaseOrderStatuses.NODE_BUDGET_OFFICE_REVIEW) || routeLevel.equals(PurchaseOrderStatuses.NODE_CONTRACTS_AND_GRANTS_REVIEW)) {
        // Budget & C&G approval levels
        documentTitle = "PO: " + poNumber + " Account Number: " + chartAcctCode + "-" + accountNumber + " Dept: " + chartCode + "-" + orgCode + " Delivery Campus: " + deliveryCampus;
    } else // KFSUPGRADE-348
    // else if (routeLevel.equals(PurchaseOrderStatuses.NODE_VENDOR_TAX_REVIEW)) {
    // // Tax approval level
    // documentTitle = "Vendor: " + vendorName + " PO: " + poNumber + " Account Number: " + chartCode + "-" + accountNumber + " Dept: " + chartCode + "-" + orgCode + " Delivery Campus: " + deliveryCampus;
    // }
    {
        documentTitle += "PO: " + poNumber + " Contract Manager: " + cmCode + " Vendor: " + vendorName + " Amount: " + totalAmount;
    }
    return documentTitle;
}
Also used : PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)

Example 4 with PurApAccountingLine

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

the class PurchasingAccountsPayableDocumentBase method refreshNonUpdateableReferences.

@Override
public void refreshNonUpdateableReferences() {
    super.refreshNonUpdateableReferences();
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        // refresh the accounts if they do exist...
        for (PurApAccountingLine account : item.getSourceAccountingLines()) {
            account.refreshNonUpdateableReferences();
        }
    }
    fixItemReferences();
}
Also used : PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) List(java.util.List) ArrayList(java.util.ArrayList)

Example 5 with PurApAccountingLine

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

the class PurchasingAccountsPayableDocumentBase method getIndexedErrorPathPrefix.

private String getIndexedErrorPathPrefix(String errorPathPrefix, AccountingLine currentLine) {
    int idx = 0;
    int i = 0;
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        int j = 0;
        // the error icon may be placed in wrong line.
        if (CollectionUtils.isNotEmpty(item.getSourceAccountingLines())) {
            Collections.sort(item.getSourceAccountingLines(), new PurapAccountingLineComparator());
        }
        for (PurApAccountingLine acctLine : item.getSourceAccountingLines()) {
            if (acctLine == currentLine) {
                return errorPathPrefix + i + "]." + KFSConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME + "[" + j + "]";
            } else {
                j++;
            }
        }
        i++;
    }
    return errorPathPrefix + 0 + "]." + KFSConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME + "[" + 0 + "]";
}
Also used : PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) List(java.util.List) ArrayList(java.util.ArrayList) PurapAccountingLineComparator(org.kuali.kfs.module.purap.util.PurapAccountingLineComparator)

Aggregations

PurApAccountingLine (org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)27 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)17 ArrayList (java.util.ArrayList)9 List (java.util.List)7 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)7 BigDecimal (java.math.BigDecimal)6 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)5 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)5 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)4 IWantAccount (edu.cornell.kfs.module.purap.businessobject.IWantAccount)3 PurchaseOrderAmendmentDocument (org.kuali.kfs.module.purap.document.PurchaseOrderAmendmentDocument)3 PurchasingAccountsPayableDocument (org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument)3 KfsParameterConstants (org.kuali.kfs.sys.service.impl.KfsParameterConstants)3 WorkflowDocument (org.kuali.rice.kew.api.WorkflowDocument)3 Account (org.kuali.kfs.coa.businessobject.Account)2 KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)2 PurchasingItemBase (org.kuali.kfs.module.purap.businessobject.PurchasingItemBase)2 RequisitionAccount (org.kuali.kfs.module.purap.businessobject.RequisitionAccount)2 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)2 PurchasingAccountsPayableDocumentBase (org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase)2