public void SplitParams_Cost_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
 {
     if (Filter.Current != null && e.NewValue is decimal?)
     {
         if (!AssetMaint.IsValueInSignedRange((decimal?)e.NewValue, Filter.Current.Cost, out (decimal MinValue, decimal MaxValue)range))
         {
             throw new PXSetPropertyException(CS.Messages.EntryInRange, range.MinValue, range.MaxValue);
         }
     }
 }
        protected virtual void _(Events.RowSelected <SplitParams> e)
        {
            SplitFilter filter = (SplitFilter)e.Cache.Graph.Caches <SplitFilter>().Current;

            (decimal minValue, decimal maxValue) = AssetMaint.GetSignedRange(filter.Cost);

            e.Cache.Adjust <PXDBDecimalAttribute>(e.Row)
            .For <SplitParams.cost>(decimalAttr =>
            {
                decimalAttr.MinValue = (double)minValue;
                decimalAttr.MaxValue = (double)maxValue;
            });
        }
Beispiel #3
0
        public virtual IEnumerable ViewAsset(PXAdapter adapter)
        {
            if (Trans.Current != null)
            {
                AssetMaint graph = CreateInstance <AssetMaint>();
                graph.CurrentAsset.Current = PXSelect <FixedAsset, Where <FixedAsset.assetID, Equal <Current <FATran.assetID> > > > .Select(this);

                if (graph.CurrentAsset.Current != null)
                {
                    throw new PXRedirectRequiredException(graph, true, "ViewAsset")
                          {
                              Mode = PXBaseRedirectException.WindowMode.Same
                          };
                }
            }
            return(adapter.Get());
        }
Beispiel #4
0
		protected virtual void FixedAsset_Depreciable_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
		{
			AssetMaint.UpdateBalances<FABookSettings.depreciate, FixedAsset.depreciable>(sender, e);
		}
 protected virtual void FALocationHistory_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
 {
     AssetMaint.LiveUpdateMaskedSubs(this, Assets.Cache, (FALocationHistory)e.Row);
 }
Beispiel #6
0
        protected override FAKeyWithSourceValues EvaluateRawKey(PXGraph graph,
                                                                FAKeyWithSourceValues keyWithSourceValues)
        {
            if (keyWithSourceValues == null)
            {
                return(null);
            }

            FABook book = BookMaint.FindByID(graph, keyWithSourceValues.SourceBookIDs.First());

            if (book == null)
            {
                if (keyWithSourceValues.SpecificationItem.IsBookRequired)
                {
                    return(keyWithSourceValues);
                }
                else
                {
                    book = BookMaint.FindByBookMarker(graph, FABook.bookID.Markers.GLOrAnyBook);
                }
            }

            if (book == null)
            {
                return(keyWithSourceValues);
            }

            keyWithSourceValues.Key.SetBookID(book);

            if (book.UpdateGL == true)
            {
                if (!PXAccess.FeatureInstalled <FeaturesSet.branch>())
                {
                    keyWithSourceValues.KeyOrganizationIDs = PXAccess.GetParentOrganizationID(PXAccess.GetBranchID()).SingleToList();
                }
                else
                {
                    keyWithSourceValues.KeyOrganizationIDs = keyWithSourceValues.SourceOrganizationIDs;

                    if (IsIDsUndefined(keyWithSourceValues.KeyOrganizationIDs))
                    {
                        if (!IsIDsUndefined(keyWithSourceValues.SourceBranchIDs))
                        {
                            keyWithSourceValues.KeyOrganizationIDs =
                                keyWithSourceValues.SourceBranchIDs
                                .Select(branchID => PXAccess.GetParentOrganizationID(branchID))
                                .ToList();
                        }
                        else
                        {
                            if (!IsIDsUndefined(keyWithSourceValues.SourceAssetIDs))
                            {
                                keyWithSourceValues.KeyOrganizationIDs =
                                    keyWithSourceValues.SourceAssetIDs
                                    .Select(assetID => PXAccess.GetParentOrganizationID(AssetMaint.FindByID(graph, assetID)?.BranchID))
                                    .ToList();
                            }
                            else if (!PXAccess.FeatureInstalled <FeaturesSet.multipleCalendarsSupport>())
                            {
                                keyWithSourceValues.KeyOrganizationIDs =
                                    ((int?)FABookPeriod.organizationID.NonPostingBookValue).SingleToList();
                            }
                        }
                    }
                }
            }
            else
            {
                keyWithSourceValues.KeyOrganizationIDs =
                    ((int?)FABookPeriod.organizationID.NonPostingBookValue).SingleToList();
            }

            keyWithSourceValues.Key.OrganizationID = keyWithSourceValues.KeyOrganizationIDs.First();

            return(keyWithSourceValues);
        }