public virtual void CopyOrderProc(SOOrder order, CopyParamFilter copyFilter, CopyOrderProcDelegate baseMethod) { RUTROT rutrotRecord = null; PXResultset <RUTROTDistribution> rutrotDistribution = null; SOOrderRUTROT orderRR = RUTROTHelper.GetExtensionNullable <SOOrder, SOOrderRUTROT>(order); if (RUTROTHelper.IsRUTROTcompatibleType(order.OrderType) && orderRR?.IsRUTROTDeductible == true) { rutrotRecord = Rutrots.SelectSingle(); rutrotDistribution = RRDistribution.Select(); } baseMethod(order, copyFilter); if (RUTROTHelper.IsRUTROTcompatibleType(copyFilter.OrderType) && rutrotRecord != null && rutrotDistribution != null) { rutrotRecord = (RUTROT)Rutrots.Cache.CreateCopy(rutrotRecord); rutrotRecord.RefNbr = Base.Document.Current.OrderNbr; rutrotRecord.DocType = Base.Document.Current.OrderType; rutrotRecord.CuryDistributedAmt = 0m; rutrotRecord.CuryUndistributedAmt = 0m; rutrotRecord = Rutrots.Update(rutrotRecord); foreach (RUTROTDistribution distribution in rutrotDistribution) { RUTROTDistribution new_distribution = (RUTROTDistribution)RRDistribution.Cache.CreateCopy(distribution); new_distribution.RefNbr = null; new_distribution.DocType = null; RRDistribution.Insert(new_distribution); } } else { Base.Document.Cache.SetValueExt <SOOrderRUTROT.isRUTROTDeductible>(Base.Document.Current, false); Base.Document.Update(Base.Document.Current); } }
public virtual void CopyOrderProc(SOOrder order, CopyParamFilter copyFilter, CopyOrderProcDelegate baseMethod) { List <RUTROTDistribution> rutrotDistribution = null; SOOrderRUTROT orderRR = RUTROTHelper.GetExtensionNullable <SOOrder, SOOrderRUTROT>(order); if (RUTROTHelper.IsRUTROTcompatibleType(order.OrderType) && orderRR?.IsRUTROTDeductible == true) { rutrotDistribution = RRDistribution.Select().RowCast <RUTROTDistribution>().ToList(); } baseMethod(order, copyFilter); if (RUTROTHelper.IsRUTROTcompatibleType(copyFilter.OrderType) && rutrotDistribution.Count > 0) { foreach (RUTROTDistribution distribution in rutrotDistribution) { RUTROTDistribution new_distribution = (RUTROTDistribution)RRDistribution.Cache.CreateCopy(distribution); new_distribution.RefNbr = null; new_distribution.DocType = null; RRDistribution.Insert(new_distribution); } } }