Beispiel #1
0
        public virtual IEnumerable cCTrans()
        {
            List <PXResult <CCProcTran, CustomerPaymentMethod, Customer, ARPayment> > res = new List <PXResult <CCProcTran, CustomerPaymentMethod, Customer, ARPayment> >();

            CCTransactionsHistoryFilter filter = (CCTransactionsHistoryFilter)this.Filter.Current;


            if (filter != null && string.IsNullOrEmpty(filter.PaymentMethodID) == false &&
                filter.StartDate.HasValue && filter.EndDate.HasValue && filter.PMInstanceID != null)
            {
                GetInternalData(filter.PaymentMethodID);

                PXSelectBase <CCProcTran> sel = new PXSelectJoin <CCProcTran,
                                                                  InnerJoin <CustomerPaymentMethod, On <CustomerPaymentMethod.pMInstanceID, Equal <CCProcTran.pMInstanceID> >,
                                                                             InnerJoin <Customer, On <CustomerPaymentMethod.bAccountID, Equal <Customer.bAccountID> >,
                                                                                        LeftJoin <ARPayment, On <ARPayment.docType, Equal <CCProcTran.docType>, And <ARPayment.refNbr, Equal <CCProcTran.refNbr> > > > > > >(this);

                if (string.IsNullOrEmpty(filter.PaymentMethodID) == false)
                {
                    sel.WhereAnd <Where <CustomerPaymentMethod.paymentMethodID, Equal <Current <CCTransactionsHistoryFilter.paymentMethodID> > > >();
                }
                if (string.IsNullOrEmpty(filter.ProcessingCenterID) == false)
                {
                    sel.WhereAnd <Where <CCProcTran.processingCenterID, Equal <Current <CCTransactionsHistoryFilter.processingCenterID> > > >();
                }
                if (filter.StartDate.HasValue)
                {
                    sel.WhereAnd <Where <CCProcTran.startTime, GreaterEqual <Current <CCTransactionsHistoryFilter.startDate> > > >();
                }
                if (filter.EndDate.HasValue)
                {
                    sel.WhereAnd <Where <CCProcTran.startTime, LessEqual <Current <CCTransactionsHistoryFilter.endDatePlusOne> > > >();
                }

                if (filter.PMInstanceID.HasValue)
                {
                    sel.WhereAnd <Where <CustomerPaymentMethod.pMInstanceID, Equal <Current <CCTransactionsHistoryFilter.pMInstanceID> > > >();
                }

                foreach (PXResult <CCProcTran, CustomerPaymentMethod, Customer, ARPayment> it in sel.Select(CardNumber_DetailID, NameOnCard_DetailID))
                {
                    ARPayment  payment = it;
                    CCProcTran ccTran  = it;
                    if (ccTran.TranType == CCTranTypeCode.Credit || ccTran.TranType == CCTranTypeCode.VoidTran)
                    {
                        ARPayment voiding = PXSelect <ARPayment, Where <ARPayment.refNbr, Equal <Required <ARPayment.refNbr> >,
                                                                        And <ARPayment.docType, Equal <ARDocType.voidPayment> > > > .Select(this, payment.RefNbr);

                        if (voiding != null)
                        {
                            ((ARPayment)it).DocType  = ARDocType.VoidPayment;
                            ((CCProcTran)it).DocType = ARDocType.VoidPayment;
                        }
                    }
                    yield return(it);
                }
            }
            yield break;
        }
        public virtual IEnumerable paymentTrans()
        {
            CCPaymentFilter filter = this.Filter.Current;

            if (filter != null)
            {
                PXSelectBase <CCProcTran> qCpmExists = new PXSelectJoin <CCProcTran,
                                                                         InnerJoin <CustomerPaymentMethod, On <CustomerPaymentMethod.pMInstanceID, Equal <CCProcTran.pMInstanceID> >,
                                                                                    LeftJoin <ARRegister, On <CCProcTran.refNbr, Equal <ARRegister.refNbr>,
                                                                                                              And <CCProcTran.docType, Equal <ARRegister.docType> > >,
                                                                                              InnerJoin <Customer, On <Customer.bAccountID, Equal <CustomerPaymentMethod.bAccountID> > > > >,
                                                                         Where <CCProcTran.startTime, GreaterEqual <Required <CCPaymentFilter.beginDate> >,
                                                                                And <CCProcTran.startTime, LessEqual <Required <CCPaymentFilter.endDate> > > > >(this);

                PXSelectBase <CCProcTran> qCpmNotExists = new PXSelectJoin <CCProcTran,
                                                                            LeftJoin <CustomerPaymentMethod, On <CustomerPaymentMethod.pMInstanceID, Equal <CCProcTran.pMInstanceID> >,
                                                                                      InnerJoin <ARRegister, On <CCProcTran.refNbr, Equal <ARRegister.refNbr>,
                                                                                                                 And <CCProcTran.docType, Equal <ARRegister.docType> > >,
                                                                                                 InnerJoin <Customer, On <Customer.bAccountID, Equal <ARRegister.customerID> > > > >,
                                                                            Where <CCProcTran.startTime, GreaterEqual <Required <CCPaymentFilter.beginDate> >,
                                                                                   And <CCProcTran.startTime, LessEqual <Required <CCPaymentFilter.endDate> >,
                                                                                        And <CCProcTran.pMInstanceID, Equal <PaymentTranExtTypes.NewPaymentProfile> > > > >(this);

                ApplyFilters(qCpmExists);
                ApplyFilters(qCpmNotExists);

                if (filter.EndDate != null)
                {
                    var result = qCpmExists.Select(filter.BeginDate, filter.EndDate.Value.AddDays(1));
                    result.AddRange(qCpmNotExists.Select(filter.BeginDate, filter.EndDate.Value.AddDays(1)));
                    foreach (PXResult <CCProcTran, CustomerPaymentMethod, ARRegister, Customer> it in result)
                    {
                        ARRegister doc    = it;
                        CCProcTran ccTran = it;
                        if (ccTran.TranType == CCTranTypeCode.Credit || ccTran.TranType == CCTranTypeCode.VoidTran)
                        {
                            ARRegister voiding = PXSelect <ARRegister, Where <ARRegister.refNbr, Equal <Required <ARRegister.refNbr> >,
                                                                              And <ARRegister.docType, Equal <ARDocType.voidPayment> > > > .Select(this, doc.RefNbr);

                            if (voiding != null)
                            {
                                doc.DocType = ARDocType.VoidPayment;
                            }
                        }
                        yield return(it);
                    }
                }
            }
            yield break;
        }
Beispiel #3
0
        public static PXGraph FindSourceDocumentGraph(CCProcTran tran)
        {
            PXGraph target = null;

            if (tran != null)
            {
                if (tran.DocType == ARDocType.CashSale || tran.DocType == ARDocType.Payment)
                {
                    if (tran.DocType == ARDocType.Payment)
                    {
                        ARPaymentEntry graph = PXGraph.CreateInstance <ARPaymentEntry>();
                        graph.Document.Current = graph.Document.Search <ARPayment.refNbr>(tran.RefNbr, tran.DocType);
                        if (graph.Document.Current != null)
                        {
                            target = graph;
                        }
                    }
                    if (tran.DocType == ARDocType.Payment)
                    {
                        ARCashSaleEntry graph = PXGraph.CreateInstance <ARCashSaleEntry>();
                        graph.Document.Current = graph.Document.Search <PX.Objects.AR.Standalone.ARCashSale.refNbr>(tran.RefNbr, tran.DocType);
                        if (graph.Document.Current != null)
                        {
                            target = graph;
                        }
                    }
                }
                if (tran.DocType == ARDocType.Invoice)
                {
                    SO.SOInvoiceEntry graph = PXGraph.CreateInstance <SO.SOInvoiceEntry>();
                    graph.Document.Current = graph.Document.Search <ARInvoice.refNbr>(tran.RefNbr, tran.DocType);
                    if (graph.Document.Current != null)
                    {
                        target = graph;
                    }
                }
                if (target == null && !String.IsNullOrEmpty(tran.OrigRefNbr))
                {
                    SO.SOOrderEntry graph = PXGraph.CreateInstance <SO.SOOrderEntry>();
                    graph.Document.Current = graph.Document.Search <SO.SOOrder.orderNbr>(tran.OrigRefNbr, tran.OrigDocType);
                    if (graph.Document.Current != null)
                    {
                        target = graph;
                    }
                }
            }
            return(target);
        }
Beispiel #4
0
 public virtual IEnumerable viewExternalTransaction(PXAdapter adapter)
 {
     if (this.CCTrans.Current != null)
     {
         CCProcTran row = this.CCTrans.Current;
         ExternalTransactionMaint graph = PXGraph.CreateInstance <ExternalTransactionMaint>();
         graph.CurrentTransaction.Current = graph.CurrentTransaction.Search <ExternalTransaction.transactionID>(row.TransactionID);
         if (graph.CurrentTransaction.Current != null)
         {
             throw new PXRedirectRequiredException(graph, true, Messages.ViewExternalTransaction)
                   {
                       Mode = PXBaseRedirectException.WindowMode.NewWindow
                   };
         }
     }
     return(Filter.Select());
 }
Beispiel #5
0
        public virtual IEnumerable viewDocument(PXAdapter adapter)
        {
            CCProcTran tran = this.CCTrans.Current;

            if (tran != null)
            {
                PXGraph target = FindSourceDocumentGraph(tran.DocType, tran.RefNbr, tran.OrigDocType, tran.OrigRefNbr);
                if (target != null)
                {
                    throw new PXRedirectRequiredException(target, true, Messages.ViewDocument)
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          }
                }
                ;
            }
            return(adapter.Get());
        }
        public virtual IEnumerable ViewDocument(PXAdapter adapter)
        {
            CCProcTran tran = this.PaymentTrans.Current;

            if (tran != null)
            {
                PXGraph target = CCTransactionsHistoryEnq.FindSourceDocumentGraph(tran);
                if (target != null)
                {
                    throw new PXRedirectRequiredException(target, true, Messages.ViewDocument)
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          }
                }
                ;
            }
            return(Filter.Select());
        }
        public virtual IEnumerable ViewCreditCard(PXAdapter adapter)
        {
            if (this.PaymentTrans.Current != null)
            {
                CCProcTran            row        = this.PaymentTrans.Current;
                CustomerPaymentMethod pmInstance = PXSelect <CustomerPaymentMethod, Where <CustomerPaymentMethod.pMInstanceID, Equal <Required <CustomerPaymentMethod.pMInstanceID> > > > .Select(this, row.PMInstanceID);

                CustomerPaymentMethodMaint graph = PXGraph.CreateInstance <CustomerPaymentMethodMaint>();
                graph.CustomerPaymentMethod.Current = graph.CustomerPaymentMethod.Search <CustomerPaymentMethod.pMInstanceID>(pmInstance.PMInstanceID, pmInstance.BAccountID);
                if (graph.CustomerPaymentMethod.Current != null)
                {
                    throw new PXRedirectRequiredException(graph, true, Messages.ViewDocument)
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
            return(Filter.Select());
        }
        public virtual IEnumerable paymentTrans()
        {
            CCPaymentFilter filter = this.Filter.Current;

            if (filter != null)
            {
                PXSelectBase <CCProcTran> select = new PXSelectJoin <CCProcTran,
                                                                     InnerJoin <CustomerPaymentMethod, On <CustomerPaymentMethod.pMInstanceID, Equal <CCProcTran.pMInstanceID> >,
                                                                                InnerJoin <Customer, On <Customer.bAccountID, Equal <CustomerPaymentMethod.bAccountID> >,
                                                                                           LeftJoin <ARPayment, On <CCProcTran.refNbr, Equal <ARPayment.refNbr>,
                                                                                                                    And <CCProcTran.docType, Equal <ARPayment.docType> > >,
                                                                                                     //LeftJoin<Customer, On<ARPayment.customerID, Equal<Customer.bAccountID>>,
                                                                                                     LeftJoin <CCProcTranH, On <CCProcTranH.docType, Equal <CCProcTran.docType>,
                                                                                                                                And <CCProcTranH.refNbr, Equal <CCProcTran.refNbr>,
                                                                                                                                     And <CCProcTranH.tranNbr, Greater <CCProcTran.tranNbr> > > > > > > >,
                                                                     Where <CCProcTran.startTime, GreaterEqual <Required <CCPaymentFilter.beginDate> >,
                                                                            And <CCProcTran.startTime, LessEqual <Required <CCPaymentFilter.endDate> > > >,
                                                                     OrderBy <Desc <ARPayment.refNbr> > >(this);

                if (!string.IsNullOrEmpty(filter.ProcessingCenterID))
                {
                    select.WhereAnd <Where <CCProcTran.processingCenterID, Equal <Current <CCPaymentFilter.processingCenterID> > > >();
                }

                if (!string.IsNullOrEmpty(filter.CustomerClassID))
                {
                    select.WhereAnd <Where <Customer.customerClassID, Equal <Current <CCPaymentFilter.customerClassID> > > >();
                }

                if (filter.CustomerID.HasValue)
                {
                    select.WhereAnd <Where <Customer.bAccountID, Equal <Current <CCPaymentFilter.customerID> > > >();
                }

                if (filter.DisplayType == DisplayTypes.Failed)
                {
                    select.WhereAnd <Where <CCProcTranH.tranNbr, IsNull,
                                            And <Where <CCProcTran.tranStatus, NotEqual <CCTranStatusCode.approved>,
                                                        Or <CCProcTran.tranStatus, IsNull> > > > >();
                }
                if (filter.EndDate != null)
                {
                    foreach (PXResult <CCProcTran, CustomerPaymentMethod, Customer, ARPayment, CCProcTranH> it in select.Select(filter.BeginDate, filter.EndDate.Value.AddDays(1)))
                    {
                        ARPayment  payment = it;
                        CCProcTran ccTran  = it;
                        if (ccTran.TranType == CCTranTypeCode.Credit || ccTran.TranType == CCTranTypeCode.VoidTran)
                        {
                            ARPayment voiding = PXSelect <ARPayment, Where <ARPayment.refNbr, Equal <Required <ARPayment.refNbr> >,
                                                                            And <ARPayment.docType, Equal <ARDocType.voidPayment> > > > .Select(this, payment.RefNbr);

                            if (voiding != null)
                            {
                                ((ARPayment)it).DocType = ARDocType.VoidPayment;
                            }
                        }
                        yield return(it);
                    }
                }
            }
            yield break;
        }