public virtual IEnumerable ViewWorkBook(PXAdapter adapter) { GLVoucherBatchEntry graph = PXGraph.CreateInstance <GLVoucherBatchEntry>(); graph.filter.Current.WorkBookID = Voucher.Current.WorkBookID; graph.VoucherBatches.Current = graph.VoucherBatches.Search <GLVoucherBatch.voucherBatchNbr>(Voucher.Current.VoucherBatchNbr); throw new PXRedirectRequiredException(graph, ""); }
public virtual IEnumerable ViewWorkBook(PXAdapter adapter) { GLVoucherBatchEntry graph = PXGraph.CreateInstance <GLVoucherBatchEntry>(); graph.filter.Current = new GLVoucherBatchEntry.Filter(); graph.filter.Current.WorkBookID = Voucher.Current.WorkBookID; graph.VoucherBatches.Current = graph.VoucherBatches.Search <GLVoucherBatch.voucherBatchNbr>(Voucher.Current.VoucherBatchNbr); string url = GLWorkBookMaint.WORKBOOK_URL + "?WorkBookID=" + Voucher.Current.WorkBookID; throw new PXRedirectRequiredException(url, graph, ""); }
public virtual IEnumerable ViewVoucherBatch(PXAdapter adapter) { GLVoucherBatchEntry graph = PXGraph.CreateInstance <GLVoucherBatchEntry>(); graph.filter.Current = new GLVoucherBatchEntry.Filter(); graph.filter.Current.WorkBookID = Voucher.Current.WorkBookID; graph.VoucherBatches.Current = graph.VoucherBatches.Search <GLVoucherBatch.voucherBatchNbr>(Voucher.Current.VoucherBatchNbr); graph.VouchersInBatch.Current = graph.VouchersInBatch.Search <GLVoucher.refNbr, GLVoucher.docType, GLVoucher.module>(Voucher.Current.RefNbr, Voucher.Current.DocType, Voucher.Current.Module); graph.ViewDocument.Press(); return(adapter.Get()); }
public void DeleteBatchProc(GLVoucherBatch aBatch, Dictionary <string, Dictionary <Guid, CAMessage> > errorList) { this.Clear(); this.Document.Current = aBatch; Dictionary <Guid, CAMessage> errorLog = null; if (!errorList.ContainsKey(aBatch.VoucherBatchNbr)) { errorList.Add(aBatch.VoucherBatchNbr, new Dictionary <Guid, CAMessage>()); } errorLog = errorList[aBatch.VoucherBatchNbr]; try { using (PXTransactionScope ts = new PXTransactionScope()) { List <Guid> failed = new List <Guid>(); Dictionary <string, List <GLVoucher> > processQueue = new Dictionary <string, List <GLVoucher> >(); foreach (GLVoucher voucher in Details.Select()) { if (!processQueue.ContainsKey(voucher.Module + voucher.DocType)) { processQueue.Add(voucher.Module + voucher.DocType, new List <GLVoucher>()); } processQueue[voucher.Module + voucher.DocType].Add(voucher); } foreach (KeyValuePair <string, List <GLVoucher> > pair in processQueue) { string module = pair.Value[0].Module; string docType = pair.Value[0].DocType; Type graphType = GLWorkBookMaint.GetGraphByDocType(module, docType); if (graphType == null) { throw new PXException(GL.Messages.ModuleDocTypeIsNotSupported, module, docType); } PXGraph deletegraph = PXGraph.CreateInstance(graphType); if (!(deletegraph is IVoucherEntry)) { throw new PXException(GL.Messages.ModuleDocTypeIsNotSupported, module, docType); } foreach (GLVoucher voucher in pair.Value) { Guid key = voucher.RefNoteID.Value; try { deletegraph.Clear(); GLVoucherBatchEntry.SetVoucherAsCurrent(this, deletegraph, voucher); (deletegraph as IVoucherEntry).DeleteButton.Press(); } catch (Exception ex) { failed.Add(key); errorLog.Add(key, FormatError(ex)); throw new PXException(Messages.DeletingFailed); } } } this.Document.Delete(aBatch); this.Save.Press(); ts.Complete(this); } } catch (PXException ex) { errorLog.Add(Guid.Empty, FormatError(ex)); throw ex; } }