Skip to content

Commit

Permalink
GP - Update migrations with 1099 data to use the new IRS Forms app. (m…
Browse files Browse the repository at this point in the history
…icrosoft#27100)

The update enhances the GP migration to use the new IRS Forms app, which
replaces the base app implementation of 1099 handling.

Fixes microsoft#26487

Fixes
[AB#545622](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/545622)

---------

Co-authored-by: jaymckinney <[email protected]>
  • Loading branch information
jaymckinney-enavate and jaymckinney authored Aug 26, 2024
1 parent 7c3fe3e commit 94f2e55
Show file tree
Hide file tree
Showing 7 changed files with 454 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ permissionset 4713 "HybridGPUS - Objects"
codeunit "GP Cloud Migration US" = X,
codeunit "GP Populate Vendor 1099 Data" = X,
codeunit "GP Vendor 1099 Mapping Helpers" = X,
codeunit "GP IRS Form Data" = X,
page "GP 1099 Migration Log" = X,
page "GP 1099 Migration Log Factbox" = X;
}
8 changes: 7 additions & 1 deletion Apps/US/HybridGP_US/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
"name": "Dynamics GP Intelligent Cloud",
"publisher": "Microsoft",
"version": "25.0.0.0"
}
},
{
"id": "b696b4c9-637c-49d1-a806-763ff8f0a20e",
"name": "IRS Forms",
"publisher": "Microsoft",
"version": "25.0.0.0"
}
],
"screenshots": [

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
namespace Microsoft.DataMigration.GP;

using System.Integration;
using System.Environment.Configuration;
using System.Environment;
using Microsoft.Purchases.Vendor;
using Microsoft.Finance.VAT.Reporting;

codeunit 42004 "GP Cloud Migration US"
{
var
IRSFormFeatureKeyIdTok: Label 'IRSForm', Locked = true;

[EventSubscriber(ObjectType::Codeunit, CodeUnit::"Data Migration Mgt.", 'OnAfterMigrationFinished', '', false, false)]
local procedure OnAfterMigrationFinishedSubscriber(var DataMigrationStatus: Record "Data Migration Status"; WasAborted: Boolean; StartTime: DateTime; Retry: Boolean)
var
Expand All @@ -22,6 +28,8 @@ codeunit 42004 "GP Cloud Migration US"
GPPopulateVendor1099Data: Codeunit "GP Populate Vendor 1099 Data";
begin
if GPCompanyAdditionalSettings.GetMigrateVendor1099Enabled() then begin
EnsureSupportedReportingYear();
SetupIRSFormsFeatureIfNeeded();
BindSubscription(GPPopulateVendor1099Data);
GPPopulateVendor1099Data.Run();
UnbindSubscription(GPPopulateVendor1099Data);
Expand All @@ -30,6 +38,22 @@ codeunit 42004 "GP Cloud Migration US"
SetPreferredVendorBankAccountsUseForElectronicPayments();
end;

local procedure EnsureSupportedReportingYear()
var
GPCompanyAdditionalSettings: Record "GP Company Additional Settings";
GPVendor1099MappingHelpers: Codeunit "GP Vendor 1099 Mapping Helpers";
CurrentYear: Integer;
begin
GPCompanyAdditionalSettings.GetSingleInstance();
CurrentYear := System.Date2DMY(Today(), 3);

// If the configured tax year is less than the minimum supported year (example: 0), default it to the current year
if (GPCompanyAdditionalSettings."1099 Tax Year" < GPVendor1099MappingHelpers.GetMinimumSupportedTaxYear()) then begin
GPCompanyAdditionalSettings."1099 Tax Year" := CurrentYear;
GPCompanyAdditionalSettings.Modify();
end;
end;

local procedure SetPreferredVendorBankAccountsUseForElectronicPayments()
var
Vendor: Record Vendor;
Expand All @@ -44,4 +68,35 @@ codeunit 42004 "GP Cloud Migration US"
end;
until Vendor.Next() = 0;
end;

internal procedure IsIRSFormsFeatureEnabled(): Boolean
var
#if not CLEAN25
FeatureManagementFacade: Codeunit "Feature Management Facade";
#endif
IsEnabled: Boolean;
begin
IsEnabled := true;

#if not CLEAN25
IsEnabled := FeatureManagementFacade.IsEnabled(IRSFormFeatureKeyIdTok);
#endif

exit(IsEnabled);
end;

local procedure SetupIRSFormsFeatureIfNeeded()
var
GPCompanyAdditionalSettings: Record "GP Company Additional Settings";
GPIRSFormData: Codeunit "GP IRS Form Data";
ReportingYear: Integer;
begin
if not IsIRSFormsFeatureEnabled() then
exit;

GPCompanyAdditionalSettings.GetSingleInstance();
ReportingYear := GPCompanyAdditionalSettings.Get1099TaxYear();

GPIRSFormData.CreateIRSFormsReportingPeriodIfNeeded(ReportingYear);
end;
}
Loading

0 comments on commit 94f2e55

Please sign in to comment.