public static ARCashSale Process(ARCashSale doc) { List <ARCashSale> list = new List <ARCashSale>(); list.Add(doc); List <ARCashSale> listWithTax = Process(list, false); return(listWithTax[0]); }
protected virtual void RedirectToDoc(string aDocType, string aRefNbr) { Dictionary <string, string> alltypes = new ARDocType.ListAttribute().ValueLabelDic; if (new ARInvoiceType.ListAttribute().ValueLabelDic.ContainsKey(aDocType)) { ARInvoice doc = ARDocumentEnq.FindDoc <ARInvoice>(this, aDocType, aRefNbr); if (doc != null) { ARInvoiceEntry graph = PXGraph.CreateInstance <ARInvoiceEntry>(); graph.Document.Current = doc; throw new PXRedirectRequiredException(graph, true, "Document") { Mode = PXBaseRedirectException.WindowMode.NewWindow }; } throw new PXException(Messages.DocumentNotFound, alltypes[aDocType], aRefNbr); } if (new ARPaymentType.ListAttribute().ValueLabelDic.ContainsKey(aDocType)) { ARPayment doc = ARDocumentEnq.FindDoc <ARPayment>(this, aDocType, aRefNbr); if (doc != null) { ARPaymentEntry graph = PXGraph.CreateInstance <ARPaymentEntry>(); graph.Document.Current = doc; throw new PXRedirectRequiredException(graph, true, "Document") { Mode = PXBaseRedirectException.WindowMode.NewWindow }; } throw new PXException(Messages.DocumentNotFound, alltypes[aDocType], aRefNbr); } if (new ARCashSaleType.ListAttribute().ValueLabelDic.ContainsKey(aDocType)) { ARCashSale doc = ARDocumentEnq.FindDoc <ARCashSale>(this, aDocType, aRefNbr); if (doc != null) { ARCashSaleEntry graph = PXGraph.CreateInstance <ARCashSaleEntry>(); graph.Document.Current = doc; throw new PXRedirectRequiredException(graph, true, "Document") { Mode = PXBaseRedirectException.WindowMode.NewWindow }; } throw new PXException(Messages.DocumentNotFound, alltypes[aDocType], aRefNbr); } throw new PXException(Messages.UnknownDocumentType); }
public static void ViewScheduleForDocument(PXGraph graph, ARCashSale document) { PXSelectBase <DRSchedule> correspondingScheduleView = new PXSelect < DRSchedule, Where < DRSchedule.module, Equal <GL.BatchModule.moduleAR>, And <DRSchedule.docType, Equal <Required <ARTran.tranType> >, And <DRSchedule.refNbr, Equal <Required <ARTran.refNbr> > > > > > (graph); DRSchedule correspondingSchedule = correspondingScheduleView.Select(document.DocType, document.RefNbr); if (correspondingSchedule?.LineNbr != null && document.Released == false) { throw new PXException(Messages.CantCompleteBecauseASC606FeatureIsEnabled); } if (correspondingSchedule?.IsOverridden != true && document.Released == false) { var netLinesAmount = ASC606Helper.CalculateNetAmount(graph, document); int?defScheduleID = null; if (netLinesAmount.Cury != 0m) { DRSingleProcess process = PXGraph.CreateInstance <DRSingleProcess>(); process.CreateSingleSchedule(document, netLinesAmount, defScheduleID, true); process.Actions.PressSave(); correspondingScheduleView.Cache.Clear(); correspondingScheduleView.Cache.ClearQueryCacheObsolete(); correspondingSchedule = correspondingScheduleView.Select(document.DocType, document.RefNbr); } } if (correspondingSchedule != null) { PXRedirectHelper.TryRedirect( graph.Caches[typeof(DRSchedule)], correspondingSchedule, "View Schedule", PXRedirectHelper.WindowMode.NewWindow); } }