Example #1
0
        public CRLeadContactValidationProcess()
        {
            Actions["Process"].SetVisible(false);
            Actions.Move("Process", "Cancel");
            var setup = Setup.Current;

            PXUIFieldAttribute.SetDisplayName <Contact.displayName>(this.Caches[typeof(Contact)], Messages.Contact);
            PXUIFieldAttribute.SetDisplayName <Contact2.displayName>(this.Caches[typeof(Contact2)], Messages.PossibleDuplicated);

            bool LeadValidationThresholdWrongValue          = Setup.Current.LeadValidationThreshold == null || Setup.Current.LeadValidationThreshold <= 0;
            bool LeadToAccountValidationThresholdWrongValue = Setup.Current.LeadToAccountValidationThreshold == null || Setup.Current.LeadToAccountValidationThreshold <= 0;
            bool CloseLeadsWithoutActivitiesScoreWrongValue = Setup.Current.CloseLeadsWithoutActivitiesScore == null || Setup.Current.CloseLeadsWithoutActivitiesScore <= 0;

            if (LeadValidationThresholdWrongValue || LeadToAccountValidationThresholdWrongValue || CloseLeadsWithoutActivitiesScoreWrongValue)
            {
                string message = String.Empty;

                if (LeadValidationThresholdWrongValue)
                {
                    message += "'" + PXUIFieldAttribute.GetDisplayName <CRSetup.leadValidationThreshold>(Setup.Cache) + "' ";
                }
                if (LeadToAccountValidationThresholdWrongValue)
                {
                    message += "'" + PXUIFieldAttribute.GetDisplayName <CRSetup.leadToAccountValidationThreshold>(Setup.Cache) + "' ";
                }
                if (CloseLeadsWithoutActivitiesScoreWrongValue)
                {
                    message += "'" + PXUIFieldAttribute.GetDisplayName <CRSetup.closeLeadsWithoutActivitiesScore>(Setup.Cache) + "' ";
                }

                throw new PXSetupNotEnteredException(Messages.CRSetupFieldsAreEmpty, typeof(CRSetup), typeof(CRSetup).Name, message);
            }

            var rules = PXSelect <CRValidationRules> .Select(this);

            if (rules == null || rules.Count == 0)
            {
                throw new PXSetupNotEnteredException(Messages.DuplicateValidationRulesAreEmpty, typeof(CRSetup), typeof(CRSetup).Name);
            }

            Contacts.ParallelProcessingOptions =
                settings =>
            {
                settings.IsEnabled = true;
            };
        }
        protected void RMReport_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del)
        {
            if (e.Row == null)
            {
                return;
            }

            PXUIFieldAttribute.SetVisible <RMReportPM.requestStartAccountGroup>(sender, e.Row, ((RMReport)e.Row).Type == RMType.PM);
            PXUIFieldAttribute.SetVisible <RMReportPM.requestEndAccountGroup>(sender, e.Row, ((RMReport)e.Row).Type == RMType.PM);
            PXUIFieldAttribute.SetVisible <RMReportPM.requestStartProject>(sender, e.Row, ((RMReport)e.Row).Type == RMType.PM);
            PXUIFieldAttribute.SetVisible <RMReportPM.requestEndProject>(sender, e.Row, ((RMReport)e.Row).Type == RMType.PM);
            PXUIFieldAttribute.SetVisible <RMReportPM.requestStartProjectTask>(sender, e.Row, ((RMReport)e.Row).Type == RMType.PM);
            PXUIFieldAttribute.SetVisible <RMReportPM.requestEndProjectTask>(sender, e.Row, ((RMReport)e.Row).Type == RMType.PM);
            PXUIFieldAttribute.SetVisible <RMReportPM.requestStartInventory>(sender, e.Row, ((RMReport)e.Row).Type == RMType.PM);
            PXUIFieldAttribute.SetVisible <RMReportPM.requestEndInventory>(sender, e.Row, ((RMReport)e.Row).Type == RMType.PM);
            del(sender, e);
        }
        public ARDunningLetterPrint()
        {
            ARSetup setup = ARSetup.Current;

            Consolidated = setup.ConsolidatedDunningLetter.GetValueOrDefault(false);
            if (setup.AutoReleaseDunningLetter == true)
            {
                PXDefaultAttribute.SetDefault <PrintParameters.action>(Filter.Cache, ActionTypes.Print);
                PXUIFieldAttribute.SetEnabled <PrintParameters.showAll>(Filter.Cache, null, true);
            }

            Details.Cache.AllowDelete = false;
            Details.Cache.AllowInsert = false;
            Details.SetSelected <ARInvoice.selected>();
            Details.SetProcessCaption(IN.Messages.Process);
            Details.SetProcessAllCaption(IN.Messages.ProcessAll);
        }
        protected override void CreateInvoiceFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            base.CreateInvoiceFilter_RowSelected(cache, e);

            CreateInvoiceFilter createInvoiceFilterRow = (CreateInvoiceFilter)e.Row;

            string errorMessage         = PXUIFieldAttribute.GetErrorOnly <CreateInvoiceFilter.invoiceFinPeriodID>(cache, createInvoiceFilterRow);
            bool   enableProcessButtons = string.IsNullOrEmpty(errorMessage) == true;

            PostLines.SetProcessAllEnabled(enableProcessButtons);
            PostLines.SetProcessEnabled(enableProcessButtons);
        }
 protected virtual void SegmentValue_IsConsolidatedValue_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
 {
     if (e.Row == null)
     {
         Segment seg = Segment.Current;
         if (seg != null)
         {
             bool isSubitem = seg.DimensionID == IN.SubItemAttribute.DimensionName;
             PXUIFieldAttribute.SetVisible <SegmentValue.isConsolidatedValue>(cache, null, isSubitem);
             PXUIFieldAttribute.SetEnabled <SegmentValue.isConsolidatedValue>(cache, null, isSubitem);
         }
         else
         {
             PXUIFieldAttribute.SetVisible <SegmentValue.isConsolidatedValue>(cache, null, false);
         }
     }
 }
Example #6
0
        public InventoryLotSerInq()
        {
            Records.Cache.AllowInsert = false;
            Records.Cache.AllowUpdate = false;
            Records.Cache.AllowDelete = false;

            Records.WhereAndCurrent <INLotSerFilter>();
            PXUIFieldAttribute.SetVisible <INTranSplit.sOOrderType>(Records.Cache, null, true);
            PXUIFieldAttribute.SetVisible <INTranSplit.sOOrderNbr>(Records.Cache, null, true);
            PXCache receipt = this.Caches[typeof(POReceiptLine)];

            PXUIFieldAttribute.SetVisible <POReceiptLine.receiptType>(receipt, null, true);
            PXUIFieldAttribute.SetVisible <POReceiptLine.receiptNbr>(receipt, null, true);
            PXUIFieldAttribute.SetDisplayName <Customer.acctCD>(this.Caches[typeof(Customer)], Messages.CustomerID);
            PXUIFieldAttribute.SetDisplayName <POReceiptLine.receiptType>(receipt, Messages.ReceiptType);
            PXUIFieldAttribute.SetDisplayName <POReceiptLine.receiptNbr>(receipt, Messages.ReceiptNbr);
        }
        public TransferProcess()
        {
            FASetup setup = fasetup.Current;

            if (fasetup.Current.UpdateGL != true)
            {
                throw new PXSetupNotEnteredException <FASetup>(Messages.OperationNotWorkInInitMode, PXUIFieldAttribute.GetDisplayName <FASetup.updateGL>(fasetup.Cache));
            }

            PXUIFieldAttribute.SetDisplayName <Account.accountClassID>(Caches[typeof(Account)], Messages.FixedAssetsAccountClass);

            if (fasetup.Current.AutoReleaseTransfer != true)
            {
                Assets.SetProcessCaption(Messages.Prepare);
                Assets.SetProcessAllCaption(Messages.PrepareAll);
            }
        }
        public CRMassMailMaint()
        {
            if (string.IsNullOrEmpty(Setup.Current.MassMailNumberingID))
            {
                throw new PXSetPropertyException(Messages.NumberingIDIsNull, "CR Setup");
            }

            PXUIFieldAttribute.SetVisible <CRMarketingList.fullName>(MailLists.Cache, null, false);

            PXUIFieldAttribute.SetEnabled(Campaigns.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.selected>(Campaigns.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <CRCampaign.targetStatus>(Campaigns.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <CRCampaign.destinationStatus>(Campaigns.Cache, null, true);

            PXUIFieldAttribute.SetDisplayName <Contact.fullName>(Leads.Cache, "Company Name");
            PXUIFieldAttribute.SetDisplayName <BAccount.classID>(Caches[typeof(BAccount)], "Company Class");
        }
Example #9
0
        protected virtual void LocationAPPaymentInfo_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            LocationAPPaymentInfo row = (LocationAPPaymentInfo)e.Row;

            if (Location.Current != null)
            {
                bool enableEdit       = object.Equals(Location.Current.LocationID, Location.Current.VPaymentInfoLocationID);
                bool hasPaymentMethod = (row != null) && (String.IsNullOrEmpty(row.VPaymentMethodID) == false);
                PXUIFieldAttribute.SetEnabled(sender, e.Row, enableEdit);
                PXUIFieldAttribute.SetEnabled <LocationAPPaymentInfo.vCashAccountID>(sender, e.Row, enableEdit && hasPaymentMethod);
            }
        }
Example #10
0
        protected virtual void EPAssignmentRoute_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            EPAssignmentRoute row = e.Row as EPAssignmentRoute;

            if (row == null)
            {
                return;
            }

            this.Rules.Cache.AllowInsert = e.Row != null && row.Sequence != null;
            this.Rules.Cache.AllowUpdate = e.Row != null && row.Sequence != null;
            this.Rules.Cache.AllowDelete = e.Row != null && row.Sequence != null;

            PXUIFieldAttribute.SetEnabled <EPAssignmentRoute.workgroupID>(sender, row, row == null || row.RouterType == EPRouterType.Workgroup);
            PXUIFieldAttribute.SetEnabled <EPAssignmentRoute.ownerID>(sender, row, row == null || row.RouterType == EPRouterType.Workgroup);
            PXUIFieldAttribute.SetEnabled <EPAssignmentRoute.routeID>(sender, row, row != null && row.RouterType == EPRouterType.Router);
        }
        protected virtual void ContractDetail_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            ContractDetail row = e.Row as ContractDetail;

            if (row != null)
            {
                ContractItem item = PXSelect <ContractItem, Where <ContractItem.contractItemID, Equal <Required <ContractDetail.contractItemID> > > > .Select(this, row.ContractItemID);

                if (item != null)
                {
                    if (!ContractItemMaint.IsValidItemPrice(this, item))
                    {
                        PXUIFieldAttribute.SetWarning <ContractDetail.contractItemID>(sender, row, Messages.ItemNotPrice);
                    }
                }
            }
        }
Example #12
0
        protected virtual void CRMarketingListMember_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            CRMarketingListMember row = e.Row as CRMarketingListMember;

            if (row == null)
            {
                return;
            }

            CRMarketingList _CRMarketingList = PXSelect <CRMarketingList, Where <CRMarketingList.marketingListID,
                                                                                 Equal <Required <CRMarketingList.marketingListID> > > > .Select(this, row.MarketingListID);

            if (_CRMarketingList != null)
            {
                PXUIFieldAttribute.SetEnabled <CRMarketingList.marketingListID>(sender, row, _CRMarketingList.IsDynamic == false);
            }
        }
Example #13
0
        protected void SetConditionList(CRMerge document, CRMergeCriteria row)
        {
            var values    = MergeMatchingTypesAttribute.CommonValues;
            var labels    = MergeMatchingTypesAttribute.CommonLabels;
            var fieldInfo = ReadProperties(document).With(_ => _[row.DataField]);

            if (fieldInfo != null && IsNumericField(fieldInfo))
            {
                values = MergeMatchingTypesAttribute.ComparableValues;
                labels = MergeMatchingTypesAttribute.ComparableLabels;
            }
            PXIntListAttribute.SetList <CRMergeCriteria.matching>(Criteria.Cache, row, values, labels);
            if (row.Matching != null && Array.IndexOf(values, (int)row.Matching) < 0)
            {
                PXUIFieldAttribute.SetWarning <CRMergeCriteria.matching>(Criteria.Cache, row, Messages.IncorrectMatching);
            }
        }
Example #14
0
        public virtual void EnableDisableCustomFields(PXCache cache,
                                                      CRCase crCaseRow,
                                                      FSxCRCase fsxCRCaseRow,
                                                      FSServiceOrder fsServiceOrderRow,
                                                      FSSrvOrdType fsSrvOrdTypeRow)
        {
            if (fsSrvOrdTypeRow != null)
            {
                bool isAnInternalSrvOrdType = fsSrvOrdTypeRow.Behavior == ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT;

                PXUIFieldAttribute.SetEnabled <CRCase.customerID>(cache, null, isAnInternalSrvOrdType || (!isAnInternalSrvOrdType && fsServiceOrderRow == null));
            }
            else
            {
                PXUIFieldAttribute.SetEnabled <CRCase.customerID>(cache, null, true);
            }
        }
Example #15
0
        protected virtual void FABook_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            FABook book = (FABook)e.Row;

            if (book == null)
            {
                return;
            }

            FABookYearSetup setup = PXSelect <FABookYearSetup, Where <FABookYearSetup.bookID, Equal <Current <FABook.bookID> > > > .SelectSingleBound(this, new object[] { book });

            if (setup == null && book.UpdateGL != true)
            {
                PXUIFieldAttribute.SetEnabled <FABook.selected>(sender, book, false);
                sender.RaiseExceptionHandling <FABook.selected>(book, null, new PXSetPropertyException(Messages.CalendarSetupNotFound, PXErrorLevel.RowWarning, book.BookCode));
            }
        }
        public void CheckForNumberingUsage <TSetup, TNumberingId>(Numbering numbering,
                                                                  PXGraph graph, string message)
            where TSetup : class, IBqlTable, new()
        {
            if (numbering == null)
            {
                return;
            }
            var setupSelect       = new PXSelect <TSetup>(graph);
            var numberingTypeName = typeof(TNumberingId).Name;

            if (IsNumberingInUse(setupSelect, numberingTypeName, numbering))
            {
                var fieldName = PXUIFieldAttribute.GetDisplayName(setupSelect.Cache, numberingTypeName);
                throw new PXException(Messages.NumberingIsUsedFailedDeleteSetup, message, fieldName);
            }
        }
Example #17
0
        protected virtual void CCProcessingCenter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            PXUIFieldAttribute.SetEnabled <CCProcessingCenter.processingTypeName>(sender, e.Row, (bool)((CCProcessingCenter)e.Row).IsActive);
            PXUIFieldAttribute.SetRequired <CCProcessingCenter.processingTypeName>(sender, (bool)((CCProcessingCenter)e.Row).IsActive);
            CCProcessingCenter row = (CCProcessingCenter)e.Row;
            bool isTokenized       = CCPaymentProcessing.IsFeatureSupported(row, CCProcessingFeature.HostedForm);

            PXUIFieldAttribute.SetVisible <CCProcessingCenter.allowDirectInput>(sender, row, isTokenized);
            PXUIFieldAttribute.SetVisible <CCProcessingCenter.syncronizeDeletion>(sender, row, isTokenized);
            PXUIFieldAttribute.SetVisible <CCProcessingCenter.syncRetryAttemptsNo>(sender, row, isTokenized);
            PXUIFieldAttribute.SetVisible <CCProcessingCenter.syncRetryDelayMs>(sender, row, isTokenized);
            this.testCredentials.SetEnabled((row != null) && !string.IsNullOrEmpty(row.ProcessingCenterID) && !string.IsNullOrEmpty(row.ProcessingTypeName));
            this.updateExpirationDate.SetVisible(row != null && row.NeedsExpDateUpdate == true);
            this.ProcessingCenter.Cache.AllowDelete = !HasTransactions((CCProcessingCenter)e.Row);
            PaymentMethods.AllowInsert = false;
            PaymentMethods.AllowDelete = false;
        }
Example #18
0
        protected virtual void PMProjectStatus_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            PMProjectStatus row = e.Row as PMProjectStatus;

            if (row != null)
            {
                PMProjectStatus ps = PXSelect <PMProjectStatus,
                                               Where <PMProjectStatus.accountGroupID, Equal <Current <ProjectBalanceFilter.accountGroupID> >,
                                                      And <PMProjectStatus.projectID, Equal <Current <ProjectBalanceFilter.projectID> >,
                                                           And <PMProjectStatus.projectTaskID, Equal <Current <ProjectBalanceFilter.projectTaskID> >,
                                                                And <PMProjectStatus.inventoryID, Equal <Current <ProjectBalanceFilter.inventoryID> >,
                                                                     And <PMProjectStatus.periodID, NotEqual <Current <PMProjectStatus.periodID> > > > > > > > .SelectWindowed(this, 0, 1);

                PXUIFieldAttribute.SetEnabled <PMProjectStatus.uOM>(Items.Cache, null, ps == null);
                PXUIFieldAttribute.SetEnabled <PMProjectStatus.rate>(Items.Cache, null, ps == null);
            }
        }
Example #19
0
        protected void RMReport_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del)
        {
            if (e.Row == null)
            {
                return;
            }

            PXUIFieldAttribute.SetVisible <RMReportGL.requestAccountClassID>(sender, e.Row, ((RMReport)e.Row).Type == RMType.GL);
            PXUIFieldAttribute.SetVisible <RMReportGL.requestEndAccount>(sender, e.Row, ((RMReport)e.Row).Type == RMType.GL);
            PXUIFieldAttribute.SetVisible <RMReportGL.requestEndSub>(sender, e.Row, ((RMReport)e.Row).Type == RMType.GL);
            PXUIFieldAttribute.SetVisible <RMReportGL.requestLedgerID>(sender, e.Row, ((RMReport)e.Row).Type == RMType.GL);
            PXUIFieldAttribute.SetVisible <RMReportGL.requestStartAccount>(sender, e.Row, ((RMReport)e.Row).Type == RMType.GL);
            PXUIFieldAttribute.SetVisible <RMReportGL.requestStartSub>(sender, e.Row, ((RMReport)e.Row).Type == RMType.GL);
            PXUIFieldAttribute.SetVisible <RMReportGL.requestStartBranch>(sender, e.Row, ((RMReport)e.Row).Type == RMType.GL);
            PXUIFieldAttribute.SetVisible <RMReportGL.requestEndBranch>(sender, e.Row, ((RMReport)e.Row).Type == RMType.GL);
            del(sender, e);
        }
        private static PXSetPropertyException VerifyingAndGetError(PXUIVerifyAttribute attr, PXCache sender, object row)
        {
            if (row == null)
            {
                return(null);
            }

            if (attr == null)
            {
                throw new PXException(ErrorMessages.AttributeNotDefined, typeof(PXUIVerifyAttribute).Name);
            }

            if (attr.Condition != null && !GetConditionResult(sender, row, attr.Condition))
            {
                List <object> messageParams = new List <object>();

                foreach (Type arg in attr._args)
                {
                    if (typeof(Constant).IsAssignableFrom(arg))
                    {
                        Constant constantInstance = Activator.CreateInstance(arg) as Constant;
                        messageParams.Add(constantInstance?.Value);
                    }
                    else if (attr.MessageArgumentsAreFieldNames)
                    {
                        messageParams.Add(PXUIFieldAttribute.GetDisplayName(sender, arg.Name));
                    }
                    else
                    {
                        var value = sender.GetValueExt(row, arg.Name);

                        if (value is PXFieldState)
                        {
                            messageParams.Add(((PXFieldState)value).Value);
                        }
                        else
                        {
                            messageParams.Add(value);
                        }
                    }
                }
                return(new PXSetPropertyException(attr._Message, attr._ErrorLevel, messageParams.ToArray()));
            }
            return(null);
        }
        protected virtual void CRActivity_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            var row = e.Row as CRActivity;

            if (row == null)
            {
                return;
            }

            string status     = ((string)cache.GetValueOriginal <CRActivity.uistatus>(row) ?? ActivityStatusListAttribute.Open);
            bool   editable   = status == ActivityStatusListAttribute.Open || status == ActivityStatusListAttribute.Draft || status == ActivityStatusListAttribute.InProcess;
            bool   deleteable = ChildActivities.SelectByParentNoteID(row.NoteID).RowCast <CRPMTimeActivity>().All(o => o.IsBillable != true);

            PXUIFieldAttribute.SetEnabled(cache, row, editable);
            Delete.SetEnabled(deleteable);
            Complete.SetEnabled(editable);
            CompleteAndFollowUp.SetEnabled(editable);
            CancelActivity.SetEnabled(editable);
            AddNewRelatedTask.SetEnabled(cache.GetStatus(row) != PXEntryStatus.Inserted);

            PXUIFieldAttribute.SetEnabled <CRActivity.noteID>(cache, row);
            PXUIFieldAttribute.SetEnabled <CRActivity.uistatus>(cache, row);
            PXUIFieldAttribute.SetEnabled <CRActivity.source>(cache, row, false);
            PXUIFieldAttribute.SetEnabled <CRActivity.createdByID>(cache, row, false);
            PXUIFieldAttribute.SetEnabled <CRActivity.completedDate>(cache, row, false);

            GotoParentActivity.SetEnabled(row.ParentNoteID != null);

            ChildActivities.Cache.AllowDelete             =
                ReferencedTasks.Cache.AllowInsert         =
                    ReferencedTasks.Cache.AllowUpdate     =
                        ReferencedTasks.Cache.AllowDelete = editable;


            var tAct      = (PMTimeActivity)TimeActivity.SelectSingle();
            var tActCache = TimeActivity.Cache;

            PXUIFieldAttribute.SetEnabled <PMTimeActivity.projectID>(tActCache, tAct, editable);
            PXUIFieldAttribute.SetEnabled <PMTimeActivity.projectTaskID>(tActCache, tAct, editable);

            PXUIFieldAttribute.SetEnabled <CRReminder.isReminderOn>(Reminder.Cache, Reminder.SelectSingle(), editable);
            PXUIFieldAttribute.SetEnabled <CRActivity.parentNoteID>(cache, row, false);

            MarkAs(cache, row, Accessinfo.UserID, EPViewStatusAttribute.VIEWED);
        }
        public ReclassificationHistoryInq()
        {
            TransView.AllowDelete = false;
            TransView.AllowInsert = false;
            TransView.AllowUpdate = true;

            PXUIFieldAttribute.SetVisible <GLTranReclHist.batchNbr>(TransView.Cache, null);

            //to hide the red asterisk on column header
            PXDefaultAttribute.SetPersistingCheck <GLTranReclHist.branchID>(TransView.Cache, null, PXPersistingCheck.Nothing);
            PXDefaultAttribute.SetPersistingCheck <GLTranReclHist.accountID>(TransView.Cache, null, PXPersistingCheck.Nothing);
            PXDefaultAttribute.SetPersistingCheck <GLTranReclHist.subID>(TransView.Cache, null, PXPersistingCheck.Nothing);

            var srcTranKey = SrcTranOfReclassKey();

            if (srcTranKey == null)
            {
                return;
            }

            var srcTran = (GLTranReclHist)PXSelect <GLTranReclHist,
                                                    Where <GLTranReclHist.module, Equal <Required <GLTran.module> >,
                                                           And <GLTranReclHist.batchNbr, Equal <Required <GLTran.batchNbr> >,
                                                                And <GLTranReclHist.lineNbr, Equal <Required <GLTran.lineNbr> > > > > >
                          .Select(this,
                                  srcTranKey.Module,
                                  srcTranKey.BatchNbr,
                                  srcTranKey.LineNbr);

            TransView.Cache.SetStatus(srcTran, PXEntryStatus.Updated);

            var hasSplittedTrans = PXSelectReadonly <GLTranReclHist,
                                                     Where <GLTranReclHist.reclassSourceTranModule, Equal <Required <GLTranReclHist.module> >,
                                                            And <GLTranReclHist.reclassSourceTranBatchNbr, Equal <Required <GLTranReclHist.batchNbr> >,
                                                                 And <GLTranReclHist.reclassSourceTranLineNbr, Equal <Required <GLTranReclHist.lineNbr> > > > >, OrderBy <Asc <GLTranReclHist.reclassSeqNbr> > >
                                   .Select(this, srcTran.Module, srcTran.BatchNbr, srcTran.LineNbr).RowCast <GLTranReclHist>().Any(m => m.ReclassType == ReclassType.Split);

            reclassifyAll.SetEnabled(hasSplittedTrans);
            reclassifyAll.SetVisible(hasSplittedTrans);
            reclassificationHistory.SetEnabled(hasSplittedTrans);
            reclassificationHistory.SetVisible(hasSplittedTrans);
            PXUIFieldAttribute.SetVisible <GLTranReclHist.selected>(TransView.Cache, null, hasSplittedTrans);
            PXUIFieldAttribute.SetVisible <GLTranReclHist.origBatchNbr>(TransView.Cache, null, hasSplittedTrans);
            PXUIFieldAttribute.SetVisible <GLTranReclHist.actionDesc>(TransView.Cache, null, hasSplittedTrans);
        }
Example #23
0
        public void SplitFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            SplitFilter filter = (SplitFilter)e.Row;

            if (filter == null)
            {
                return;
            }

            PXProcessingStep[] targets = PXAutomation.GetProcessingSteps(this);
            if (targets.Length > 0)
            {
                Splits.SetProcessTarget(targets[0].GraphName,
                                        targets.Length > 1 ? null : targets[0].Name,
                                        targets[0].Actions[0].Name,
                                        targets[0].Actions[0].Menus[0],
                                        filter.SplitDate,
                                        filter.SplitPeriodID,
                                        null, null, null, null, null,
                                        filter.DeprBeforeSplit,
                                        null,
                                        filter.AssetID);
            }
            else
            {
                throw new PXException(SO.Messages.MissingMassProcessWorkFlow);
            }

            Splits.SetProcessVisible(false);
            Splits.SetProcessAllEnabled(filter.AssetID != null && filter.SplitPeriodID != null);
            Splits.SetProcessAllCaption(Messages.Split);

            Splits.Cache.AllowInsert = filter.AssetID != null;
            Splits.Cache.AllowUpdate = filter.AssetID != null;
            Splits.Cache.AllowDelete = true;

            PXUIFieldAttribute.SetEnabled <SplitParams.cost>(Splits.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <SplitParams.qty>(Splits.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <SplitParams.ratio>(Splits.Cache, null, true);
            Numbering nbr = assetNumbering.Select();

            PXUIFieldAttribute.SetEnabled <SplitParams.assetCD>(Splits.Cache, null, nbr == null || nbr.UserNumbering == true);

            PXUIFieldAttribute.SetEnabled <SplitFilter.deprBeforeSplit>(sender, filter, fasetup.Current.AutoReleaseDepr == true);
        }
Example #24
0
        protected virtual void TaxAdjustment_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            TaxAdjustment doc = e.Row as TaxAdjustment;

            if (doc == null)
            {
                return;
            }

            if (doc.Released == true)
            {
                PXUIFieldAttribute.SetEnabled(cache, doc, false);
                cache.AllowDelete = false;
                cache.AllowUpdate = false;
                Transactions.Cache.AllowDelete = false;
                Transactions.Cache.AllowUpdate = false;
                Transactions.Cache.AllowInsert = false;

                release.SetEnabled(false);
            }
            else
            {
                PXUIFieldAttribute.SetEnabled(cache, doc, true);
                PXUIFieldAttribute.SetEnabled <TaxAdjustment.status>(cache, doc, false);
                PXUIFieldAttribute.SetEnabled <TaxAdjustment.curyDocBal>(cache, doc, false);
                PXUIFieldAttribute.SetEnabled <TaxAdjustment.batchNbr>(cache, doc, false);

                cache.AllowDelete = true;
                cache.AllowUpdate = true;
                Transactions.Cache.AllowDelete = true;
                Transactions.Cache.AllowUpdate = true;
                Transactions.Cache.AllowInsert = true;

                release.SetEnabled(doc.Hold == false);
            }
            PXUIFieldAttribute.SetEnabled <TaxAdjustment.docType>(cache, doc);
            PXUIFieldAttribute.SetEnabled <TaxAdjustment.refNbr>(cache, doc);
            PXUIFieldAttribute.SetEnabled <TaxAdjustment.curyID>(cache, doc, false);

            editVendor.SetEnabled(vendor.Current != null);
            bool tranExist = (TaxTran)this.Transactions.SelectWindowed(0, 1) != null;

            PXUIFieldAttribute.SetEnabled <TaxAdjustment.vendorID>(cache, doc, !tranExist);
            PXUIFieldAttribute.SetEnabled <TaxAdjustment.taxPeriod>(cache, doc, !tranExist);
        }
Example #25
0
        protected virtual void GLVoucherBatch_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            GLVoucherBatch row = (GLVoucherBatch)e.Row;

            if (row == null)
            {
                return;
            }

            Dictionary <string, Dictionary <Guid, CAMessage> > listMessages = PXLongOperation.GetCustomInfo(this.UID) as Dictionary <string, Dictionary <Guid, CAMessage> >;
            PXLongRunStatus status = GetLongOperationStatus();

            if ((status == PXLongRunStatus.Aborted || status == PXLongRunStatus.Completed) && listMessages != null)
            {
                string key = row.VoucherBatchNbr;
                if (listMessages.ContainsKey(key))
                {
                    VouchersInBatch.View.AllowSelect = true;
                    CAMessage message;
                    if (listMessages[key].TryGetValue(Guid.Empty, out message))
                    {
                        sender.RaiseExceptionHandling <GLVoucherBatch.voucherBatchNbr>(row, row.VoucherBatchNbr, new PXSetPropertyException <GLVoucherBatch.voucherBatchNbr>(message.Message, message.ErrorLevel));
                    }
                    else
                    {
                        sender.RaiseExceptionHandling <GLVoucherBatch.voucherBatchNbr>(row, row.VoucherBatchNbr, new PXSetPropertyException <GLVoucherBatch.voucherBatchNbr>("Processed", PXErrorLevel.RowInfo));
                    }
                }
                else
                {
                    VouchersInBatch.View.AllowSelect = false;
                }
            }
            else
            {
                VouchersInBatch.View.AllowSelect = false;
            }

            GLWorkBook workBook = WorkBook.Select(filter.Current.WorkBookID);

            bool active = workBook.Status == WorkBookStatus.Active;

            PXUIFieldAttribute.SetEnabled <GLVoucherBatch.selected>(sender, row, row.Released == false && active);
            PXUIFieldAttribute.SetEnabled <GLVoucherBatch.descr>(sender, row, row.Released == false && active);
        }
Example #26
0
        /// <summary>The RowUpdated event handler for the <see cref="Document" /> mapped cache extension.</summary>
        /// <param name="e">Parameters of the event.</param>
        protected virtual void _(Events.RowUpdated <Document> e)
        {
            if (e.Row == null)
            {
                return;
            }

            if (e.ExternalCall && (!Documents.Cache.ObjectsEqual <Document.documentDate>(e.OldRow, e.Row)))
            {
                DiscountEngineGraph.AutoRecalculatePricesAndDiscounts(Details.Cache,
                                                                      Details, null, Discounts, e.Row.LocationID ?? 0, e.Row.DocumentDate ?? (new PXGraph()).Accessinfo.BusinessDate, DiscountEngine.DefaultARDiscountCalculationParameters);
            }

            if (e.ExternalCall && Documents.Cache.GetStatus(e.Row) != PXEntryStatus.Deleted && !Documents.Cache.ObjectsEqual <Document.curyDiscTot>(e.OldRow, e.Row))
            {
                var current = Documents.Current;
                DiscountEngineGraph.CalculateDocumentDiscountRate(Details.Cache,
                                                                  Details, null, null, Discounts, current.CuryLineTotal ?? 0m, current.CuryDiscTot ?? 0m);
            }

            if (e.Row.CustomerID != null && e.Row.CuryDiscTot != null && e.Row.CuryDiscTot > 0 && e.Row.CuryLineTotal != null && e.Row.CuryMiscTot != null && (e.Row.CuryLineTotal > 0 || e.Row.CuryMiscTot > 0))
            {
                decimal discountLimit = DiscountEngineGraph.GetDiscountLimit(Documents.Cache, e.Row.CustomerID);
                if (((e.Row.CuryLineTotal + e.Row.CuryMiscTot) / 100 * discountLimit) < e.Row.CuryDiscTot)
                {
                    PXUIFieldAttribute.SetWarning <Document.curyDiscTot>(Documents.Cache, e.Row, string.Format(Messages.DocDiscountExceedLimit, discountLimit));
                }
            }

            if (!Documents.Cache.ObjectsEqual <Document.locationID>(e.OldRow, e.Row) || !Documents.Cache.ObjectsEqual <Document.documentDate>(e.OldRow, e.Row))
            {
                RecalcDiscountsParamFilter recalcFilter =
                    new RecalcDiscountsParamFilter
                {
                    OverrideManualDiscounts = false,
                    OverrideManualPrices    = false,
                    RecalcDiscounts         = true,
                    RecalcUnitPrices        = true,
                    RecalcTarget            = RecalcDiscountsParamFilter.AllLines
                };
                DiscountEngineGraph.RecalculatePricesAndDiscounts(Details.Cache,
                                                                  Details, null, Discounts, e.Row.LocationID ?? 0, e.Row.DocumentDate ?? (new PXGraph()).Accessinfo.BusinessDate, recalcFilter, DiscountEngine.DefaultARDiscountCalculationParameters);
                RecalculateTotalDiscount();
            }
        }
        public virtual void _(Events.RowSelected <EPExpenseClaimDetails> e)
        {
            if (e.Row is EPExpenseClaimDetails row)
            {
                EPExpenseClaim claim = GetParentClaim(row.RefNbr);

                bool enabledApprovalReceipt = PXAccess.FeatureInstalled <FeaturesSet.approvalWorkflow>() && epsetup.Current.ClaimDetailsAssignmentMapID != null;
                bool legacyClaim            = row.LegacyReceipt == true && !String.IsNullOrEmpty(row.RefNbr);
                bool enabledEditReceipt     = (row.Hold == true || !enabledApprovalReceipt || (UseClaimStatus && claim?.Hold == true)) && !legacyClaim;

                if (claim != null)
                {
                    bool enabledEditClaim = (claim.Hold == true);
                    enabledEditReceipt = enabledEditReceipt && enabledEditClaim;
                }

                bool notMatchedToBankTran = row.BankTranDate == null;

                e.Cache.Adjust <PXUIFieldAttribute>()
                .For <EPExpenseClaimDetails.expenseDate>(ui =>
                                                         ui.Enabled = notMatchedToBankTran && enabledEditReceipt)
                .SameFor <EPExpenseClaimDetails.qty>()
                .SameFor <EPExpenseClaimDetails.uOM>()
                .SameFor <EPExpenseClaimDetails.curyUnitCost>()
                .SameFor <EPExpenseClaimDetails.curyEmployeePart>()
                .SameFor <EPExpenseClaimDetails.curyExtCost>()
                .SameFor <EPExpenseClaimDetails.paidWith>();

                PXUIFieldAttribute.SetEnabled <EPExpenseClaimDetails.curyTipAmt>(e.Cache, row, notMatchedToBankTran &&
                                                                                 enabledEditReceipt &&
                                                                                 row.PaidWith != EPExpenseClaimDetails.paidWith.CardPersonalExpense);

                var corpCardIsEnabled = row.PaidWith != EPExpenseClaimDetails.paidWith.PersonalAccount && notMatchedToBankTran && row.Released != true;
                PXUIFieldAttribute.SetEnabled <EPExpenseClaimDetails.corpCardID>(e.Cache, row, corpCardIsEnabled);

                bool isProjectEnabled = row.PaidWith != EPExpenseClaimDetails.paidWith.CardPersonalExpense && row.Released != true;
                PXUIFieldAttribute.SetEnabled <EPExpenseClaimDetails.contractID>(e.Cache, row, isProjectEnabled);
                PXUIFieldAttribute.SetEnabled <EPExpenseClaimDetails.taskID>(e.Cache, row, isProjectEnabled);
                PXUIFieldAttribute.SetEnabled <EPExpenseClaimDetails.costCodeID>(e.Cache, row, isProjectEnabled);

                UIState.RaiseOrHideError <EPExpenseClaimDetails.claimDetailCD>(e.Cache, row, row.BankTranDate != null,
                                                                               Messages.SomeBoxesAndActionsOnTheFormAreUnavailableExpenseReceiptIsMatchedToBankStatement, PXErrorLevel.Warning,
                                                                               row.BankTranDate?.ToShortDateString());
            }
        }
        protected virtual void Account_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            Account row = (Account)e.Row;

            if (row == null)
            {
                return;
            }

            Exception rateTypeWarning = (row != null && row.CuryID != null && row.CuryID != Company.Current.BaseCuryID && row.RevalCuryRateTypeId == null) ?
                                        new PXSetPropertyException(Messages.RevaluationRateTypeIsNotDefined, PXErrorLevel.Warning) :
                                        null;

            sender.RaiseExceptionHandling <Account.revalCuryRateTypeId>(row, row.RevalCuryRateTypeId, rateTypeWarning);

            PXUIFieldAttribute.SetEnabled <Account.curyID>(sender, row, row.IsCashAccount != true);
            PXUIFieldAttribute.SetEnabled <Account.postOption>(sender, row, row.IsCashAccount != true);
        }
Example #29
0
        public TXInvoiceEntry()
        {
            Document.View = new PXView(this, false, new Select2 <APInvoice,
                                                                 LeftJoin <Vendor, On <APInvoice.vendorID, Equal <Vendor.bAccountID> > >,
                                                                 Where <APInvoice.docType, Equal <Optional <APInvoice.docType> >,
                                                                        And <APInvoice.origModule, Equal <GL.BatchModule.moduleTX>,
                                                                             And <Where <Vendor.bAccountID, IsNull,
                                                                                         Or <Match <Vendor, Current <AccessInfo.userName> > > > > > > >());

            this.Views[nameof(Document)] = Document.View;

            PXUIFieldAttribute.SetVisible <TaxRev.taxID>(Caches[typeof(TaxRev)], null);

            prebook.SetEnabled(false);
            prebook.SetVisible(false);
            voidInvoice.SetVisible(false);
            voidInvoice.SetEnabled(false);
        }
        public CRMarketingListMaint()
        {
            var contactCache = Caches[typeof(Contact)];

            PXUIFieldAttribute.SetDisplayName <Contact.fullName>(contactCache, Messages.ContactFullName);
            PXDBAttributeAttribute.Activate(FilteredItems.Cache);

            var parentBAccountCache = Caches[typeof(BAccount)];

            parentBAccountCache.DisplayName = Messages.ParentAccount;
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(parentBAccountCache, Messages.ParentAccountNameShort);
            PXDBAttributeAttribute.Activate(parentBAccountCache);

            PXUIFieldAttribute.SetVisible <CRMarketingListMember.marketingListID>(MailRecipients.Cache, null, false);
            PXUIFieldAttribute.SetVisibility <Contact.fullName>(this.Caches[typeof(Contact)], null, PXUIVisibility.Visible);
            PXUIFieldAttribute.SetEnabled(this.Caches[typeof(Contact)], null, null, false);
            PXUIFieldAttribute.SetEnabled <Contact.selected>(this.Caches[typeof(Contact)], null, true);
        }