First, find the method that does the calculation/Filter in mycase it is CalculateFinancialCharges
2de add your logic under the normal baseMethod and remove needed items using Remove(item);
public delegate void CalculateFinancialChargesDelegate(ARFinChargesApplyParameters filter);
[PXOverride]
public void CalculateFinancialCharges(ARFinChargesApplyParameters filter, CalculateFinancialChargesDelegate baseMethod)
{
baseMethod(filter);
try
{
ARFinChargesApplyParameters curARFinChargesApplyParameters = this.Base.Filter.Current;
ARFinChargesApplyParametersExt curARFinChargesApplyParametersExt = curARFinChargesApplyParameters.GetExtension<ARFinChargesApplyParametersExt>();
if (!string.IsNullOrWhiteSpace(curARFinChargesApplyParametersExt.UsrEmployeeID))
{
foreach (ARFinChargesDetails item in this.Base.ARFinChargeRecords.Cache.Inserted)
{
BAccount bAccount = PXSelect<Customer,
Where<Customer.bAccountID, Equal<Required<ARFinChargesDetails.customerID>>>>.
Select(Base, item.CustomerID);
BAccountExt bAccountExt = bAccount.GetExtension<BAccountExt>();
if (bAccountExt.UsrEmployeeID != curARFinChargesApplyParametersExt.UsrEmployeeID)
{
this.Base.ARFinChargeRecords.Cache.Remove(item);
}
}
}
}
catch (Exception ex)
{
PXTrace.WriteError(ex);
}
}