Skip to content

Commit e4aa3da

Browse files
GP - Enhancements to Payment Terms creation, visibility of unposted batches, and Migration Log (#25831)
This PR enhances the GP migration by hardening the code around Payment Terms creation, adds visibility of unposted batches, and a new Migration Log. ### Payment Terms This change hardens the code around Payment Term creation. It also includes an integration event so that a failing Payment Term could be created by a PTE if needed. ### Migration Log This change also includes a migration log. A Factbox tile is added to the Cloud Migration Management page that will show the user when a non-error action was taken by the migration app, and they should be made aware of it. Currently, these are the scenarios that are now logged: - The Payment Term was handled by 3rd party code. - Skipped creating an Account because there isn't an account number. - Skipped creating a PO because the Vendor has not been migrated. ### Unposted Batches A Factbox tile is added to the Cloud Migration Management page that shows the number of unposted batches. Fixes [AB#499261](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/499261) --------- Co-authored-by: jaymckinney <[email protected]>
1 parent 3ec0ce7 commit e4aa3da

21 files changed

+1616
-73
lines changed

Apps/W1/HybridGP/app/Permissions/HybridGPEdit.PermissionSet.al

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,6 @@ permissionset 4031 "HybridGP - Edit"
118118
tabledata "GP PM10200" = IMD,
119119
tabledata "GP PM30300" = IMD,
120120
tabledata "GP RM20201" = IMD,
121-
tabledata "GP RM30201" = IMD;
121+
tabledata "GP RM30201" = IMD,
122+
tabledata "GP Migration Warnings" = IMD;
122123
}

Apps/W1/HybridGP/app/Permissions/HybridGPObjects.PermissionSet.al

+4-1
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,8 @@ permissionset 4029 "HybridGP - Objects"
153153
table "GP PM10200" = X,
154154
table "GP PM30300" = X,
155155
table "GP RM20201" = X,
156-
table "GP RM30201" = X;
156+
table "GP RM30201" = X,
157+
table "GP Migration Warnings" = X,
158+
page "GP Migration Warnings" = X,
159+
page "GP Payment Terms" = X;
157160
}

Apps/W1/HybridGP/app/Permissions/HybridGPRead.PermissionSet.al

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,6 @@ permissionset 4032 "HybridGP - Read"
118118
tabledata "GP PM10200" = R,
119119
tabledata "GP PM30300" = R,
120120
tabledata "GP RM20201" = R,
121-
tabledata "GP RM30201" = R;
121+
tabledata "GP RM30201" = R,
122+
tabledata "GP Migration Warnings" = R;
122123
}

Apps/W1/HybridGP/app/Permissions/INTELLIGENTCLOUDHGP.PermissionSetExt.al

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,6 @@ permissionsetextension 4028 "INTELLIGENT CLOUD - HGP" extends "INTELLIGENT CLOUD
110110
tabledata "GP PM10200" = RIMD,
111111
tabledata "GP PM30300" = RIMD,
112112
tabledata "GP RM20201" = RIMD,
113-
tabledata "GP RM30201" = RIMD;
113+
tabledata "GP RM30201" = RIMD,
114+
tabledata "GP Migration Warnings" = RIMD;
114115
}

Apps/W1/HybridGP/app/Permissions/d365basicHGP.permissionsetext.al

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,6 @@ permissionsetextension 4025 "D365 BASIC - HGP" extends "D365 BASIC"
109109
tabledata "GP PM10200" = RIMD,
110110
tabledata "GP PM30300" = RIMD,
111111
tabledata "GP RM20201" = RIMD,
112-
tabledata "GP RM30201" = RIMD;
112+
tabledata "GP RM30201" = RIMD,
113+
tabledata "GP Migration Warnings" = RIMD;
113114
}

Apps/W1/HybridGP/app/Permissions/d365basicisvHGP.permissionsetext.al

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,6 @@ permissionsetextension 4026 "D365 BASIC ISV - HGP" extends "D365 BASIC ISV"
108108
tabledata "GP PM10200" = RIMD,
109109
tabledata "GP PM30300" = RIMD,
110110
tabledata "GP RM20201" = RIMD,
111-
tabledata "GP RM30201" = RIMD;
111+
tabledata "GP RM30201" = RIMD,
112+
tabledata "GP Migration Warnings" = RIMD;
112113
}

Apps/W1/HybridGP/app/Permissions/d365teammemberHGP.permissionsetext.al

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,6 @@ permissionsetextension 4027 "D365 TEAM MEMBER - HGP" extends "D365 TEAM MEMBER"
109109
tabledata "GP PM10200" = RIMD,
110110
tabledata "GP PM30300" = RIMD,
111111
tabledata "GP RM20201" = RIMD,
112-
tabledata "GP RM30201" = RIMD;
112+
tabledata "GP RM30201" = RIMD,
113+
tabledata "GP Migration Warnings" = RIMD;
113114
}

Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccountMigrator.codeunit.al

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ codeunit 4017 "GP Account Migrator"
1414
PostingGroupDescriptionTxt: Label 'Migrated from GP', Locked = true;
1515
DescriptionTrxTxt: Label 'Migrated transaction', Locked = true;
1616
BeginningBalanceTrxTxt: Label 'Beginning Balance', Locked = true;
17+
MigrationLogAreaTxt: Label 'Account', Locked = true;
1718

1819
#if not CLEAN22
1920
#pragma warning disable AA0207
@@ -28,6 +29,7 @@ codeunit 4017 "GP Account Migrator"
2829
var
2930
GPAccount: Record "GP Account";
3031
GPCompanyAdditionalSettings: Record "GP Company Additional Settings";
32+
GPMigrationWarnings: Record "GP Migration Warnings";
3133
AccountNum: Code[20];
3234
begin
3335
if RecordIdToMigrate.TableNo() <> Database::"GP Account" then
@@ -39,8 +41,10 @@ codeunit 4017 "GP Account Migrator"
3941
GPAccount.Get(RecordIdToMigrate);
4042

4143
AccountNum := CopyStr(GPAccount.AcctNum.Trim(), 1, 20);
42-
if AccountNum = '' then
44+
if AccountNum = '' then begin
45+
GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, 'Account Index: ' + Format(GPAccount.AcctIndex), 'Account is skipped because there is no account number.');
4346
exit;
47+
end;
4448

4549
MigrateAccountDetails(GPAccount, Sender);
4650
end;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
namespace Microsoft.DataMigration.GP;
2+
3+
page 40134 "GP Payment Terms"
4+
{
5+
ApplicationArea = All;
6+
Caption = 'GP Payment Terms';
7+
PageType = Worksheet;
8+
SourceTable = "GP Payment Terms";
9+
UsageCategory = Lists;
10+
InsertAllowed = false;
11+
DeleteAllowed = false;
12+
Editable = true;
13+
14+
layout
15+
{
16+
area(content)
17+
{
18+
repeater(General)
19+
{
20+
field(DateFormulaIsValid; DateFormulaIsValid)
21+
{
22+
Caption = 'Valid Date Formula';
23+
ToolTip = 'Indicates if the resulting date formula is valid.';
24+
Editable = false;
25+
}
26+
field(CalculatedDateFormula; CalculatedDateFormulaTxt)
27+
{
28+
Caption = 'Calculated Date Formula';
29+
ToolTip = 'Calculated Date Formula';
30+
Editable = false;
31+
Style = Unfavorable;
32+
StyleExpr = not DateFormulaIsValid;
33+
}
34+
field(PYMTRMID; Rec.PYMTRMID)
35+
{
36+
ToolTip = 'Specifies the value of the Payment Terms ID field.';
37+
}
38+
field(DUETYPE; Rec.DUETYPE)
39+
{
40+
ToolTip = 'Specifies the value of the Due Type field.';
41+
}
42+
field(DUEDTDS; Rec.DUEDTDS)
43+
{
44+
ToolTip = 'Specifies the value of the Due Date/Days field.';
45+
}
46+
field(DISCTYPE; Rec.DISCTYPE)
47+
{
48+
ToolTip = 'Specifies the value of the Discount Type field.';
49+
}
50+
field(DISCDTDS; Rec.DISCDTDS)
51+
{
52+
ToolTip = 'Specifies the value of the Discount Date/Days field.';
53+
}
54+
field(DSCLCTYP; Rec.DSCLCTYP)
55+
{
56+
ToolTip = 'Specifies the value of the Discount Calculate Type field.';
57+
}
58+
field(DSCPCTAM; Rec.DSCPCTAM)
59+
{
60+
ToolTip = 'Specifies the value of the Discount Percent Amount field.';
61+
}
62+
field(TAX; Rec.TAX)
63+
{
64+
ToolTip = 'Specifies the value of the Tax field.';
65+
}
66+
field(CBUVATMD; Rec.CBUVATMD)
67+
{
68+
ToolTip = 'Specifies the value of the CB_Use_VAT_Mode field.';
69+
}
70+
field(USEGRPER; Rec.USEGRPER)
71+
{
72+
ToolTip = 'Specifies the value of the Use Grace Periods field.';
73+
}
74+
field(CalculateDateFrom; Rec.CalculateDateFrom)
75+
{
76+
ToolTip = 'Specifies the value of the Calculate Date From field.';
77+
}
78+
field(CalculateDateFromDays; Rec.CalculateDateFromDays)
79+
{
80+
ToolTip = 'Specifies the value of the Calculate Date From Days field.';
81+
}
82+
field(DueMonth; Rec.DueMonth)
83+
{
84+
ToolTip = 'Specifies the value of the Due Month field.';
85+
}
86+
field(DiscountMonth; Rec.DiscountMonth)
87+
{
88+
ToolTip = 'Specifies the value of the Discount Month field.';
89+
}
90+
}
91+
}
92+
}
93+
94+
trigger OnAfterGetRecord()
95+
begin
96+
UpdateRecordStatus();
97+
end;
98+
99+
100+
trigger OnAfterGetCurrRecord()
101+
begin
102+
UpdateRecordStatus();
103+
end;
104+
105+
trigger OnModifyRecord(): Boolean
106+
begin
107+
UpdateRecordStatus();
108+
exit(true);
109+
end;
110+
111+
local procedure UpdateRecordStatus()
112+
begin
113+
DateFormulaIsValid := Rec.GetCalculatedDateForumla(CalculatedDateFormulaTxt);
114+
end;
115+
116+
var
117+
CalculatedDateFormulaTxt: Text[50];
118+
DateFormulaIsValid: Boolean;
119+
}

Apps/W1/HybridGP/app/src/Migration/Support/GPPaymentTerms.table.al

+28
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,33 @@ table 4026 "GP Payment Terms"
9797
Clustered = true;
9898
}
9999
}
100+
101+
internal procedure GetCalculatedDateForumla(var CalculatedDateFormulaTxt: Text[50]): Boolean
102+
var
103+
HelperFunctions: Codeunit "Helper Functions";
104+
DueDateCalculation: DateFormula;
105+
DiscountDateCalculation: DateFormula;
106+
DueDateCalculationText: Text[50];
107+
DiscountDateCalculationText: Text[50];
108+
DateFormulaIsValid: Boolean;
109+
begin
110+
DateFormulaIsValid := false;
111+
DiscountDateCalculationText := HelperFunctions.CalculateDiscountDateFormula(Rec);
112+
CalculatedDateFormulaTxt := DiscountDateCalculationText;
113+
if Evaluate(DiscountDateCalculation, DiscountDateCalculationText) then begin
114+
if Rec.CalculateDateFrom = Rec.CalculateDateFrom::"Transaction Date" then begin
115+
DueDateCalculationText := HelperFunctions.CalculateDueDateFormula(Rec, false, '');
116+
CalculatedDateFormulaTxt := DueDateCalculationText;
117+
end else begin
118+
DueDateCalculationText := HelperFunctions.CalculateDueDateFormula(Rec, true, CopyStr(DiscountDateCalculationText, 1, 32));
119+
CalculatedDateFormulaTxt := DueDateCalculationText;
120+
end;
121+
122+
if Evaluate(DueDateCalculation, DueDateCalculationText) then
123+
DateFormulaIsValid := true;
124+
end;
125+
126+
exit(DateFormulaIsValid);
127+
end;
100128
}
101129

0 commit comments

Comments
 (0)