public virtual IEnumerable cards()
        {
            ARExpiredCardFilter filter = this.Filter.Current;

            if (filter != null)
            {
                PXSelectBase <CustomerPaymentMethod> select = new PXSelectJoin <CustomerPaymentMethod,
                                                                                InnerJoin <Customer, On <Customer.bAccountID, Equal <CustomerPaymentMethod.bAccountID>,
                                                                                                         And <Customer.status, NotEqual <Customer.status.inactive> > >,
                                                                                           LeftJoin <CR.Contact, On <CR.Contact.bAccountID, Equal <Customer.bAccountID>,
                                                                                                                     And <CR.Contact.contactID, Equal <Customer.defBillContactID> > > > >,
                                                                                Where <CustomerPaymentMethod.isActive, Equal <boolTrue>,
                                                                                       And <CustomerPaymentMethod.expirationDate, LessEqual <Required <CustomerPaymentMethod.expirationDate> >,
                                                                                            And <CustomerPaymentMethod.expirationDate, GreaterEqual <Required <CustomerPaymentMethod.expirationDate> > > > > >(this);

                if (!string.IsNullOrEmpty(filter.CustomerClassID))
                {
                    select.WhereAnd <Where <Customer.customerClassID, Equal <Required <Customer.customerClassID> > > >();
                }
                if (filter.DefaultOnly == true)
                {
                    select.WhereAnd <Where <CustomerPaymentMethod.pMInstanceID, Equal <Customer.defPMInstanceID> > >();
                }
                //Dates are inverted - end is less then begin
                foreach (PXResult <CustomerPaymentMethod, Customer, Contact> it in select.Select(filter.BeginDate, filter.EndDate, filter.CustomerClassID))
                {
                    CustomerPaymentMethod cpm = (CustomerPaymentMethod)it;
                    if (filter.NotificationSendOnly == true)
                    {
                        if (cpm.LastNotificationDate.HasValue)
                        {
                            if (cpm.ExpirationDate.HasValue)
                            {
                                TimeSpan diff = cpm.ExpirationDate.Value - cpm.LastNotificationDate.Value;
                                if (diff.TotalDays > 0)
                                {
                                    if (diff.TotalDays > 60)
                                    {
                                        continue;
                                    }
                                }
                                else
                                {
                                    if (Math.Abs(diff.TotalDays) > 180)
                                    {
                                        continue;
                                    }
                                }
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    yield return(it);
                }
            }
            yield break;
        }
        public virtual IEnumerable cards()
        {
            ARExpiredCardFilter filter = this.Filter.Current;

            if (filter != null)
            {
                PXSelectBase <CustomerPaymentMethod> select = new PXSelectJoin <CustomerPaymentMethod,
                                                                                InnerJoin <Customer, On <Customer.bAccountID, Equal <CustomerPaymentMethod.bAccountID>,
                                                                                                         And <Customer.status, NotEqual <BAccount.status.inactive> > >,
                                                                                           LeftJoin <CR.Contact, On <CR.Contact.bAccountID, Equal <Customer.bAccountID>,
                                                                                                                     And <CR.Contact.contactID, Equal <Customer.defBillContactID> > > > >,
                                                                                Where <CustomerPaymentMethod.isActive, Equal <True>,
                                                                                       And <CustomerPaymentMethod.expirationDate, LessEqual <Required <CustomerPaymentMethod.expirationDate> >,
                                                                                            And <CustomerPaymentMethod.expirationDate, GreaterEqual <Required <CustomerPaymentMethod.expirationDate> > > > > >(this);

                if (!string.IsNullOrEmpty(filter.CustomerClassID))
                {
                    select.WhereAnd <Where <Customer.customerClassID, Equal <Required <Customer.customerClassID> > > >();
                }
                if (filter.DefaultOnly == true)
                {
                    select.WhereAnd <Where <CustomerPaymentMethod.pMInstanceID, Equal <Customer.defPMInstanceID> > >();
                }

                foreach (PXResult <CustomerPaymentMethod, Customer, Contact> it in select.Select(filter.BeginDate, filter.EndDate, filter.CustomerClassID))
                {
                    CustomerPaymentMethod cpm = (CustomerPaymentMethod)it;

                    if (filter.NotificationSendOnly.GetValueOrDefault() == true && !cpm.LastNotificationDate.HasValue)
                    {
                        continue;
                    }
                    yield return(it);
                }
            }
            yield break;
        }
        public virtual void ARExpiredCardFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            ARExpiredCardFilter row = e.Row as ARExpiredCardFilter;

            if (row == null)
            {
                return;
            }
            PXUIFieldAttribute.SetEnabled <CustomerPaymentMethod.selected>(this.Cards.Cache, null, true);
            if (row.TokenizedPMs == null)
            {
                string pmString = CCProcessingHelper.GetTokenizedPMsString(this);
                sender.SetValue <ARExpiredCardFilter.tokenizedPMs>(row, pmString);
            }
            else
            {
                if (row.TokenizedPMs != String.Empty)
                {
                    Filter.Cache.RaiseExceptionHandling <ARExpiredCardFilter.customerClassID>(e.Row, ((ARExpiredCardFilter)e.Row).CustomerClassID,
                                                                                              new PXSetPropertyException(Messages.NotAllCardsShown,
                                                                                                                         PXErrorLevel.Warning, row.TokenizedPMs));
                }
            }
        }