public static List <ARInvoice> Process(List <ARInvoice> list, bool isMassProcess) { List <ARInvoice> listWithTax = new List <ARInvoice>(list.Count); ARInvoiceEntry rg = PXGraph.CreateInstance <ARInvoiceEntry>(); for (int i = 0; i < list.Count; i++) { try { rg.Clear(); rg.Document.Current = PXSelect <ARInvoice, Where <ARInvoice.docType, Equal <Required <ARInvoice.docType> >, And <ARInvoice.refNbr, Equal <Required <ARInvoice.refNbr> > > > > .Select(rg, list[i].DocType, list[i].RefNbr); listWithTax.Add(rg.CalculateAvalaraTax(rg.Document.Current)); PXProcessing <ARInvoice> .SetInfo(i, ActionsMessages.RecordProcessed); } catch (Exception e) { if (isMassProcess) { PXProcessing <ARInvoice> .SetError(i, e is PXOuterException?e.Message + "\r\n" + String.Join("\r\n", ((PXOuterException)e).InnerMessages) : e.Message); } else { throw new PXMassProcessException(i, e); } } } return(listWithTax); }
public static ARInvoice Process(ARInvoiceEntry ie) { if (ie != null) { if (ie.Document.Current.OrigModule == GL.BatchModule.SO) { return(ie.CalculateAvalaraTax(ie.Document.Current)); } else { List <ARInvoice> list = new List <ARInvoice>(); list.Add(ie.Document.Current); List <ARInvoice> listWithTax = Process(list, false); return(listWithTax[0]); } } return(null); }