Beispiel #1
0
        public static void Redirect(PXCache sender, CATran catran)
        {
            if (catran == null)
            {
                return;
            }
            if (catran.OrigTranType == CAAPARTranType.GLEntry)
            {
                JournalEntry graph = PXGraph.CreateInstance <JournalEntry>();
                graph.Clear();
                if (sender != null)
                {
                    sender.IsDirty = false;
                }
                graph.BatchModule.Current = PXSelect <Batch, Where <Batch.module, Equal <Required <Batch.module> >, And <Batch.batchNbr, Equal <Required <Batch.batchNbr> > > > > .Select(graph, catran.OrigModule, catran.OrigRefNbr);

                throw new PXRedirectRequiredException(graph, true, "Document")
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (catran.OrigModule == GL.BatchModule.AP && (catran.OrigTranType == AP.APDocType.QuickCheck || catran.OrigTranType == AP.APDocType.VoidQuickCheck))
            {
                APQuickCheckEntry graph = PXGraph.CreateInstance <APQuickCheckEntry>();
                graph.Clear();
                if (sender != null)
                {
                    sender.IsDirty = false;
                }
                graph.Document.Current = PXSelect <APQuickCheck, Where <APQuickCheck.refNbr, Equal <Required <APQuickCheck.refNbr> >,
                                                                        And <APQuickCheck.docType, Equal <Required <APQuickCheck.docType> > > > > .Select(graph, catran.OrigRefNbr, catran.OrigTranType);

                throw new PXRedirectRequiredException(graph, true, "Document")
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (catran.OrigModule == GL.BatchModule.AP && catran.OrigTranType == CATranType.CABatch)
            {
                CABatchEntry graph = PXGraph.CreateInstance <CABatchEntry>();
                graph.Clear();
                if (sender != null)
                {
                    sender.IsDirty = false;
                }
                graph.Document.Current = PXSelect <CABatch, Where <CABatch.batchNbr, Equal <Required <CATran.origRefNbr> > > > .Select(graph, catran.OrigRefNbr);

                throw new PXRedirectRequiredException(graph, true, "Document")
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (catran.OrigModule == GL.BatchModule.AP)
            {
                APPaymentEntry graph = PXGraph.CreateInstance <APPaymentEntry>();
                graph.Clear();
                if (sender != null)
                {
                    sender.IsDirty = false;
                }
                graph.Document.Current = (APPayment)PXSelect <APPayment, Where <APPayment.refNbr, Equal <Required <APPayment.refNbr> >,
                                                                                And <APPayment.docType, Equal <Required <APPayment.docType> > > > > .Select(graph, catran.OrigRefNbr, catran.OrigTranType);

                throw new PXRedirectRequiredException(graph, true, "Document")
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (catran.OrigModule == GL.BatchModule.AR && (catran.OrigTranType == ARDocType.CashSale || catran.OrigTranType == ARDocType.CashReturn))
            {
                ARCashSale document = (ARCashSale)PXSelect <ARCashSale, Where <ARCashSale.refNbr, Equal <Required <ARCashSale.refNbr> >,
                                                                               And <ARCashSale.docType, Equal <Required <ARCashSale.docType> > > > > .Select(sender.Graph, catran.OrigRefNbr, catran.OrigTranType);

                if (document.OrigModule == BatchModule.SO && document.Released == false)
                {
                    SO.SOInvoiceEntry graph = PXGraph.CreateInstance <SO.SOInvoiceEntry>();
                    graph.Clear();
                    sender.IsDirty = false;

                    graph.Document.Current = (ARInvoice)PXSelect <ARInvoice, Where <ARInvoice.refNbr, Equal <Required <ARInvoice.refNbr> >,
                                                                                    And <ARInvoice.docType, Equal <Required <ARInvoice.docType> > > > > .Select(sender.Graph, catran.OrigRefNbr, catran.OrigTranType);

                    throw new PXRedirectRequiredException(graph, true, "Document")
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
                else
                {
                    ARCashSaleEntry graph = PXGraph.CreateInstance <ARCashSaleEntry>();
                    graph.Clear();
                    if (sender != null)
                    {
                        sender.IsDirty = false;
                    }

                    graph.Document.Current = document;
                    throw new PXRedirectRequiredException(graph, true, "Document")
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
            else if (catran.OrigModule == GL.BatchModule.AR)
            {
                ARPaymentEntry graph = PXGraph.CreateInstance <ARPaymentEntry>();
                graph.Clear();
                if (sender != null)
                {
                    sender.IsDirty = false;
                }
                graph.Document.Current = (ARPayment)PXSelect <ARPayment, Where <ARPayment.refNbr, Equal <Required <ARPayment.refNbr> >,
                                                                                And <ARPayment.docType, Equal <Required <ARPayment.docType> > > > > .Select(graph, catran.OrigRefNbr, catran.OrigTranType);

                throw new PXRedirectRequiredException(graph, true, "Document")
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (catran.OrigModule == GL.BatchModule.CA && catran.OrigTranType == CATranType.CAAdjustment)
            {
                CATranEntry graph = PXGraph.CreateInstance <CATranEntry>();
                graph.Clear();
                if (sender != null)
                {
                    sender.IsDirty = false;
                }
                graph.CAAdjRecords.Current = PXSelect <CAAdj, Where <CAAdj.tranID, Equal <Required <CAAdj.tranID> > > > .Select(graph, catran.TranID);

                throw new PXRedirectRequiredException(graph, true, "Document")
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (catran.OrigModule == GL.BatchModule.CA && catran.OrigTranType == CATranType.CATransferExp)
            {
                CATranEntry graph = PXGraph.CreateInstance <CATranEntry>();
                graph.Clear();
                if (sender != null)
                {
                    sender.IsDirty = false;
                }
                graph.CAAdjRecords.Current = PXSelect <CAAdj, Where <CAAdj.adjTranType, Equal <CAAPARTranType.cATransferExp>, And <CAAdj.transferNbr, Equal <Required <CATran.origRefNbr> > > > > .Select(graph, catran.OrigRefNbr);

                throw new PXRedirectRequiredException(graph, true, "Document")
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (catran.OrigModule == GL.BatchModule.CA)
            {
                if (catran.OrigTranType == CATranType.CADeposit || catran.OrigTranType == CATranType.CAVoidDeposit)
                {
                    CADepositEntry graph = PXGraph.CreateInstance <CADepositEntry>();
                    graph.Clear();
                    if (sender != null)
                    {
                        sender.IsDirty = false;
                    }
                    graph.Document.Current = PXSelect <CADeposit, Where <CADeposit.tranType, Equal <Required <CADeposit.tranType> >,
                                                                         And <CADeposit.refNbr, Equal <Required <CADeposit.refNbr> > > > >
                                             .Select(graph, catran.OrigTranType, catran.OrigRefNbr);

                    throw new PXRedirectRequiredException(graph, true, "Document")
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
                else
                {
                    CashTransferEntry graph = PXGraph.CreateInstance <CashTransferEntry>();
                    graph.Clear();
                    if (sender != null)
                    {
                        sender.IsDirty = false;
                    }
                    graph.Transfer.Current = PXSelect <CATransfer, Where <CATransfer.tranIDOut, Equal <Required <CATransfer.tranIDOut> >, Or <CATransfer.tranIDIn, Equal <Required <CATransfer.tranIDIn> > > > >
                                             .Select(graph, catran.TranID, catran.TranID);

                    throw new PXRedirectRequiredException(graph, true, "Document")
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
        }
Beispiel #2
0
 public static void InitBackwardEditorHandlers(CashTransferEntry graph)
 {
     graph.RowPersisting.AddHandler <CAExpense>(CAExpenseHelper.CAExpense_RowPersisting);
 }