Skip to content

Instantly share code, notes, and snippets.

@gmichaud
Created December 23, 2019 16:04
Show Gist options
  • Save gmichaud/17e346cdf3062de233f52c9976d0a03e to your computer and use it in GitHub Desktop.
Save gmichaud/17e346cdf3062de233f52c9976d0a03e to your computer and use it in GitHub Desktop.
Custom Acumatica Popup Notes
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using PX.CCProcessingBase;
using PX.Common;
using PX.Data;
using PX.Objects.AP;
using PX.Objects.AR;
using PX.Objects.CA;
using PX.Objects.CM;
using PX.Objects.CR;
using PX.Objects.CS;
using PX.Objects.DR;
using PX.Objects.EP;
using PX.Objects.GL;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.Objects.PO;
using PX.Objects.TX;
using POLine = PX.Objects.PO.POLine;
using POOrder = PX.Objects.PO.POOrder;
using System.Threading.Tasks;
using PX.CarrierService;
using CRLocation = PX.Objects.CR.Standalone.Location;
using PX.Objects.AR.CCPaymentProcessing;
using PX.Objects.AR.CCPaymentProcessing.Common;
using PX.Objects.AR.CCPaymentProcessing.Helpers;
using PX.Objects.AR.CCPaymentProcessing.Interfaces;
using ARRegisterAlias = PX.Objects.AR.Standalone.ARRegisterAlias;
using PX.Objects.AR.MigrationMode;
using PX.Objects.Common;
using PX.Objects.Common.Discount;
using PX.Objects.Common.Extensions;
using PX.Objects.IN.Overrides.INDocumentRelease;
using PX.CS.Contracts.Interfaces;
using Message = PX.CarrierService.Message;
using PX.TaxProvider;
using PX.Data.DependencyInjection;
using PX.LicensePolicy;
using PX.Objects.Extensions.PaymentTransaction;
using PX.Objects.SO.GraphExtensions.CarrierRates;
using PX.Objects;
using PX.Objects.SO;
namespace PX.Objects.SO
{
public class SOOrderEntryPopupSampleExt : PXGraphExtension<SOOrderEntry>
{
public void SOLine_InventoryID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
{
var openOrdersForItem = new PXSelectJoin<SOOrder,
InnerJoin<SOLine, On<SOOrder.orderType, Equal<SOLine.orderType>, And<SOOrder.orderNbr, Equal<SOLine.orderNbr>>>>,
Where<SOOrder.status, NotEqual<SOOrderStatus.completed>,
And<SOOrder.status, NotEqual<SOOrderStatus.cancelled>,
And<SOOrder.customerID, Equal<Current<SOOrder.customerID>>,
And<SOOrder.customerLocationID, Equal<Current<SOOrder.customerLocationID>>,
And<SOLine.inventoryID, Equal<Required<SOLine.inventoryID>>,
And<SOLine.completed, Equal<False>,
And<SOLine.operation, Equal<SOOperation.issue>>>>>>>>>(Base);
string orderList = String.Empty;
foreach(SOOrder order in openOrdersForItem.Select(e.NewValue))
{
if (orderList != String.Empty) orderList += ", ";
orderList += order.OrderType + " " + order.OrderNbr;
}
if(orderList != String.Empty)
{
PopupNoteManager.RegisterText(sender, e.Row, "InventoryID",
"This item is on one or more open sales orders. Please confirm with the customer before ordering it again: " + orderList);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment