예제 #1
0
        //@TODO SD-7694
        public static IEnumerable RouteRecordsDelegate(
            PXFilter <RouteAppointmentAssignmentFilter> filter,
            PXSelectBase <FSRouteDocument> cmd)
        {
            if (filter.Current == null)
            {
                yield break;
            }

            foreach (PXResult <FSRouteDocument, FSRoute> bqlResult in cmd.Select())
            {
                FSRouteDocument fsRouteDocumentRow = (FSRouteDocument)bqlResult;
                FSRoute         fsRouteRow         = (FSRoute)bqlResult;
                if (filter.Current.RouteDate.HasValue == true)
                {
                    if (!fsRouteDocumentRow.TimeBegin.HasValue)
                    {
                        fsRouteDocumentRow.TimeBegin = AppointmentCore.GetDateTimeEnd(fsRouteDocumentRow.Date, 0, 0, 0);
                    }

                    if (fsRouteDocumentRow.Date.Value.Date >= filter.Current.RouteDate.Value.Date &&
                        fsRouteDocumentRow.Date.Value.Date <= AppointmentCore.GetDateTimeEnd(filter.Current.RouteDate.Value.Date, 23, 59, 59))
                    {
                        yield return(bqlResult);
                    }
                }
                else
                {
                    yield return(bqlResult);
                }
            }
        }
예제 #2
0
        protected virtual LumDeadStockEnqResult GetRowByPrimaryKeys(PXSelectBase <INSiteStatus> command,
                                                                    LumDeadStockEnqFilter filter, DateTime?inStockSince, DateTime?noSalesSince)
        {
            if (PXView.MaximumRows == 1 && PXView.StartRow == 0 &&
                PXView.Searches?.Length == Result.Cache.Keys.Count &&
                PXView.SearchColumns.Select(sc => sc.Column)
                .SequenceEqual(Result.Cache.Keys, StringComparer.OrdinalIgnoreCase) &&
                PXView.Searches.All(k => k != null))
            {
                int startRow  = 0;
                int totalRows = 0;
                var rows      = command.View.Select(new object[] { filter },
                                                    PXView.Parameters, PXView.Searches, PXView.SortColumns, PXView.Descendings,
                                                    PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows);

                foreach (var row in rows)
                {
                    if (row is PXResult)
                    {
                        return(MakeResult(row as PXResult <INSiteStatus>, inStockSince, noSalesSince));
                    }

                    return(MakeResult(new PXResult <INSiteStatus>(row as INSiteStatus), inStockSince, noSalesSince));
                }
            }

            return(null);
        }
예제 #3
0
 protected virtual void AddSiteFilter(PXSelectBase <INSiteStatus> command, LumDeadStockEnqFilter filter)
 {
     if (filter.SiteID != null)
     {
         command.WhereAnd <Where <INSiteStatus.siteID.IsEqual <LumDeadStockEnqFilter.siteID.FromCurrent> > >();
     }
 }
예제 #4
0
        private IEnumerable getTemplates <TTemplate>(PXSelectBase <TTemplate> select)
            where TTemplate : CRFilterTemplate, new()
        {
            Hashtable hashTable = new Hashtable();

            foreach (TTemplate item in select.Cache.Updated)
            {
                hashTable.Add(item.FilterTemplateID, item);
                yield return(item);
            }
            foreach (TTemplate item in select.Cache.Inserted)
            {
                hashTable.Add(item.FilterTemplateID, item);
                yield return(item);
            }
            PXView view = new PXView(this, true, select.View.BqlSelect);

            foreach (TTemplate item in view.SelectMulti(graphTypeName, PXAccess.GetUserID()))
            {
                if (!hashTable.Contains(item.FilterTemplateID))
                {
                    yield return(item);
                }
            }
            if (hashTable.Count < 1)
            {
                select.Cache.IsDirty = false;
            }
        }
예제 #5
0
        public static IEnumerable SkillFilterDelegate <ServiceDetType>(
            PXGraph graph,
            PXSelectBase <ServiceDetType> servicesView,
            PXFilter <StaffSelectionFilter> filter,
            PXSelectBase <SkillGridFilter> skillView)
            where ServiceDetType : class, IBqlTable, IFSSODetBase, new()
        {
            List <int?> serviceIDList      = new List <int?>();
            List <int?> serviceIDCheckList = new List <int?>();

            IEnumerable <SkillGridFilter> skillRecords = skillView.Cache.Cached.Cast <SkillGridFilter>();
            bool initSkillFilter = skillRecords.Count() == 0;

            if (initSkillFilter)
            {
                serviceIDList      = ServiceSelectionHelper.GetServicesInServiceTab <ServiceDetType>(servicesView, null);
                serviceIDCheckList = ServiceSelectionHelper.GetServicesInServiceTab <ServiceDetType>(servicesView, filter.Current.ServiceLineRef);
            }

            foreach (SkillGridFilter skillRow in PXSelect <SkillGridFilter> .Select(graph))
            {
                if (initSkillFilter)
                {
                    skillRow.Mem_ServicesList = SkillGridFilter.GetServiceListField(graph, serviceIDList, skillRow.SkillID);
                    string serviceList = SkillGridFilter.GetServiceListField(graph, serviceIDCheckList, skillRow.SkillID);

                    skillRow.Mem_Selected = string.IsNullOrEmpty(serviceList) == false;
                }

                skillView.Cache.SetStatus(skillRow, PXEntryStatus.Held);
                skillView.Cache.IsDirty = false;

                yield return(skillRow);
            }
        }
        public static void CreditCCPayment <TNode>(TNode doc, string aPCRefTranNbr, PXSelectBase <CCProcTran> ccProcTran, bool doRelease, ReleaseDelegate CustomPreReleaseDelegate)
            where TNode : ARRegister, IBqlTable, ICCPayment, new()
        {
            ReleaseDelegate combinedReleaseDelegate = doRelease ? CustomPreReleaseDelegate + ReleaseARDocument : CustomPreReleaseDelegate;

            CreditCCPayment <TNode>(doc, aPCRefTranNbr, ccProcTran, combinedReleaseDelegate, null);
        }
예제 #7
0
        public static IEnumerable LicenseTypeFilterDelegate <ServiceDetType>(
            PXGraph graph,
            PXSelectBase <ServiceDetType> servicesView,
            PXFilter <StaffSelectionFilter> filter,
            PXSelectBase <LicenseTypeGridFilter> licenseTypeView)
            where ServiceDetType : class, IBqlTable, IFSSODetBase, new()
        {
            List <int?> serviceIDList = new List <int?>();

            IEnumerable <LicenseTypeGridFilter> licenseTypeRecords = licenseTypeView.Cache.Cached.Cast <LicenseTypeGridFilter>();
            bool initLicenseTypeFilter = licenseTypeRecords.Count() == 0;

            if (initLicenseTypeFilter)
            {
                serviceIDList = ServiceSelectionHelper.GetServicesInServiceTab <ServiceDetType>(servicesView, filter.Current.ServiceLineRef);
            }

            foreach (LicenseTypeGridFilter licenseTypeRow in PXSelect <LicenseTypeGridFilter> .Select(graph))
            {
                if (initLicenseTypeFilter)
                {
                    licenseTypeRow.Mem_FromService = LicenseTypeGridFilter.IsThisLicenseTypeRequiredByAnyService(graph, licenseTypeRow.LicenseTypeID, serviceIDList);
                    licenseTypeRow.Mem_Selected    = licenseTypeRow.Mem_FromService == true;
                }

                licenseTypeView.Cache.SetStatus(licenseTypeRow, PXEntryStatus.Held);
                licenseTypeView.Cache.IsDirty = false;

                yield return(licenseTypeRow);
            }
        }
        public static void VoidCCPayment <TNode>(TNode doc, PXSelectBase <CCProcTran> ccProcTran, bool doRelease, ReleaseDelegate CustomPreReleaseDelegate)
            where TNode : ARRegister, ICCPayment, new()
        {
            ReleaseDelegate combinedReleaseDelegate = doRelease ? CustomPreReleaseDelegate + ReleaseARDocument : CustomPreReleaseDelegate;

            VoidCCPayment <TNode>(doc, ccProcTran, combinedReleaseDelegate, null);
        }
 public void GetCreatePaymentProfileForm <TPaymentMethodType>(PXGraph graph,
                                                              PXSelectBase <TPaymentMethodType> customerPaymentMethodView,
                                                              TPaymentMethodType currentCustomerPaymentMethod)
     where TPaymentMethodType : CustomerPaymentMethod, new()
 {
     CCCustomerInformationManager.GetCreatePaymentProfileForm(graph, customerPaymentMethodView, currentCustomerPaymentMethod);
 }
        public static void AuthorizeCCPayment <TNode>(TNode doc, PXSelectBase <CCProcTran> ccProcTran, UpdateDocStateDelegate aDocStateUpdater)
            where TNode : class, IBqlTable, ICCPayment, new()
        {
            if (doc != null && doc.PMInstanceID != null && doc.CuryDocBal != null)
            {
                if (CCPaymentEntry.HasOpenCCTran(ccProcTran))
                {
                    throw new PXException(Messages.ERR_CCTransactionCurrentlyInProgress);
                }

                CCPaymentState paymentState = CCPaymentEntry.ResolveCCPaymentState(ccProcTran.Select());
                if ((paymentState & (CCPaymentState.Captured | CCPaymentState.PreAuthorized)) > 0)
                {
                    throw new PXException(Messages.ERR_CCPaymentAlreadyAuthorized);
                }

                ccProcTran.View.Graph.Actions.PressSave();

                TNode toProc = PXCache <TNode> .CreateCopy(doc);

                PXLongOperation.StartOperation(ccProcTran.View.Graph, delegate() {
                    try
                    {
                        CCPaymentEntry.ProcessCCTransaction(toProc, null, CCTranType.AuthorizeOnly);
                    }
                    finally
                    {
                        if (aDocStateUpdater != null)
                        {
                            aDocStateUpdater(doc, CCTranType.AuthorizeOnly);
                        }
                    }
                });
            }
        }
예제 #11
0
        private void ApplyFilters(PXSelectBase <CCProcTran> query)
        {
            CCPaymentFilter filter = this.Filter.Current;

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

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

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

            if (filter.DisplayType == DisplayTypes.Failed)
            {
                query.Join <LeftJoin <CCProcTranH, On <CCProcTranH.docType, Equal <CCProcTran.docType>,
                                                       And <CCProcTranH.refNbr, Equal <CCProcTran.refNbr>,
                                                            And <CCProcTranH.tranNbr, Greater <CCProcTran.tranNbr> > > > > >();
                query.WhereAnd <Where <CCProcTranH.tranNbr, IsNull,
                                       And <Where <CCProcTran.tranStatus, NotEqual <CCTranStatusCode.approved>,
                                                   Or <CCProcTran.tranStatus, IsNull> > > > >();
            }
        }
 private void ValidateUsage(object row, PXSelectBase select, string message)
 {
     if (select.View.SelectSingleBound(new object[] { row }) != null)
     {
         throw new PXException(message);
     }
 }
예제 #13
0
 public PayBillAmountsToPayValidator(APInvoiceEntry graph,
                                     PXSelectBase <JointPayeePayment> jointPayeePaymentsView, PXSelectBase <JointPayee> jointPayeesView)
 {
     this.graph = graph;
     this.jointPayeePaymentsView = jointPayeePaymentsView;
     this.jointPayeesView        = jointPayeesView;
 }
        public static void SyncDeletePMI(PXGraph graph, PXSelectBase <CustomerPaymentMethod> customerPaymentMethodView, PXSelectBase <CustomerPaymentMethodDetail> detailsView)
        {
            IEnumerator cpmEnumerator = customerPaymentMethodView.Cache.Deleted.GetEnumerator();

            if (cpmEnumerator.MoveNext())
            {
                CustomerPaymentMethod current          = (CustomerPaymentMethod)cpmEnumerator.Current;
                CCProcessingCenter    processingCenter = CCProcessingUtils.getProcessingCenter(graph, current.CCProcessingCenterID);
                if (!string.IsNullOrEmpty(current.CCProcessingCenterID) && processingCenter.SyncronizeDeletion == true)
                {
                    CCCustomerInformationManager cim = new CCCustomerInformationManager(current.CCProcessingCenterID, CCProcessingFeature.Tokenization,
                                                                                        new ProcessingContext()
                    {
                        aCustomerID = current.BAccountID, aPMInstanceID = current.PMInstanceID
                    });
                    CustomerPaymentMethodDetail ccpidCPMDet = null;
                    PaymentMethodDetail         ccpidPMDet  = PXSelect <PaymentMethodDetail,
                                                                        Where <PaymentMethodDetail.paymentMethodID, Equal <Optional <CustomerPaymentMethod.paymentMethodID> >,
                                                                               And <PaymentMethodDetail.useFor, Equal <PaymentMethodDetailUsage.useForARCards>, And <PaymentMethodDetail.isCCProcessingID, Equal <True> > > > > .Select(graph, current.PaymentMethodID);

                    foreach (CustomerPaymentMethodDetail deletedDet in detailsView.Cache.Deleted)
                    {
                        if (deletedDet.DetailID == ccpidPMDet.DetailID)
                        {
                            ccpidCPMDet = deletedDet;
                            break;
                        }
                    }
                    if (ccpidCPMDet != null && !string.IsNullOrEmpty(ccpidCPMDet.Value))
                    {
                        cim.DeletePaymentMethod();
                    }
                }
            }
        }
예제 #15
0
            private Dictionary <string, PXResult <Tax, TaxRev> > GetTaxRevisionList(PXGraph aGraph, DateTime aDocDate)
            {
                PXSelectBase <Tax> taxRevSelect = null;

                if (_aSalesOrPurchaseSwitch)
                {
                    taxRevSelect = new PXSelectReadonly2 <Tax,
                                                          InnerJoin <TaxRev, On <TaxRev.taxID, Equal <Tax.taxID>,
                                                                                 And <TaxRev.outdated, Equal <False>,
                                                                                      And <TaxRev.taxType, Equal <TaxType.sales>,
                                                                                           And <Tax.taxType, NotEqual <CSTaxType.withholding>,
                                                                                                And <Tax.taxType, NotEqual <CSTaxType.use>,
                                                                                                     And <Tax.reverseTax, Equal <False>,
                                                                                                          And <Tax.directTax, Equal <False>,
                                                                                                               And <Current <GLTranDoc.tranDate>, Between <TaxRev.startDate, TaxRev.endDate> > > > > > > > > > >(aGraph);
                }
                else
                {
                    taxRevSelect = new PXSelectReadonly2 <Tax,
                                                          InnerJoin <TaxRev, On <TaxRev.taxID, Equal <Tax.taxID>,
                                                                                 And <TaxRev.outdated, Equal <False>,
                                                                                      And <Tax.directTax, Equal <False>,
                                                                                           And2 <Where <TaxRev.taxType, Equal <TaxType.purchase>, And <Tax.reverseTax, Equal <False>,
                                                                                                                                                       Or <TaxRev.taxType, Equal <TaxType.sales>, And <Where <Tax.reverseTax, Equal <True>,
                                                                                                                                                                                                              Or <Tax.taxType, Equal <CSTaxType.use>, Or <Tax.taxType, Equal <CSTaxType.withholding> > > > > > > >,
                                                                                                 And <Required <TaxRev.startDate>, Between <TaxRev.startDate, TaxRev.endDate> > > > > > > >(aGraph);
                }

                Dictionary <string, PXResult <Tax, TaxRev> > tail = new Dictionary <string, PXResult <Tax, TaxRev> >();

                foreach (PXResult <Tax, TaxRev> record in taxRevSelect.Select(aDocDate))
                {
                    tail[((Tax)record).TaxID] = record;
                    Tax tax = record;
                    if (tax.TaxCalcType == CSTaxCalcType.Item)
                    {
                        switch (_enforcing)
                        {
                        case TaxCalcLevelEnforcing.EnforceCalcOnItemAmount:
                            if (tax.TaxCalcLevel == CSTaxCalcLevel.Inclusive)
                            {
                                tax.TaxCalcLevel = CSTaxCalcLevel.CalcOnItemAmt;
                            }
                            break;

                        case TaxCalcLevelEnforcing.EnforceInclusive:
                            if (tax.TaxCalcLevel == CSTaxCalcLevel.CalcOnItemAmt)
                            {
                                tax.TaxCalcLevel = CSTaxCalcLevel.Inclusive;
                            }
                            break;

                        case TaxCalcLevelEnforcing.None:
                            break;
                        }
                    }
                }
                return(tail);
            }
        private static bool IsNumberingInUse(PXSelectBase setupSelect, string numberingType,
                                             Numbering numbering)
        {
            var setup = setupSelect.View.SelectSingle(numbering.NumberingID);

            return(setup != null && (string)setupSelect.Cache.GetValue(setup, numberingType) ==
                   numbering.NumberingID);
        }
 public void GetOrCreatePaymentProfile <TPaymentMethodType, TDetialsType>(PXGraph graph
                                                                          , PXSelectBase <TPaymentMethodType> customerPaymentMethodView
                                                                          , PXSelectBase <TDetialsType> detailsView)
     where TPaymentMethodType : CustomerPaymentMethod, new()
     where TDetialsType : CustomerPaymentMethodDetail, new()
 {
     CCCustomerInformationManager.GetOrCreatePaymentProfile(graph, customerPaymentMethodView, detailsView);
 }
예제 #18
0
 protected virtual void AddItemClassFilter(PXSelectBase <INSiteStatus> command, LumDeadStockEnqFilter filter)
 {
     if (filter.ItemClassID != null)
     {
         command.WhereAnd <Where <InventoryItem.itemClassID.
                                  IsEqual <LumDeadStockEnqFilter.itemClassID.FromCurrent> > >();
     }
 }
 public CommonAttributeColumnCreator(PXGraph graph,
                                     PXSelectBase <CSAttributeGroup> attributeGroups)
 {
     this.graph           = graph;
     this.attributeGroups = attributeGroups;
     entityHelper         = new EntityHelper(graph);
     answers = new PXSelect <CSAnswers>(graph);
 }
        public virtual IEnumerable cards()
        {
            ARExpiringCardFilter filter = this.Filter.Current;

            if (filter != null)
            {
                PXSelectBase <CustomerPaymentMethod> select = null;
                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 <CustomerPaymentMethod.bAccountID>,
                                                                                And <Where2 <Where <CustomerPaymentMethod.billContactID, IsNull,
                                                                                                    And <CR.Contact.contactID, Equal <Customer.defBillContactID> > >,
                                                                                             Or <Where <CustomerPaymentMethod.billContactID, IsNotNull,
                                                                                                        And <CustomerPaymentMethod.billContactID, Equal <CR.Contact.contactID> > > > > > > > >,
                                           Where <CustomerPaymentMethod.expirationDate, GreaterEqual <Required <CustomerPaymentMethod.expirationDate> >,
                                                  And <CustomerPaymentMethod.expirationDate, LessEqual <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> > >();
                }
                if ((bool)filter.ActiveOnly)
                {
                    select.WhereAnd <Where <CustomerPaymentMethod.isActive, Equal <BQLConstants.BitOn> > >();
                }
                foreach (PXResult <CustomerPaymentMethod, Customer, Contact> it in select.Select(filter.BeginDate, filter.EndDate, filter.CustomerClassID, filter.ActiveOnly))
                {
                    CustomerPaymentMethod cpm = (CustomerPaymentMethod)it;
                    if (cpm.LastNotificationDate.HasValue && cpm.ExpirationDate.HasValue)
                    {
                        TimeSpan diff = cpm.ExpirationDate.Value - cpm.LastNotificationDate.Value;
                        if (diff.TotalDays > 0)
                        {
                            if (diff.TotalDays < filter.NoteLeftLimit)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            if (Math.Abs(diff.TotalDays) < filter.NoteRightLimit)
                            {
                                continue;
                            }
                        }
                    }

                    yield return(it);
                }
            }
            yield break;
        }
예제 #21
0
        public static void VoidCCPayment <TNode>(TNode doc,
                                                 PXSelectBase <CCProcTran> ccProcTran,
                                                 CCPaymentEntry.ReleaseDelegate aReleaseDelegate,
                                                 UpdateDocStateDelegate aDocStateUpdater,
                                                 ICCTransactionsProcessor processor = null)
            where TNode : class, IBqlTable, ICCPayment, new()
        {
            if (processor == null)
            {
                processor = CCTransactionsProcessor.GetCCTransactionsProcessor();
            }
            if (doc != null && doc.PMInstanceID != null && doc.CuryDocBal != null)
            {
                if (CCProcTranHelper.HasOpenCCTran(ccProcTran))
                {
                    throw new PXException(Messages.ERR_CCTransactionCurrentlyInProgress);
                }

                CCProcTran toVoid = CCProcTranHelper.FindCCLastSuccessfulTran(ccProcTran);
                if (toVoid == null)
                {
                    throw new PXException(Messages.ERR_CCNoTransactionToVoid);
                }
                else if (toVoid.TranType == CCTranTypeCode.VoidTran || toVoid.TranType == CCTranTypeCode.Credit)
                {
                    throw new PXException(Messages.ERR_CCTransactionOfThisTypeInvalidToVoid);
                }

                if (CCProcTranHelper.IsExpired(toVoid))
                {
                    throw new PXException(Messages.TransactionHasExpired);
                }
                if (doc.Released == false)
                {
                    ccProcTran.View.Graph.Actions.PressSave();
                }
                TNode toProc = PXCache <TNode> .CreateCopy(doc);

                PXLongOperation.StartOperation(ccProcTran.View.Graph, delegate()
                {
                    try
                    {
                        processor.ProcessCCTransaction(toProc, toVoid, CCTranType.VoidOrCredit);
                    }
                    finally
                    {
                        if (aDocStateUpdater != null)
                        {
                            aDocStateUpdater(doc, CCTranType.VoidOrCredit);
                        }
                    }
                    if (aReleaseDelegate != null)
                    {
                        aReleaseDelegate(toProc);
                    }
                });
            }
        }
예제 #22
0
        public static void GetCreatePaymentProfileForm <TPaymentMethodType>(PXGraph graph,
                                                                            PXSelectBase <TPaymentMethodType> customerPaymentMethodView,
                                                                            TPaymentMethodType currentCustomerPaymentMethod)
            where TPaymentMethodType : CustomerPaymentMethod, new()
        {
            GenericCustomerPaymentMethodAdaper <TPaymentMethodType> adapter = new GenericCustomerPaymentMethodAdaper <TPaymentMethodType>(customerPaymentMethodView);

            GetCreatePaymentProfileForm(graph, adapter);
        }
예제 #23
0
        private void InitRulesHandlres(PXSelectBase select)
        {
            Type cacheType = select.Cache.GetItemType();

            this.FieldSelecting.AddHandler(cacheType, typeof(CRValidationRules.matchingField).Name, (sender, e) => CreateFieldStateForFieldName(e.ReturnState, typeof(Contact)));
            this.RowInserted.AddHandler(cacheType, (sender, e) => UpdateGrammValidationDate());
            this.RowUpdated.AddHandler(cacheType, (sender, e) => UpdateGrammValidationDate());
            this.RowDeleted.AddHandler(cacheType, (sender, e) => UpdateGrammValidationDate());
        }
 public ComplianceDocumentService(PXGraph graph, PXSelectBase <CSAttributeGroup> attributeGroups,
                                  PXSelectBase <ComplianceDocument> complianceDocuments,
                                  string complianceDocumentsViewName)
 {
     this.graph = graph;
     this.complianceDocuments         = complianceDocuments;
     this.complianceDocumentsViewName = complianceDocumentsViewName;
     columnCreator = new CommonAttributeColumnCreator(graph, attributeGroups);
 }
예제 #25
0
        public void Prefetch()
        {
            var tempGraph = PXGraph.CreateInstance <PXGraph>();

            PXSelectBase <Table> select = CreateSelect(tempGraph);

            using (new PXFieldScope(select.View, typeof(KeyField)))
                RecordExists = ((Table)select.SelectSingle()) != null;
        }
 public void GetNewPaymentProfiles <TPaymentMethodType, TDetialsType>(PXGraph graph,
                                                                      PXSelectBase <TPaymentMethodType> customerPaymentMethodView,
                                                                      PXSelectBase <TDetialsType> detailsView,
                                                                      TPaymentMethodType currentCustomerPaymentMethod)
     where TPaymentMethodType : CustomerPaymentMethod, new()
     where TDetialsType : CustomerPaymentMethodDetail, new()
 {
     CCCustomerInformationManager.GetNewPaymentProfiles(graph, customerPaymentMethodView, detailsView, currentCustomerPaymentMethod);
 }
        public static CCProcTran findCapturing(PXSelectBase <CCProcTran> ccProcTran)
        {
            List <CCProcTran> authTrans = new List <CCProcTran>(1);
            List <CCProcTran> result    = new List <CCProcTran>(1);

            foreach (CCProcTran iTran in ccProcTran.Select())
            {
                if (iTran.ProcStatus != CCProcStatus.Finalized)
                {
                    continue;
                }
                if ((
                        iTran.TranType == CCTranTypeCode.PriorAuthorizedCapture ||
                        iTran.TranType == CCTranTypeCode.AuthorizeAndCapture ||
                        iTran.TranType == CCTranTypeCode.CaptureOnly
                        ) &&
                    iTran.TranStatus == CCTranStatusCode.Approved)
                {
                    authTrans.Add(iTran);
                }
            }
            foreach (CCProcTran it in authTrans)
            {
                bool cancelled = false;
                foreach (CCProcTran iTran in ccProcTran.Select())
                {
                    if (iTran.ProcStatus != CCProcStatus.Finalized)
                    {
                        continue;
                    }
                    if (iTran.RefTranNbr == it.TranNbr && iTran.TranStatus == CCTranStatusCode.Approved)
                    {
                        if (iTran.TranType == CCTranTypeCode.Credit ||
                            iTran.TranType == CCTranTypeCode.VoidTran)
                        {
                            cancelled = true;
                            break;
                        }
                    }
                }
                if (!cancelled)
                {
                    result.Add(it);
                }
            }
            if (result.Count > 0)
            {
                result.Sort(new CCProcTranOrderComparer(true)                 /*Comparison<CCProcTran>(delegate(CCProcTran a, CCProcTran b)
                                                                               * {
                                                                               * return a.EndTime.Value.CompareTo(b.EndTime.Value);
                                                                               * }
                                                                               * )*/
                            );
                return(result[0]);
            }
            return(null);
        }
        protected KCBasicBulkStrategy(KCBulkProductMaint graph)
        {
            Graph = graph;

            ProductsForUpdate = new PXSelectJoin <InventoryItem,
                                                  LeftJoin <KNSIKCInventoryItem, On <InventoryItem.inventoryID, Equal <KNSIKCInventoryItem.inventoryID> > >,
                                                  Where <KNSIKCInventoryItem.usrKCActiveOnCa, Equal <True> > >(graph);
            SiteMaster = Graph.SiteMaster.SelectSingle();
        }
예제 #29
0
        public static void CaptureCCPayment <TNode>(TNode doc, PXSelectBase <CCProcTran> ccProcTran,
                                                    CCPaymentEntry.ReleaseDelegate aReleaseDelegate,
                                                    UpdateDocStateDelegate aDocStateUpdater,
                                                    ICCTransactionsProcessor processor = null)
            where TNode : class, IBqlTable, ICCPayment, new()
        {
            if (processor == null)
            {
                processor = CCTransactionsProcessor.GetCCTransactionsProcessor();
            }
            if (doc != null && doc.PMInstanceID != null && doc.CuryDocBal != null)
            {
                if (CCProcTranHelper.HasOpenCCTran(ccProcTran))
                {
                    throw new PXException(Messages.ERR_CCTransactionCurrentlyInProgress);
                }

                CCPaymentState paymentState = CCProcTranHelper.ResolveCCPaymentState(ccProcTran.Select());
                if ((paymentState & (CCPaymentState.Captured)) > 0)
                {
                    throw new PXException(Messages.ERR_CCAuthorizedPaymentAlreadyCaptured);
                }
                if (doc.Released == false)
                {
                    ccProcTran.View.Graph.Actions.PressSave();
                }
                CCProcTran authTran = CCProcTranHelper.FindCCPreAthorizing(ccProcTran.Select());
                TNode      toProc   = PXCache <TNode> .CreateCopy(doc);

                CCProcTran authTranCopy = null;
                if (authTran != null && !CCProcTranHelper.IsExpired(authTran))
                {
                    authTranCopy = PXCache <CCProcTran> .CreateCopy(authTran);
                }
                CCTranType operation = (authTranCopy) != null ? CCTranType.PriorAuthorizedCapture : CCTranType.AuthorizeAndCapture;
                PXLongOperation.StartOperation(ccProcTran.View.Graph, delegate()
                {
                    try
                    {
                        processor.ProcessCCTransaction(toProc, authTranCopy, operation);
                    }
                    finally
                    {
                        //Update doc state in any case
                        if (aDocStateUpdater != null)
                        {
                            aDocStateUpdater(doc, operation);
                        }
                    }
                    if (aReleaseDelegate != null)
                    {
                        aReleaseDelegate(toProc);                               //On Success Only
                    }
                });
            }
        }
        public static bool HasSuccessfulCCTrans(PXSelectBase <CCProcTran> ccProcTran)
        {
            CCProcTran lastSTran = findCCLastSuccessfulTran(ccProcTran);

            if (lastSTran != null && !IsExpired(lastSTran))
            {
                return(true);
            }
            return(false);
        }