Esempio n. 1
0
        public virtual void openDocument()
        {
            PostingBatchDetail postingBatchDetailRow = BatchDetailsInfo.Current;

            if (postingBatchDetailRow.SOPosted == true)
            {
                if (PXAccess.FeatureInstalled <FeaturesSet.distributionModule>())
                {
                    SOOrderEntry graphSOOrderEntry = PXGraph.CreateInstance <SOOrderEntry>();
                    graphSOOrderEntry.Document.Current = graphSOOrderEntry.Document.Search <SOOrder.orderNbr>(postingBatchDetailRow.SOOrderNbr, postingBatchDetailRow.SOOrderType);
                    throw new PXRedirectRequiredException(graphSOOrderEntry, null)
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
            else if (postingBatchDetailRow.ARPosted == true)
            {
                ARInvoiceEntry graphARInvoiceEntry = PXGraph.CreateInstance <ARInvoiceEntry>();
                graphARInvoiceEntry.Document.Current = graphARInvoiceEntry.Document.Search <ARInvoice.refNbr>(postingBatchDetailRow.ARRefNbr, postingBatchDetailRow.ARDocType);
                throw new PXRedirectRequiredException(graphARInvoiceEntry, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (postingBatchDetailRow.APPosted == true)
            {
                APInvoiceEntry graphAPInvoiceEntry = PXGraph.CreateInstance <APInvoiceEntry>();
                graphAPInvoiceEntry.Document.Current = graphAPInvoiceEntry.Document.Search <APInvoice.refNbr>(postingBatchDetailRow.APRefNbr, postingBatchDetailRow.APDocType);
                throw new PXRedirectRequiredException(graphAPInvoiceEntry, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
        }
Esempio n. 2
0
        protected virtual void PostingBatchDetail_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            PostingBatchDetail postingBatchDetailRow = e.Row as PostingBatchDetail;

            if (postingBatchDetailRow.SOPosted == true)
            {
                using (new PXConnectionScope())
                {
                    var soOrderShipment = (SOOrderShipment)PXSelectReadonly <SOOrderShipment,
                                                                             Where <
                                                                                 SOOrderShipment.orderNbr, Equal <Required <SOOrderShipment.orderNbr> >,
                                                                                 And <
                                                                                     SOOrderShipment.orderType, Equal <Required <SOOrderShipment.orderType> > > > >
                                          .Select(cache.Graph, postingBatchDetailRow.SOOrderNbr, postingBatchDetailRow.SOOrderType);

                    postingBatchDetailRow.InvoiceRefNbr = soOrderShipment?.InvoiceNbr;
                }
            }
            else if (postingBatchDetailRow.ARPosted == true)
            {
                postingBatchDetailRow.InvoiceRefNbr = postingBatchDetailRow.Mem_DocNbr;
            }
        }