public virtual IEnumerable Reclassify(PXAdapter adapter) { var trans = TransView.Cache.Updated.RowCast <GLTranReclHist>(); if (trans == null) { return(new GLTran[0]); } if (trans.Any(m => m.ReclassType == ReclassType.Split)) { var selectedTrans = trans.Where(m => m.Selected == true); if (selectedTrans.Count() == 0) { return(adapter.Get()); } ReclassifyTransactionsProcess.OpenForReclassification(selectedTrans.ToList().AsReadOnly(), PXBaseRedirectException.WindowMode.New); return(adapter.Get()); } var tran = trans.LastOrDefault(); if (tran.Released == false) { throw new PXException(Messages.TheTransactionCannotBeReclassifiedBecauseItIsNotReleased); } ReclassifyTransactionsProcess.OpenForReclassification(new[] { tran }, PXBaseRedirectException.WindowMode.New); return(adapter.Get()); }
public virtual IEnumerable Reclassify(PXAdapter adapter) { var tran = TransView.Select().RowCast <GLTran>().LastOrDefault(); if (tran == null) { return(new GLTran[0]); } if (tran.Released == false) { throw new PXException(Messages.TheTransactionCannotBeReclassifiedBecauseItIsNotReleased); } ReclassifyTransactionsProcess.OpenForReclassification(new[] { tran }, PXBaseRedirectException.WindowMode.Same); return(adapter.Get()); }
public virtual IEnumerable ReclassifyAll(PXAdapter adapter) { var trans = TransView.Cache.Updated.RowCast <GLTranReclHist>().Where(m => m.SortOrder.HasValue); if (trans == null) { TransView.Cache.Clear(); return(adapter.Get()); } ReclassifyTransactionsProcess.TryOpenForReclassification <GLTran>(trans, BatchTypeCode.Normal, TransView.View, InfoMessages.SomeTransactionsOfTheBatchCannotBeReclassified, InfoMessages.NoReclassifiableTransactionsHaveBeenFoundInTheBatch, PXBaseRedirectException.WindowMode.New); return(adapter.Get()); }