Search in sources :

Example 1 with AutoClosePurchaseOrderView

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

the class CuAutoClosePurchaseOrderServiceImpl method autoCloseFullyDisencumberedOrders.

@Override
public boolean autoCloseFullyDisencumberedOrders() {
    LOG.debug("autoCloseFullyDisencumberedOrders() started");
    List<AutoClosePurchaseOrderView> autoCloseList = this.getAllOpenPurchaseOrdersForAutoClose();
    for (AutoClosePurchaseOrderView poAutoClose : autoCloseList) {
        if ((poAutoClose.getTotalAmount() != null) && ((KualiDecimal.ZERO.compareTo(poAutoClose.getTotalAmount())) != 0)) {
            // KFSUPGRADE-363
            if (paymentRequestsStatusCanAutoClose(poAutoClose)) {
                // TODO: can the following be replaced with this one line?
                // autoClosePurchaseOrder(poAutoClose);
                LOG.info("autoCloseFullyDisencumberedOrders() PO ID " + poAutoClose.getPurapDocumentIdentifier() + " with total " + poAutoClose.getTotalAmount().doubleValue() + " will be closed");
                String newStatus = PurapConstants.PurchaseOrderStatuses.APPDOC_PENDING_CLOSE;
                String annotation = "This PO was automatically closed in batch.";
                String documentType = PurapConstants.PurchaseOrderDocTypes.PURCHASE_ORDER_CLOSE_DOCUMENT;
                PurchaseOrderDocument document = purchaseOrderService.getPurchaseOrderByDocumentNumber(poAutoClose.getDocumentNumber());
                this.createNoteForAutoCloseOrders(document, annotation);
                purchaseOrderService.createAndRoutePotentialChangeDocument(poAutoClose.getDocumentNumber(), documentType, annotation, null, newStatus);
            }
        }
    }
    LOG.debug("autoCloseFullyDisencumberedOrders() ended");
    return true;
}
Also used : AutoClosePurchaseOrderView(org.kuali.kfs.module.purap.businessobject.AutoClosePurchaseOrderView) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument)

Example 2 with AutoClosePurchaseOrderView

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

the class CuPurchaseOrderDaoOjb method getAllOpenPurchaseOrders.

public List<AutoClosePurchaseOrderView> getAllOpenPurchaseOrders(List<String> excludedVendorChoiceCodes) {
    LOG.info("getAllOpenPurchaseOrders() started");
    Criteria criteria = new Criteria();
    criteria.addIsNull(PurapPropertyConstants.RECURRING_PAYMENT_TYPE_CODE);
    criteria.addEqualTo(PurapPropertyConstants.TOTAL_ENCUMBRANCE, new KualiDecimal(0));
    criteria.addEqualTo(PurapPropertyConstants.PURCHASE_ORDER_CURRENT_INDICATOR, true);
    criteria.addEqualTo(KewApiConstants.APP_DOC_STATUS_DETAIL, PurapConstants.PurchaseOrderStatuses.APPDOC_OPEN);
    for (String excludeCode : excludedVendorChoiceCodes) {
        criteria.addNotEqualTo(PurapPropertyConstants.VENDOR_CHOICE_CODE, excludeCode);
    }
    QueryByCriteria qbc = new QueryByCriteria(CuAutoClosePurchaseOrderView.class, criteria);
    LOG.info("getAllOpenPurchaseOrders() Query criteria is " + criteria.toString());
    // KFSUPGRADE-363
    limitResultSize(qbc);
    List<AutoClosePurchaseOrderView> l = (List<AutoClosePurchaseOrderView>) getPersistenceBrokerTemplate().getCollectionByQuery(qbc);
    LOG.info("getAllOpenPurchaseOrders() ended.");
    return l;
}
Also used : CuAutoClosePurchaseOrderView(edu.cornell.kfs.module.purap.businessobject.CuAutoClosePurchaseOrderView) AutoClosePurchaseOrderView(org.kuali.kfs.module.purap.businessobject.AutoClosePurchaseOrderView) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) List(java.util.List) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria)

Aggregations

AutoClosePurchaseOrderView (org.kuali.kfs.module.purap.businessobject.AutoClosePurchaseOrderView)2 CuAutoClosePurchaseOrderView (edu.cornell.kfs.module.purap.businessobject.CuAutoClosePurchaseOrderView)1 List (java.util.List)1 Criteria (org.apache.ojb.broker.query.Criteria)1 QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)1 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)1 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)1