diff --git a/src/Acuminator/Acuminator.Utilities/Acuminator.Utilities.csproj b/src/Acuminator/Acuminator.Utilities/Acuminator.Utilities.csproj
index ad7a4aa1d..347706ef8 100644
--- a/src/Acuminator/Acuminator.Utilities/Acuminator.Utilities.csproj
+++ b/src/Acuminator/Acuminator.Utilities/Acuminator.Utilities.csproj
@@ -15,6 +15,7 @@
../../packages
enable
Nullable
+ $(NoWarn);CS0168
https://github.com/Acumatica/Acuminator/blob/dev/LICENSE
diff --git a/src/Acuminator/Acuminator.Utilities/Common/Concurrent/ConcurrentExtensions.cs b/src/Acuminator/Acuminator.Utilities/Common/Concurrent/ConcurrentExtensions.cs
index 26ce6b61e..a08e44e90 100644
--- a/src/Acuminator/Acuminator.Utilities/Common/Concurrent/ConcurrentExtensions.cs
+++ b/src/Acuminator/Acuminator.Utilities/Common/Concurrent/ConcurrentExtensions.cs
@@ -32,44 +32,119 @@ public static void Clear(this ConcurrentQueue? queue)
}
///
- /// A Task extension method that attempts to await task which could be cancelled.
+ /// A Task extension method that attempts to await task which could be cancelled or faulted.
///
/// The task to act on.
- ///
- public async static Task TryAwait(this Task? task)
+ /// (Optional) The optional logger for non cancellation exceptions.
+ /// (Optional) True to continue on captured context.
+ ///
+ public async static Task TryAwait(this Task? task, Action? logger = null,
+ bool continueOnCapturedContext = false)
{
if (task == null || task.IsCanceled || task.IsFaulted)
return false;
try
{
- await task.ConfigureAwait(false);
+ await task.ConfigureAwait(continueOnCapturedContext);
+ return true;
+ }
+ catch (OperationCanceledException cancelledException)
+ {
+ return false;
+ }
+ catch (Exception exception)
+ {
+ logger?.Invoke(exception);
+ return false;
+ }
+ }
+
+ ///
+ /// A extension method that attempts to await task which could be cancelled or faulted.
+ ///
+ /// The task to act on.
+ /// (Optional) The optional logger for non cancellation exceptions.
+ /// (Optional) True to continue on captured context.
+ ///
+ public async static ValueTask TryAwait(this ValueTask task, Action? logger = null,
+ bool continueOnCapturedContext = false)
+ {
+ if (task.IsCanceled || task.IsFaulted)
+ return false;
+
+ try
+ {
+ await task.ConfigureAwait(continueOnCapturedContext);
return true;
}
- catch (OperationCanceledException)
+ catch (OperationCanceledException cancelledException)
+ {
+ return false;
+ }
+ catch (Exception exception)
{
+ logger?.Invoke(exception);
return false;
}
}
///
- /// A extension method that attempts to await task which could be cancelled.
+ /// A extension method that attempts to await task which could be cancelled or faulted.
///
/// Type of the result.
/// The task to act on.
+ /// (Optional) The optional logger for non cancellation exceptions.
+ /// (Optional) True to continue on captured context.
///
- public async static Task> TryAwait(this Task? task)
+ public async static Task> TryAwait(this Task? task, Action? logger = null,
+ bool continueOnCapturedContext = false)
{
if (task == null || task.IsCanceled || task.IsFaulted)
return new TaskResult(false, default);
try
{
- TResult? result = await task.ConfigureAwait(false);
+ TResult? result = await task.ConfigureAwait(continueOnCapturedContext);
return new TaskResult(true, result);
}
- catch (OperationCanceledException)
+ catch (OperationCanceledException cancelledException)
+ {
+ return new TaskResult(false, default);
+ }
+ catch (Exception exception)
+ {
+ logger?.Invoke(exception);
+ return new TaskResult(false, default);
+ }
+ }
+
+ ///
+ /// A extension method that attempts to await task which could be cancelled or faulted.
+ ///
+ /// Type of the result.
+ /// The task to act on.
+ /// (Optional) The optional logger for non cancellation exceptions.
+ /// (Optional) True to continue on captured context.
+ ///
+ public async static ValueTask> TryAwait(this ValueTask task, Action? logger = null,
+ bool continueOnCapturedContext = false)
+ {
+ if (task.IsCanceled || task.IsFaulted)
+ return new TaskResult(false, default);
+
+ try
+ {
+ TResult? result = await task.ConfigureAwait(continueOnCapturedContext);
+ return new TaskResult(true, result);
+ }
+ catch (OperationCanceledException cancelledException)
+ {
+ return new TaskResult(false, default);
+ }
+ catch (Exception exception)
{
+ logger?.Invoke(exception);
return new TaskResult(false, default);
}
}
diff --git a/src/Acuminator/Acuminator.Utilities/Roslyn/Semantic/SemanticModelUtils.cs b/src/Acuminator/Acuminator.Utilities/Roslyn/Semantic/SemanticModelUtils.cs
index f338dbd93..1fc944d3b 100644
--- a/src/Acuminator/Acuminator.Utilities/Roslyn/Semantic/SemanticModelUtils.cs
+++ b/src/Acuminator/Acuminator.Utilities/Roslyn/Semantic/SemanticModelUtils.cs
@@ -15,10 +15,10 @@ namespace Acuminator.Utilities.Roslyn.Semantic
public static class SemanticModelUtils
{
///
- /// Safely analyse data flow for a and return if analysis succeeded.
+ /// Safely analyze data flow for a and return if analysis succeeded.
///
/// The semanticModel to act on.
- /// The node to analyse.
+ /// The node to analyze.
///
/// A if the data flow analysis succeeded, if not.
///
@@ -62,12 +62,14 @@ public static class SemanticModelUtils
[SuppressMessage("Usage", "VSTHRD103:Call async methods when in an async method", Justification = "Aggregated await is used")]
public static async Task<(SemanticModel? SemanticModel, SyntaxNode? Root)> GetSemanticModelAndRootAsync(this Document document,
- CancellationToken cancellation = default)
+ CancellationToken cancellation = default,
+ bool continueOnCapturedContext = false)
{
var semanticModelTask = document.CheckIfNull().GetSemanticModelAsync(cancellation);
var syntaxRootTask = document.GetSyntaxRootAsync(cancellation);
- await Task.WhenAll(semanticModelTask, syntaxRootTask).ConfigureAwait(false);
+ await Task.WhenAll(semanticModelTask, syntaxRootTask)
+ .ConfigureAwait(continueOnCapturedContext);
return (semanticModelTask.Result, syntaxRootTask.Result);
}
diff --git a/src/Acuminator/Acuminator.Vsix/AcuminatorVSPackage.cs b/src/Acuminator/Acuminator.Vsix/AcuminatorVSPackage.cs
index 30f8c306d..3c1f919d9 100644
--- a/src/Acuminator/Acuminator.Vsix/AcuminatorVSPackage.cs
+++ b/src/Acuminator/Acuminator.Vsix/AcuminatorVSPackage.cs
@@ -504,9 +504,6 @@ private static void DeployCodeSnippets(AcuminatorMyDocumentsStorage? myDocuments
#region Package Settings
public bool ColoringEnabled => GeneralOptionsPage?.ColoringEnabled ?? AcuminatorConstants.Settings.Coloring.ColoringEnabledDefault;
-
- public bool UseRegexColoring => GeneralOptionsPage?.UseRegexColoring ?? AcuminatorConstants.Settings.Coloring.UseRegexColoringDefault;
-
public bool UseBqlOutlining => GeneralOptionsPage?.UseBqlOutlining ?? AcuminatorConstants.Settings.Outlining.UseBqlOutliningDefault;
public bool UseBqlDetailedOutlining =>
diff --git a/src/Acuminator/Acuminator.Vsix/BannedApi/BannedApiDeployer.cs b/src/Acuminator/Acuminator.Vsix/BannedApi/BannedApiDeployer.cs
index b20b8f373..50f9bc271 100644
--- a/src/Acuminator/Acuminator.Vsix/BannedApi/BannedApiDeployer.cs
+++ b/src/Acuminator/Acuminator.Vsix/BannedApi/BannedApiDeployer.cs
@@ -35,7 +35,7 @@ private BannedApiDeployer(AcuminatorMyDocumentsStorage myDocumentsStorage, strin
return null;
try
{
- string bannedApiFolder = Path.Combine(myDocumentsStorage.AcuminatorFolder, Constants.BannedApi.BannnedApiFolder);
+ string bannedApiFolder = Path.Combine(myDocumentsStorage.AcuminatorFolder, Constants.BannedApi.BannedApiFolder);
return new BannedApiDeployer(myDocumentsStorage, bannedApiFolder);
}
catch (Exception e)
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/BackgroundTagging.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/BackgroundTagging.cs
index 69e2418e2..72d583c5d 100644
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/BackgroundTagging.cs
+++ b/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/BackgroundTagging.cs
@@ -1,7 +1,5 @@
#nullable enable
-
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@@ -13,10 +11,9 @@
namespace Acuminator.Vsix.Coloriser
{
- public class BackgroundTagging : IDisposable
+ internal class BackgroundTagging : IDisposable
{
- private static TaskScheduler? _vsTaskScheduler;
-
+ private static TaskScheduler? _vsTaskScheduler;
private CancellationTokenSource _cancellationTokenSource = new();
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
@@ -27,10 +24,9 @@ public class BackgroundTagging : IDisposable
private BackgroundTagging()
{
-
}
- public static BackgroundTagging StartBackgroundTagging(PXColorizerTaggerBase tagger)
+ public static BackgroundTagging StartBackgroundTagging(PXRoslynColorizerTagger tagger)
{
tagger.ThrowOnNull();
@@ -48,10 +44,22 @@ public static BackgroundTagging StartBackgroundTagging(PXColorizerTaggerBase tag
// No need for synchronization because FromCurrentSynchronizationContext creates schedulers which wrap around the same synchronization context
// Therefore all schedulers should be identical and nothing wrong will happen if different thread will create multiple instance of the scheduler in a race condition
_vsTaskScheduler = _vsTaskScheduler ?? TaskScheduler.FromCurrentSynchronizationContext();
- backgroundTagging.TaggingTask = taggingTask.ContinueWith(task => AfterTaggingActionAsync(tagger, backgroundTagging.CancellationToken), //continuation should be on the UI thread
+ var continuationTask = taggingTask.ContinueWith(task => AfterTaggingActionAsync(task, tagger, backgroundTagging.CancellationToken), //continuation should be on the UI thread
backgroundTagging.CancellationToken,
- TaskContinuationOptions.OnlyOnRanToCompletion,
+ TaskContinuationOptions.NotOnCanceled,
_vsTaskScheduler);
+
+ // ContinueWith schedules the lambda on the VS UI thread scheduler. The lambda runs on the UI thread and calls AfterTaggingActionAsync(...).
+ // Inside AfterTaggingActionAsync, the important path calls ThreadHelper.JoinableTaskFactory.RunAsync(tagger.RaiseTagsChangedAsync).Task
+ // this starts RaiseTagsChangedAsync and immediately returns the underlying Task representing it (still running).
+ // The lambda returns that inner Task immediately — it does not await it.
+ // The outer Task stored in TaggingTask is marked as Completed (RanToCompletion) at this point, because the lambda has returned.
+ // The outer task's result is the still-running inner task, but the outer task itself is done.
+ // RaiseTagsChangedAsync may still be running in the background raising tags-changed notifications.
+ //
+ // Thus, we need to keep the nested unwrapped task as the tagging task to be able to correctly calculate IsTaskRunning() and
+ // handle exceptions thrown in the AfterTaggingActionAsync.
+ backgroundTagging.TaggingTask = continuationTask.Unwrap();
return backgroundTagging;
}
@@ -76,12 +84,21 @@ public void Dispose()
_cancellationTokenSource.Dispose();
}
- private static Task AfterTaggingActionAsync(PXColorizerTaggerBase tagger, CancellationToken cancellationToken)
+ private static Task AfterTaggingActionAsync(Task taggingTask, PXRoslynColorizerTagger tagger, CancellationToken cancellationToken)
{
- if (cancellationToken.IsCancellationRequested)
+ if (taggingTask.IsCanceled || cancellationToken.IsCancellationRequested)
+ {
+ tagger.LastTaggingWasSuccessful = false;
return Task.FromCanceled(cancellationToken);
-
- // We should be on UI thread here but the tagger.RaiseTagsChangedAsync switches to UI thread from non UI threads internally if needed
+ }
+
+ if (taggingTask.IsFaulted)
+ {
+ tagger.LastTaggingWasSuccessful = false;
+ return Task.FromException(taggingTask.Exception!);
+ }
+
+ // We should be on UI thread here but the tagger.RaiseTagsChangedAsync switches to UI thread from non UI threads internally if needed
return Shell.ThreadHelper.JoinableTaskFactory.RunAsync(tagger.RaiseTagsChangedAsync).Task;
}
}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/Interfaces/ITagsCache.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/Interfaces/ITagsCache.cs
deleted file mode 100644
index 0998c5b68..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/Interfaces/ITagsCache.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-using Microsoft.VisualStudio.Text.Tagging;
-using System.Collections;
-using Acuminator.Vsix.Utilities;
-
-
-namespace Acuminator.Vsix.Coloriser
-{
- public interface ITagsCache : IReadOnlyCollection>
- where TTag : ITag
- {
- bool IsCompleted { get; }
-
- IReadOnlyCollection> ProcessedTags { get; }
-
- void CompleteProcessing();
-
- void Reset();
-
- void AddTag(ITagSpan tag);
-
- void AddTags(IEnumerable> tags);
- }
-}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/TagsCacheAsync.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/TagsCacheAsync.cs
index dc8ba60fd..67f2c10ab 100644
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/TagsCacheAsync.cs
+++ b/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/TagsCacheAsync.cs
@@ -1,5 +1,4 @@
#nullable enable
-
using System;
using System.Collections;
using System.Collections.Concurrent;
@@ -7,77 +6,76 @@
using System.Linq;
using System.Threading;
-using Acuminator.Utilities;
using Acuminator.Utilities.Common;
using Microsoft.VisualStudio.Text.Tagging;
namespace Acuminator.Vsix.Coloriser
{
- public class TagsCacheAsync : ITagsCache
- where TTag : ITag
- {
- protected CancellationToken CancellationToken { get; set; }
+ public class TagsCacheAsync : IReadOnlyCollection>
+ where TTag : ITag
+ {
+ protected CancellationToken CancellationToken { get; set; }
+
+ public bool IsCompleted { get; private set; }
- public bool IsCompleted { get; private set; }
+ private readonly ConcurrentQueue> _tagsQueue = new ConcurrentQueue>();
- private readonly ConcurrentQueue> _tagsQueue = new ConcurrentQueue>();
+ public IReadOnlyCollection> ProcessedTags => _tagsQueue;
- public IReadOnlyCollection> ProcessedTags => _tagsQueue;
-
- public int Count => ProcessedTags.Count;
+ public int Count => ProcessedTags.Count;
- public TagsCacheAsync()
- {
- CancellationToken = CancellationToken.None;
- }
+ public TagsCacheAsync()
+ {
+ CancellationToken = CancellationToken.None;
+ }
- internal void SetCancellation(CancellationToken cancellationToken)
- {
- CancellationToken = cancellationToken;
- }
+ internal void SetCancellation(CancellationToken cancellationToken)
+ {
+ CancellationToken = cancellationToken;
+ }
- public void CompleteProcessing()
- {
- if (CancellationToken.IsCancellationRequested)
- return;
+ public void CompleteProcessing()
+ {
+ if (CancellationToken.IsCancellationRequested)
+ return;
- IsCompleted = true;
- }
+ IsCompleted = true;
+ }
- public void Reset()
- {
- _tagsQueue.Clear();
+ public void Reset()
+ {
+ _tagsQueue.Clear();
- IsCompleted = false;
- }
+ IsCompleted = false;
+ }
- public void AddTag(ITagSpan tag)
- {
- if (tag == null || CancellationToken.IsCancellationRequested)
- return;
+ public void AddTag(ITagSpan tag)
+ {
+ if (tag == null || CancellationToken.IsCancellationRequested)
+ return;
- _tagsQueue.Enqueue(tag);
- }
+ _tagsQueue.Enqueue(tag);
+ }
- public void AddTags(IEnumerable> tags)
- {
- List>? tagsCopy = tags?.ToList();
+ public void AddTags(IEnumerable> tags)
+ {
+ List>? tagsCopy = tags?.ToList();
- if (tagsCopy.IsNullOrEmpty() || CancellationToken.IsCancellationRequested)
- return;
+ if (tagsCopy.IsNullOrEmpty() || CancellationToken.IsCancellationRequested)
+ return;
- foreach (ITagSpan tag in tagsCopy)
- {
- if (CancellationToken.IsCancellationRequested)
- return;
+ foreach (ITagSpan tag in tagsCopy)
+ {
+ if (CancellationToken.IsCancellationRequested)
+ return;
- _tagsQueue.Enqueue(tag);
- }
- }
+ _tagsQueue.Enqueue(tag);
+ }
+ }
- public IEnumerator> GetEnumerator() => ProcessedTags.GetEnumerator();
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
- }
+ public IEnumerator> GetEnumerator() => ProcessedTags.GetEnumerator();
+ }
}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/TagsCacheSync.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/TagsCacheSync.cs
deleted file mode 100644
index c8dc7bc07..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/AsyncTagging/TagsCacheSync.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using Microsoft.VisualStudio.Text.Tagging;
-using System.Collections;
-using Acuminator.Utilities;
-
-
-namespace Acuminator.Vsix.Coloriser
-{
- public class TagsCacheSync : ITagsCache
- where TTag : ITag
- {
- private const int DefaultCapacity = 64;
-
- public bool IsCompleted { get; private set; }
-
- private readonly List> _resultTagsList;
-
- public IReadOnlyCollection> ProcessedTags { get; }
-
- public int Count => ProcessedTags.Count;
-
- public TagsCacheSync(int? capacity = null)
- {
- _resultTagsList = new List>(capacity ?? DefaultCapacity);
- ProcessedTags = _resultTagsList.AsReadOnly();
- }
-
- public void CompleteProcessing()
- {
- IsCompleted = true;
- }
-
- public void Reset()
- {
- _resultTagsList.Clear();
- IsCompleted = false;
- }
-
- public void AddTag(ITagSpan tag)
- {
- if (tag == null)
- return;
-
- _resultTagsList.Add(tag);
- }
-
- public void AddTags(IEnumerable> tags) => _resultTagsList.AddRange(tags);
-
- public IEnumerator> GetEnumerator() => ProcessedTags.GetEnumerator();
-
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
- }
-}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/Base/PXTaggerBase.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/Base/PXTaggerBase.cs
index f0124e882..0ecf4b4e4 100644
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/Base/PXTaggerBase.cs
+++ b/src/Acuminator/Acuminator.Vsix/Coloriser/Base/PXTaggerBase.cs
@@ -1,7 +1,7 @@
#nullable enable
-
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
@@ -9,118 +9,106 @@
using Acuminator.Vsix.Settings;
using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Tagging;
-using Shell = Microsoft.VisualStudio.Shell;
+using ThreadHelper = Microsoft.VisualStudio.Shell.ThreadHelper;
namespace Acuminator.Vsix.Coloriser
{
- ///
- /// Values that represent tagger types.
- ///
- public enum TaggerType
- {
- ///
- /// The general tagger which chooses other taggers according to the settings.
- ///
- General,
-
- ///
- /// The tagger based on Roslyn
- ///
- Roslyn,
-
- ///
- /// The tagger based on regular expressions
- ///
- RegEx,
-
- ///
- /// The tagger used for outlining
- ///
- Outlining
- };
-
- public abstract class PXTaggerBase : IDisposable
- {
+ public abstract class PXTaggerBase : IDisposable
+ {
#pragma warning disable CS0067
- public event EventHandler? TagsChanged;
+ public event EventHandler? TagsChanged;
#pragma warning restore CS0067
- protected ITextBuffer Buffer { get; }
+ protected ITextBuffer Buffer { get; }
+
+ protected internal ITextSnapshot? Snapshot { get; private set; }
+
+ protected bool ColoringSettingsChanged { get; private set; }
- protected internal ITextSnapshot? Snapshot { get; private set; }
+ protected bool SubscribedToSettingsChanges { get; private set; }
- protected bool ColoringSettingsChanged { get; private set; }
+ internal abstract bool LastTaggingWasSuccessful { get; set; }
- protected bool SubscribedToSettingsChanges { get; private set; }
+ public abstract bool HasReferenceToAcumaticaPlatform { get; }
- protected PXTaggerProviderBase ProviderBase { get; }
+ protected bool CacheCheckingEnabled { get; }
- ///
- /// The type of the tagger.
- ///
- public abstract TaggerType TaggerType { get; }
+ protected PXTaggerBase(ITextBuffer buffer, bool subscribeToSettingsChanges, bool useCacheChecking)
+ {
+ Buffer = buffer.CheckIfNull();
+ SubscribedToSettingsChanges = subscribeToSettingsChanges;
+ CacheCheckingEnabled = useCacheChecking;
+
+ if (SubscribedToSettingsChanges)
+ {
+ var genOptionsPage = AcuminatorVSPackage.Instance?.GeneralOptionsPage;
- protected bool CacheCheckingEnabled { get; }
+ if (genOptionsPage != null)
+ {
+ genOptionsPage.ColoringSettingChanged += ColoringSettingChangedHandler;
+ }
+ }
+ }
- protected PXTaggerBase(ITextBuffer buffer, PXTaggerProviderBase provider, bool subscribeToSettingsChanges, bool useCacheChecking)
- {
- Buffer = buffer.CheckIfNull();
- ProviderBase = provider.CheckIfNull();
- SubscribedToSettingsChanges = subscribeToSettingsChanges;
- CacheCheckingEnabled = useCacheChecking;
+ private void ColoringSettingChangedHandler(object sender, SettingChangedEventArgs e)
+ {
+ ColoringSettingsChanged = true;
+ LastTaggingWasSuccessful = false;
- if (SubscribedToSettingsChanges)
- {
- var genOptionsPage = AcuminatorVSPackage.Instance?.GeneralOptionsPage;
+ // Coloring setting should be called from the UI thread and there is a safety check in RaiseTagsChanged
+ // It should be OK to make a sync call
+ RaiseTagsChanged();
+ }
- if (genOptionsPage != null)
- {
- genOptionsPage.ColoringSettingChanged += ColoringSettingChangedHandler;
- }
- }
- }
+ internal async Task RaiseTagsChangedAsync()
+ {
+ if (!ThreadHelper.CheckAccess())
+ {
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
+ }
- protected virtual void ColoringSettingChangedHandler(object sender, SettingChangedEventArgs e)
- {
- ColoringSettingsChanged = true;
- Shell.ThreadHelper.JoinableTaskFactory.Run(RaiseTagsChangedAsync);
- }
+ RaiseTagsChangedImpl();
+ }
- internal async virtual Task RaiseTagsChangedAsync()
+ internal void RaiseTagsChanged()
{
- if (!Shell.ThreadHelper.CheckAccess())
+ if (!ThreadHelper.CheckAccess())
{
- await Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
+ Debug.Fail("RaiseTagsChanged should be called from the UI thread. " +
+ "Call RaiseTagsChangedAsync if you need to raise tags changed from a background thread.");
+ return;
}
+ RaiseTagsChangedImpl();
+ }
+
+ private void RaiseTagsChangedImpl()
+ {
TagsChanged?.Invoke(this,
new SnapshotSpanEventArgs(
new SnapshotSpan(Buffer.CurrentSnapshot,
new Span(0, Buffer.CurrentSnapshot.Length))));
}
- protected internal virtual void ResetCacheAndFlags(ITextSnapshot newCache)
- {
- ColoringSettingsChanged = false;
- Snapshot = newCache;
- }
-
- protected virtual bool CheckIfRetaggingIsNotNecessary(ITextSnapshot snapshot) =>
- CacheCheckingEnabled && Snapshot != null && Snapshot == snapshot && !ColoringSettingsChanged;
+ protected internal virtual void ResetCacheAndFlags(ITextSnapshot? newSnapshotToCache)
+ {
+ ColoringSettingsChanged = false;
+ LastTaggingWasSuccessful = false;
+ Snapshot = newSnapshotToCache;
+ }
- public virtual void Dispose()
- {
- if (!SubscribedToSettingsChanges)
- return;
+ public virtual void Dispose()
+ {
+ if (!SubscribedToSettingsChanges)
+ return;
- var genOptionsPage = AcuminatorVSPackage.Instance?.GeneralOptionsPage;
+ var genOptionsPage = AcuminatorVSPackage.Instance?.GeneralOptionsPage;
- if (genOptionsPage != null)
- {
- genOptionsPage.ColoringSettingChanged -= ColoringSettingChangedHandler;
- }
- }
- }
+ if (genOptionsPage != null)
+ {
+ genOptionsPage.ColoringSettingChanged -= ColoringSettingChangedHandler;
+ }
+ }
+ }
}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/Base/PXTaggerProviderBase.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/Base/PXTaggerProviderBase.cs
deleted file mode 100644
index 5036ccd68..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/Base/PXTaggerProviderBase.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#nullable enable
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.VisualStudio.Text;
-
-using Path = System.IO.Path;
-
-namespace Acuminator.Vsix.Coloriser
-{
- public abstract class PXTaggerProviderBase
- {
- protected bool HasReferenceToAcumaticaPlatform { get; private set; }
-
- public Workspace? Workspace { get; private set; }
-
- ///
- /// Initializes the base fields - and .
- ///
- protected virtual void Initialize(ITextBuffer buffer)
- {
- Workspace = buffer?.GetWorkspace();
- HasReferenceToAcumaticaPlatform = CheckIfCurrentSolutionHasReferenceToAcumatica();
- }
-
- protected bool CheckIfCurrentSolutionHasReferenceToAcumatica()
- {
- if (Workspace?.CurrentSolution == null)
- return false;
-
- bool hasAcumaticaProjectsInSolution =
- Workspace.CurrentSolution.Projects.Any(project => IsAcumaticaAssemblyName(project.Name) ||
- IsAcumaticaAssemblyName(project.AssemblyName));
- if (hasAcumaticaProjectsInSolution)
- return true;
-
- bool hasMetadataRefs = (from project in Workspace.CurrentSolution.Projects
- from reference in project.MetadataReferences
- select Path.GetFileNameWithoutExtension(reference.Display))
- .Any(reference => IsAcumaticaAssemblyName(reference));
-
- return hasMetadataRefs;
-
- //*********************************************************************************************************************************
- static bool IsAcumaticaAssemblyName(string dllName) => ColoringConstants.PlatformDllName == dllName ||
- ColoringConstants.AppDllName == dllName;
- }
- }
-}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/MainTagger/PXColorizerMainTagger.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/MainTagger/PXColorizerMainTagger.cs
deleted file mode 100644
index 3a9452344..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/MainTagger/PXColorizerMainTagger.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-#nullable enable
-
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-using Acuminator.Utilities;
-using Acuminator.Utilities.Common;
-
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Classification;
-using Microsoft.VisualStudio.Text.Tagging;
-
-namespace Acuminator.Vsix.Coloriser
-{
- ///
- /// A colorizer tagger base class.
- ///
- public class PXColorizerMainTagger : PXColorizerTaggerBase
- {
- public override TaggerType TaggerType => TaggerType.General;
-
- private readonly Dictionary _taggersByType;
-
- protected internal override bool UseAsyncTagging
- {
- get {
- TaggerType currentTaggerType = GetCurrentTaggerTypeFromSettings();
- return _taggersByType.TryGetValue(currentTaggerType, out PXColorizerTaggerBase tagger)
- ? tagger.UseAsyncTagging
- : false;
- }
- }
-
- protected internal override ITagsCache ClassificationTagsCache
- {
- get {
- TaggerType currentTaggerType = GetCurrentTaggerTypeFromSettings();
- return _taggersByType.TryGetValue(currentTaggerType, out PXColorizerTaggerBase tagger)
- ? tagger.ClassificationTagsCache
- : throw new NotSupportedException($"Tagger type {currentTaggerType} not supported");
- }
- }
-
- protected internal override ITagsCache OutliningsTagsCache
- {
- get {
- TaggerType currentTaggerType = GetCurrentTaggerTypeFromSettings();
- return _taggersByType.TryGetValue(currentTaggerType, out PXColorizerTaggerBase tagger)
- ? tagger.OutliningsTagsCache
- : throw new NotSupportedException($"Tagger type {currentTaggerType} not supported");
- }
- }
-
- public PXColorizerMainTagger(ITextBuffer buffer, PXColorizerTaggerProvider aProvider, bool subscribeToSettingsChanges,
- bool useCacheChecking) :
- base(buffer, aProvider, subscribeToSettingsChanges, useCacheChecking)
- {
- PXColorizerTaggerBase roslynTagger = new PXRoslynColorizerTagger(buffer, aProvider, subscribeToSettingsChanges: false,
- useCacheChecking: false);
- PXColorizerTaggerBase regexTagger = new PXRegexColorizerTagger(buffer, aProvider, subscribeToSettingsChanges: false,
- useCacheChecking: false);
-
- _taggersByType = new Dictionary(capacity: 2)
- {
- { roslynTagger.TaggerType, roslynTagger },
- { regexTagger.TaggerType, regexTagger }
- };
- }
-
- protected internal override IEnumerable> GetTagsSynchronousImplementation(ITextSnapshot snapshot)
- {
- TaggerType currentTaggerType = GetCurrentTaggerTypeFromSettings();
-
- if (!_taggersByType.TryGetValue(currentTaggerType, out PXColorizerTaggerBase activeTagger))
- return [];
-
- return activeTagger.GetTagsSynchronousImplementation(snapshot);
- }
-
- protected internal override Task>> GetTagsAsyncImplementationAsync(ITextSnapshot snapshot,
- CancellationToken cancellationToken)
- {
- TaggerType currentTaggerType = GetCurrentTaggerTypeFromSettings();
-
- if (!_taggersByType.TryGetValue(currentTaggerType, out PXColorizerTaggerBase activeTagger))
- return Task.FromResult(Enumerable.Empty>());
-
- if (activeTagger.UseAsyncTagging)
- {
- return activeTagger.GetTagsAsyncImplementationAsync(snapshot, cancellationToken);
- }
- else
- {
- var tags = activeTagger.GetTagsSynchronousImplementation(snapshot);
- return Task.FromResult(tags);
- }
- }
-
- public override void Dispose()
- {
- _taggersByType.Values.Distinct()
- .ForEach(tagger => tagger.Dispose());
- base.Dispose();
- }
-
- protected internal override void ResetCacheAndFlags(ITextSnapshot newCache)
- {
- base.ResetCacheAndFlags(newCache);
- _taggersByType.Values.ForEach(tagger => tagger.ResetCacheAndFlags(newCache));
- }
-
- protected TaggerType GetCurrentTaggerTypeFromSettings()
- {
- return AcuminatorVSPackage.Instance?.UseRegexColoring == true
- ? TaggerType.RegEx
- : TaggerType.Roslyn;
- }
- }
-}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/Outlining/PXOutliningTagger.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/Outlining/PXOutliningTagger.cs
index a52a5d1a2..7735721b2 100644
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/Outlining/PXOutliningTagger.cs
+++ b/src/Acuminator/Acuminator.Vsix/Coloriser/Outlining/PXOutliningTagger.cs
@@ -1,33 +1,34 @@
#nullable enable
-
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Tagging;
-using Shell = Microsoft.VisualStudio.Shell;
-
namespace Acuminator.Vsix.Coloriser
{
- public class PXOutliningTagger : PXTaggerBase, ITagger
+ internal class PXOutliningTagger : PXTaggerBase, ITagger
{
private int _isSubscribed = NOT_SUBSCRIBED;
private const int NOT_SUBSCRIBED = 0;
private const int SUBSCRIBED = 1;
- public override TaggerType TaggerType => TaggerType.Outlining;
+ protected PXRoslynColorizerTagger? ColorizerTagger { get; private set; }
- protected PXOutliningTaggerProvider Provider => (ProviderBase as PXOutliningTaggerProvider)!;
+ internal override bool LastTaggingWasSuccessful
+ {
+ get => ColorizerTagger?.LastTaggingWasSuccessful ?? false;
+ set { }
+ }
- protected PXColorizerTaggerBase? ColorizerTagger { get; private set; }
+ [MemberNotNullWhen(returnValue: true, nameof(ColorizerTagger))]
+ public override bool HasReferenceToAcumaticaPlatform => ColorizerTagger?.HasReferenceToAcumaticaPlatform ?? false;
- public PXOutliningTagger(ITextBuffer buffer, PXOutliningTaggerProvider aProvider,
- bool subscribeToSettingsChanges, bool useCacheChecking) :
- base(buffer, aProvider, subscribeToSettingsChanges, useCacheChecking)
+ public PXOutliningTagger(ITextBuffer buffer, bool subscribeToSettingsChanges, bool useCacheChecking) :
+ base(buffer, subscribeToSettingsChanges, useCacheChecking)
{
}
@@ -38,33 +39,26 @@ public IEnumerable> GetTags(NormalizedSnapshotSpan
if (ColorizerTagger == null)
{
- if (!TryGetColorizingTaggerFromBuffer(Buffer, out PXColorizerTaggerBase colorizingTagger) || colorizingTagger == null)
+ if (!TryGetColorizingTaggerFromBuffer(Buffer, out PXRoslynColorizerTagger colorizingTagger) || colorizingTagger == null)
return [];
SubscribeToColorizingTaggerEvents(colorizingTagger);
}
- switch (ColorizerTagger?.TaggerType)
- {
- case TaggerType.General when AcuminatorVSPackage.Instance?.UseRegexColoring == true:
- case TaggerType.RegEx:
- case null:
- return [];
- }
+ // Check reference to Acumatica platform only after initializing ColorizerTagger
+ if (!HasReferenceToAcumaticaPlatform)
+ return [];
return ColorizerTagger.OutliningsTagsCache.ProcessedTags;
}
- private static bool TryGetColorizingTaggerFromBuffer(ITextBuffer textBuffer, out PXColorizerTaggerBase colorizingTagger)
+ private static bool TryGetColorizingTaggerFromBuffer(ITextBuffer textBuffer, out PXRoslynColorizerTagger colorizingTagger)
{
- return textBuffer.Properties.TryGetProperty(typeof(PXColorizerTaggerBase), out colorizingTagger);
+ return textBuffer.Properties.TryGetProperty(typeof(PXRoslynColorizerTagger), out colorizingTagger);
}
- private void SubscribeToColorizingTaggerEvents(PXColorizerTaggerBase colorizerTagger)
+ private void SubscribeToColorizingTaggerEvents(PXRoslynColorizerTagger colorizerTagger)
{
- if (colorizerTagger.TaggerType == TaggerType.RegEx)
- return;
-
if (Interlocked.Exchange(ref _isSubscribed, SUBSCRIBED) == NOT_SUBSCRIBED)
{
ColorizerTagger = colorizerTagger;
@@ -74,7 +68,7 @@ private void SubscribeToColorizingTaggerEvents(PXColorizerTaggerBase colorizerTa
private void OnColorizingTaggerTagsChanged(object sender, SnapshotSpanEventArgs e)
{
- Shell.ThreadHelper.JoinableTaskFactory.Run(RaiseTagsChangedAsync);
+ RaiseTagsChanged();
}
public override void Dispose()
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/Outlining/PXOutliningTaggerProvider.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/Outlining/PXOutliningTaggerProvider.cs
index 8b8cd5728..1a525d29b 100644
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/Outlining/PXOutliningTaggerProvider.cs
+++ b/src/Acuminator/Acuminator.Vsix/Coloriser/Outlining/PXOutliningTaggerProvider.cs
@@ -18,21 +18,16 @@ namespace Acuminator.Vsix.Coloriser
[TagType(typeof(IOutliningRegionTag))]
[TextViewRole(PredefinedTextViewRoles.Document)]
[Export(typeof(ITaggerProvider))]
- public class PXOutliningTaggerProvider : PXTaggerProviderBase, ITaggerProvider
+ public class PXOutliningTaggerProvider : ITaggerProvider
{
public ITagger? CreateTagger(ITextBuffer buffer) where T : ITag
{
if (buffer == null || !ThreadHelper.CheckAccess())
return null;
- Initialize(buffer);
-
- if (!HasReferenceToAcumaticaPlatform)
- return null;
-
PXOutliningTagger outliningTagger = buffer.Properties.GetOrCreateSingletonProperty(() =>
{
- return new PXOutliningTagger(buffer, this, subscribeToSettingsChanges: true, useCacheChecking: true);
+ return new PXOutliningTagger(buffer, subscribeToSettingsChanges: true, useCacheChecking: true);
});
return outliningTagger as ITagger;
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/PXColorizerTaggerBase.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/PXColorizerTaggerBase.cs
deleted file mode 100644
index a4812a06d..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/PXColorizerTaggerBase.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-#nullable enable
-// The asynchronous tagging part of the PXColorizerTaggerBase class
-
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Classification;
-using Microsoft.VisualStudio.Text.Tagging;
-
-namespace Acuminator.Vsix.Coloriser
-{
- ///
- /// A colorizer tagger base class.
- ///
- public abstract class PXColorizerTaggerBase : PXTaggerBase, ITagger, IDisposable
- {
- public BackgroundTagging? BackgroundTagging { get; protected set; }
-
- protected internal abstract ITagsCache ClassificationTagsCache { get; }
-
- protected internal abstract ITagsCache OutliningsTagsCache { get; }
-
- protected internal abstract bool UseAsyncTagging { get; }
-
- protected PXColorizerTaggerProvider Provider => (ProviderBase as PXColorizerTaggerProvider)!;
-
- protected PXColorizerTaggerBase(ITextBuffer buffer, PXColorizerTaggerProvider aProvider, bool subscribeToSettingsChanges,
- bool useCacheChecking) :
- base(buffer, aProvider, subscribeToSettingsChanges, useCacheChecking)
- {
- }
-
- protected internal override void ResetCacheAndFlags(ITextSnapshot newCache)
- {
- base.ResetCacheAndFlags(newCache);
- ClassificationTagsCache.Reset();
- OutliningsTagsCache.Reset();
- }
-
- public virtual IEnumerable> GetTags(NormalizedSnapshotSpanCollection spans)
- {
- if (spans == null || spans.Count == 0 || AcuminatorVSPackage.Instance?.ColoringEnabled != true)
- return Array.Empty>();
-
- ITextSnapshot snapshot = spans[0].Snapshot;
-
- if (CheckIfRetaggingIsNotNecessary(snapshot))
- {
- return ClassificationTagsCache.ProcessedTags;
- }
-
- if (UseAsyncTagging)
- {
- return GetTagsAsync(snapshot);
- }
- else
- {
- ResetCacheAndFlags(snapshot);
- return GetTagsSynchronousImplementation(snapshot);
- }
- }
-
-#pragma warning disable VSTHRD200 // Use "Async" suffix for async methods - this method is async by its nature.
- ///
- /// Gets the tags asynchronous in this collection.
- ///
- /// The snapshot.
- ///
- /// An enumerator that allows foreach to be used to process the tags asynchronous in this collection.
- ///
- protected virtual IEnumerable> GetTagsAsync(ITextSnapshot snapshot)
-
- {
- if (BackgroundTagging != null)
- {
- BackgroundTagging.CancelTagging(); //Cancel currently running task
- BackgroundTagging = null;
- }
-
- ResetCacheAndFlags(snapshot);
- BackgroundTagging = BackgroundTagging.StartBackgroundTagging(this);
-
- return ClassificationTagsCache.ProcessedTags;
- }
-#pragma warning restore VSTHRD200
-
- protected internal abstract IEnumerable> GetTagsSynchronousImplementation(ITextSnapshot snapshot);
-
- protected internal abstract Task>> GetTagsAsyncImplementationAsync(ITextSnapshot snapshot,
- CancellationToken cancellationToken);
-
- public override void Dispose()
- {
- BackgroundTagging?.Dispose();
- ClassificationTagsCache?.Reset();
- OutliningsTagsCache?.Reset();
-
- base.Dispose();
- }
- }
-}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/PXColorizerTaggerProvider.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/PXColorizerTaggerProvider.cs
index e3618aa1e..2e25233b1 100644
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/PXColorizerTaggerProvider.cs
+++ b/src/Acuminator/Acuminator.Vsix/Coloriser/PXColorizerTaggerProvider.cs
@@ -1,5 +1,4 @@
#nullable enable
-
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
@@ -19,13 +18,15 @@
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
+using ThreadHelper = Microsoft.VisualStudio.Shell.ThreadHelper;
+
namespace Acuminator.Vsix.Coloriser
{
[ContentType(Constants.CSharp.LegacyLanguageName)]
[TagType(typeof(IClassificationTag))]
[TextViewRole(PredefinedTextViewRoles.Document)]
[Export(typeof(IViewTaggerProvider))]
- public class PXColorizerTaggerProvider : PXTaggerProviderBase, IViewTaggerProvider
+ public class PXColorizerTaggerProvider : IViewTaggerProvider
{
[Import]
internal IClassificationTypeRegistryService _classificationRegistry = null!; // Set via MEF
@@ -71,30 +72,28 @@ public IClassificationType? this[int braceLevel]
public virtual ITagger? CreateTagger(ITextView textView, ITextBuffer textBuffer)
where T : ITag
{
- Initialize(textBuffer);
-
- if (textView.TextBuffer != textBuffer || !HasReferenceToAcumaticaPlatform)
+ if (textView == null || textBuffer == null || textView.TextBuffer != textBuffer || !ThreadHelper.CheckAccess())
return null;
- var tagger = textBuffer.Properties.GetOrCreateSingletonProperty(typeof(PXColorizerTaggerBase), () =>
+ Initialize(textBuffer);
+
+ var tagger = textBuffer.Properties.GetOrCreateSingletonProperty(typeof(PXRoslynColorizerTagger), () =>
{
- return new PXColorizerMainTagger(textBuffer, this, subscribeToSettingsChanges: true, useCacheChecking: true);
+ return new PXRoslynColorizerTagger(textBuffer, this, subscribeToSettingsChanges: true, useCacheChecking: true);
});
return tagger as ITagger;
}
[MemberNotNull(nameof(_codeColoringClassificationTypes), nameof(_braceTypeByLevel))]
- protected override void Initialize(ITextBuffer textBuffer)
+ protected void Initialize(ITextBuffer textBuffer)
{
- base.Initialize(textBuffer);
-
if (AreClassificationsInitialized)
return;
AreClassificationsInitialized = true;
InitializeClassificationTypes();
- IncreaseCommentFormatTypesPrioirity(_classificationRegistry, _classificationFormatMapService,
+ IncreaseCommentFormatTypesPriority(_classificationRegistry, _classificationFormatMapService,
_codeColoringClassificationTypes[PXCodeType.BqlParameter]);
}
@@ -105,17 +104,17 @@ protected void InitializeClassificationTypes()
_codeColoringClassificationTypes = new Dictionary
{
- [PXCodeType.Dac] = _classificationRegistry.GetClassificationType(ColoringConstants.DacFormat),
+ [PXCodeType.Dac] = _classificationRegistry.GetClassificationType(ColoringConstants.DacFormat),
[PXCodeType.DacExtension] = _classificationRegistry.GetClassificationType(ColoringConstants.DacExtensionFormat),
- [PXCodeType.DacField] = _classificationRegistry.GetClassificationType(ColoringConstants.DacFieldFormat),
+ [PXCodeType.DacField] = _classificationRegistry.GetClassificationType(ColoringConstants.DacFieldFormat),
[PXCodeType.BqlParameter] = _classificationRegistry.GetClassificationType(ColoringConstants.BQLParameterFormat),
- [PXCodeType.BqlOperator] = bqlClassificationType,
- [PXCodeType.BqlCommand] = bqlClassificationType,
+ [PXCodeType.BqlOperator] = bqlClassificationType,
+ [PXCodeType.BqlCommand] = bqlClassificationType,
[PXCodeType.BQLConstantPrefix] = _classificationRegistry.GetClassificationType(ColoringConstants.BQLConstantPrefixFormat),
[PXCodeType.BQLConstantEnding] = _classificationRegistry.GetClassificationType(ColoringConstants.BQLConstantEndingFormat),
- [PXCodeType.PXGraph] = _classificationRegistry.GetClassificationType(ColoringConstants.PXGraphFormat),
+ [PXCodeType.PXGraph] = _classificationRegistry.GetClassificationType(ColoringConstants.PXGraphFormat),
[PXCodeType.PXAction] = _classificationRegistry.GetClassificationType(ColoringConstants.PXActionFormat),
};
@@ -133,7 +132,7 @@ protected void InitializeClassificationTypes()
[7] = _classificationRegistry.GetClassificationType(ColoringConstants.BraceLevel_8_Format),
[8] = _classificationRegistry.GetClassificationType(ColoringConstants.BraceLevel_9_Format),
- [9] = _classificationRegistry.GetClassificationType(ColoringConstants.BraceLevel_10_Format),
+ [9] = _classificationRegistry.GetClassificationType(ColoringConstants.BraceLevel_10_Format),
[10] = _classificationRegistry.GetClassificationType(ColoringConstants.BraceLevel_11_Format),
[11] = _classificationRegistry.GetClassificationType(ColoringConstants.BraceLevel_12_Format),
@@ -142,7 +141,7 @@ protected void InitializeClassificationTypes()
};
}
- private static void IncreaseCommentFormatTypesPrioirity(IClassificationTypeRegistryService registry, IClassificationFormatMapService formatMapService,
+ private static void IncreaseCommentFormatTypesPriority(IClassificationTypeRegistryService registry, IClassificationFormatMapService formatMapService,
IClassificationType highestPriorityType)
{
bool lockTaken = false;
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs
new file mode 100644
index 000000000..00218015c
--- /dev/null
+++ b/src/Acuminator/Acuminator.Vsix/Coloriser/PXRoslynColorizerTagger.cs
@@ -0,0 +1,348 @@
+#nullable enable
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+
+using Acuminator.Utilities.Common;
+
+using Microsoft.CodeAnalysis;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Tagging;
+
+using ThreadHelper = Microsoft.VisualStudio.Shell.ThreadHelper;
+
+namespace Acuminator.Vsix.Coloriser;
+
+///
+/// A Roslyn-based colorizer tagger.
+///
+internal partial class PXRoslynColorizerTagger : PXTaggerBase, ITagger, IDisposable
+{
+ protected internal TagsCacheAsync ClassificationTagsCache { get; }
+
+ protected internal TagsCacheAsync OutliningsTagsCache { get; }
+
+ public BackgroundTagging? BackgroundTagging { get; private set; }
+
+ protected PXColorizerTaggerProvider Provider { get; }
+
+ private volatile bool _hasReferenceToAcumaticaPlatform;
+
+ public sealed override bool HasReferenceToAcumaticaPlatform => _hasReferenceToAcumaticaPlatform;
+
+ private readonly object _lastTaggingLock = new object();
+ private bool _lastTaggingWasSuccessful;
+
+ internal override bool LastTaggingWasSuccessful
+ {
+ get
+ {
+ lock (_lastTaggingLock)
+ {
+ return _lastTaggingWasSuccessful;
+ }
+ }
+ set
+ {
+ lock (_lastTaggingLock)
+ {
+ _lastTaggingWasSuccessful = value;
+ }
+ }
+ }
+
+ private volatile Workspace? _subscribedWorkspace;
+ private readonly object _workspaceSubscriptionLock = new();
+
+ private readonly RoslynWorkspaceProvider _roslynWorkspaceProvider;
+
+ public PXRoslynColorizerTagger(ITextBuffer buffer, PXColorizerTaggerProvider provider, bool subscribeToSettingsChanges,
+ bool useCacheChecking) :
+ base(buffer, subscribeToSettingsChanges, useCacheChecking)
+ {
+ Provider = provider.CheckIfNull();
+ ClassificationTagsCache = new TagsCacheAsync();
+ OutliningsTagsCache = new TagsCacheAsync();
+
+ _roslynWorkspaceProvider = new RoslynWorkspaceProvider(buffer);
+ _roslynWorkspaceProvider.WorkspaceChanged += WorkspaceAttachedToDocumentChanged;
+
+ // Drive initial setup through the same code path as change events.
+ // If a real change fires between the subscribe above and this call, the handler is idempotent
+ // (guarded by _subscribedWorkspace) — whichever invocation runs second is a no-op.
+ WorkspaceAttachedToDocumentChanged(this,
+ new DocumentWorkspaceChangedEventArgs(oldWorkspace: null, newWorkspace: _roslynWorkspaceProvider.Workspace));
+
+ //Buffer.Changed += Buffer_Changed;
+ }
+
+ #region Commented Parsing optimizations
+ //private bool isParsed;
+ //private ParsedDocument documentCache;
+ //private volatile static int walking;
+
+ //private async void Buffer_Changed(object sender, TextContentChangedEventArgs e)
+ //{
+ // if (TagsChangedIsNull() || Buffer.CurrentSnapshot == null || e.Changes.IsNullOrEmpty())
+ // return;
+
+ // if (e.After != Buffer.CurrentSnapshot)
+ // return;
+
+ // try
+ // {
+ // // If this isn't the most up-to-date version of the buffer, then ignore it for now (we'll eventually get another change event).
+ // int min = Int32.MaxValue, max = Int32.MinValue;
+
+ // foreach (var change in e.Changes)
+ // {
+ // min = Math.Min(min, change.NewPosition);
+ // max = Math.Max(max, change.NewPosition + change.NewLength);
+ // }
+
+ // TextSpan span = new TextSpan(min, max);
+ // var parsedDoc = await ParsedDocument.Resolve(Buffer, Buffer.CurrentSnapshot).ConfigureAwait(false);
+
+ // documentCache = parsedDoc;
+
+ // if (System.Threading.Interlocked.CompareExchange(ref walking, 1, comparand: 0) == 0)
+ // {
+ // WalkDocumentSyntaxTreeForTags(parsedDoc);
+ // RaiseTagsChanged();
+ // walking = 0;
+ // }
+ // }
+ // catch
+ // {
+
+ // }
+ //}
+ #endregion
+
+ protected internal override void ResetCacheAndFlags(ITextSnapshot? newSnapshotToCache)
+ {
+ base.ResetCacheAndFlags(newSnapshotToCache);
+ ClassificationTagsCache.Reset();
+ OutliningsTagsCache.Reset();
+ }
+
+ ///
+ /// Gets the tags asynchronously from the specified snapshot with Roslyn.
+ ///
+ /// The spans for tagging. The current implementation doesn't take them into account and re-tags the entire document.
+ ///
+ /// The current snapshot of the collected tags.
+ ///
+ public IEnumerable> GetTags(NormalizedSnapshotSpanCollection spans)
+ {
+ if (spans?.Count is null or 0 || AcuminatorVSPackage.Instance?.ColoringEnabled != true || !HasReferenceToAcumaticaPlatform)
+ return [];
+
+ var workspace = _roslynWorkspaceProvider.Workspace;
+
+ if (workspace == null)
+ return [];
+
+ ITextSnapshot newSnapshotToTag = spans[0].Snapshot;
+
+ if (CheckIfParsingAndRetaggingIsNotNecessary(newSnapshotToTag))
+ {
+ return ClassificationTagsCache.ProcessedTags;
+ }
+
+ if (BackgroundTagging != null)
+ {
+ BackgroundTagging.CancelTagging(); //Cancel currently running task
+ BackgroundTagging = null;
+ }
+
+ ResetCacheAndFlags(newSnapshotToTag);
+ BackgroundTagging = BackgroundTagging.StartBackgroundTagging(this);
+
+ return ClassificationTagsCache.ProcessedTags;
+ }
+
+ protected virtual bool CheckIfParsingAndRetaggingIsNotNecessary(ITextSnapshot newSnapshotToTag) =>
+ CacheCheckingEnabled && Snapshot != null && Snapshot == newSnapshotToTag && !ColoringSettingsChanged &&
+ (LastTaggingWasSuccessful || BackgroundTagging?.IsTaskRunning() == true);
+
+ protected internal async Task>> GetTagsAsyncImplementationAsync(ITextSnapshot snapshot,
+ CancellationToken cToken)
+ {
+ ClassificationTagsCache.SetCancellation(cToken);
+ OutliningsTagsCache.SetCancellation(cToken);
+
+ Workspace? workspace;
+
+ lock (_workspaceSubscriptionLock)
+ {
+ workspace = _subscribedWorkspace;
+ }
+
+ if (cToken.IsCancellationRequested)
+ {
+ LastTaggingWasSuccessful = false;
+ return [];
+ }
+
+ Task<(ParsedDocument? Parsed, bool TaggingSupported)> getDocumentTask =
+ ParsedDocument.ResolveAsync(snapshot, workspace, cToken); // Razor cshtml returns a null document for some reason.
+
+ var documentTaskResult = await getDocumentTask.TryAwait(LogError);
+
+ if (!documentTaskResult.IsSuccess)
+ {
+ LastTaggingWasSuccessful = false;
+ return [];
+ }
+
+ var (document, taggingSupported) = documentTaskResult.Result;
+
+ if (document == null || cToken.IsCancellationRequested)
+ {
+ // If the text buffer doesn't support tagging, we can mark tagging as successful to avoid repeated attempts
+ LastTaggingWasSuccessful = !taggingSupported;
+ return [];
+ }
+
+ bool completedSuccessfully = await WalkDocumentSyntaxTreeForTagsOnThreadPoolAsync(document, cToken).TryAwait(LogError);
+ LastTaggingWasSuccessful = completedSuccessfully && ClassificationTagsCache.IsCompleted;
+ return ClassificationTagsCache.ProcessedTags;
+ }
+
+ private static void LogError(Exception exception) =>
+ AcuminatorVSPackage.Instance?.AcuminatorLogger?.LogException(exception, logOnlyFromAcuminatorAssemblies: true,
+ Logger.LogMode.Warning);
+
+ private Task WalkDocumentSyntaxTreeForTagsOnThreadPoolAsync(ParsedDocument document, CancellationToken cancellationToken)
+ {
+ return Task.Run(() => WalkDocumentSyntaxTreeForTags(document, cancellationToken));
+ }
+
+ private void WalkDocumentSyntaxTreeForTags(ParsedDocument document, CancellationToken cancellationToken)
+ {
+ var syntaxWalker = new PXColorizerSyntaxWalker(this, document, cancellationToken);
+
+ syntaxWalker.Visit(document.SyntaxRoot);
+ ClassificationTagsCache.CompleteProcessing();
+ OutliningsTagsCache.CompleteProcessing();
+ }
+
+ public override void Dispose()
+ {
+ _roslynWorkspaceProvider.WorkspaceChanged -= WorkspaceAttachedToDocumentChanged;
+
+ if (_subscribedWorkspace != null)
+ {
+ lock (_workspaceSubscriptionLock)
+ {
+ if (_subscribedWorkspace != null)
+ {
+ _subscribedWorkspace.WorkspaceChanged -= OnWorkspaceChanged;
+ _subscribedWorkspace = null;
+ }
+ }
+ }
+
+ _roslynWorkspaceProvider.Dispose();
+ BackgroundTagging?.Dispose();
+ ClassificationTagsCache?.Reset();
+ OutliningsTagsCache?.Reset();
+
+ _hasReferenceToAcumaticaPlatform = false;
+
+ base.Dispose();
+ }
+
+ private void OnWorkspaceChanged(object sender, WorkspaceChangeEventArgs e)
+ {
+ bool oldValue = _hasReferenceToAcumaticaPlatform;
+
+ switch (e.Kind)
+ {
+ case WorkspaceChangeKind.SolutionRemoved:
+ case WorkspaceChangeKind.SolutionCleared:
+ _hasReferenceToAcumaticaPlatform = false;
+ break;
+
+ case WorkspaceChangeKind.SolutionAdded:
+ case WorkspaceChangeKind.SolutionChanged:
+ case WorkspaceChangeKind.SolutionReloaded:
+ case WorkspaceChangeKind.ProjectAdded:
+ case WorkspaceChangeKind.ProjectRemoved:
+ case WorkspaceChangeKind.ProjectChanged:
+ case WorkspaceChangeKind.ProjectReloaded:
+ _hasReferenceToAcumaticaPlatform = CheckIfCurrentSolutionHasReferenceToAcumatica(_roslynWorkspaceProvider.Workspace);
+ break;
+
+ default:
+ return;
+ }
+
+ if (oldValue != _hasReferenceToAcumaticaPlatform)
+ {
+ ResetCacheAndFlags(newSnapshotToCache: null);
+ ThreadHelper.JoinableTaskFactory.Run(RaiseTagsChangedAsync);
+ }
+ }
+
+ private void WorkspaceAttachedToDocumentChanged(object sender, DocumentWorkspaceChangedEventArgs e)
+ {
+ lock (_workspaceSubscriptionLock)
+ {
+ // Idempotency guard: ignore if we're already subscribed to this exact workspace.
+ if (ReferenceEquals(_subscribedWorkspace, e.NewWorkspace))
+ return;
+
+ if (_subscribedWorkspace != null)
+ _subscribedWorkspace.WorkspaceChanged -= OnWorkspaceChanged;
+
+ _subscribedWorkspace = e.NewWorkspace;
+
+ // if new Workspace supports coloring, we need to subscribe to workspace events and calculate the hasReferenceToAcumaticaPlatform flag.
+ if (_subscribedWorkspace != null)
+ {
+ _subscribedWorkspace.WorkspaceChanged += OnWorkspaceChanged;
+ _hasReferenceToAcumaticaPlatform = CheckIfCurrentSolutionHasReferenceToAcumatica(_subscribedWorkspace);
+ }
+ else
+ {
+ _hasReferenceToAcumaticaPlatform = false;
+ }
+ }
+
+ // We need to raise the tags changed event to trigger re-coloring on workspace change
+ ResetCacheAndFlags(newSnapshotToCache: null);
+ ThreadHelper.JoinableTaskFactory.Run(RaiseTagsChangedAsync);
+ }
+
+ protected bool CheckIfCurrentSolutionHasReferenceToAcumatica(Workspace? workspace)
+ {
+ var currentSolution = workspace?.CurrentSolution;
+
+ if (currentSolution == null || currentSolution.ProjectIds.Count == 0)
+ return false;
+
+ bool hasReferenceInMetadata = currentSolution.Projects.SelectMany(project => project.MetadataReferences)
+ .Any(IsAcumaticaAssemblyName);
+ if (hasReferenceInMetadata)
+ return true;
+
+ bool hasAcumaticaProjectsInSolution =
+ currentSolution.Projects.Any(project => IsAcumaticaAssemblyName(project.Name) || IsAcumaticaAssemblyName(project.AssemblyName));
+
+ return hasAcumaticaProjectsInSolution;
+ }
+
+ private static bool IsAcumaticaAssemblyName(MetadataReference reference)
+ {
+ string referenceName = Path.GetFileNameWithoutExtension(reference.Display);
+ return IsAcumaticaAssemblyName(referenceName);
+ }
+
+ private static bool IsAcumaticaAssemblyName(string dllName) => ColoringConstants.PlatformDllName == dllName ||
+ ColoringConstants.AppDllName == dllName;
+}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/PXRegexColorizerTagger.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/PXRegexColorizerTagger.cs
deleted file mode 100644
index d368e2a07..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/PXRegexColorizerTagger.cs
+++ /dev/null
@@ -1,188 +0,0 @@
-#nullable enable
-
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-
-using Acuminator.Utilities;
-using Acuminator.Utilities.Common;
-using Acuminator.Utilities.Roslyn;
-
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Classification;
-using Microsoft.VisualStudio.Text.Tagging;
-
-namespace Acuminator.Vsix.Coloriser
-{
- internal class PXRegexColorizerTagger : PXColorizerTaggerBase
- {
- protected internal override bool UseAsyncTagging => false;
-
- public override TaggerType TaggerType => TaggerType.RegEx;
-
- private readonly TagsCacheSync _classificationTagsCache = new TagsCacheSync();
-
- protected internal override ITagsCache ClassificationTagsCache => _classificationTagsCache;
-
- private readonly TagsCacheSync _outliningTagsCache = new TagsCacheSync(capacity: 0);
-
- protected internal override ITagsCache OutliningsTagsCache => _outliningTagsCache;
-
-
- private readonly ConcurrentBag> _tagsBag = new ConcurrentBag>();
-
- internal PXRegexColorizerTagger(ITextBuffer buffer, PXColorizerTaggerProvider aProvider, bool subscribeToSettingsChanges,
- bool useCacheChecking) :
- base(buffer, aProvider, subscribeToSettingsChanges, useCacheChecking)
- {
- }
-
- protected internal async override Task>> GetTagsAsyncImplementationAsync(ITextSnapshot snapshot,
- CancellationToken cancellationToken)
- {
- var taggingInfo = await Task.Run(() => GetTagsSynchronousImplementation(snapshot))
- .TryAwait();
-
- if (!taggingInfo.IsSuccess)
- return [];
-
- return taggingInfo.Result ?? [];
- }
-
- protected internal override IEnumerable> GetTagsSynchronousImplementation(ITextSnapshot snapshot)
- {
- GetTagsFromSnapshot(snapshot);
- _classificationTagsCache.AddTags(_tagsBag);
- ClassificationTagsCache.CompleteProcessing();
- OutliningsTagsCache.CompleteProcessing();
- return ClassificationTagsCache;
- }
-
- protected internal override void ResetCacheAndFlags(ITextSnapshot newCache)
- {
- base.ResetCacheAndFlags(newCache);
- _tagsBag.Clear();
- }
-
- private void GetTagsFromSnapshot(ITextSnapshot newSnapshot)
- {
- string wholeText = newSnapshot.GetText();
- var matches = RegExpressions.BQLSelectCommandRegex
- .Matches(wholeText)
- .OfType()
- .Where(bqlCommandMatch => !string.IsNullOrWhiteSpace(bqlCommandMatch.Value));
-
- Parallel.ForEach(matches,
- bqlCommandMatch => GetTagsFromBQLCommand(newSnapshot, bqlCommandMatch.Value, bqlCommandMatch.Index));
- }
-
- private void GetTagsFromBQLCommand(ITextSnapshot newSnapshot, string bqlCommand, int offset)
- {
- int lastAngleBraces = bqlCommand.LastIndexOf('>');
- bqlCommand = bqlCommand.Substring(0, lastAngleBraces + 1);
- int lastAngleBraceIndex = bqlCommand.LastIndexOf('>');
-
- if (lastAngleBraceIndex >= 0)
- bqlCommand = bqlCommand.Substring(0, lastAngleBraceIndex + 1);
-
- int firstAngleBraceIndex = bqlCommand.IndexOf('<');
-
- if (firstAngleBraceIndex < 0)
- return;
-
- string selectOp = bqlCommand.Substring(0, firstAngleBraceIndex);
- GetSelectCommandTag(newSnapshot, bqlCommand, offset);
-
- GetBQLOperandTags(newSnapshot, bqlCommand, offset);
- GetDacWithFieldTags(newSnapshot, bqlCommand, offset);
- GetSingleDacAndConstantTags(newSnapshot, bqlCommand, offset);
- GetBqlParameterTags(newSnapshot, bqlCommand, offset);
- }
-
- private void GetBQLOperandTags(ITextSnapshot newSnapshot, string bqlCommand, int offset)
- {
- var matches = RegExpressions.DacOperandRegex.Matches(bqlCommand);
-
- foreach (Match bqlOperandMatch in matches.OfType().Skip(1))
- {
- string bqlOperand = bqlOperandMatch.Value.TrimEnd('<');
- CreateTag(newSnapshot, bqlOperandMatch, offset, bqlOperand, Provider[PXCodeType.BqlOperator]);
- }
- }
-
- private void GetSelectCommandTag(ITextSnapshot newSnapshot, string selectOp, int offset)
- {
- Span span = new Span(offset, selectOp.Length);
- SnapshotSpan snapshotSpan = new SnapshotSpan(newSnapshot, span);
- var tag = new TagSpan(snapshotSpan, new ClassificationTag(Provider[PXCodeType.BqlOperator]));
- _tagsBag.Add(tag);
- }
-
- private void GetBqlParameterTags(ITextSnapshot newSnapshot, string bqlCommand, int offset)
- {
- var matches = RegExpressions.BQLParametersRegex.Matches(bqlCommand);
-
- foreach (Match bqlParamMatch in matches)
- {
- string bqlParam = bqlParamMatch.Value;
- CreateTag(newSnapshot, bqlParamMatch, offset, bqlParam, Provider[PXCodeType.BqlParameter]);
- }
- }
-
- private void GetSingleDacAndConstantTags(ITextSnapshot newSnapshot, string bqlCommand, int offset)
- {
- var matches = RegExpressions.DacOrConstantRegex.Matches(bqlCommand);
-
- foreach (Match dacOrConstMatch in matches)
- {
- string dacOrConst = dacOrConstMatch.Value.Trim(',', '<', '>');
- CreateTag(newSnapshot, dacOrConstMatch, offset, dacOrConst, Provider[PXCodeType.Dac]);
- }
- }
-
- private void GetDacWithFieldTags(ITextSnapshot newSnapshot, string bqlCommand, int offset)
- {
- var matches = RegExpressions.DacWithFieldRegex.Matches(bqlCommand);
-
- foreach (Match dacWithFieldMatch in matches)
- {
- string[] dacParts = dacWithFieldMatch.Value.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
-
- if (dacParts.Length != 2)
- continue;
-
- GetDacTag(newSnapshot, dacWithFieldMatch, offset, dacParts);
- GetFieldTag(newSnapshot, dacWithFieldMatch, offset, dacParts);
- }
- }
-
- private void GetDacTag(ITextSnapshot newSnapshot, Match match, int offset, string[] dacParts)
- {
- string dacPart = dacParts[0].TrimStart(',', '<');
- CreateTag(newSnapshot, match, offset, dacPart, Provider[PXCodeType.Dac]);
- }
-
- private void GetFieldTag(ITextSnapshot newSnapshot, Match match, int offset, string[] dacParts)
- {
- string fieldPart = dacParts[1].TrimEnd(',', '>');
- CreateTag(newSnapshot, match, offset, fieldPart, Provider[PXCodeType.DacField]);
- }
-
- private void CreateTag(ITextSnapshot newSnapshot, Match match, int offset, string tagContent, IClassificationType? classType)
- {
- if (classType == null)
- return;
-
- int startIndex = offset + match.Index + match.Value.IndexOf(tagContent);
- var span = new Span(startIndex, tagContent.Length);
- var snapshotSpan = new SnapshotSpan(newSnapshot, span);
- var tag = new TagSpan(snapshotSpan, new ClassificationTag(classType));
-
- _tagsBag.Add(tag);
- }
- }
-}
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/APInvoice.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/APInvoice.cs
deleted file mode 100644
index 2a38758cc..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/APInvoice.cs
+++ /dev/null
@@ -1,1911 +0,0 @@
-using System;
-
-using PX.Common;
-
-using PX.Data;
-using PX.Data.EP;
-
-using PX.Objects.GL;
-using PX.Objects.CM;
-using PX.Objects.CS;
-using PX.Objects.TX;
-using PX.Objects.CR;
-using PX.Objects.CA;
-
-using CRLocation = PX.Objects.CR.Standalone.Location;
-
-namespace PX.Objects.AP
-{
- public class APInvoiceType : APDocType
- {
- ///
- /// Specialized selector for APInvoice RefNbr.
- /// By default, defines the following set of columns for the selector:
- /// APInvoice.refNbr,APInvoice.docDate, APInvoice.finPeriodID,
- /// APInvoice.vendorID, APInvoice.vendorID_Vendor_acctName,
- /// APInvoice.vendorLocationID, APInvoice.curyID, APInvoice.curyOrigDocAmt,
- /// APInvoice.curyDocBal,APInvoice.status, APInvoice.dueDate, APInvoice.invoiceNbr
- ///
- public class RefNbrAttribute : PXSelectorAttribute
- {
- public RefNbrAttribute(Type SearchType)
- : base(SearchType,
- typeof(APRegister.refNbr),
- typeof(APRegister.docDate),
- typeof(APRegister.finPeriodID),
- typeof(APRegister.vendorID),
- typeof(APRegister.vendorID_Vendor_acctName),
- typeof(APRegister.vendorLocationID),
- typeof(APInvoice.invoiceNbr),
- typeof(APRegister.curyID),
- typeof(APRegister.curyOrigDocAmt),
- typeof(APRegister.curyDocBal),
- typeof(APRegister.status),
- typeof(APInvoice.dueDate))
- {
- }
- }
-
- public class AdjdRefNbrAttribute : PXSelectorAttribute
- {
- public AdjdRefNbrAttribute(Type SearchType)
- : base(SearchType,
- typeof(APRegister.refNbr),
- typeof(APRegister.docDate),
- typeof(APRegister.finPeriodID),
- typeof(APRegister.vendorLocationID),
- typeof(APRegister.curyID),
- typeof(APRegister.curyOrigDocAmt),
- typeof(APRegister.curyDocBal),
- typeof(APRegister.status),
- typeof(APAdjust.APInvoice.dueDate),
- typeof(APAdjust.APInvoice.invoiceNbr),
- typeof(APRegister.docDesc))
- {
- }
- }
-
- ///
- /// Specialized for APInvoices version of the
- /// It defines how the new numbers are generated for the AP Invoice.
- /// References APInvoice.docType and APInvoice.docDate fields of the document,
- /// and also define a link between numbering ID's defined in AP Setup and APInvoice types:
- /// namely APSetup.invoiceNumberingID, APSetup.adjustmentNumberingID,
- /// APSetup.adjustmentNumberingID, APSetup.invoiceNumberingID
- ///
- public class NumberingAttribute : AutoNumberAttribute
- {
- private static string[] _DocTypes
- {
- get
- {
- return new string[] { Invoice, CreditAdj, DebitAdj, Prepayment };
- }
- }
-
- private static Type[] _SetupFields
- {
- get
- {
- return new Type[]
- {
- typeof(APSetup.invoiceNumberingID),
- typeof(APSetup.creditAdjNumberingID),
- typeof(APSetup.debitAdjNumberingID),
- typeof(APSetup.invoiceNumberingID)
- };
- }
- }
-
- public static Type GetNumberingIDField(string docType)
- {
- foreach (var pair in _DocTypes.Zip(_SetupFields))
- if (pair.Item1 == docType)
- return pair.Item2;
-
- return null;
- }
-
- public NumberingAttribute()
- : base(typeof(APInvoice.docType), typeof(APInvoice.docDate), _DocTypes, _SetupFields)
- {
- }
- }
-
- public new static readonly string[] Values = { Invoice, CreditAdj, DebitAdj, Prepayment };
- public new static readonly string[] Labels = { Messages.Invoice, Messages.CreditAdj, Messages.DebitAdj, Messages.Prepayment };
-
- public new class ListAttribute : PXStringListAttribute
- {
- public ListAttribute()
- : base(Values, Labels)
- {
- }
- }
-
- public class TaxInvoiceListAttribute : PXStringListAttribute
- {
- public TaxInvoiceListAttribute()
- : base(
- new string[] { Invoice, CreditAdj, DebitAdj },
- new string[] { Messages.Invoice, Messages.CreditAdj, Messages.DebitAdj })
- { }
- }
-
- public class AdjdListAttribute : PXStringListAttribute
- {
- public AdjdListAttribute()
- : base(
- new string[] { Invoice, CreditAdj },
- new string[] { Messages.Invoice, Messages.CreditAdj })
- { }
- }
-
- ///
- /// String list with DocType, suitable for the APInvoice document.
- /// Used in the DocType selector of APInvoices.
- ///
- public class InvoiceListAttribute : PXStringListAttribute
- {
- public InvoiceListAttribute()
- : base(
- new string[] { Invoice, CreditAdj, Prepayment },
- new string[] { Messages.Invoice, Messages.CreditAdj, Messages.Prepayment })
- { }
- }
-
- public static string DrCr(string DocType)
- {
- switch (DocType)
- {
- case Invoice:
- case CreditAdj:
- case Prepayment:
- case QuickCheck:
- return GL.DrCr.Debit;
- case DebitAdj:
- case VoidQuickCheck:
- return GL.DrCr.Credit;
- default:
- return null;
- }
- }
- }
-
- public class APPaymentBy
- {
- public const int DueDate = 0;
- public const int DiscountDate = 1;
-
- public class List : PXIntListAttribute
- {
- public List()
- : base(
- new[] { DueDate, DiscountDate },
- new[] { Messages.DueDate, Messages.DiscountDate })
- {
- }
- }
-
- public class dueDate : Constant
- {
- public dueDate() : base(DueDate)
- {
- }
- }
- public class discountDate : Constant
- {
- public discountDate() : base(DiscountDate)
- {
- }
- }
- }
-
- ///
- /// Represents AP Invoices, Credit and Debit Adjustments.
- /// The DAC is based on and extends it with the fields
- /// relevant to the documents of the above types.
- ///
- [System.SerializableAttribute()]
- [PXTable()]
- [PXSubstitute(GraphType = typeof(APInvoiceEntry))]
- [PXSubstitute(GraphType = typeof(TX.TXInvoiceEntry))]
- [PXPrimaryGraph(typeof(APInvoiceEntry))]
- [PXCacheName(Messages.APInvoice)]
- [PXEMailSource]
- public partial class APInvoice : APRegister, IInvoice, IAssign
- {
- #region Selected
- public new abstract class selected : PX.Data.IBqlField
- {
- }
- #endregion
- #region BranchID
- public new abstract class branchID : PX.Data.IBqlField
- {
- }
-
- ///
- /// Identifier of the Branch, to which the document belongs.
- ///
- ///
- /// Corresponds to the Branch.BranchID field.
- ///
- [GL.Branch(typeof(Coalesce<
- Search>, And>>>>,
- Search>>>>), IsDetail = false)]
- public override Int32? BranchID
- {
- get
- {
- return this._BranchID;
- }
- set
- {
- this._BranchID = value;
- }
- }
- #endregion
- #region DocType
- public new abstract class docType : PX.Data.IBqlField
- {
- }
-
- ///
- /// [key] Type of the document.
- ///
- ///
- /// Possible values are: "INV" - Invoice, "ACR" - Credit Adjustment, "ADR" - Debit Adjustment,
- /// "PPM" - Prepayment.
- ///
- [PXDBString(3, IsKey = true, IsFixed = true)]
- [PXDefault()]
- [APInvoiceType.List()]
- [PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
- [PXFieldDescription]
- public override String DocType
- {
- get
- {
- return this._DocType;
- }
- set
- {
- this._DocType = value;
- }
- }
- #endregion
- #region RefNbr
- public new abstract class refNbr : PX.Data.IBqlField
- {
- }
-
- ///
- /// [key] Reference number of the document.
- ///
- [PXDBString(15, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCCCCCCCC")]
- [PXDefault()]
- [PXUIField(DisplayName = "Reference Nbr.", Visibility = PXUIVisibility.SelectorVisible, TabOrder = 1)]
- [APInvoiceType.RefNbr(typeof(Search2,
- And>>,
- InnerJoinSingleTable>>>,
- Where>,
- And2,
- Or>>,
- And>>>>,
- OrderBy>>), Filterable = true, IsPrimaryViewCompatible = true)]
- [APInvoiceType.Numbering()]
- [PXFieldDescription]
- public override String RefNbr
- {
- get
- {
- return this._RefNbr;
- }
- set
- {
- this._RefNbr = value;
- }
- }
- #endregion
- #region Status
- public new abstract class status : PX.Data.IBqlField
- {
- }
- #endregion
- #region VendorID
- public new abstract class vendorID : PX.Data.IBqlField
- {
- }
- #endregion
- #region VendorLocationID
- public new abstract class vendorLocationID : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryID
- public new abstract class curyID : PX.Data.IBqlField
- {
- }
- #endregion
- #region APAccountID
- public new abstract class aPAccountID : PX.Data.IBqlField
- {
- }
- #endregion
- #region APSubID
- public new abstract class aPSubID : PX.Data.IBqlField
- {
- }
- #endregion
- #region TermsID
- public abstract class termsID : PX.Data.IBqlField
- {
- }
- protected String _TermsID;
-
- ///
- /// The credit terms associated with the document (unavailable for prepayments and debit adjustments).\
- /// Defaults to the credit terms of the vendor.
- ///
- [PXDBString(10, IsUnicode = true)]
- [PXDefault(typeof(Search>, And, NotEqual>>>), PersistingCheck = PXPersistingCheck.Nothing)]
- [PXUIField(DisplayName = "Terms", Visibility = PXUIVisibility.Visible)]
- [PXSelector(typeof(Search, Or>>>), DescriptionField = typeof(Terms.descr), Filterable = true)]
- [Terms(typeof(APInvoice.docDate), typeof(APInvoice.dueDate), typeof(APInvoice.discDate), typeof(APInvoice.curyOrigDocAmt), typeof(APInvoice.curyOrigDiscAmt))]
- public virtual String TermsID
- {
- get
- {
- return this._TermsID;
- }
- set
- {
- this._TermsID = value;
- }
- }
- #endregion
- #region DueDate
- public abstract class dueDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _DueDate;
-
- ///
- /// The date when payment for the document is due in accordance with the credit terms.
- ///
- [PXDBDate()]
- [PXUIField(DisplayName = "Due Date", Visibility = PXUIVisibility.SelectorVisible)]
- public virtual DateTime? DueDate
- {
- get
- {
- return this._DueDate;
- }
- set
- {
- this._DueDate = value;
- }
- }
- #endregion
- #region DiscDate
- public abstract class discDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _DiscDate;
-
- ///
- /// The date when the cash discount can be taken in accordance with the credit terms.
- ///
- [PXDBDate()]
- [PXUIField(DisplayName = "Cash Discount Date", Visibility = PXUIVisibility.SelectorVisible)]
- public virtual DateTime? DiscDate
- {
- get
- {
- return this._DiscDate;
- }
- set
- {
- this._DiscDate = value;
- }
- }
- #endregion
- #region MasterRefNbr
- public abstract class masterRefNbr : IBqlField { }
- ///
- /// For an installment this field holds the reference number of the master document.
- ///
- [PXDBString(15, IsUnicode = true)]
- public virtual string MasterRefNbr { get; set; }
- #endregion
- #region InstallmentNbr
- public abstract class installmentNbr : IBqlField { }
- ///
- /// The number of the installment, which the document represents.
- ///
- ///
- /// Corresponds to the TermsInstallments.InstallmentNbr field.
- ///
- [PXDBShort]
- public virtual short? InstallmentNbr { get; set; }
- #endregion
- #region InstallmentCntr
- public abstract class installmentCntr : IBqlField { }
- ///
- /// Counter of the document's installments.
- ///
- [PXDBShort]
- [PXUIField(DisplayName = "Number of Installments")]
- public virtual short? InstallmentCntr { get; set; }
- #endregion
- #region InvoiceNbr
- public abstract class invoiceNbr : PX.Data.IBqlField
- {
- }
- protected String _InvoiceNbr;
-
- ///
- /// The document’s original reference number as assigned by the vendor (for informational purposes).
- /// The reference to the vendor document is required if is set to true.
- /// The reference should also be unique if is set to true.
- ///
- [PXDBString(40, IsUnicode = true)]
- [PXUIField(DisplayName = "Vendor Ref.", Visibility = PXUIVisibility.SelectorVisible)]
- [APVendorRefNbr]
- public virtual String InvoiceNbr
- {
- get
- {
- return this._InvoiceNbr;
- }
- set
- {
- this._InvoiceNbr = value;
- }
- }
- #endregion
- #region InvoiceDate
- public abstract class invoiceDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _InvoiceDate;
-
- ///
- /// The document’s original date as assigned by the vendor (for informational purposes).
- ///
- [PXDBDate()]
- [PXDefault(TypeCode.DateTime, "01/01/1900")]
- [PXUIField(DisplayName = "Vendor Ref. Date", Visibility = PXUIVisibility.Invisible)]
- public virtual DateTime? InvoiceDate
- {
- get
- {
- return this._InvoiceDate;
- }
- set
- {
- this._InvoiceDate = value;
- }
- }
- #endregion
- #region TaxZoneID
- public abstract class taxZoneID : PX.Data.IBqlField
- {
- }
- protected String _TaxZoneID;
-
- ///
- /// Identifier of the tax zone associated with the document.
- /// Defaults to vendor's tax zone.
- ///
- [PXDBString(10, IsUnicode = true)]
- [PXDefault(typeof(Search>, And>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
- [PXUIField(DisplayName = "Vendor Tax Zone", Visibility = PXUIVisibility.Visible)]
- [PXSelector(typeof(TaxZone.taxZoneID), DescriptionField = typeof(TaxZone.descr), Filterable = true)]
- public virtual String TaxZoneID
- {
- get
- {
- return this._TaxZoneID;
- }
- set
- {
- this._TaxZoneID = value;
- }
- }
- #endregion
- #region DocDate
- public new abstract class docDate : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryTaxTotal
- public abstract class curyTaxTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryTaxTotal;
-
- ///
- /// The total amount of taxes associated with the document. (Presented in the currency of the document, see )
- ///
- [PXDBCurrency(typeof(APInvoice.curyInfoID), typeof(APInvoice.taxTotal))]
- [PXUIField(DisplayName = "Tax Total", Visibility = PXUIVisibility.Visible, Enabled = false)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryTaxTotal
- {
- get
- {
- return this._CuryTaxTotal;
- }
- set
- {
- this._CuryTaxTotal = value;
- }
- }
- #endregion
- #region TaxTotal
- public abstract class taxTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _TaxTotal;
-
- ///
- /// The total amount of taxes associated with the document. (Presented in the base currency of the company, see )
- ///
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? TaxTotal
- {
- get
- {
- return this._TaxTotal;
- }
- set
- {
- this._TaxTotal = value;
- }
- }
- #endregion
- #region CuryLineTotal
- public abstract class curyLineTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryLineTotal;
-
- ///
- /// The document total presented in the currency of the document. (See )
- ///
- [PXDBCurrency(typeof(APInvoice.curyInfoID), typeof(APInvoice.lineTotal))]
- [PXUIField(DisplayName = "Detail Total", Visibility = PXUIVisibility.Visible, Enabled = false)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryLineTotal
- {
- get
- {
- return this._CuryLineTotal;
- }
- set
- {
- this._CuryLineTotal = value;
- }
- }
- #endregion
- #region LineTotal
- public abstract class lineTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _LineTotal;
-
- ///
- /// The document total presented in the base currency of the company. (See )
- ///
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? LineTotal
- {
- get
- {
- return this._LineTotal;
- }
- set
- {
- this._LineTotal = value;
- }
- }
- #endregion
- #region DiscTot
- public new abstract class discTot : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryDiscTot
- public new abstract class curyDiscTot : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryTaxAmt
- public abstract class curyTaxAmt : IBqlField { }
- [PXDBCurrency(typeof(APInvoice.curyInfoID), typeof(APInvoice.taxAmt))]
- [PXUIField(DisplayName = "Tax Amount")]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryTaxAmt { get; set; }
- #endregion
- #region TaxAmt
- public abstract class taxAmt : IBqlField { }
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? TaxAmt { get; set; }
- #endregion
-
- #region DocDisc
- public new abstract class docDisc : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryDocDisc
- public new abstract class curyDocDisc : PX.Data.IBqlField
- {
- }
- #endregion
-
- #region CuryVatExemptTotal
- public abstract class curyVatExemptTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryVatExemptTotal;
-
- ///
- /// The part of the document total that is exempt from VAT.
- /// This total is calculated as a sum of the taxable amounts for the taxes
- /// of type VAT, which are marked as exempt
- /// and are neither statistical nor reverse.
- /// (Presented in the currency of the document, see )
- ///
- [PXDBCurrency(typeof(APInvoice.curyInfoID), typeof(APInvoice.vatExemptTotal))]
- [PXUIField(DisplayName = "VAT Exempt Total", Visibility = PXUIVisibility.Visible, Enabled = false)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryVatExemptTotal
- {
- get
- {
- return this._CuryVatExemptTotal;
- }
- set
- {
- this._CuryVatExemptTotal = value;
- }
- }
- #endregion
-
- #region VatExemptTaxTotal
- public abstract class vatExemptTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _VatExemptTotal;
-
- ///
- /// The part of the document total that is exempt from VAT.
- /// This total is calculated as a sum of the taxable amounts for the taxes
- /// of type VAT, which are marked as exempt
- /// and are neither statistical nor reverse.
- /// (Presented in the base currency of the company, see )
- ///
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? VatExemptTotal
- {
- get
- {
- return this._VatExemptTotal;
- }
- set
- {
- this._VatExemptTotal = value;
- }
- }
- #endregion
-
- #region CuryVatTaxableTotal
- public abstract class curyVatTaxableTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryVatTaxableTotal;
-
- ///
- /// The part of the document total, which is subject to VAT.
- /// This total is calculated as a sum of the taxable amounts for the taxes
- /// of type VAT, which are neither exempt,
- /// nor statistical, nor reverse.
- /// (Presented in the currency of the document, see )
- ///
- [PXDBCurrency(typeof(APInvoice.curyInfoID), typeof(APInvoice.vatTaxableTotal))]
- [PXUIField(DisplayName = "VAT Taxable Total", Visibility = PXUIVisibility.Visible, Enabled = false)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryVatTaxableTotal
- {
- get
- {
- return this._CuryVatTaxableTotal;
- }
- set
- {
- this._CuryVatTaxableTotal = value;
- }
- }
- #endregion
-
- #region VatTaxableTotal
- public abstract class vatTaxableTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _VatTaxableTotal;
-
- ///
- /// The part of the document total, which is subject to VAT.
- /// This total is calculated as a sum of the taxable amounts for the taxes
- /// of type VAT, which are neither exempt,
- /// nor statistical, nor reverse.
- /// (Presented in the base currency of the company, see )
- ///
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? VatTaxableTotal
- {
- get
- {
- return this._VatTaxableTotal;
- }
- set
- {
- this._VatTaxableTotal = value;
- }
- }
- #endregion
-
- #region CuryInfoID
- public new abstract class curyInfoID : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryOrigDocAmt
- public new abstract class curyOrigDocAmt : PX.Data.IBqlField
- {
- }
- #endregion
- #region OrigDocAmt
- public new abstract class origDocAmt : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryDocBal
- public new abstract class curyDocBal : PX.Data.IBqlField
- {
- }
- #endregion
- #region DocBal
- public new abstract class docBal : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryDiscBal
- public new abstract class curyDiscBal : PX.Data.IBqlField
- {
- }
- #endregion
- #region DiscBal
- public new abstract class discBal : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryOrigDiscAmt
- public new abstract class curyOrigDiscAmt : PX.Data.IBqlField
- {
- }
- #endregion
- #region OrigDiscAmt
- public new abstract class origDiscAmt : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryOrigWhTaxAmt
- public new abstract class curyOrigWhTaxAmt : PX.Data.IBqlField
- {
- }
- #endregion
- #region OrigWhTaxAmt
- public new abstract class origWhTaxAmt : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryWhTaxBal
- public new abstract class curyWhTaxBal : PX.Data.IBqlField
- {
- }
- #endregion
- #region WhTaxBal
- public new abstract class whTaxBal : PX.Data.IBqlField
- {
- }
- #endregion
- #region CuryTaxWheld
- public new abstract class curyTaxWheld : PX.Data.IBqlField
- {
- }
- #endregion
- #region TaxWheld
- public new abstract class taxWheld : PX.Data.IBqlField
- {
- }
- #endregion
- #region DrCr
- public abstract class drCr : PX.Data.IBqlField
- {
- }
- protected string _DrCr;
-
- ///
- /// Read-only field indicating whether the document is of debit or credit type.
- /// The value of this field is based solely on the field.
- ///
- ///
- /// Possible values are "D" (for Invoice, Credit Adjustment, Prepayment, Quick Check)
- /// and "C" (for Debit Adjustment and Void Quick Check).
- ///
- [PXString(1, IsFixed = true)]
- public string DrCr
- {
- [PXDependsOnFields(typeof(docType))]
- get
- {
- return APInvoiceType.DrCr(this._DocType);
- }
- set
- {
- }
- }
- #endregion
- #region SeparateCheck
- public abstract class separateCheck : PX.Data.IBqlField
- {
- }
- protected Boolean? _SeparateCheck;
-
- ///
- /// When set to true indicates that the document should be paid for by a separate check.
- /// In other words, the payment to such a document must not be consolidated with other payments.
- ///
- ///
- /// Defaults to the value of the same setting for vendor.
- ///
- [PXDBBool()]
- [PXUIField(DisplayName = "Pay Separately", Visibility = PXUIVisibility.Visible)]
- [PXDefault(typeof(Search>, And>>>>))]
- public virtual Boolean? SeparateCheck
- {
- get
- {
- return this._SeparateCheck;
- }
- set
- {
- this._SeparateCheck = value;
- }
- }
- #endregion
- #region PaySel
- public abstract class paySel : IBqlField
- {
- }
- protected bool? _PaySel;
-
- ///
- /// When set to true indicates that the document is approved for payment.
- ///
- [PXDBBool]
- [PXDefault(false)]
- [PXUIField(DisplayName = "Approved for Payment")]
- public bool? PaySel
- {
- get
- {
- return _PaySel;
- }
- set
- {
- _PaySel = value;
- }
- }
- #endregion
- #region PayLocationID
- public abstract class payLocationID : PX.Data.IBqlField
- {
- }
- protected Int32? _PayLocationID;
-
- ///
- /// location for payment.
- ///
- ///
- /// Defaults to vendor's default location
- /// or to the first active location of the vendor if the former is not set.
- ///
- [LocationID(
- typeof(Where>,
- And, And>>>),
- DescriptionField = typeof(Location.descr),
- Visibility = PXUIVisibility.SelectorVisible,
- DisplayName = "Payment Location")]
- [PXDefault(typeof(Coalesce<
- Search2,
- And>>>,
- Where>,
- And, And>>>>,
- Search>,
- And, And>>>>>))]
- public virtual Int32? PayLocationID
- {
- get
- {
- return this._PayLocationID;
- }
- set
- {
- this._PayLocationID = value;
- }
- }
- #endregion
- #region PayDate
- public abstract class payDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _PayDate;
-
- ///
- /// The date when the bill has been approved for payment.
- ///
- [PXDBDate()]
- [PXUIField(DisplayName = "Pay Date", Visibility = PXUIVisibility.Visible)]
- [PXDefault()]
- [PXFormula(typeof(SO.DateMinusDaysNotLessThenDate<
- Switch<
- Case, Equal,
- And>, APInvoice.discDate>,
- APInvoice.dueDate>,
- IsNull, decimal0>, APInvoice.docDate>))]
- public virtual DateTime? PayDate
- {
- get
- {
- return this._PayDate;
- }
- set
- {
- this._PayDate = value;
- }
- }
- #endregion
- #region PayTypeID
- public abstract class payTypeID : PX.Data.IBqlField
- {
- }
- protected String _PayTypeID;
-
- ///
- /// The payment method used for the document.
- ///
- ///
- /// Corresponds to the PaymentMethod.PaymentMethodID field.
- /// Defaults to the payment method associated with the vendor location.
- ///
- [PXDBString(10, IsUnicode = true)]
- [PXUIField(DisplayName = "Payment Method", Visibility = PXUIVisibility.Visible)]
-
- [PXSelector(typeof(Search,
- And>>>), DescriptionField = typeof(PaymentMethod.descr))]
- [PXDefault(typeof(Search>, And>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
- public virtual String PayTypeID
- {
- get
- {
- return this._PayTypeID;
- }
- set
- {
- this._PayTypeID = value;
- }
- }
- #endregion
- #region PayAccountID
- public abstract class payAccountID : PX.Data.IBqlField
- {
- }
- protected Int32? _PayAccountID;
-
- ///
- /// The cash account used for the payment.
- ///
- ///
- /// Defaults to the cash account associated with the selected location and payment method.
- /// In case such account is not found the default value will be the cash account which is specified as
- /// default for AP for the selected payment method.
- ///
- [PXDefault(typeof(Coalesce,
- And,
- And>>>>,
- Where<
- Location.bAccountID, Equal>,
- And>,
- And>>>>>,
- // Handle the case when the payment settings for the currently selected payment
- // location are set to "Same as Main" (the first condition in the Where clause).
- // -
- Search2<
- Location.cashAccountID,
- InnerJoin>,
- InnerJoin,
- And,
- And>>>>>,
- Where<
- CR.Standalone.LocationAlias.locationID, NotEqual,
- And>,
- And>,
- And>>>>>>>,
- Search2<
- PaymentMethodAccount.cashAccountID,
- InnerJoin>>,
- Where<
- PaymentMethodAccount.paymentMethodID, Equal>,
- And>,
- And,
- And>>>>>>),
- PersistingCheck = PXPersistingCheck.Nothing)]
- [CashAccount(typeof(APInvoice.branchID), typeof(Search2>>,
- Where2>,
- And,
- And>,
- And>>>>>),
- Visibility = PXUIVisibility.Visible)]
- [PXFormula(typeof(Validate))]
- public virtual Int32? PayAccountID
- {
- get
- {
- return this._PayAccountID;
- }
- set
- {
- this._PayAccountID = value;
- }
- }
- #endregion
- #region PrebookAcctID
- public abstract class prebookAcctID : PX.Data.IBqlField
- {
- }
- protected Int32? _PrebookAcctID;
-
- ///
- /// The expense account used to record the expenses pending reclassification.
- /// The field is relevant only if the Support for Expense Reclassification feature is activated
- /// and the document has or has had the Prebooked ("K") status. (See )
- ///
- ///
- /// Defaults to the account associated with the vendor of the document.
- /// Corresponds to the AccountID field.
- ///
- [PXDefault(typeof(Select>>>), SourceField = typeof(Vendor.prebookAcctID), PersistingCheck = PXPersistingCheck.Nothing)]
- [Account(DisplayName = "Reclassification Account", Visibility = PXUIVisibility.Visible, DescriptionField = typeof(Account.description))]
- public virtual Int32? PrebookAcctID
- {
- get
- {
- return this._PrebookAcctID;
- }
- set
- {
- this._PrebookAcctID = value;
- }
- }
- #endregion
- #region PrebookSubID
- public abstract class prebookSubID : PX.Data.IBqlField
- {
- }
- protected Int32? _PrebookSubID;
-
-
- ///
- /// The subaccount used to record the expenses pending reclassification.
- /// The field is relevant only if the Support for Expense Reclassification feature is activated
- /// and the document has or has had the Prebooked ("K") status. (See )
- ///
- ///
- /// Defaults to the subaccount associated with the vendor of the document.
- /// Corresponds to the AccountID field.
- ///
- [PXDefault(typeof(Select>>>), SourceField = typeof(Vendor.prebookSubID), PersistingCheck = PXPersistingCheck.Nothing)]
- [SubAccount(typeof(APInvoice.prebookAcctID), DisplayName = "Reclassification Subaccount", Visibility = PXUIVisibility.Visible, DescriptionField = typeof(Sub.description))]
- public virtual Int32? PrebookSubID
- {
- get
- {
- return this._PrebookSubID;
- }
- set
- {
- this._PrebookSubID = value;
- }
- }
- #endregion
- #region Released
- public new abstract class released : PX.Data.IBqlField
- {
- }
- #endregion
- #region OpenDoc
- public new abstract class openDoc : PX.Data.IBqlField
- {
- }
- #endregion
- #region Hold
- public new abstract class hold : PX.Data.IBqlField
- {
- }
- #endregion
- #region Printed
- public new abstract class printed : PX.Data.IBqlField
- {
- }
- #endregion
- #region Voided
- public new abstract class voided : PX.Data.IBqlField
- {
- }
- #endregion
- #region Prebooked
- public new abstract class prebooked : PX.Data.IBqlField
- {
- }
- #endregion
- #region BatchNbr
- public new abstract class batchNbr : PX.Data.IBqlField
- {
- }
- #endregion
- #region PrebookBatchNbr
- public new abstract class prebookBatchNbr : PX.Data.IBqlField
- {
- }
- #endregion
- #region VoidBatchNbr
- public new abstract class voidBatchNbr : PX.Data.IBqlField
- {
- }
- #endregion
- #region ScheduleID
- public new abstract class scheduleID : IBqlField
- {
- }
- #endregion
- #region Scheduled
- public new abstract class scheduled : IBqlField
- {
- }
- #endregion
- #region DocDesc
- public new abstract class docDesc : PX.Data.IBqlField
- {
- }
- #endregion
- #region VendorID_Vendor_acctName
- public new abstract class vendorID_Vendor_acctName : PX.Data.IBqlField
- {
- }
- #endregion
- #region EstPayDate
- public abstract class estPayDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _EstPayDate;
-
- ///
- /// Estimated payment date.
- ///
- ///
- /// The field is calculated and equals either if the document is
- /// selected for payment or the otherwise.
- ///
- [PXDBCalced(typeof(Switch>, APInvoice.payDate>, APInvoice.dueDate>), typeof(DateTime))]
- public virtual DateTime? EstPayDate
- {
- get
- {
- return this._EstPayDate;
- }
- set
- {
- this._EstPayDate = value;
- }
- }
- #endregion
-
- #region LCEnabled
- public abstract class lCEnabled : PX.Data.IBqlField
- {
- }
- protected Boolean? _LCEnabled = false;
-
- ///
- /// Indicates whether landed cost is enabled for the document.
- ///
- ///
- /// Equals true if the vendor of the document is a Landed Cost vendor and
- /// the document has landed cost associated with it.
- ///
- [PXBool()]
- [PXUIField(Visible = false)]
- public virtual Boolean? LCEnabled
- {
- get
- {
- return this._LCEnabled;
- }
- set
- {
- this._LCEnabled = value;
- }
- }
- #endregion
- #region IsTaxValid
- public new abstract class isTaxValid : PX.Data.IBqlField
- {
- }
- #endregion
- #region IsTaxPosted
- public new abstract class isTaxPosted : PX.Data.IBqlField
- {
- }
- #endregion
- #region IsTaxSaved
- public new abstract class isTaxSaved : PX.Data.IBqlField
- {
- }
- #endregion
- #region NoteID
- public new abstract class noteID : PX.Data.IBqlField
- {
- }
-
- ///
- /// Identifier of the Note object, associated with the document.
- ///
- ///
- /// Corresponds to the Note.NoteID field.
- ///
- [PXSearchable(SM.SearchCategory.AP, "AP {0}: {1} - {3}", new Type[] { typeof(APInvoice.docType), typeof(APInvoice.refNbr), typeof(APInvoice.vendorID), typeof(Vendor.acctName) },
- new Type[] { typeof(APInvoice.invoiceNbr), typeof(APInvoice.docDesc) },
- NumberFields = new Type[] { typeof(APInvoice.refNbr) },
- Line1Format = "{0:d}{1}{2}", Line1Fields = new Type[] { typeof(APInvoice.docDate), typeof(APInvoice.status), typeof(APInvoice.invoiceNbr) },
- Line2Format = "{0}", Line2Fields = new Type[] { typeof(APInvoice.docDesc) },
- MatchWithJoin = typeof(InnerJoin>>),
- SelectForFastIndexing = typeof(Select2>>>)
- )]
- [PXNote(ShowInReferenceSelector = true)]
- public override Guid? NoteID
- {
- get
- {
- return this._NoteID;
- }
- set
- {
- this._NoteID = value;
- }
- }
- #endregion
-
- #region RefNoteID
- public new abstract class refNoteID : PX.Data.IBqlField
- {
- }
- #endregion
-
- #region PONumber
- public abstract class pONumber : PX.Data.IBqlField
- {
- }
- protected String _PONumber;
- [PXString(15, IsUnicode = true)]
- public String PONumber
- {
- get
- {
- return this._PONumber;
- }
- set
- {
- this._PONumber = value;
- }
- }
- #endregion
-
- #region TaxCalcMode
- public new abstract class taxCalcMode : IBqlField { }
- #endregion
- #region HasWithHoldTax
- public abstract class hasWithHoldTax : IBqlField { }
- protected bool? _HasWithHoldTax;
- [PXBool]
- [RestrictWithholdingTaxCalcMode(typeof(APInvoice.taxZoneID), typeof(APInvoice.taxCalcMode))]
- public virtual bool? HasWithHoldTax
- {
- get { return this._HasWithHoldTax; }
- set { this._HasWithHoldTax = value; }
- }
- #endregion
- #region HasUseTax
- public abstract class hasUseTax : IBqlField { }
- protected bool? _HasUseTax;
- [PXBool]
- [RestrictUseTaxCalcMode(typeof(APInvoice.taxZoneID), typeof(APInvoice.taxCalcMode))]
- public virtual bool? HasUseTax
- {
- get { return this._HasUseTax; }
- set { this._HasUseTax = value; }
- }
- #endregion
- #region UsesManualVAT
- public abstract class usesManualVAT : IBqlField
- {
- }
- protected bool? _UsesManualVAT;
- [PXDBBool]
- [RestrictManualVAT(typeof(APInvoice.taxZoneID), typeof(APInvoice.taxCalcMode))]
- [PXUIField(DisplayName = "Manual VAT Entry", Enabled = false)]
- public virtual bool? UsesManualVAT
- {
- get
- {
- return this._UsesManualVAT;
- }
- set
- {
- this._UsesManualVAT = value;
- }
- }
- #endregion
-
- #region IsTaxDocument
- public abstract class isTaxDocument : IBqlField { }
-
- ///
- /// Specifies (if set to true) that the document is tax bill and orginally has been created by tax reporting process.
- ///
- [PXDBBool]
- public virtual bool? IsTaxDocument { get; set; }
- #endregion
- }
-}
-
-namespace PX.Objects.AP.Standalone
-{
- [Serializable]
- [PXHidden(ServiceVisible = false)]
- public partial class APInvoice : PX.Data.IBqlTable
- {
- #region DocType
- public abstract class docType : PX.Data.IBqlField
- {
- }
- protected string _DocType;
- [PXDBString(3, IsKey = true, IsFixed = true)]
- [PXDefault()]
- public virtual String DocType
- {
- get
- {
- return this._DocType;
- }
- set
- {
- this._DocType = value;
- }
- }
- #endregion
- #region RefNbr
- public abstract class refNbr : PX.Data.IBqlField
- {
- }
- protected string _RefNbr;
- [PXDBString(15, IsUnicode = true, IsKey = true, InputMask = "")]
- [PXDefault()]
- public virtual String RefNbr
- {
- get
- {
- return this._RefNbr;
- }
- set
- {
- this._RefNbr = value;
- }
- }
- #endregion
- #region TermsID
- public abstract class termsID : PX.Data.IBqlField
- {
- }
- protected String _TermsID;
- [PXDBString(10, IsUnicode = true)]
- public virtual String TermsID
- {
- get
- {
- return this._TermsID;
- }
- set
- {
- this._TermsID = value;
- }
- }
- #endregion
- #region DueDate
- public abstract class dueDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _DueDate;
- [PXDBDate()]
- public virtual DateTime? DueDate
- {
- get
- {
- return this._DueDate;
- }
- set
- {
- this._DueDate = value;
- }
- }
- #endregion
- #region DiscDate
- public abstract class discDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _DiscDate;
- [PXDBDate()]
- public virtual DateTime? DiscDate
- {
- get
- {
- return this._DiscDate;
- }
- set
- {
- this._DiscDate = value;
- }
- }
- #endregion
- #region InvoiceNbr
- public abstract class invoiceNbr : PX.Data.IBqlField
- {
- }
- protected String _InvoiceNbr;
- [PXDBString(40, IsUnicode = true)]
- public virtual String InvoiceNbr
- {
- get
- {
- return this._InvoiceNbr;
- }
- set
- {
- this._InvoiceNbr = value;
- }
- }
- #endregion
- #region InvoiceDate
- public abstract class invoiceDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _InvoiceDate;
- [PXDBDate()]
- [PXDefault(TypeCode.DateTime, "01/01/1900")]
- [PXUIField(DisplayName = "Vendor Ref. Date", Visibility = PXUIVisibility.Invisible)]
- public virtual DateTime? InvoiceDate
- {
- get
- {
- return this._InvoiceDate;
- }
- set
- {
- this._InvoiceDate = value;
- }
- }
- #endregion
- #region TaxZoneID
- public abstract class taxZoneID : PX.Data.IBqlField
- {
- }
- protected String _TaxZoneID;
- [PXDBString(10, IsUnicode = true)]
- public virtual String TaxZoneID
- {
- get
- {
- return this._TaxZoneID;
- }
- set
- {
- this._TaxZoneID = value;
- }
- }
- #endregion
- #region MasterRefNbr
- public abstract class masterRefNbr : PX.Data.IBqlField
- {
- }
- protected String _MasterRefNbr;
- [PXDBString(15, IsUnicode = true)]
- public virtual String MasterRefNbr
- {
- get
- {
- return this._MasterRefNbr;
- }
- set
- {
- this._MasterRefNbr = value;
- }
- }
- #endregion
- #region InstallmentNbr
- public abstract class installmentNbr : PX.Data.IBqlField
- {
- }
- protected Int16? _InstallmentNbr;
- [PXDBShort()]
- public virtual Int16? InstallmentNbr
- {
- get
- {
- return this._InstallmentNbr;
- }
- set
- {
- this._InstallmentNbr = value;
- }
- }
- #endregion
- #region CuryTaxTotal
- public abstract class curyTaxTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryTaxTotal;
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryTaxTotal
- {
- get
- {
- return this._CuryTaxTotal;
- }
- set
- {
- this._CuryTaxTotal = value;
- }
- }
- #endregion
- #region TaxTotal
- public abstract class taxTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _TaxTotal;
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? TaxTotal
- {
- get
- {
- return this._TaxTotal;
- }
- set
- {
- this._TaxTotal = value;
- }
- }
- #endregion
- #region CuryTaxAmt
- public abstract class curyTaxAmt : IBqlField { }
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryTaxAmt { get; set; }
- #endregion
- #region TaxAmt
- public abstract class taxAmt : IBqlField { }
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? TaxAmt { get; set; }
- #endregion
- #region CuryVatTaxableTotal
- public abstract class curyVatTaxableTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryVatTaxableTotal;
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryVatTaxableTotal
- {
- get
- {
- return this._CuryVatTaxableTotal;
- }
- set
- {
- this._CuryVatTaxableTotal = value;
- }
- }
- #endregion
- #region VatTaxableTotal
- public abstract class vatTaxableTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _VatTaxableTotal;
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? VatTaxableTotal
- {
- get
- {
- return this._VatTaxableTotal;
- }
- set
- {
- this._VatTaxableTotal = value;
- }
- }
- #endregion
- #region CuryVatExemptTotal
- public abstract class curyVatExemptTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryVatExemptTotal;
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryVatExemptTotal
- {
- get
- {
- return this._CuryVatExemptTotal;
- }
- set
- {
- this._CuryVatExemptTotal = value;
- }
- }
- #endregion
- #region VatExemptTotal
- public abstract class vatExemptTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _VatExemptTotal;
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? VatExemptTotal
- {
- get
- {
- return this._VatExemptTotal;
- }
- set
- {
- this._VatExemptTotal = value;
- }
- }
- #endregion
- #region CuryLineTotal
- public abstract class curyLineTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryLineTotal;
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? CuryLineTotal
- {
- get
- {
- return this._CuryLineTotal;
- }
- set
- {
- this._CuryLineTotal = value;
- }
- }
- #endregion
- #region LineTotal
- public abstract class lineTotal : PX.Data.IBqlField
- {
- }
- protected Decimal? _LineTotal;
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? LineTotal
- {
- get
- {
- return this._LineTotal;
- }
- set
- {
- this._LineTotal = value;
- }
- }
- #endregion
- #region SeparateCheck
- public abstract class separateCheck : PX.Data.IBqlField
- {
- }
- protected Boolean? _SeparateCheck;
- [PXDBBool()]
- [PXDefault(true)]
- public virtual Boolean? SeparateCheck
- {
- get
- {
- return this._SeparateCheck;
- }
- set
- {
- this._SeparateCheck = value;
- }
- }
- #endregion
- #region PaySel
- public abstract class paySel : IBqlField
- {
- }
- protected bool? _PaySel = false;
- [PXDBBool]
- [PXDefault(false)]
- public bool? PaySel
- {
- get
- {
- return _PaySel;
- }
- set
- {
- _PaySel = value;
- }
- }
- #endregion
- #region PayDate
- public abstract class payDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _PayDate;
- [PXDBDate()]
- public virtual DateTime? PayDate
- {
- get
- {
- return this._PayDate;
- }
- set
- {
- this._PayDate = value;
- }
- }
- #endregion
- #region PayTypeID
- public abstract class payTypeID : PX.Data.IBqlField
- {
- }
- protected String _PayTypeID;
- [PXDBString(10, IsUnicode = true)]
- public virtual String PayTypeID
- {
- get
- {
- return this._PayTypeID;
- }
- set
- {
- this._PayTypeID = value;
- }
- }
- #endregion
- #region PayAccountID
- public abstract class payAccountID : PX.Data.IBqlField
- {
- }
- protected Int32? _PayAccountID;
- [PXDBInt()]
- public virtual Int32? PayAccountID
- {
- get
- {
- return this._PayAccountID;
- }
- set
- {
- this._PayAccountID = value;
- }
- }
- #endregion
- #region PayLocationID
- public abstract class payLocationID : PX.Data.IBqlField
- {
- }
- protected Int32? _PayLocationID;
- [PXDBInt()]
- public virtual Int32? PayLocationID
- {
- get
- {
- return this._PayLocationID;
- }
- set
- {
- this._PayLocationID = value;
- }
- }
- #endregion
- #region PrebookAcctID
- public abstract class prebookAcctID : PX.Data.IBqlField
- {
- }
- protected Int32? _PrebookAcctID;
-
- [PXDBInt()]
- public virtual Int32? PrebookAcctID
- {
- get
- {
- return this._PrebookAcctID;
- }
- set
- {
- this._PrebookAcctID = value;
- }
- }
- #endregion
- #region PrebookSubID
- public abstract class prebookSubID : PX.Data.IBqlField
- {
- }
- protected Int32? _PrebookSubID;
-
- [PXDBInt()]
- public virtual Int32? PrebookSubID
- {
- get
- {
- return this._PrebookSubID;
- }
- set
- {
- this._PrebookSubID = value;
- }
- }
- #endregion
- #region TaxCalcMode
- public abstract class taxCalcMode : IBqlField { }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/APRegister.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/APRegister.cs
deleted file mode 100644
index 581e9adf5..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/APRegister.cs
+++ /dev/null
@@ -1,2813 +0,0 @@
-#define USE_CACHE_EXTENSION
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using PX.Common;
-
-using PX.Data;
-using PX.Data.EP;
-
-using PX.TM;
-
-using PX.Objects.AP.BQL;
-using PX.Objects.Common;
-using PX.Objects.GL;
-using PX.Objects.CM;
-using PX.Objects.CS;
-using PX.Objects.CR;
-
-using APQuickCheck = PX.Objects.AP.Standalone.APQuickCheck;
-using CRLocation = PX.Objects.CR.Standalone.Location;
-using IRegister = PX.Objects.CM.IRegister;
-
-namespace PX.Objects.AP
-{
- public class APDocType : ILabelProvider
- {
- public const string Invoice = "INV";
- public const string CreditAdj = "ACR";
- public const string DebitAdj = "ADR";
- public const string Check = "CHK";
- public const string VoidCheck = "VCK";
- public const string Prepayment = "PPM";
- public const string Refund = "REF";
- public const string QuickCheck = "QCK";
- public const string VoidQuickCheck = "VQC";
-
- protected static readonly IEnumerable _valueLabelPairs = new ValueLabelList
- {
- { Invoice, Messages.Invoice },
- { CreditAdj, Messages.CreditAdj },
- { DebitAdj, Messages.DebitAdj },
- { Check, Messages.Check },
- { VoidCheck, Messages.VoidCheck },
- { Prepayment, Messages.Prepayment },
- { Refund, Messages.Refund },
- { QuickCheck, Messages.QuickCheck },
- { VoidQuickCheck, Messages.VoidQuickCheck },
- };
-
- protected static readonly IEnumerable _valuePrintableLabelPairs = new ValueLabelList
- {
- { Invoice, Messages.PrintInvoice },
- { CreditAdj, Messages.PrintCreditAdj },
- { DebitAdj, Messages.PrintDebitAdj },
- { Check, Messages.PrintCheck },
- { VoidCheck, Messages.PrintVoidCheck },
- { Prepayment, Messages.PrintPrepayment },
- { Refund, Messages.PrintRefund },
- { QuickCheck, Messages.PrintQuickCheck },
- { VoidQuickCheck, Messages.PrintVoidQuickCheck },
- };
-
- public static readonly string[] Values = { Invoice, CreditAdj, DebitAdj, Check, VoidCheck, Prepayment, Refund, QuickCheck, VoidQuickCheck };
- public static readonly string[] Labels = { Messages.Invoice, Messages.CreditAdj, Messages.DebitAdj, Messages.Check, Messages.VoidCheck, Messages.Prepayment, Messages.Refund, Messages.QuickCheck, Messages.VoidQuickCheck };
-
- public IEnumerable ValueLabelPairs => _valueLabelPairs;
-
- public class ListAttribute : LabelListAttribute
- {
- public ListAttribute() : base(_valueLabelPairs)
- { }
- }
-
- ///
- /// Defines a Selector of the AP Document types with shorter description.
- /// In the screens displayed as combo-box.
- /// Mostly used in the reports.
- ///
- public class PrintListAttribute : LabelListAttribute
- {
- public PrintListAttribute() : base(_valuePrintableLabelPairs)
- { }
- }
-
- public class invoice : Constant
- {
- public invoice() : base(Invoice) { }
- }
-
- public class creditAdj : Constant
- {
- public creditAdj() : base(CreditAdj) { }
- }
-
- public class debitAdj : Constant
- {
- public debitAdj() : base(DebitAdj) { }
- }
-
- public class check : Constant
- {
- public check() : base(Check) { }
- }
-
- public class voidCheck : Constant
- {
- public voidCheck() : base(VoidCheck) { }
- }
-
- public class prepayment : Constant
- {
- public prepayment() : base(Prepayment) { }
- }
-
- public class refund : Constant
- {
- public refund() : base(Refund) { }
- }
-
- public class quickCheck : Constant
- {
- public quickCheck() : base(QuickCheck) { }
- }
-
- public class voidQuickCheck : Constant
- {
- public voidQuickCheck() : base(VoidQuickCheck) { }
- }
-
- public static string DocClass(string DocType)
- {
- switch (DocType)
- {
- case Invoice:
- case CreditAdj:
- case DebitAdj:
- case QuickCheck:
- case VoidQuickCheck:
- return GLTran.tranClass.Normal;
- case Check:
- case VoidCheck:
- case Refund:
- return GLTran.tranClass.Payment;
- case Prepayment:
- return GLTran.tranClass.Charge;
- default:
- return null;
- }
- }
-
- public static bool? Payable(string DocType)
- {
- switch (DocType)
- {
- case Invoice:
- case CreditAdj:
- return true;
- case Check:
- case DebitAdj:
- case VoidCheck:
- case Prepayment:
- case Refund:
- case QuickCheck:
- case VoidQuickCheck:
- return false;
- default:
- return null;
- }
- }
-
- public static Int16? SortOrder(string DocType)
- {
- switch (DocType)
- {
- case Invoice:
- case CreditAdj:
- case QuickCheck:
- return 0;
- case Prepayment:
- return 1;
- case DebitAdj:
- return 2;
- case Check:
- return 3;
- case VoidCheck:
- case VoidQuickCheck:
- return 4;
- case Refund:
- return 5;
- default:
- return null;
- }
- }
-
- public static Decimal? SignBalance(string DocType)
- {
- switch (DocType)
- {
- case Refund:
- case Invoice:
- case CreditAdj:
- return 1m;
- case DebitAdj:
- case Check:
- case VoidCheck:
- return -1m;
- case Prepayment:
- return -1m;
- case QuickCheck:
- case VoidQuickCheck:
- return 0m;
- default:
- return null;
- }
- }
-
- public static Decimal? SignAmount(string DocType)
- {
- switch (DocType)
- {
- case Refund:
- case Invoice:
- case CreditAdj:
- case QuickCheck:
- return 1m;
- case DebitAdj:
- case Check:
- case VoidCheck:
- case VoidQuickCheck:
- return -1m;
- case Prepayment:
- return -1m;
- default:
- return null;
- }
- }
-
- public static string TaxDrCr(string DocType)
- {
- switch (DocType)
- {
- //Invoice Types
- case Invoice:
- case CreditAdj:
- case QuickCheck:
- return DrCr.Debit;
- case DebitAdj:
- case VoidQuickCheck:
- return DrCr.Credit;
- //Payment Types
- case Check:
- case Prepayment:
- case VoidCheck:
- return DrCr.Debit;
- case Refund:
- return DrCr.Credit;
- default:
- return DrCr.Debit;
- }
- }
-
- public static bool? HasNegativeAmount(string docType)
- {
- switch (docType)
- {
- case Refund:
- case Invoice:
- case CreditAdj:
- case QuickCheck:
- case DebitAdj:
- case Check:
- case Prepayment:
- case VoidQuickCheck:
- return false;
- case VoidCheck:
- return true;
- default:
- return null;
- }
- }
- }
-
- public class APDocStatus
- {
- public static readonly string[] Values = { Hold, Balanced, Voided, Scheduled, Open, Closed, Printed, Prebooked, PendingApproval, Rejected, Reserved };
- public static readonly string[] Labels = { Messages.Hold, Messages.Balanced, Messages.Voided, Messages.Scheduled, Messages.Open, Messages.Closed, Messages.Printed, Messages.Prebooked, Messages.PendingApproval, Messages.Rejected, Messages.Reserved };
-
- public class ListAttribute : PXStringListAttribute
- {
- public ListAttribute()
- : base(Values, Labels) { }
- }
-
- public const string Hold = "H";
- public const string Balanced = "B";
- public const string Voided = "V";
- public const string Scheduled = "S";
- public const string Open = "N";
- public const string Closed = "C";
- public const string Printed = "P";
- public const string Prebooked = "K";
- public const string PendingApproval = "E";
- public const string Rejected = "R";
- public const string Reserved = "Z";
-
- public class hold : Constant
- {
- public hold() : base(Hold) { }
- }
-
- public class balanced : Constant
- {
- public balanced() : base(Balanced) { }
- }
-
- public class voided : Constant
- {
- public voided() : base(Voided) { }
- }
-
- public class scheduled : Constant
- {
- public scheduled() : base(Scheduled) { }
- }
-
- public class open : Constant
- {
- public open() : base(Open) { }
- }
-
- public class closed : Constant
- {
- public closed() : base(Closed) { }
- }
-
- public class printed : Constant
- {
- public printed() : base(Printed) { }
- }
-
- public class prebooked : Constant
- {
- public prebooked() : base(Prebooked) { }
- }
-
- public class pendingApproval : Constant
- {
- public pendingApproval() : base(PendingApproval) { }
- }
-
- public class rejected : Constant
- {
- public rejected() : base(Rejected) { }
- }
-
- public class reserved : Constant
- {
- public reserved() : base(Reserved) { }
- }
- }
-
- ///
- /// An auxiliary DAC that is used in Accounts Payable and Accounts Receivable balance reports
- /// to properly join documents with their adjustments.
- ///
- [Serializable]
- [PXCacheName(Messages.APAROrd)]
- public partial class APAROrd : PX.Data.IBqlTable
- {
- #region Ord
- public abstract class ord : PX.Data.IBqlField
- {
- }
- protected Int16? _Ord;
-
- ///
- /// [key] The field is used in reports for joining and filtering purposes.
- ///
- [PXDBShort(IsKey = true)]
- public virtual Int16? Ord
- {
- get
- {
- return this._Ord;
- }
- set
- {
- this._Ord = value;
- }
- }
- #endregion
- }
-
- ///
- /// Primary DAC for the Accounts Payable documents.
- /// Includes fields common to all types of AP documents.
- ///
- [PXCacheName(Messages.Document)]
- [System.SerializableAttribute()]
- [PXPrimaryGraph(new Type[] {
- typeof(APQuickCheckEntry),
- typeof(TX.TXInvoiceEntry),
- typeof(APInvoiceEntry),
- typeof(APPaymentEntry)
- },
- new Type[] {
- typeof(Select>,
- And>>>>),
- typeof(Select>,
- And>,
- And, And>>>>>>),
- typeof(Select>,
- And>>>>),
- typeof(Select>,
- And>>>>)
- })]
- public partial class APRegister : IBqlTable, IRegister, IBalance
- {
- #region Selected
- public abstract class selected : PX.Data.IBqlField
- {
- }
- protected bool? _Selected = false;
-
- ///
- /// Indicates whether the record is selected for mass processing or not.
- ///
- [PXBool]
- [PXDefault(false)]
- [PXUIField(DisplayName = "Selected")]
- public virtual bool? Selected
- {
- get
- {
- return _Selected;
- }
- set
- {
- _Selected = value;
- }
- }
- #endregion
- #region Hidden
- public abstract class hidden : PX.Data.IBqlField
- {
- }
- protected bool? _Hidden = false;
-
- ///
- /// If set to true, this field indicates that the document represents a payment by a separate check.
- /// In this case the payment cannot be combined with other payments to the vendor.
- /// Applicable only in case VSeparateCheck option
- /// is turned on for the Vendor.
- ///
- [PXBool]
- [PXDefault(false)]
- public virtual bool? Hidden
- {
- get
- {
- return _Hidden;
- }
- set
- {
- _Hidden = value;
- }
- }
- #endregion
- #region BranchID
- public abstract class branchID : PX.Data.IBqlField
- {
- }
- protected Int32? _BranchID;
-
- ///
- /// Identifier of the Branch, to which the document belongs.
- ///
- ///
- /// Corresponds to the Branch.BranchID field.
- ///
- [GL.Branch()]
- public virtual Int32? BranchID
- {
- get
- {
- return this._BranchID;
- }
- set
- {
- this._BranchID = value;
- }
- }
- #endregion
- #region Passed
- public virtual bool? Passed
- {
- get;
- set;
- }
- #endregion
- #region DocType
- public abstract class docType : PX.Data.IBqlField
- {
- }
- protected String _DocType;
-
- ///
- /// [key] Type of the document.
- ///
- ///
- /// Possible values are: "INV" - Invoice, "ACR" - Credit Adjustment, "ADR" - Debit Adjustment,
- /// "CHK" - Check, "VCK" - Void Check, "PPM" - Prepayment, "REF" - Vendor Refund,
- /// "QCK" - Quick Check, "VQC" - Void Quick Check.
- ///
- [PXDBString(3, IsKey = true, IsFixed = true)]
- [PXDefault()]
- [APDocType.List()]
- [PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
- [PXFieldDescription]
- public virtual String DocType
- {
- get
- {
- return this._DocType;
- }
- set
- {
- this._DocType = value;
- }
- }
-
- [PXString]
- [PXUIFieldAttribute(DisplayName = "Document Type (Internal)")]
- public string InternalDocType
- {
- [PXDependsOnFields(typeof(docType))]
- get
- {
- return DocType;
- }
- }
- #endregion
- #region PrintDocType
- public abstract class printDocType : PX.Data.IBqlField
- {
- }
-
- ///
- /// Type of the document for displaying in reports.
- /// This field has the same set of possible internal values as the field,
- /// but exposes different user-friendly values.
- ///
- ///
- ///
- ///
- [PXString(3, IsFixed = true)]
- [APDocType.PrintList()]
- [PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.Visible, Enabled = true)]
- public virtual String PrintDocType
- {
- get
- {
- return this._DocType;
- }
- set
- {
- }
- }
- #endregion
- #region RefNbr
- public abstract class refNbr : PX.Data.IBqlField
- {
- }
- protected String _RefNbr;
-
- ///
- /// [key] Reference number of the document.
- ///
- [PXDBString(15, IsUnicode = true, IsKey = true, InputMask = "")]
- [PXDefault()]
- [PXUIField(DisplayName = "Reference Nbr.", Visibility = PXUIVisibility.SelectorVisible, TabOrder = 1)]
- [PXSelector(typeof(Search>>>), Filterable = true)]
- [PXFieldDescription]
- public virtual String RefNbr
- {
- get
- {
- return this._RefNbr;
- }
- set
- {
- this._RefNbr = value;
- }
- }
- #endregion
- #region OrigModule
- public abstract class origModule : PX.Data.IBqlField
- {
- }
- protected String _OrigModule;
-
- ///
- /// Module, from which the document originates.
- ///
- ///
- /// Code of the module of the system. Defaults to "AP".
- /// Possible values are: "GL", "AP", "AR", "CM", "CA", "IN", "DR", "FA", "PM", "TX", "SO", "PO".
- ///
- [PXDBString(2, IsFixed = true)]
- [PXDefault(GL.BatchModule.AP)]
- [PXUIField(DisplayName = "Source", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
- [GL.BatchModule.FullList()]
- public virtual String OrigModule
- {
- get
- {
- return this._OrigModule;
- }
- set
- {
- this._OrigModule = value;
- }
- }
- #endregion
- #region DocDate
- public abstract class docDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _DocDate;
-
- ///
- /// Date of the document.
- ///
- [PXDBDate()]
- [PXDefault(typeof(AccessInfo.businessDate))]
- [PXUIField(DisplayName = "Date", Visibility = PXUIVisibility.SelectorVisible)]
- public virtual DateTime? DocDate
- {
- get
- {
- return this._DocDate;
- }
- set
- {
- this._DocDate = value;
- }
- }
- #endregion
- #region OrigDocDate
- public abstract class origDocDate : PX.Data.IBqlField
- {
- }
- protected DateTime? _OrigDocDate;
-
- ///
- /// Date of the original (source) document.
- ///
- [PXDBDate()]
- public virtual DateTime? OrigDocDate
- {
- get
- {
- return this._OrigDocDate;
- }
- set
- {
- this._OrigDocDate = value;
- }
- }
- #endregion
- #region TranPeriodID
- public abstract class tranPeriodID : PX.Data.IBqlField
- {
- }
- protected String _TranPeriodID;
-
- ///
- /// Financial Period of the document.
- ///
- ///
- /// Determined by the date of the document. Unlike
- /// the value of this field can't be overriden by user.
- ///
- [TranPeriodID(typeof(APRegister.docDate))]
- [PXUIField(DisplayName = "Transaction Period")]
- public virtual String TranPeriodID
- {
- get
- {
- return this._TranPeriodID;
- }
- set
- {
- this._TranPeriodID = value;
- }
- }
- #endregion
- #region FinPeriodID
- public abstract class finPeriodID : PX.Data.IBqlField
- {
- }
- protected String _FinPeriodID;
-
- ///
- /// Financial Period of the document.
- ///
- ///
- /// Defaults to the period, to which the belongs, but can be overriden by user.
- ///
- [APOpenPeriod(typeof(APRegister.docDate))]
- [PXDefault()]
- [PXUIField(DisplayName = "Post Period", Visibility = PXUIVisibility.SelectorVisible)]
- public virtual String FinPeriodID
- {
- get
- {
- return this._FinPeriodID;
- }
- set
- {
- this._FinPeriodID = value;
- }
- }
- #endregion
- #region VendorID
- public abstract class vendorID : PX.Data.IBqlField
- {
- }
- ///
- /// Identifier of the , whom the document belongs to.
- ///
- [VendorActive(
- Visibility = PXUIVisibility.SelectorVisible,
- DescriptionField = typeof(Vendor.acctName),
- CacheGlobal = true,
- Filterable = true)]
- [PXDefault]
- public virtual int? VendorID
- {
- get;
- set;
- }
- #endregion
- #region VendorID_Vendor_acctName
- public abstract class vendorID_Vendor_acctName : PX.Data.IBqlField
- {
- }
- #endregion
- #region VendorLocationID
- public abstract class vendorLocationID : PX.Data.IBqlField
- {
- }
- protected Int32? _VendorLocationID;
-
- ///
- /// Identifier of the Location of the Vendor, associated with the document.
- ///
- ///
- /// Corresponds to the field. Defaults to vendor's default location.
- ///
- [LocationID(
- typeof(Where>,
- And,
- And>>>),
- DescriptionField = typeof(Location.descr),
- Visibility = PXUIVisibility.SelectorVisible)]
- [PXDefault(typeof(Coalesce<
- Search2,
- And>>>,
- Where>,
- And, And>>>>,
- Search>,
- And, And>>>>>))]
- public virtual Int32? VendorLocationID
- {
- get
- {
- return this._VendorLocationID;
- }
- set
- {
- this._VendorLocationID = value;
- }
- }
- #endregion
- #region CuryID
- public abstract class curyID : PX.Data.IBqlField
- {
- }
- protected String _CuryID;
-
- ///
- /// Code of the Currency of the document.
- ///
- ///
- /// Defaults to the company's base currency.
- ///
- [PXDBString(5, IsUnicode = true, InputMask = ">LLLLL")]
- [PXUIField(DisplayName = "Currency", Visibility = PXUIVisibility.SelectorVisible)]
- [PXDefault(typeof(Search))]
- [PXSelector(typeof(Currency.curyID))]
- public virtual String CuryID
- {
- get
- {
- return this._CuryID;
- }
- set
- {
- this._CuryID = value;
- }
- }
- #endregion
- #region APAccountID
- public abstract class aPAccountID : PX.Data.IBqlField
- {
- }
- protected Int32? _APAccountID;
-
- ///
- /// Identifier of the AP account, to which the document belongs.
- ///
- ///
- /// Corresponds to the field.
- ///
- [PXDefault]
- [Account(typeof(APRegister.branchID), typeof(Search>,
- And,
- And,
- And, IsNull,
- Or>>>>>>>>), DisplayName = "AP Account")]
- public virtual Int32? APAccountID
- {
- get
- {
- return this._APAccountID;
- }
- set
- {
- this._APAccountID = value;
- }
- }
- #endregion
- #region APSubID
- public abstract class aPSubID : PX.Data.IBqlField
- {
- }
- protected Int32? _APSubID;
-
- ///
- /// Identifier of the AP subaccount, to which the document belongs.
- ///
- ///
- /// Corresponds to the field.
- ///
- [PXDefault]
- [SubAccount(typeof(APRegister.aPAccountID), typeof(APRegister.branchID), true, DescriptionField = typeof(Sub.description), DisplayName = "AP Subaccount", Visibility = PXUIVisibility.Visible)]
- public virtual Int32? APSubID
- {
- get
- {
- return this._APSubID;
- }
- set
- {
- this._APSubID = value;
- }
- }
- #endregion
- #region LineCntr
- public abstract class lineCntr : PX.Data.IBqlField
- {
- }
- protected Int32? _LineCntr;
-
- ///
- /// Counter of the document lines, used internally to assign numbers to newly created lines.
- /// It is not recommended to rely on this fields to determine the exact count of lines, because it might not reflect the latter under various conditions.
- ///
- [PXDBInt()]
- [PXDefault(0)]
- public virtual Int32? LineCntr
- {
- get
- {
- return this._LineCntr;
- }
- set
- {
- this._LineCntr = value;
- }
- }
- #endregion
- #region CuryInfoID
- public abstract class curyInfoID : PX.Data.IBqlField
- {
- }
- protected Int64? _CuryInfoID;
-
- ///
- /// Identifier of the CurrencyInfo object associated with the document.
- ///
- ///
- /// Generated automatically. Corresponds to the field.
- ///
- [PXDBLong()]
- [CurrencyInfo(ModuleCode = "AP")]
- public virtual Int64? CuryInfoID
- {
- get
- {
- return this._CuryInfoID;
- }
- set
- {
- this._CuryInfoID = value;
- }
- }
- #endregion
- #region CuryOrigDocAmt
- public abstract class curyOrigDocAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryOrigDocAmt;
-
- ///
- /// The amount to be paid for the document in the currency of the document. (See )
- ///
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.origDocAmt))]
- [PXUIField(DisplayName = "Amount", Visibility = PXUIVisibility.SelectorVisible)]
- public virtual Decimal? CuryOrigDocAmt
- {
- get
- {
- return this._CuryOrigDocAmt;
- }
- set
- {
- this._CuryOrigDocAmt = value;
- }
- }
- #endregion
- #region OrigDocAmt
- public abstract class origDocAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _OrigDocAmt;
-
- ///
- /// The amount to be paid for the document in the base currency of the company. (See )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXUIField(DisplayName = "Amount")]
- public virtual Decimal? OrigDocAmt
- {
- get
- {
- return this._OrigDocAmt;
- }
- set
- {
- this._OrigDocAmt = value;
- }
- }
- #endregion
- #region CuryDocBal
- public abstract class curyDocBal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryDocBal;
-
- ///
- /// The balance of the Accounts Payable document after tax (if inclusive) and the discount in the currency of the document. (See )
- ///
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.docBal), BaseCalc = false)]
- [PXUIField(DisplayName = "Balance", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
- public virtual Decimal? CuryDocBal
- {
- get
- {
- return this._CuryDocBal;
- }
- set
- {
- this._CuryDocBal = value;
- }
- }
- #endregion
- #region DocBal
- public abstract class docBal : PX.Data.IBqlField
- {
- }
- protected Decimal? _DocBal;
-
- ///
- /// The balance of the Accounts Payable document after tax (if inclusive) and the discount in the base currency of the company. (See )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? DocBal
- {
- get
- {
- return this._DocBal;
- }
- set
- {
- this._DocBal = value;
- }
- }
- #endregion
- #region DiscTot
- public abstract class discTot : PX.Data.IBqlField
- {
- }
- protected Decimal? _DiscTot;
-
- ///
- /// Total discount associated with the document in the base currency of the company. (See )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? DiscTot
- {
- get
- {
- return this._DiscTot;
- }
- set
- {
- this._DiscTot = value;
- }
- }
- #endregion
- #region CuryDiscTot
- public abstract class curyDiscTot : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryDiscTot;
-
- ///
- /// Total discount associated with the document in the currency of the document. (See )
- ///
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.discTot))]
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXUIField(DisplayName = "Discount Total", Enabled = true)]
- public virtual Decimal? CuryDiscTot
- {
- get
- {
- return this._CuryDiscTot;
- }
- set
- {
- this._CuryDiscTot = value;
- }
- }
- #endregion
- #region DocDisc
- public abstract class docDisc : PX.Data.IBqlField
- {
- }
- protected Decimal? _DocDisc;
- [PXBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
- public virtual Decimal? DocDisc
- {
- get
- {
- return this._DocDisc;
- }
- set
- {
- this._DocDisc = value;
- }
- }
- #endregion
- #region CuryDocDisc
- public abstract class curyDocDisc : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryDocDisc;
- [PXCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.docDisc))]
- [PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
- [PXUIField(DisplayName = "Document Discount", Enabled = true)]
- public virtual Decimal? CuryDocDisc
- {
- get
- {
- return this._CuryDocDisc;
- }
- set
- {
- this._CuryDocDisc = value;
- }
- }
- #endregion
- #region CuryOrigDiscAmt
- public abstract class curyOrigDiscAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryOrigDiscAmt;
-
- ///
- /// !REV! The amount of the cash discount taken for the original document.
- /// (Presented in the currency of the document, see )
- ///
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.origDiscAmt))]
- [PXUIField(DisplayName = "Cash Discount", Visibility = PXUIVisibility.SelectorVisible)]
- public virtual Decimal? CuryOrigDiscAmt
- {
- get
- {
- return this._CuryOrigDiscAmt;
- }
- set
- {
- this._CuryOrigDiscAmt = value;
- }
- }
- #endregion
- #region OrigDiscAmt
- public abstract class origDiscAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _OrigDiscAmt;
-
- ///
- /// The amount of the cash discount taken for the original document.
- /// (Presented in the base currency of the company, see )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? OrigDiscAmt
- {
- get
- {
- return this._OrigDiscAmt;
- }
- set
- {
- this._OrigDiscAmt = value;
- }
- }
- #endregion
- #region CuryDiscTaken
- public abstract class curyDiscTaken : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryDiscTaken;
-
- ///
- /// !REV! The amount of the cash discount taken.
- /// (Presented in the currency of the document, see )
- ///
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.discTaken))]
- public virtual Decimal? CuryDiscTaken
- {
- get
- {
- return this._CuryDiscTaken;
- }
- set
- {
- this._CuryDiscTaken = value;
- }
- }
- #endregion
- #region DiscTaken
- public abstract class discTaken : PX.Data.IBqlField
- {
- }
- protected Decimal? _DiscTaken;
-
- ///
- /// The amount of the cash discount taken.
- /// (Presented in the base currency of the company, see )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? DiscTaken
- {
- get
- {
- return this._DiscTaken;
- }
- set
- {
- this._DiscTaken = value;
- }
- }
- #endregion
- #region CuryDiscBal
- public abstract class curyDiscBal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryDiscBal;
-
- ///
- /// The difference between the cash discount that was available and the actual amount of cash discount taken.
- /// (Presented in the currency of the document, see )
- ///
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.discBal), BaseCalc = false)]
- [PXUIField(DisplayName = "Cash Discount Balance", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
- public virtual Decimal? CuryDiscBal
- {
- get
- {
- return this._CuryDiscBal;
- }
- set
- {
- this._CuryDiscBal = value;
- }
- }
- #endregion
- #region DiscBal
- public abstract class discBal : PX.Data.IBqlField
- {
- }
- protected Decimal? _DiscBal;
-
- ///
- /// The difference between the cash discount that was available and the actual amount of cash discount taken.
- /// (Presented in the base currency of the company, see )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? DiscBal
- {
- get
- {
- return this._DiscBal;
- }
- set
- {
- this._DiscBal = value;
- }
- }
- #endregion
- #region CuryOrigWhTaxAmt
- public abstract class curyOrigWhTaxAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryOrigWhTaxAmt;
-
- ///
- /// The amount of withholding tax calculated for the document, if applicable, in the currency of the document. (See )
- ///
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.origWhTaxAmt))]
- [PXUIField(DisplayName = "With. Tax", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
- public virtual Decimal? CuryOrigWhTaxAmt
- {
- get
- {
- return this._CuryOrigWhTaxAmt;
- }
- set
- {
- this._CuryOrigWhTaxAmt = value;
- }
- }
- #endregion
- #region OrigWhTaxAmt
- public abstract class origWhTaxAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _OrigWhTaxAmt;
-
- ///
- /// The amount of withholding tax calculated for the document, if applicable, in the base currency of the company. (See )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? OrigWhTaxAmt
- {
- get
- {
- return this._OrigWhTaxAmt;
- }
- set
- {
- this._OrigWhTaxAmt = value;
- }
- }
- #endregion
- #region CuryWhTaxBal
- public abstract class curyWhTaxBal : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryWhTaxBal;
-
- ///
- /// !REV! The difference between the original amount of withholding tax to be payed and the amount that was actually paid.
- /// (Presented in the currency of the document, see )
- ///
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.whTaxBal), BaseCalc = false)]
- public virtual Decimal? CuryWhTaxBal
- {
- get
- {
- return this._CuryWhTaxBal;
- }
- set
- {
- this._CuryWhTaxBal = value;
- }
- }
- #endregion
- #region WhTaxBal
- public abstract class whTaxBal : PX.Data.IBqlField
- {
- }
- protected Decimal? _WhTaxBal;
-
- ///
- /// The difference between the original amount of withholding tax to be payed and the amount that was actually paid.
- /// (Presented in the base currency of the company, see )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? WhTaxBal
- {
- get
- {
- return this._WhTaxBal;
- }
- set
- {
- this._WhTaxBal = value;
- }
- }
- #endregion
- #region CuryTaxWheld
- public abstract class curyTaxWheld : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryTaxWheld;
-
- ///
- /// !REV! The amount of tax withheld from the payments to the document.
- /// (Presented in the currency of the document, see )
- ///
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.taxWheld))]
- public virtual Decimal? CuryTaxWheld
- {
- get
- {
- return this._CuryTaxWheld;
- }
- set
- {
- this._CuryTaxWheld = value;
- }
- }
- #endregion
- #region TaxWheld
- public abstract class taxWheld : PX.Data.IBqlField
- {
- }
- protected Decimal? _TaxWheld;
-
- ///
- /// The amount of tax withheld from the payments to the document.
- /// (Presented in the base currency of the company, see )
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? TaxWheld
- {
- get
- {
- return this._TaxWheld;
- }
- set
- {
- this._TaxWheld = value;
- }
- }
- #endregion
- #region CuryChargeAmt
- public abstract class curyChargeAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _CuryChargeAmt;
-
- ///
- /// The amount of charges associated with the document in the currency of the document. (See )
- ///
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.chargeAmt))]
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXUIField(DisplayName = "Finance Charges", Visibility = PXUIVisibility.Visible, Enabled = false)]
- public virtual Decimal? CuryChargeAmt
- {
- get
- {
- return this._CuryChargeAmt;
- }
- set
- {
- this._CuryChargeAmt = value;
- }
- }
- #endregion
- #region ChargeAmt
- public abstract class chargeAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _ChargeAmt;
-
- ///
- /// The amount of charges associated with the document in the base currency of the company. (See )
- ///
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? ChargeAmt
- {
- get
- {
- return this._ChargeAmt;
- }
- set
- {
- this._ChargeAmt = value;
- }
- }
- #endregion
- #region DocDesc
- public abstract class docDesc : PX.Data.IBqlField
- {
- }
- protected String _DocDesc;
-
- ///
- /// Description of the document.
- ///
- [PXDBString(60, IsUnicode = true)]
- [PXUIField(DisplayName = "Description", Visibility = PXUIVisibility.SelectorVisible)]
- public virtual String DocDesc
- {
- get
- {
- return this._DocDesc;
- }
- set
- {
- this._DocDesc = value;
- }
- }
- #endregion
- #region CreatedByID
- public abstract class createdByID : PX.Data.IBqlField
- {
- }
- protected Guid? _CreatedByID;
- [PXDBCreatedByID()]
- public virtual Guid? CreatedByID
- {
- get
- {
- return this._CreatedByID;
- }
- set
- {
- this._CreatedByID = value;
- }
- }
- #endregion
- #region CreatedByScreenID
- public abstract class createdByScreenID : PX.Data.IBqlField
- {
- }
- protected String _CreatedByScreenID;
- [PXDBCreatedByScreenID()]
- public virtual String CreatedByScreenID
- {
- get
- {
- return this._CreatedByScreenID;
- }
- set
- {
- this._CreatedByScreenID = value;
- }
- }
- #endregion
- #region CreatedDateTime
- public abstract class createdDateTime : PX.Data.IBqlField
- {
- }
- protected DateTime? _CreatedDateTime;
- [PXDBCreatedDateTime()]
- public virtual DateTime? CreatedDateTime
- {
- get
- {
- return this._CreatedDateTime;
- }
- set
- {
- this._CreatedDateTime = value;
- }
- }
- #endregion
- #region LastModifiedByID
- public abstract class lastModifiedByID : PX.Data.IBqlField
- {
- }
- protected Guid? _LastModifiedByID;
- [PXDBLastModifiedByID()]
- public virtual Guid? LastModifiedByID
- {
- get
- {
- return this._LastModifiedByID;
- }
- set
- {
- this._LastModifiedByID = value;
- }
- }
- #endregion
- #region LastModifiedByScreenID
- public abstract class lastModifiedByScreenID : PX.Data.IBqlField
- {
- }
- protected String _LastModifiedByScreenID;
- [PXDBLastModifiedByScreenID()]
- public virtual String LastModifiedByScreenID
- {
- get
- {
- return this._LastModifiedByScreenID;
- }
- set
- {
- this._LastModifiedByScreenID = value;
- }
- }
- #endregion
- #region LastModifiedDateTime
- public abstract class lastModifiedDateTime : PX.Data.IBqlField
- {
- }
- protected DateTime? _LastModifiedDateTime;
- [PXDBLastModifiedDateTime()]
- public virtual DateTime? LastModifiedDateTime
- {
- get
- {
- return this._LastModifiedDateTime;
- }
- set
- {
- this._LastModifiedDateTime = value;
- }
- }
- #endregion
- #region tstamp
- public abstract class Tstamp : PX.Data.IBqlField
- {
- }
- protected Byte[] _tstamp;
- [PXDBTimestamp()]
- public virtual Byte[] tstamp
- {
- get
- {
- return this._tstamp;
- }
- set
- {
- this._tstamp = value;
- }
- }
- #endregion
- #region DocClass
- public abstract class docClass : PX.Data.IBqlField
- {
- }
-
- ///
- /// Class of the document. This field is calculated based on the .
- ///
- ///
- /// Possible values are: "N" - for Invoice, Credit Adjustment, Debit Adjustment, Quick Check and Void Quick Check; "P" - for Check, Void Check and Refund; "U" - for Prepayment.
- ///
- [PXString(1, IsFixed = true)]
- public virtual string DocClass
- {
- [PXDependsOnFields(typeof(docType))]
- get
- {
- return APDocType.DocClass(this._DocType);
- }
- set
- {
- }
- }
- #endregion
- #region BatchNbr
- public abstract class batchNbr : PX.Data.IBqlField
- {
- }
- protected String _BatchNbr;
-
- ///
- /// Number of the , generated for the document on release.
- ///
- ///
- /// Corresponds to the Batch.BatchNbr field.
- ///
- [PXDBString(15, IsUnicode = true)]
- [PXUIField(DisplayName = "Batch Nbr.", Visibility = PXUIVisibility.Visible, Enabled = false)]
- [PXSelector(typeof(Search>>))]
- public virtual String BatchNbr
- {
- get
- {
- return this._BatchNbr;
- }
- set
- {
- this._BatchNbr = value;
- }
- }
- #endregion
- #region PrebookBatchNbr
- public abstract class prebookBatchNbr : PX.Data.IBqlField
- {
- }
- protected String _PrebookBatchNbr;
-
- ///
- /// Stores the number of the generated during prebooking.
- ///
- ///
- /// Corresponds to the Batch.BatchNbr field.
- ///
- [PXDBString(15, IsUnicode = true)]
- [PXUIField(DisplayName = "Pre-Releasing Batch Nbr.", Visibility = PXUIVisibility.Visible, Enabled = false)]
- [PXSelector(typeof(Batch.batchNbr))]
- public virtual String PrebookBatchNbr
- {
- get
- {
- return this._PrebookBatchNbr;
- }
- set
- {
- this._PrebookBatchNbr = value;
- }
- }
- #endregion
- #region VoidBatchNbr
- public abstract class voidBatchNbr : PX.Data.IBqlField
- {
- }
- protected String _VoidBatchNbr;
-
- ///
- /// Stores the number of the generated when the document was voided.
- ///
- ///
- /// Corresponds to the Batch.BatchNbr field.
- ///
- [PXDBString(15, IsUnicode = true)]
- [PXUIField(DisplayName = "Void Batch Nbr.", Visibility = PXUIVisibility.Visible, Enabled = false)]
- [PXSelector(typeof(Batch.batchNbr))]
- public virtual String VoidBatchNbr
- {
- get
- {
- return this._VoidBatchNbr;
- }
- set
- {
- this._VoidBatchNbr = value;
- }
- }
- #endregion
- #region Released
- public abstract class released : PX.Data.IBqlField
- {
- }
- protected Boolean? _Released;
-
- ///
- /// When set to true indicates that the document was released.
- ///
- [PXDBBool()]
- [PXDefault(false)]
- [PXUIField(DisplayName = "Released", Visible = false)]
- public virtual Boolean? Released
- {
- get
- {
- return this._Released;
- }
- set
- {
- this._Released = value;
- }
- }
- #endregion
- #region OpenDoc
- public abstract class openDoc : PX.Data.IBqlField
- {
- }
- protected Boolean? _OpenDoc;
-
- ///
- /// When set to true indicates that the document is open.
- ///
- [PXDBBool()]
- [PXDefault(true)]
- [PXUIField(DisplayName = "Open", Visible = false)]
- public virtual Boolean? OpenDoc
- {
- get
- {
- return this._OpenDoc;
- }
- set
- {
- this._OpenDoc = value;
- }
- }
- #endregion
- #region Hold
- public abstract class hold : PX.Data.IBqlField
- {
- }
- protected Boolean? _Hold;
-
- ///
- /// When set to true indicates that the document is on hold and thus cannot be released.
- ///
- [PXDBBool()]
- [PXUIField(DisplayName = "Hold", Visibility = PXUIVisibility.Visible)]
- [PXDefault(true, typeof(APSetup.holdEntry))]
- public virtual Boolean? Hold
- {
- get
- {
- return this._Hold;
- }
- set
- {
- this._Hold = value;
- }
- }
- #endregion
- #region Scheduled
- public abstract class scheduled : PX.Data.IBqlField
- {
- }
- protected Boolean? _Scheduled;
-
- ///
- /// When set to true indicates that the document is part of a Schedule and serves as a template for generating other documents according to it.
- ///
- [PXDBBool()]
- [PXDefault(false)]
- public virtual Boolean? Scheduled
- {
- get
- {
- return this._Scheduled;
- }
- set
- {
- this._Scheduled = value;
- }
- }
- #endregion
- #region Voided
- public abstract class voided : PX.Data.IBqlField
- {
- }
- protected Boolean? _Voided;
-
- ///
- /// When set to true indicates that the document was voided. In this case field will hold the number of the voiding .
- ///
- [PXDBBool()]
- [PXDefault(false)]
- [PXUIField(DisplayName = "Void", Visible = false)]
- public virtual Boolean? Voided
- {
- get
- {
- return this._Voided;
- }
- set
- {
- this._Voided = value;
- }
- }
- #endregion
- #region Printed
- public abstract class printed : PX.Data.IBqlField
- {
- }
- protected Boolean? _Printed;
-
- ///
- /// When set to true indicates that the document was printed.
- ///
- [PXDBBool()]
- [PXDefault(false)]
- public virtual Boolean? Printed
- {
- get
- {
- return this._Printed;
- }
- set
- {
- this._Printed = value;
- }
- }
- #endregion
- #region Prebooked
- public abstract class prebooked : PX.Data.IBqlField
- {
- }
- protected Boolean? _Prebooked;
-
- ///
- /// When set to true indicates that the document was prebooked.
- ///
- [PXDBBool()]
- [PXDefault(false)]
- [PXUIField(DisplayName = "Prebooked")]
- public virtual Boolean? Prebooked
- {
- get
- {
- return this._Prebooked;
- }
- set
- {
- this._Prebooked = value;
- }
- }
- #endregion
- #region Approved
- public abstract class approved : PX.Data.IBqlField
- {
- }
- [PXDBBool]
- [PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]
- public virtual bool? Approved
- {
- get;
- set;
- }
- #endregion
- #region Rejected
- public abstract class rejected : IBqlField
- {
- }
- [PXDBBool]
- [PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]
- public bool? Rejected
- {
- get;
- set;
- }
- #endregion
- #region RequestApproval
- public abstract class requestApproval : PX.Data.IBqlField
- {
- }
- ///
- /// Indicates that requests approval
- /// for AP documents.
- ///
- [PXBool]
- [PXDefault(typeof(Search), PersistingCheck = PXPersistingCheck.Nothing)]
- [PXDBScalar(typeof(Search))]
- [PXUIField(DisplayName = "Request Approval", Visible = false)]
- public virtual bool? RequestApproval
- {
- get;
- set;
- }
- #endregion
- #region DontApprove
- public abstract class dontApprove : PX.Data.IBqlField
- {
- }
- ///
- /// Indicates that the current document should be excluded from the
- /// approval process.
- ///
- [PXBool]
- [PXFormula(typeof(Switch<
- Case,
- Or, Equal>>,
- True,
- Case>,
- False>>,
- True>))]
- [PXUIField(DisplayName = "Don't Approve", Visible = false, Enabled = false)]
- public virtual bool? DontApprove
- {
- get;
- set;
- }
- #endregion
- #region NoteID
- public abstract class noteID : PX.Data.IBqlField
- {
- }
- protected Guid? _NoteID;
-
- ///
- /// Identifier of the Note object, associated with the document.
- ///
- ///
- /// Corresponds to the Note.NoteID field.
- ///
- [PXNote(DescriptionField = typeof(APRegister.refNbr))]
- public virtual Guid? NoteID
- {
- get
- {
- return this._NoteID;
- }
- set
- {
- this._NoteID = value;
- }
- }
- #endregion
- #region RefNoteID
- public abstract class refNoteID : PX.Data.IBqlField
- {
- }
- protected Guid? _RefNoteID;
-
- ///
- /// !REV!
- ///
- [PXDBGuid()]
- public virtual Guid? RefNoteID
- {
- get
- {
- return this._RefNoteID;
- }
- set
- {
- this._RefNoteID = value;
- }
- }
- #endregion
- #region ClosedFinPeriodID
- public abstract class closedFinPeriodID : PX.Data.IBqlField
- {
- }
- protected String _ClosedFinPeriodID;
-
- ///
- /// The Financial Period, in which the document was closed.
- ///
- ///
- /// Corresponds to the field.
- ///
- [FinPeriodID()]
- [PXUIField(DisplayName = "Closed Period", Visibility = PXUIVisibility.Invisible)]
- public virtual String ClosedFinPeriodID
- {
- get
- {
- return this._ClosedFinPeriodID;
- }
- set
- {
- this._ClosedFinPeriodID = value;
- }
- }
- #endregion
- #region ClosedTranPeriodID
- public abstract class closedTranPeriodID : PX.Data.IBqlField
- {
- }
- protected String _ClosedTranPeriodID;
-
- ///
- /// The Financial Period, in which the document was closed.
- ///
- ///
- /// Corresponds to the field.
- ///
- [FinPeriodID()]
- [PXUIField(DisplayName = "Closed Period", Visibility = PXUIVisibility.Invisible)]
- public virtual String ClosedTranPeriodID
- {
- get
- {
- return this._ClosedTranPeriodID;
- }
- set
- {
- this._ClosedTranPeriodID = value;
- }
- }
- #endregion
- #region RGOLAmt
- public abstract class rGOLAmt : PX.Data.IBqlField
- {
- }
- protected Decimal? _RGOLAmt;
-
- ///
- /// Realized Gain and Loss amount associated with the document.
- ///
- [PXDBDecimal(4)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public virtual Decimal? RGOLAmt
- {
- get
- {
- return this._RGOLAmt;
- }
- set
- {
- this._RGOLAmt = value;
- }
- }
- #endregion
- #region CuryRoundDiff
- public abstract class curyRoundDiff : IBqlField { }
-
- ///
- /// The difference between the original amount and the rounded amount in the currency of the document. (See )
- /// (Applicable only in case Invoice Rounding feature is on.)
- ///
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.roundDiff), BaseCalc = false)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXUIField(DisplayName = "Rounding Diff.", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
- public decimal? CuryRoundDiff
- {
- get;
- set;
- }
- #endregion
- #region RoundDiff
- public abstract class roundDiff : IBqlField { }
-
- ///
- /// The difference between the original amount and the rounded amount in the base currency of the company. (See )
- /// (Applicable only in case Invoice Rounding feature is on.)
- ///
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public decimal? RoundDiff
- {
- get;
- set;
- }
- #endregion
- #region CuryTaxRoundDiff
- public abstract class curyTaxRoundDiff : IBqlField { }
-
- [PXDBCurrency(typeof(APRegister.curyInfoID), typeof(APRegister.taxRoundDiff), BaseCalc = false)]
- [PXDefault(TypeCode.Decimal, "0.0")]
- [PXUIField(DisplayName = "Rounding Diff.", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
- public decimal? CuryTaxRoundDiff
- {
- get;
- set;
- }
- #endregion
- #region TaxRoundDiff
- public abstract class taxRoundDiff : IBqlField { }
-
- [PXDBBaseCury()]
- [PXDefault(TypeCode.Decimal, "0.0")]
- public decimal? TaxRoundDiff
- {
- get;
- set;
- }
- #endregion
- #region Payable
-
- ///
- /// Read-only field indicating whether the document is payable. Depends solely on the APRegister.DocType field.
- /// Opposite to field.
- ///
- ///
- /// true - for payable documents, e.g. bills; false - for paying, e.g. checks.
- ///
- public virtual Boolean? Payable
- {
- [PXDependsOnFields(typeof(docType))]
- get
- {
- return APDocType.Payable(this._DocType);
- }
- set
- {
- }
- }
- #endregion
- #region Paying
-
- ///
- /// Read-only field indicating whether the document is paying. Depends solely on the APRegister.DocType field.
- /// Opposite to field.
- ///
- ///
- /// true - for paying documents, e.g. checks; false - for payable ones, e.g. bills.
- ///
- public virtual Boolean? Paying
- {
- [PXDependsOnFields(typeof(docType))]
- get
- {
- return (APDocType.Payable(this._DocType) == false);
- }
- set
- {
- }
- }
- #endregion
- #region SortOrder
-
- ///
- /// Read-only field determining the sort order for AP documents based on the field.
- ///
- public virtual Int16? SortOrder
- {
- [PXDependsOnFields(typeof(docType))]
- get
- {
- return APDocType.SortOrder(this._DocType);
- }
- set
- {
- }
- }
- #endregion
- #region SignBalance
-
- ///
- /// Read-only field indicating the sign of the document's impact on AP balance .
- /// Depends solely on the
- ///
- ///
- /// Can be 1, -1 or 0.
- ///
- public virtual Decimal? SignBalance
- {
- [PXDependsOnFields(typeof(docType))]
- get
- {
- return APDocType.SignBalance(this._DocType);
- }
- set
- {
- }
- }
- #endregion
- #region SignAmount
-
- ///
- /// Read-only field indicating the sign of the document amount.
- /// Depends solely on the
- ///
- ///
- /// Can be 1, -1 or 0.
- ///
- public virtual Decimal? SignAmount
- {
- [PXDependsOnFields(typeof(docType))]
- get
- {
- return APDocType.SignAmount(this._DocType);
- }
- set
- {
- }
- }
- #endregion
- #region Status
- public abstract class status : IBqlField { }
- protected string _Status;
-
- ///
- /// Status of the document. The field is calculated based on the values of status flag. It can't be changed directly.
- /// The fields tht determine status of a document are: , , ,
- /// , , , , .
- ///
- ///
- /// Possible values are:
- /// "H" - Hold, "B" - Balanced, "V" - Voided, "S" - Scheduled,
- /// "N" - Open, "C" - Closed, "P" - Printed, "K" - Prebooked,
- /// "E" - Pending Approval, "R" - Rejected, "Z" - Reserved.
- /// Defaults to Hold.
- ///
- [PXDBString(1, IsFixed = true)]
- [PXDefault(APDocStatus.Hold)]
- [PXUIField(DisplayName = "Status", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
- [APDocStatus.List]
- [SetStatus]
- [PXDependsOnFields(
- typeof(APRegister.voided),
- typeof(APRegister.hold),
- typeof(APRegister.scheduled),
- typeof(APRegister.released),
- typeof(APRegister.printed),
- typeof(APRegister.prebooked),
- typeof(APRegister.openDoc),
- typeof(APRegister.approved),
- typeof(APRegister.rejected))]
- public virtual string Status
- {
- get
- {
- return this._Status;
- }
- set
- {
- this._Status = value;
- }
- }
- #endregion
- #region Methods
- public class SetStatusAttribute : PXEventSubscriberAttribute, IPXRowUpdatingSubscriber, IPXRowInsertingSubscriber
- {
- public override void CacheAttached(PXCache sender)
- {
- base.CacheAttached(sender);
-
- sender.Graph.FieldUpdating.AddHandler(
- sender.GetItemType(),
- nameof(APRegister.hold),
- (cache, e) =>
- {
- PXBoolAttribute.ConvertValue(e);
-
- APRegister item = e.Row as APRegister;
- if (item != null)
- {
- StatusSet(cache, item, (bool?)e.NewValue);
- }
- });
-
- sender.Graph.FieldVerifying.AddHandler(
- sender.GetItemType(),
- nameof(APRegister.status),
- (cache, e) => { e.NewValue = cache.GetValue(e.Row); });
-
- sender.Graph.RowSelecting.AddHandler(sender.GetItemType(), RowSelecting);
-
- sender.Graph.RowSelected.AddHandler(
- sender.GetItemType(),
- (cache, e) =>
- {
- APRegister document = e.Row as APRegister;
-
- if (document != null)
- {
- StatusSet(cache, document, document.Hold);
- }
- });
- }
-
- protected virtual void StatusSet(PXCache cache, APRegister item, bool? HoldVal)
- {
- if (item.Voided == true)
- {
- item.Status = APDocStatus.Voided;
- }
- else if (item.Hold == true)
- {
- if (item.Released == true)
- {
- item.Status = APDocStatus.Reserved;
- }
- else
- {
- item.Status = APDocStatus.Hold;
- }
- }
- else if (item.Scheduled == true)
- {
- item.Status = APDocStatus.Scheduled;
- }
- else if (item.Rejected == true)
- {
- item.Status = APDocStatus.Rejected;
- }
- else if (item.Released != true)
- {
- if (item.Printed == true && item.DocType == APDocType.Check)
- {
- item.Status = APDocStatus.Printed;
- }
- else if (item.Prebooked == true)
- {
- item.Status = APDocStatus.Prebooked;
- }
- else if (
- item.Approved != true &&
- item.DontApprove != true)
- {
- item.Status = APDocStatus.PendingApproval;
- }
- else
- {
- item.Status = APDocStatus.Balanced;
- }
- }
- else if (item.OpenDoc == true)
- {
- item.Status = APDocStatus.Open;
- }
- else if (item.OpenDoc == false)
- {
- item.Status = APDocStatus.Closed;
- }
- }
-
- public virtual void RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
- {
- APRegister item = (APRegister)e.Row;
- if (item != null)
- StatusSet(sender, item, item.Hold);
- }
-
- public virtual void RowInserting(PXCache sender, PXRowInsertingEventArgs e)
- {
- APRegister item = (APRegister)e.Row;
- StatusSet(sender, item, item.Hold);
- }
-
- public virtual void RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
- {
- APRegister item = (APRegister)e.NewRow;
- StatusSet(sender, item, item.Hold);
- }
- }
- #endregion
- #region ScheduleID
- public abstract class scheduleID : IBqlField
- {
- }
- protected string _ScheduleID;
-
- ///
- /// Identifier of the Schedule object, associated with the document.
- /// In case is true, ScheduleID points to the Schedule, to which the document belongs as a template.
- /// Otherwise, ScheduleID points to the Schedule, from which this document was generated, if any.
- ///
- ///
- /// Corresponds to the field.
- ///
- [PXDBString(10, IsUnicode = true)]
- public virtual string ScheduleID
- {
- get
- {
- return this._ScheduleID;
- }
- set
- {
- this._ScheduleID = value;
- }
- }
- #endregion
- #region ImpRefNbr
- public abstract class impRefNbr : PX.Data.IBqlField
- {
- }
- protected String _ImpRefNbr;
-
- ///
- /// Implementation specific reference number of the document.
- /// This field is neither filled nor used by the core Acumatica itself, but may be utilized by customizations or extensions.
- ///
- [PXDBString(15, IsUnicode = true)]
- public virtual String ImpRefNbr
- {
- get
- {
- return this._ImpRefNbr;
- }
- set
- {
- this._ImpRefNbr = value;
- }
- }
- #endregion
-
- #region IsTaxValid
- public abstract class isTaxValid : PX.Data.IBqlField
- {
- }
-
- ///
- /// When true, indicates that the amount of tax calculated with the external Tax Engine(Avalara) is up to date.
- /// If this field equals false, the document was updated since last synchronization with the Tax Engine
- /// and taxes might need recalculation.
- ///
- [PXDBBool()]
- [PXDefault(false)]
- [PXUIField(DisplayName = "Tax is up to date", Enabled = false)]
- public virtual Boolean? IsTaxValid
- {
- get;
- set;
- }
- #endregion
- #region IsTaxPosted
- public abstract class isTaxPosted : PX.Data.IBqlField
- {
- }
-
- ///
- /// When true, indicates that the tax information was successfully commited to the external Tax Engine(Avalara).
- ///
- [PXDBBool()]
- [PXDefault(false)]
- [PXUIField(DisplayName = "Tax is posted/commited to the external Tax Engine(Avalara)", Enabled = false)]
- public virtual Boolean? IsTaxPosted
- {
- get;
- set;
- }
- #endregion
- #region IsTaxSaved
- public abstract class isTaxSaved : PX.Data.IBqlField
- {
- }
-
- ///
- /// Indicates whether the tax information related to the document was saved to the external Tax Engine (Avalara).
- ///
- [PXDBBool()]
- [PXDefault(false)]
- [PXUIField(DisplayName = "Tax is saved in external Tax Engine(Avalara)", Enabled = false)]
- public virtual Boolean? IsTaxSaved
- {
- get;
- set;
- }
- #endregion
- #region OrigDocType
- public abstract class origDocType : PX.Data.IBqlField
- {
- }
- protected String _OrigDocType;
-
- ///
- /// Type of the original (source) document.
- ///
- [PXDBString(3, IsFixed = true)]
- [APDocType.List()]
- [PXUIField(DisplayName = "Orig. Doc. Type")]
- public virtual String OrigDocType
- {
- get
- {
- return this._OrigDocType;
- }
- set
- {
- this._OrigDocType = value;
- }
- }
- #endregion
- #region OrigRefNbr
- public abstract class origRefNbr : PX.Data.IBqlField
- {
- }
- protected String _OrigRefNbr;
-
- ///
- /// Reference number of the original (source) document.
- ///
- [PXDBString(15, IsUnicode = true, InputMask = "")]
- [PXUIField(DisplayName = "Orig. Ref. Nbr.")]
- public virtual String OrigRefNbr
- {
- get
- {
- return this._OrigRefNbr;
- }
- set
- {
- this._OrigRefNbr = value;
- }
- }
- #endregion
- #region Released
- public abstract class releasedOrPrebooked : IBqlField
- {
- }
- ///
- /// Read-only field that is equal to true in case the document
- /// was either prebooked or
- /// released.
- ///
- [PXBool]
- public virtual bool? ReleasedOrPrebooked
- {
- [PXDependsOnFields(typeof(released), typeof(prebooked))]
- get
- {
- return
- this.Released == true ||
- this.Prebooked == true;
- }
- set
- {
- }
- }
- #endregion
- #region TaxCalcMode
- public abstract class taxCalcMode : IBqlField { }
- protected string _TaxCalcMode;
- [PXDBString(1, IsFixed = true)]
- [PXDefault(VendorClass.taxCalcMode.TaxSetting, typeof(Search>,
- And>>>>))]
- [VendorClass.taxCalcMode.List]
- [PXUIField(DisplayName = "Tax Calculation Mode")]
- public virtual string TaxCalcMode
- {
- get { return this._TaxCalcMode; }
- set { this._TaxCalcMode = value; }
- }
- #endregion
- internal string WarningMessage { get; set; }
- #region EmployeeWorkgroupID
- public abstract class employeeWorkgroupID : PX.Data.IBqlField
- {
- }
- ///
- /// The workgroup that is responsible for the document.
- ///
- ///
- /// Corresponds to the EPCompanyTree.WorkGroupID field.
- ///
- [PXDBInt]
- [PXDefault(typeof(Vendor.workgroupID), PersistingCheck = PXPersistingCheck.Nothing)]
- [PXCompanyTreeSelector]
- [PXUIField(DisplayName = Messages.WorkgroupID, Enabled = false)]
- public virtual int? EmployeeWorkgroupID
- {
- get;
- set;
- }
- #endregion
- #region EmployeeID
- public abstract class employeeID : IBqlField
- {
- }
- ///
- /// The employee responsible
- /// for the document.
- ///
- ///
- /// Corresponds to the field.
- ///
- [PXDBGuid]
- [PXDefault(typeof(Coalesce<
- Search<
- CREmployee.userID,
- Where<
- CREmployee.userID, Equal>,
- And>>>,
- Search<
- BAccount.ownerID,
- Where<
- BAccount.bAccountID, Equal>>>>),
- PersistingCheck = PXPersistingCheck.Nothing)]
- [PXOwnerSelector(typeof(APRegister.employeeWorkgroupID))]
- [PXUIField(DisplayName = Messages.Owner)]
- public virtual Guid? EmployeeID
- {
- get;
- set;
- }
- #endregion
- #region WorkgroupID
- public abstract class workgroupID : PX.Data.IBqlField
- {
- }
- ///
- /// The workgroup that is responsible for document
- /// approval process.
- ///
- [PXInt]
- [PXSelector(
- typeof(Search),
- SubstituteKey = typeof(EPCompanyTree.description))]
- [PXUIField(DisplayName = Messages.ApprovalWorkGroupID, Enabled = false)]
- public virtual int? WorkgroupID
- {
- get;
- set;
- }
- #endregion
- #region OwnerID
- public abstract class ownerID : IBqlField
- {
- }
- ///
- /// The employee responsible
- /// for document approval process.
- ///
- ///
- /// Corresponds to the field.
- ///
- [PXGuid]
- [PXOwnerSelector]
- [PXUIField(DisplayName = Messages.Approver, Enabled = false)]
- public virtual Guid? OwnerID
- {
- get;
- set;
- }
- #endregion
- }
-
- [PXProjection(typeof(Select2>>>))]
- [PXBreakInheritance]
- [Serializable]
- public partial class APRegisterAccess : Vendor
- {
- #region DocType
- public abstract class docType : PX.Data.IBqlField
- {
- }
- protected String _DocType;
- [PXDBString(3, IsKey = true, IsFixed = true, BqlField = typeof(APRegister.docType))]
- public virtual String DocType
- {
- get
- {
- return this._DocType;
- }
- set
- {
- this._DocType = value;
- }
- }
- #endregion
- #region RefNbr
- public abstract class refNbr : PX.Data.IBqlField
- {
- }
- protected String _RefNbr;
- [PXDBString(15, IsUnicode = true, IsKey = true, BqlField = typeof(APRegister.refNbr))]
- public virtual String RefNbr
- {
- get
- {
- return this._RefNbr;
- }
- set
- {
- this._RefNbr = value;
- }
- }
- #endregion
- #region Scheduled
- public abstract class scheduled : PX.Data.IBqlField
- {
- }
- protected Boolean? _Scheduled;
- [PXDBBool(BqlField = typeof(APRegister.scheduled))]
- public virtual Boolean? Scheduled
- {
- get
- {
- return this._Scheduled;
- }
- set
- {
- this._Scheduled = value;
- }
- }
- #endregion
- #region ScheduleID
- public abstract class scheduleID : IBqlField
- {
- }
- protected string _ScheduleID;
- [PXDBString(10, IsUnicode = true, BqlField = typeof(APRegister.scheduleID))]
- public virtual string ScheduleID
- {
- get
- {
- return this._ScheduleID;
- }
- set
- {
- this._ScheduleID = value;
- }
- }
- #endregion
- }
-
- [PXProjection(typeof(Select))]
- public class APRegisterP : IBqlTable
- {
- #region OrigModule
- public abstract class origModule : PX.Data.IBqlField
- {
- }
- protected String _OrigModule;
-
- [PXDBString(2, IsFixed = true, BqlField = typeof(APRegister.origModule))]
- public virtual String OrigModule
- {
- get
- {
- return this._OrigModule;
- }
- set
- {
- this._OrigModule = value;
- }
- }
- #endregion
- #region DocDesc
- public abstract class docDesc : PX.Data.IBqlField
- {
- }
- protected String _DocDesc;
-
- [PXDBString(60, IsUnicode = true, BqlField = typeof(APRegister.docDesc))]
- public virtual String DocDesc
- {
- get
- {
- return this._DocDesc;
- }
- set
- {
- this._DocDesc = value;
- }
- }
- #endregion
- #region DocType
- public abstract class docType : PX.Data.IBqlField
- {
- }
- protected String _DocType;
-
- [PXDBString(3, IsFixed = true, BqlField = typeof(APRegister.docType))]
- public virtual String OrigDocType
- {
- get
- {
- return this._DocType;
- }
- set
- {
- this._DocType = value;
- }
- }
- #endregion
- #region RefNbr
- public abstract class refNbr : PX.Data.IBqlField
- {
- }
- protected String _RefNbr;
-
- [PXDBString(15, IsUnicode = true, BqlField = typeof(APRegister.refNbr))]
- public virtual String RefNbr
- {
- get
- {
- return this._RefNbr;
- }
- set
- {
- this._RefNbr = value;
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/ARDocumentRelease.cs b/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/ARDocumentRelease.cs
deleted file mode 100644
index f9ebf6434..000000000
--- a/src/Acuminator/Acuminator.Vsix/Coloriser/Regex/Test/ARDocumentRelease.cs
+++ /dev/null
@@ -1,5688 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.Text;
-
-using PX.Data;
-
-using PX.Common;
-
-using PX.Objects.AR.BQL;
-using PX.Objects.CM;
-using PX.Objects.GL;
-using PX.Objects.CS;
-using PX.Objects.PM;
-using PX.Objects.TX;
-using PX.Objects.CA;
-using PX.Objects.DR;
-using PX.Objects.CR;
-using PX.Objects.SO;
-using PX.Objects.AR.CCPaymentProcessing;
-using PX.Objects.AR.Overrides.ARDocumentRelease;
-using PX.Objects.Common;
-using PX.Objects.Common.DataIntegrity;
-
-using Avalara.AvaTax.Adapter;
-using Avalara.AvaTax.Adapter.TaxService;
-
-using SOOrder = PX.Objects.SO.SOOrder;
-using SOInvoice = PX.Objects.SO.SOInvoice;
-using SOOrderShipment = PX.Objects.SO.SOOrderShipment;
-using INTran = PX.Objects.IN.INTran;
-using PMTran = PX.Objects.PM.PMTran;
-using CRLocation = PX.Objects.CR.Standalone.Location;
-
-namespace PX.Objects.AR
-{
- [System.SerializableAttribute()]
- public partial class BalancedARDocument : ARRegister
- {
- #region Selected
- public new abstract class selected : IBqlField
- {
- }
- #endregion
- #region DocType
- public new abstract class docType : PX.Data.IBqlField
- {
- }
- #endregion
- #region RefNbr
- public new abstract class refNbr : PX.Data.IBqlField
- {
- }
- #endregion
- #region OrigModule
- public new abstract class origModule : PX.Data.IBqlField
- {
- }
- #endregion
- #region OpenDoc
- public new abstract class openDoc : PX.Data.IBqlField
- {
- }
- #endregion
- #region Released
- public new abstract class released : PX.Data.IBqlField
- {
- }
- #endregion
- #region Hold
- public new abstract class hold : PX.Data.IBqlField
- {
- }
- #endregion
- #region Scheduled
- public new abstract class scheduled : PX.Data.IBqlField
- {
- }
- #endregion
- #region Voided
- public new abstract class voided : PX.Data.IBqlField
- {
- }
- #endregion
- #region Status
- public new abstract class status : PX.Data.IBqlField
- {
- }
- [PXDBString(1, IsFixed = true)]
- [PXUIField(DisplayName = "Status", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
- [ARDocStatus.List()]
- public override String Status
- {
- get
- {
- return this._Status;
- }
- set
- {
- this._Status = value;
- }
- }
- #endregion
- #region CreatedByID
- public new abstract class createdByID : PX.Data.IBqlField
- {
- }
- #endregion
- #region LastModifiedByID
- public new abstract class lastModifiedByID : PX.Data.IBqlField
- {
- }
- #endregion
- #region CustomerRefNbr
- public abstract class customerRefNbr : IBqlField
- {
- }
- protected String _CustomerRefNbr;
- [PXString(40, IsUnicode = true)]
- [PXUIField(DisplayName = "Customer Order")]
- public String CustomerRefNbr
- {
- get
- {
- return _CustomerRefNbr;
- }
- set
- {
- _CustomerRefNbr = value;
- }
- }
- #endregion
- #region IsTaxValid
- public new abstract class isTaxValid : PX.Data.IBqlField
- {
- }
- #endregion
- #region IsTaxPosted
- public new abstract class isTaxPosted : PX.Data.IBqlField
- {
- }
- #endregion
- #region IsTaxSaved
- public new abstract class isTaxSaved : PX.Data.IBqlField
- {
- }
- #endregion
- #region PaymentMethodID
- public abstract class paymentMethodID : IBqlField { }
- [PXString(10, IsUnicode = true)]
- [PXUIField(DisplayName = CA.Messages.PaymentMethod, Visible = false)]
- public virtual string PaymentMethodID { get; set; }
- #endregion
- }
-
-
- public class PXMassProcessException : PXException
- {
- protected Exception _InnerException;
- protected int _ListIndex;
-
- public int ListIndex
- {
- get
- {
- return this._ListIndex;
- }
- }
-
- public PXMassProcessException(int ListIndex, Exception InnerException)
- : base(InnerException is PXOuterException ? InnerException.Message + "\r\n" + String.Join("\r\n", ((PXOuterException)InnerException).InnerMessages) : InnerException.Message, InnerException)
- {
- this._ListIndex = ListIndex;
- }
-
- public PXMassProcessException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- PXReflectionSerializer.RestoreObjectProps(this, info);
- }
-
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- PXReflectionSerializer.GetObjectData(this, info);
- base.GetObjectData(info, context);
- }
- }
-
- [PX.Objects.GL.TableAndChartDashboardType]
- public class ARDocumentRelease : PXGraph
- {
- public PXCancel Cancel;
- [PXFilterable]
- [PX.SM.PXViewDetailsButton(typeof(BalancedARDocument.refNbr), WindowMode = PXRedirectHelper.WindowMode.NewWindow)]
- public PXProcessingJoin,
- And>>,
- LeftJoin,
- And>>,
- InnerJoinSingleTable>,
- LeftJoin