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