Skip to content

Commit

Permalink
GP - Enhancements to Payment Terms creation, visibility of unposted b…
Browse files Browse the repository at this point in the history
…atches, and Migration Log (microsoft#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]>
  • Loading branch information
jaymckinney-enavate and jaymckinney authored Feb 12, 2024
1 parent 8929bc9 commit b887da9
Show file tree
Hide file tree
Showing 21 changed files with 1,616 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ permissionset 4031 "HybridGP - Edit"
tabledata "GP PM10200" = IMD,
tabledata "GP PM30300" = IMD,
tabledata "GP RM20201" = IMD,
tabledata "GP RM30201" = IMD;
tabledata "GP RM30201" = IMD,
tabledata "GP Migration Warnings" = IMD;
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,8 @@ permissionset 4029 "HybridGP - Objects"
table "GP PM10200" = X,
table "GP PM30300" = X,
table "GP RM20201" = X,
table "GP RM30201" = X;
table "GP RM30201" = X,
table "GP Migration Warnings" = X,
page "GP Migration Warnings" = X,
page "GP Payment Terms" = X;
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ permissionset 4032 "HybridGP - Read"
tabledata "GP PM10200" = R,
tabledata "GP PM30300" = R,
tabledata "GP RM20201" = R,
tabledata "GP RM30201" = R;
tabledata "GP RM30201" = R,
tabledata "GP Migration Warnings" = R;
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@ permissionsetextension 4028 "INTELLIGENT CLOUD - HGP" extends "INTELLIGENT CLOUD
tabledata "GP PM10200" = RIMD,
tabledata "GP PM30300" = RIMD,
tabledata "GP RM20201" = RIMD,
tabledata "GP RM30201" = RIMD;
tabledata "GP RM30201" = RIMD,
tabledata "GP Migration Warnings" = RIMD;
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@ permissionsetextension 4025 "D365 BASIC - HGP" extends "D365 BASIC"
tabledata "GP PM10200" = RIMD,
tabledata "GP PM30300" = RIMD,
tabledata "GP RM20201" = RIMD,
tabledata "GP RM30201" = RIMD;
tabledata "GP RM30201" = RIMD,
tabledata "GP Migration Warnings" = RIMD;
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,6 @@ permissionsetextension 4026 "D365 BASIC ISV - HGP" extends "D365 BASIC ISV"
tabledata "GP PM10200" = RIMD,
tabledata "GP PM30300" = RIMD,
tabledata "GP RM20201" = RIMD,
tabledata "GP RM30201" = RIMD;
tabledata "GP RM30201" = RIMD,
tabledata "GP Migration Warnings" = RIMD;
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@ permissionsetextension 4027 "D365 TEAM MEMBER - HGP" extends "D365 TEAM MEMBER"
tabledata "GP PM10200" = RIMD,
tabledata "GP PM30300" = RIMD,
tabledata "GP RM20201" = RIMD,
tabledata "GP RM30201" = RIMD;
tabledata "GP RM30201" = RIMD,
tabledata "GP Migration Warnings" = RIMD;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ codeunit 4017 "GP Account Migrator"
PostingGroupDescriptionTxt: Label 'Migrated from GP', Locked = true;
DescriptionTrxTxt: Label 'Migrated transaction', Locked = true;
BeginningBalanceTrxTxt: Label 'Beginning Balance', Locked = true;
MigrationLogAreaTxt: Label 'Account', Locked = true;

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

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

MigrateAccountDetails(GPAccount, Sender);
end;
Expand Down
119 changes: 119 additions & 0 deletions Apps/W1/HybridGP/app/src/Migration/Support/GPPaymentTerms.Page.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
namespace Microsoft.DataMigration.GP;

page 40134 "GP Payment Terms"
{
ApplicationArea = All;
Caption = 'GP Payment Terms';
PageType = Worksheet;
SourceTable = "GP Payment Terms";
UsageCategory = Lists;
InsertAllowed = false;
DeleteAllowed = false;
Editable = true;

layout
{
area(content)
{
repeater(General)
{
field(DateFormulaIsValid; DateFormulaIsValid)
{
Caption = 'Valid Date Formula';
ToolTip = 'Indicates if the resulting date formula is valid.';
Editable = false;
}
field(CalculatedDateFormula; CalculatedDateFormulaTxt)
{
Caption = 'Calculated Date Formula';
ToolTip = 'Calculated Date Formula';
Editable = false;
Style = Unfavorable;
StyleExpr = not DateFormulaIsValid;
}
field(PYMTRMID; Rec.PYMTRMID)
{
ToolTip = 'Specifies the value of the Payment Terms ID field.';
}
field(DUETYPE; Rec.DUETYPE)
{
ToolTip = 'Specifies the value of the Due Type field.';
}
field(DUEDTDS; Rec.DUEDTDS)
{
ToolTip = 'Specifies the value of the Due Date/Days field.';
}
field(DISCTYPE; Rec.DISCTYPE)
{
ToolTip = 'Specifies the value of the Discount Type field.';
}
field(DISCDTDS; Rec.DISCDTDS)
{
ToolTip = 'Specifies the value of the Discount Date/Days field.';
}
field(DSCLCTYP; Rec.DSCLCTYP)
{
ToolTip = 'Specifies the value of the Discount Calculate Type field.';
}
field(DSCPCTAM; Rec.DSCPCTAM)
{
ToolTip = 'Specifies the value of the Discount Percent Amount field.';
}
field(TAX; Rec.TAX)
{
ToolTip = 'Specifies the value of the Tax field.';
}
field(CBUVATMD; Rec.CBUVATMD)
{
ToolTip = 'Specifies the value of the CB_Use_VAT_Mode field.';
}
field(USEGRPER; Rec.USEGRPER)
{
ToolTip = 'Specifies the value of the Use Grace Periods field.';
}
field(CalculateDateFrom; Rec.CalculateDateFrom)
{
ToolTip = 'Specifies the value of the Calculate Date From field.';
}
field(CalculateDateFromDays; Rec.CalculateDateFromDays)
{
ToolTip = 'Specifies the value of the Calculate Date From Days field.';
}
field(DueMonth; Rec.DueMonth)
{
ToolTip = 'Specifies the value of the Due Month field.';
}
field(DiscountMonth; Rec.DiscountMonth)
{
ToolTip = 'Specifies the value of the Discount Month field.';
}
}
}
}

trigger OnAfterGetRecord()
begin
UpdateRecordStatus();
end;


trigger OnAfterGetCurrRecord()
begin
UpdateRecordStatus();
end;

trigger OnModifyRecord(): Boolean
begin
UpdateRecordStatus();
exit(true);
end;

local procedure UpdateRecordStatus()
begin
DateFormulaIsValid := Rec.GetCalculatedDateForumla(CalculatedDateFormulaTxt);
end;

var
CalculatedDateFormulaTxt: Text[50];
DateFormulaIsValid: Boolean;
}
28 changes: 28 additions & 0 deletions Apps/W1/HybridGP/app/src/Migration/Support/GPPaymentTerms.table.al
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,33 @@ table 4026 "GP Payment Terms"
Clustered = true;
}
}

internal procedure GetCalculatedDateForumla(var CalculatedDateFormulaTxt: Text[50]): Boolean
var
HelperFunctions: Codeunit "Helper Functions";
DueDateCalculation: DateFormula;
DiscountDateCalculation: DateFormula;
DueDateCalculationText: Text[50];
DiscountDateCalculationText: Text[50];
DateFormulaIsValid: Boolean;
begin
DateFormulaIsValid := false;
DiscountDateCalculationText := HelperFunctions.CalculateDiscountDateFormula(Rec);
CalculatedDateFormulaTxt := DiscountDateCalculationText;
if Evaluate(DiscountDateCalculation, DiscountDateCalculationText) then begin
if Rec.CalculateDateFrom = Rec.CalculateDateFrom::"Transaction Date" then begin
DueDateCalculationText := HelperFunctions.CalculateDueDateFormula(Rec, false, '');
CalculatedDateFormulaTxt := DueDateCalculationText;
end else begin
DueDateCalculationText := HelperFunctions.CalculateDueDateFormula(Rec, true, CopyStr(DiscountDateCalculationText, 1, 32));
CalculatedDateFormulaTxt := DueDateCalculationText;
end;

if Evaluate(DueDateCalculation, DueDateCalculationText) then
DateFormulaIsValid := true;
end;

exit(DateFormulaIsValid);
end;
}

Loading

0 comments on commit b887da9

Please sign in to comment.