diff --git a/Apps/W1/DynamicsGPHistoricalData/app/Permissions/GPHistoricalTrx.permissionset.al b/Apps/W1/DynamicsGPHistoricalData/app/Permissions/GPHistoricalTrx.permissionset.al index 1058eeccb2..abf1abe335 100644 --- a/Apps/W1/DynamicsGPHistoricalData/app/Permissions/GPHistoricalTrx.permissionset.al +++ b/Apps/W1/DynamicsGPHistoricalData/app/Permissions/GPHistoricalTrx.permissionset.al @@ -43,6 +43,7 @@ permissionset 40900 "GP Historical Trx." tabledata "Hist. Recv. Trx. SerialLot" = RIMD, tabledata "Hist. Sales Trx. Header" = RIMD, tabledata "Hist. Sales Trx. Line" = RIMD, + tabledata "Hist. Payroll Details" = I, table "Hist. G/L Account" = X, table "Hist. Gen. Journal Line" = X, table "Hist. Inventory Trx. Header" = X, @@ -59,6 +60,7 @@ permissionset 40900 "GP Historical Trx." table "Hist. Recv. Trx. SerialLot" = X, table "Hist. Sales Trx. Header" = X, table "Hist. Sales Trx. Line" = X, + table "Hist. Payroll Details" = X, codeunit "Hist. Migration Status Mgmt." = X, codeunit "Hist. Page Navigation Handler" = X, page "Hist. Invt. Trx. SerialLot" = X, diff --git a/Apps/W1/DynamicsGPHistoricalData/app/Permissions/GPPayrollDetail.permissionset.al b/Apps/W1/DynamicsGPHistoricalData/app/Permissions/GPPayrollDetail.permissionset.al new file mode 100644 index 0000000000..cc1eabad7c --- /dev/null +++ b/Apps/W1/DynamicsGPHistoricalData/app/Permissions/GPPayrollDetail.permissionset.al @@ -0,0 +1,10 @@ +namespace Microsoft.DataMigration.GP.HistoricalData; + +permissionset 40901 "GP Payroll Detail" +{ + Assignable = true; + Access = Public; + Caption = 'GP Historical Payroll Details', MaxLength = 30; + Permissions = tabledata "Hist. Payroll Details" = R, + page "Hist. Payroll Details" = X; +} \ No newline at end of file diff --git a/Apps/W1/DynamicsGPHistoricalData/app/Permissions/d365FullAccessExt.permissionsetext.al b/Apps/W1/DynamicsGPHistoricalData/app/Permissions/d365FullAccessExt.permissionsetext.al index 3d8059b20a..139403e78e 100644 --- a/Apps/W1/DynamicsGPHistoricalData/app/Permissions/d365FullAccessExt.permissionsetext.al +++ b/Apps/W1/DynamicsGPHistoricalData/app/Permissions/d365FullAccessExt.permissionsetext.al @@ -19,5 +19,6 @@ permissionsetextension 40901 "D365 Full Access Ext." extends "D365 FULL ACCESS" tabledata "Hist. Payables Apply" = RIMD, tabledata "Hist. Receivables Apply" = RIMD, tabledata "Hist. Invt. Trx. SerialLot" = RIMD, - tabledata "Hist. Recv. Trx. SerialLot" = RIMD; + tabledata "Hist. Recv. Trx. SerialLot" = RIMD, + tabledata "Hist. Payroll Details" = I; } \ No newline at end of file diff --git a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistGenJournalLines.Page.al b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistGenJournalLines.Page.al index eed6150c82..69f880501e 100644 --- a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistGenJournalLines.Page.al +++ b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistGenJournalLines.Page.al @@ -138,6 +138,29 @@ page 41001 "Hist. Gen. Journal Lines" HistPageNavigationHandler.NavigateToTransactionDetail(Rec); end; } + action(ViewPayrollDetails) + { + ApplicationArea = All; + Caption = 'View Payroll Details'; + ToolTip = 'View the payroll details for this transaction.'; + Promoted = true; + PromotedCategory = Process; + PromotedOnly = true; + Image = View; + Visible = HasAccessablePayrollDetails; + + trigger OnAction() + var + HistPayrollDetailsRec: Record "Hist. Payroll Details"; + HistPayrollDetailsPage: Page "Hist. Payroll Details"; + begin + if HistPayrollDetailsRec.Get(Rec."Primary Key") then begin + HistPayrollDetailsPage.SetRecord(HistPayrollDetailsRec); + HistPayrollDetailsPage.RunModal(); + end else + Error(RecordNotFoundErr); + end; + } } } @@ -150,6 +173,18 @@ page 41001 "Hist. Gen. Journal Lines" Rec.SetRange("Orig. Trx. Source No.", FilterOriginatingTrxSourceNo); end; + trigger OnAfterGetCurrRecord() + var + HistPayrollDetails: Record "Hist. Payroll Details"; + begin + HasAccessablePayrollDetails := false; + + if HistPayrollDetails.ReadPermission() then begin + HistPayrollDetails.SetRange("Hist. Gen. Journal Line Key", Rec."Primary Key"); + HasAccessablePayrollDetails := (not HistPayrollDetails.IsEmpty()); + end; + end; + procedure SetFilterAccountNo(AccountNo: Code[130]) begin FilterAccountNo := AccountNo; @@ -163,4 +198,6 @@ page 41001 "Hist. Gen. Journal Lines" var FilterAccountNo: Code[130]; FilterOriginatingTrxSourceNo: Code[35]; + HasAccessablePayrollDetails: Boolean; + RecordNotFoundErr: Label 'Record could not be found!'; } \ No newline at end of file diff --git a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistInventoryTrx.Page.al b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistInventoryTrx.Page.al index 8dcddbefae..103187e497 100644 --- a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistInventoryTrx.Page.al +++ b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistInventoryTrx.Page.al @@ -103,7 +103,7 @@ page 41010 "Hist. Inventory Trx." HistGenJournalLines: Page "Hist. Gen. Journal Lines"; begin HistGenJournalLines.SetFilterOriginatingTrxSourceNo(Rec."Audit Code"); - HistGenJournalLines.Run(); + HistGenJournalLines.RunModal(); end; } } diff --git a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPayablesDocument.Page.al b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPayablesDocument.Page.al index 1d1b86c515..97ac140c20 100644 --- a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPayablesDocument.Page.al +++ b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPayablesDocument.Page.al @@ -214,10 +214,13 @@ page 41008 "Hist. Payables Document" trigger OnAction() var + HistGenJournalLine: Record "Hist. Gen. Journal Line"; HistGenJournalLines: Page "Hist. Gen. Journal Lines"; begin - HistGenJournalLines.SetFilterOriginatingTrxSourceNo(Rec."Audit Code"); - HistGenJournalLines.Run(); + HistGenJournalLine.SetRange("Orig. Trx. Source No.", Rec."Audit Code"); + HistGenJournalLine.SetRange("Orig. Document No.", Rec."Document No."); + HistGenJournalLines.SetTableView(HistGenJournalLine); + HistGenJournalLines.RunModal(); end; } } diff --git a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPayrollDetails.Page.al b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPayrollDetails.Page.al new file mode 100644 index 0000000000..25e40cc860 --- /dev/null +++ b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPayrollDetails.Page.al @@ -0,0 +1,38 @@ +namespace Microsoft.DataMigration.GP.HistoricalData; + +page 41031 "Hist. Payroll Details" +{ + ApplicationArea = All; + Caption = 'Historical Gen. Journal Line Payroll Details'; + PageType = Card; + SourceTable = "Hist. Payroll Details"; + UsageCategory = None; + Editable = false; + DeleteAllowed = false; + InsertAllowed = false; + ModifyAllowed = false; + + layout + { + area(Content) + { + group(General) + { + Caption = 'General'; + + field("Orig. Document No."; Rec."Orig. Document No.") + { + ToolTip = 'Specifies the value of the Orig. Document No. field.'; + } + field("Source No."; Rec."Source No.") + { + ToolTip = 'Specifies the value of the Source No. field.'; + } + field("Source Name"; Rec."Source Name") + { + ToolTip = 'Specifies the value of the Source Name field.'; + } + } + } + } +} \ No newline at end of file diff --git a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPurchaseRecv.Page.al b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPurchaseRecv.Page.al index 2beec770a9..bbd0a8a03b 100644 --- a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPurchaseRecv.Page.al +++ b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistPurchaseRecv.Page.al @@ -203,7 +203,7 @@ page 41013 "Hist. Purchase Recv." HistGenJournalLines: Page "Hist. Gen. Journal Lines"; begin HistGenJournalLines.SetFilterOriginatingTrxSourceNo(Rec."Audit Code"); - HistGenJournalLines.Run(); + HistGenJournalLines.RunModal(); end; } } diff --git a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistReceivablesDocument.Page.al b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistReceivablesDocument.Page.al index e59c8c9ba1..7e2cf20898 100644 --- a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistReceivablesDocument.Page.al +++ b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistReceivablesDocument.Page.al @@ -204,10 +204,13 @@ page 41006 "Hist. Receivables Document" trigger OnAction() var + HistGenJournalLine: Record "Hist. Gen. Journal Line"; HistGenJournalLines: Page "Hist. Gen. Journal Lines"; begin - HistGenJournalLines.SetFilterOriginatingTrxSourceNo(Rec."Audit Code"); - HistGenJournalLines.Run(); + HistGenJournalLine.SetRange("Orig. Trx. Source No.", Rec."Audit Code"); + HistGenJournalLine.SetRange("Orig. Document No.", Rec."Document No."); + HistGenJournalLines.SetTableView(HistGenJournalLine); + HistGenJournalLines.RunModal(); end; } } diff --git a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistSalesTrx.Page.al b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistSalesTrx.Page.al index 3a6b32153f..228964a196 100644 --- a/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistSalesTrx.Page.al +++ b/Apps/W1/DynamicsGPHistoricalData/app/src/Pages/HistSalesTrx.Page.al @@ -217,7 +217,7 @@ page 41007 "Hist. Sales Trx." HistGenJournalLines: Page "Hist. Gen. Journal Lines"; begin HistGenJournalLines.SetFilterOriginatingTrxSourceNo(Rec."Audit Code"); - HistGenJournalLines.Run(); + HistGenJournalLines.RunModal(); end; } } diff --git a/Apps/W1/DynamicsGPHistoricalData/app/src/Tables/HistPayrollDetails.Table.al b/Apps/W1/DynamicsGPHistoricalData/app/src/Tables/HistPayrollDetails.Table.al new file mode 100644 index 0000000000..067a2b842f --- /dev/null +++ b/Apps/W1/DynamicsGPHistoricalData/app/src/Tables/HistPayrollDetails.Table.al @@ -0,0 +1,34 @@ +namespace Microsoft.DataMigration.GP.HistoricalData; + +table 40917 "Hist. Payroll Details" +{ + Caption = 'Hist. Payroll Details'; + DataClassification = CustomerContent; + + fields + { + field(1; "Hist. Gen. Journal Line Key"; Integer) + { + Caption = 'Hist. Gen. Journal Line Key'; + } + field(2; "Orig. Document No."; Text[35]) + { + Caption = 'Orig. Document No.'; + } + field(3; "Source No."; Text[35]) + { + Caption = 'Source No.'; + } + field(4; "Source Name"; Text[50]) + { + Caption = 'Source Name'; + } + } + keys + { + key(PK; "Hist. Gen. Journal Line Key") + { + Clustered = true; + } + } +} \ No newline at end of file diff --git a/Apps/W1/HybridGP/app/Permissions/HybridGPEdit.PermissionSet.al b/Apps/W1/HybridGP/app/Permissions/HybridGPEdit.PermissionSet.al index b7a8e12fca..4cd2f93f25 100644 --- a/Apps/W1/HybridGP/app/Permissions/HybridGPEdit.PermissionSet.al +++ b/Apps/W1/HybridGP/app/Permissions/HybridGPEdit.PermissionSet.al @@ -116,5 +116,7 @@ permissionset 4031 "HybridGP - Edit" tabledata "GP IV00104" = IMD, tabledata "GP PM00101" = IMD, tabledata "GP PM00203" = IMD, - tabledata "GP PO Validation Buffer" = IMD; + tabledata "GP PO Validation Buffer" = IMD, + tabledata "GP GL00103" = IMD, + tabledata "GP GL00104" = IMD; } diff --git a/Apps/W1/HybridGP/app/Permissions/HybridGPObjects.PermissionSet.al b/Apps/W1/HybridGP/app/Permissions/HybridGPObjects.PermissionSet.al index aafd7326df..33172aad15 100644 --- a/Apps/W1/HybridGP/app/Permissions/HybridGPObjects.PermissionSet.al +++ b/Apps/W1/HybridGP/app/Permissions/HybridGPObjects.PermissionSet.al @@ -143,5 +143,7 @@ permissionset 4029 "HybridGP - Objects" table "GP PM00101" = X, table "GP PM00203" = X, table "GP PO Validation Buffer" = X, - codeunit "GP Migration Validator" = X; + codeunit "GP Migration Validator" = X, + table "GP GL00103" = X, + table "GP GL00104" = X; } \ No newline at end of file diff --git a/Apps/W1/HybridGP/app/Permissions/HybridGPRead.PermissionSet.al b/Apps/W1/HybridGP/app/Permissions/HybridGPRead.PermissionSet.al index 71d31d5842..7b61684ad6 100644 --- a/Apps/W1/HybridGP/app/Permissions/HybridGPRead.PermissionSet.al +++ b/Apps/W1/HybridGP/app/Permissions/HybridGPRead.PermissionSet.al @@ -116,5 +116,7 @@ permissionset 4032 "HybridGP - Read" tabledata "GP IV00104" = R, tabledata "GP PM00101" = R, tabledata "GP PM00203" = R, - tabledata "GP PO Validation Buffer" = R; + tabledata "GP PO Validation Buffer" = R, + tabledata "GP GL00103" = R, + tabledata "GP GL00104" = R; } diff --git a/Apps/W1/HybridGP/app/Permissions/INTELLIGENTCLOUDHGP.PermissionSetExt.al b/Apps/W1/HybridGP/app/Permissions/INTELLIGENTCLOUDHGP.PermissionSetExt.al index edc239401b..b26d042435 100644 --- a/Apps/W1/HybridGP/app/Permissions/INTELLIGENTCLOUDHGP.PermissionSetExt.al +++ b/Apps/W1/HybridGP/app/Permissions/INTELLIGENTCLOUDHGP.PermissionSetExt.al @@ -114,5 +114,7 @@ permissionsetextension 4028 "INTELLIGENT CLOUD - HGP" extends "INTELLIGENT CLOUD tabledata "GP IV00104" = RIMD, tabledata "GP PM00101" = RIMD, tabledata "GP PM00203" = RIMD, - tabledata "GP PO Validation Buffer" = RIMD; + tabledata "GP PO Validation Buffer" = RIMD, + tabledata "GP GL00103" = RIMD, + tabledata "GP GL00104" = RIMD; } \ No newline at end of file diff --git a/Apps/W1/HybridGP/app/Permissions/d365basicHGP.permissionsetext.al b/Apps/W1/HybridGP/app/Permissions/d365basicHGP.permissionsetext.al index a886068122..9c439638df 100644 --- a/Apps/W1/HybridGP/app/Permissions/d365basicHGP.permissionsetext.al +++ b/Apps/W1/HybridGP/app/Permissions/d365basicHGP.permissionsetext.al @@ -113,5 +113,7 @@ permissionsetextension 4025 "D365 BASIC - HGP" extends "D365 BASIC" tabledata "GP IV00104" = RIMD, tabledata "GP PM00101" = RIMD, tabledata "GP PM00203" = RIMD, - tabledata "GP PO Validation Buffer" = RIMD; + tabledata "GP PO Validation Buffer" = RIMD, + tabledata "GP GL00103" = RIMD, + tabledata "GP GL00104" = RIMD; } \ No newline at end of file diff --git a/Apps/W1/HybridGP/app/Permissions/d365basicisvHGP.permissionsetext.al b/Apps/W1/HybridGP/app/Permissions/d365basicisvHGP.permissionsetext.al index 297d2cfefb..e118938e25 100644 --- a/Apps/W1/HybridGP/app/Permissions/d365basicisvHGP.permissionsetext.al +++ b/Apps/W1/HybridGP/app/Permissions/d365basicisvHGP.permissionsetext.al @@ -113,5 +113,7 @@ permissionsetextension 4026 "D365 BASIC ISV - HGP" extends "D365 BASIC ISV" tabledata "GP IV00104" = RIMD, tabledata "GP PM00101" = RIMD, tabledata "GP PM00203" = RIMD, - tabledata "GP PO Validation Buffer" = RIMD; + tabledata "GP PO Validation Buffer" = RIMD, + tabledata "GP GL00103" = RIMD, + tabledata "GP GL00104" = RIMD; } \ No newline at end of file diff --git a/Apps/W1/HybridGP/app/Permissions/d365teammemberHGP.permissionsetext.al b/Apps/W1/HybridGP/app/Permissions/d365teammemberHGP.permissionsetext.al index ae278a96b3..80389b858d 100644 --- a/Apps/W1/HybridGP/app/Permissions/d365teammemberHGP.permissionsetext.al +++ b/Apps/W1/HybridGP/app/Permissions/d365teammemberHGP.permissionsetext.al @@ -113,5 +113,7 @@ permissionsetextension 4027 "D365 TEAM MEMBER - HGP" extends "D365 TEAM MEMBER" tabledata "GP IV00104" = RIMD, tabledata "GP PM00101" = RIMD, tabledata "GP PM00203" = RIMD, - tabledata "GP PO Validation Buffer" = RIMD; + tabledata "GP PO Validation Buffer" = RIMD, + tabledata "GP GL00103" = RIMD, + tabledata "GP GL00104" = RIMD; } \ No newline at end of file diff --git a/Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccount.table.al b/Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccount.table.al index 3b1242c859..807626afda 100644 --- a/Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccount.table.al +++ b/Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccount.table.al @@ -102,6 +102,16 @@ table 4090 "GP Account" { DataClassification = SystemMetadata; } + field(102; "Sub Type"; Option) + { + DataClassification = SystemMetadata; + OptionMembers = "Standard","Fixed","Variable"; + } + field(103; "Balance For Calculation"; Option) + { + DataClassification = SystemMetadata; + OptionMembers = "YTD","Period"; + } } keys diff --git a/Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccountMigrator.codeunit.al b/Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccountMigrator.codeunit.al index adc52d53eb..b5ec9cf433 100644 --- a/Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccountMigrator.codeunit.al +++ b/Apps/W1/HybridGP/app/src/Migration/Accounts/GPAccountMigrator.codeunit.al @@ -1,6 +1,8 @@ namespace Microsoft.DataMigration.GP; +using Microsoft.Finance.AllocationAccount; using Microsoft.Finance.Analysis.StatisticalAccount; +using Microsoft.Finance.Dimension; using Microsoft.Finance.GeneralLedger.Account; using Microsoft.Finance.GeneralLedger.Journal; using Microsoft.Finance.GeneralLedger.Setup; @@ -18,6 +20,12 @@ codeunit 4017 "GP Account Migrator" MigrationLogAreaTxt: Label 'Account', Locked = true; FiscalYearMissingContextTxt: Label 'Account: %1, Year: %2', Locked = true; FiscalYearMissingMessageTxt: Label 'Could not migrate beginning balance because the fiscal year is missing.'; + AllocationAccountMigrationCategoryTok: Label 'Allocation Account: %1', Comment = '%1 = Account Number'; + AllocationAccountSkippedBecauseOfBreakdownIdxMissingErr: Label 'Allocation Account skipped because the breakdown account %1 is missing.', Comment = '%1 = GP Account Index'; + AllocationAccountSkippedBecauseOfDistributionIdxMissingErr: Label 'Allocation Account skipped because the distribution account %1 is missing.', Comment = '%1 = GP Account Index'; + AllocationAccountDistSkippedBecauseOfBreakdownGLMissingErr: Label 'Allocation Account Distribution skipped because the breakdown account %1 is not a G/L Account.', Comment = '%1 = Account Number'; + AllocationAccountDistSkippedBecauseOfDistributionGLMissingErr: Label 'Allocation Account Distribution skipped because the distribution account %1 is not a G/L Account.', Comment = '%1 = Account Number'; + AllocationAccountSkippedBecauseHasNonGLAccountErr: Label 'Allocation Account skipped because it contains a distribution or breakdown account that is not a posting account.'; [EventSubscriber(ObjectType::Codeunit, Codeunit::"GL Acc. Data Migration Facade", 'OnMigrateGlAccount', '', true, true)] local procedure OnMigrateGlAccount(var Sender: Codeunit "GL Acc. Data Migration Facade"; RecordIdToMigrate: RecordId) @@ -140,7 +148,7 @@ codeunit 4017 "GP Account Migrator" CreateBeginningBalance(GPAccount); end; - procedure CreateBeginningBalance(GPAccount: Record "GP Account") + procedure CreateBeginningBalance(var GPAccount: Record "GP Account") begin case GPAccount.AccountType of 1: @@ -150,7 +158,7 @@ codeunit 4017 "GP Account Migrator" end; end; - local procedure CreateGLAccountBeginningBalanceImp(GPAccount: Record "GP Account") + local procedure CreateGLAccountBeginningBalanceImp(var GPAccount: Record "GP Account") var GLAccount: Record "G/L Account"; GPGL10111: Record "GP GL10111"; @@ -229,7 +237,7 @@ codeunit 4017 "GP Account Migrator" GenJournalLine.Modify(true); end; - local procedure CreateStatisticalAccountBeginningBalanceImp(GPAccount: Record "GP Account") + local procedure CreateStatisticalAccountBeginningBalanceImp(var GPAccount: Record "GP Account") var GPGL00100: Record "GP GL00100"; GPGL10111: Record "GP GL10111"; @@ -317,7 +325,7 @@ codeunit 4017 "GP Account Migrator" StatisticalAccJournalLine.Modify(true); end; - procedure MigrateAccountDetails(GPAccount: Record "GP Account"; var GLAccDataMigrationFacade: Codeunit "GL Acc. Data Migration Facade") + procedure MigrateAccountDetails(var GPAccount: Record "GP Account"; var GLAccDataMigrationFacade: Codeunit "GL Acc. Data Migration Facade") begin case GPAccount.AccountType of 1: @@ -327,7 +335,7 @@ codeunit 4017 "GP Account Migrator" end; end; - local procedure MigrateGLAccountDetailsImp(GPAccount: Record "GP Account"; var GLAccDataMigrationFacade: Codeunit "GL Acc. Data Migration Facade") + local procedure MigrateGLAccountDetailsImp(var GPAccount: Record "GP Account"; var GLAccDataMigrationFacade: Codeunit "GL Acc. Data Migration Facade") var HelperFunctions: Codeunit "Helper Functions"; DataMigrationErrorLogging: Codeunit "Data Migration Error Logging"; @@ -347,7 +355,7 @@ codeunit 4017 "GP Account Migrator" GLAccDataMigrationFacade.ModifyGLAccount(true); end; - local procedure MigrateStatisticalAccountDetailsImp(GPAccount: Record "GP Account") + local procedure MigrateStatisticalAccountDetailsImp(var GPAccount: Record "GP Account") var StatisticalAccount: Record "Statistical Account"; GeneralLedgerSetup: Record "General Ledger Setup"; @@ -372,7 +380,7 @@ codeunit 4017 "GP Account Migrator" StatisticalAccount.Insert(true); end; - procedure GenerateGLTransactionBatches(GPAccount: Record "GP Account") + procedure GenerateGLTransactionBatches(var GPAccount: Record "GP Account") begin case GPAccount.AccountType of 1: @@ -382,7 +390,7 @@ codeunit 4017 "GP Account Migrator" end; end; - local procedure GenerateGLAccountTransactionsImp(GPAccount: Record "GP Account") + local procedure GenerateGLAccountTransactionsImp(var GPAccount: Record "GP Account") var GPGLTransactions: Record "GP GLTransactions"; GenJournalLine: Record "Gen. Journal Line"; @@ -434,7 +442,7 @@ codeunit 4017 "GP Account Migrator" until GPGLTransactions.Next() = 0; end; - local procedure GenerateStatisticalAccountTransactionsImp(GPAccount: Record "GP Account") + local procedure GenerateStatisticalAccountTransactionsImp(var GPAccount: Record "GP Account") var GPGLTransactions: Record "GP GLTransactions"; GPCompanyAdditionalSettings: Record "GP Company Additional Settings"; @@ -490,4 +498,215 @@ codeunit 4017 "GP Account Migrator" end; until GPGLTransactions.Next() = 0; end; + + internal procedure CreateAllocationAccounts() + var + GPCompanyAdditionalSettings: Record "GP Company Additional Settings"; + GPAccount: Record "GP Account"; + DataMigrationErrorLogging: Codeunit "Data Migration Error Logging"; + begin + if not GPCompanyAdditionalSettings.GetGLModuleEnabled() then + exit; + + GPAccount.SetRange(AccountType, 3); + if not GPCompanyAdditionalSettings.GetMigrateInactiveAllocationAccounts() then + GPAccount.SetRange(Active, true); + + if not GPAccount.FindSet() then + exit; + + repeat + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(GPAccount.RecordId)); + MigrateAllocationAccount(GPAccount); + until GPAccount.Next() = 0; + end; + + local procedure MigrateAllocationAccount(var GPAccount: Record "GP Account") + begin + case GPAccount."Sub Type" of + GPAccount."Sub Type"::Fixed: + MigrateFixedAllocationAccountImp(GPAccount); + GPAccount."Sub Type"::Variable: + MigrateVariableAllocationAccountImp(GPAccount); + end; + end; + + local procedure MigrateFixedAllocationAccountImp(var GPAccount: Record "GP Account") + var + AllocationAccount: Record "Allocation Account"; + GPGL00103: Record "GP GL00103"; + GPMigrationWarnings: Record "GP Migration Warnings"; + AccountNum: Code[20]; + LineNo: Integer; + begin + AccountNum := CopyStr(GPAccount.AcctNum.Trim(), 1, MaxStrLen(AllocationAccount."No.")); + + if AllocationAccount.Get(AccountNum) then + exit; + + GPGL00103.SetRange(ACTINDX, GPAccount.AcctIndex); + GPGL00103.SetRange("Dist. Is Posting Account", false); + if not GPGL00103.IsEmpty() then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), AllocationAccountSkippedBecauseHasNonGLAccountErr); + exit; + end; + + GPGL00103.Reset(); + GPGL00103.SetRange(ACTINDX, GPAccount.AcctIndex); + if not GPGL00103.FindSet() then + exit; + + Clear(AllocationAccount); + AllocationAccount.Validate("No.", AccountNum); + AllocationAccount.Validate(Name, GPAccount.Name); + AllocationAccount.Validate("Account Type", AllocationAccount."Account Type"::Fixed); + AllocationAccount.Validate("Document Lines Split", AllocationAccount."Document Lines Split"::"Split Amount"); + AllocationAccount.Insert(true); + + repeat + CreateFixedAllocationAccountDistribution(AllocationAccount, GPGL00103, GPMigrationWarnings, LineNo, AccountNum); + until GPGL00103.Next() = 0; + end; + + local procedure CreateFixedAllocationAccountDistribution(var AllocationAccount: Record "Allocation Account"; var GPGL00103: Record "GP GL00103"; var GPMigrationWarnings: Record "GP Migration Warnings"; var LineNo: Integer; AccountNum: Code[20]) + var + AllocAccountDistribution: Record "Alloc. Account Distribution"; + DistGPAccount: Record "GP Account"; + GLAccount: Record "G/L Account"; + HelperFunctions: Codeunit "Helper Functions"; + DistAccountNum: Code[20]; + DimSetID: Integer; + begin + if not DistGPAccount.Get(GPGL00103.DSTINDX) then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), StrSubstNo(AllocationAccountSkippedBecauseOfDistributionIdxMissingErr, GPGL00103.DSTINDX)); + exit; + end; + + DistAccountNum := CopyStr(DistGPAccount.AcctNum.Trim(), 1, MaxStrLen(AllocationAccount."No.")); + + if not GLAccount.Get(DistAccountNum) then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), StrSubstNo(AllocationAccountDistSkippedBecauseOfDistributionGLMissingErr, DistAccountNum)); + exit; + end; + + LineNo := LineNo + 10000; + + Clear(AllocAccountDistribution); + AllocAccountDistribution.Validate("Allocation Account No.", AccountNum); + AllocAccountDistribution.validate("Line No.", LineNo); + AllocAccountDistribution.Validate("Account Type", AllocAccountDistribution."Account Type"::Fixed); + AllocAccountDistribution.Validate(Share, GPGL00103.PRCNTAGE); + AllocAccountDistribution.Validate("Destination Account Type", AllocAccountDistribution."Destination Account Type"::"G/L Account"); + AllocAccountDistribution.Validate("Destination Account Number", DistAccountNum); + + DimSetID := HelperFunctions.CreateDimSet(DistGPAccount.ACTNUMBR_1, DistGPAccount.ACTNUMBR_2, DistGPAccount.ACTNUMBR_3, DistGPAccount.ACTNUMBR_4, DistGPAccount.ACTNUMBR_5, DistGPAccount.ACTNUMBR_6, DistGPAccount.ACTNUMBR_7, DistGPAccount.ACTNUMBR_8); + AllocAccountDistribution.Validate("Dimension Set ID", DimSetID); + + AllocAccountDistribution.Insert(true); + end; + + local procedure MigrateVariableAllocationAccountImp(var GPAccount: Record "GP Account") + var + AllocationAccount: Record "Allocation Account"; + GPGL00104: Record "GP GL00104"; + GPMigrationWarnings: Record "GP Migration Warnings"; + AccountNum: Code[20]; + LineNo: Integer; + begin + AccountNum := CopyStr(GPAccount.AcctNum.Trim(), 1, MaxStrLen(AllocationAccount."No.")); + + if AllocationAccount.Get(AccountNum) then + exit; + + GPGL00104.SetRange(ACTINDX, GPAccount.AcctIndex); + GPGL00104.SetRange("Dist. Is Posting Account", false); + if not GPGL00104.IsEmpty() then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), AllocationAccountSkippedBecauseHasNonGLAccountErr); + exit; + end; + + GPGL00104.Reset(); + GPGL00104.SetRange(ACTINDX, GPAccount.AcctIndex); + GPGL00104.SetRange("Brkdn. Is Posting Account", false); + if not GPGL00104.IsEmpty() then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), AllocationAccountSkippedBecauseHasNonGLAccountErr); + exit; + end; + + GPGL00104.Reset(); + GPGL00104.SetRange(ACTINDX, GPAccount.AcctIndex); + if not GPGL00104.FindSet() then + exit; + + Clear(AllocationAccount); + AllocationAccount.Validate("No.", AccountNum); + AllocationAccount.Validate(Name, GPAccount.Name); + AllocationAccount.Validate("Account Type", AllocationAccount."Account Type"::Variable); + AllocationAccount.Validate("Document Lines Split", AllocationAccount."Document Lines Split"::"Split Amount"); + AllocationAccount.Insert(true); + + repeat + CreateVariableAllocationAccountDistribution(GPAccount, AllocationAccount, GPGL00104, GPMigrationWarnings, LineNo, AccountNum); + until GPGL00104.Next() = 0; + end; + + local procedure CreateVariableAllocationAccountDistribution(var GPAccount: Record "GP Account"; var AllocationAccount: Record "Allocation Account"; var GPGL00104: Record "GP GL00104"; var GPMigrationWarnings: Record "GP Migration Warnings"; var LineNo: Integer; AccountNum: Code[20]) + var + AllocAccountDistribution: Record "Alloc. Account Distribution"; + BreakdownGPAccount: Record "GP Account"; + DistGPAccount: Record "GP Account"; + GLAccount: Record "G/L Account"; + HelperFunctions: Codeunit "Helper Functions"; + BreakdownAccountNum: Code[20]; + DistAccountNum: Code[20]; + DimSetID: Integer; + begin + if not BreakdownGPAccount.Get(GPGL00104.BDNINDX) then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), StrSubstNo(AllocationAccountSkippedBecauseOfBreakdownIdxMissingErr, GPGL00104.BDNINDX)); + exit; + end; + + if not DistGPAccount.Get(GPGL00104.DSTINDX) then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), StrSubstNo(AllocationAccountSkippedBecauseOfDistributionIdxMissingErr, GPGL00104.DSTINDX)); + exit; + end; + + BreakdownAccountNum := CopyStr(BreakdownGPAccount.AcctNum.Trim(), 1, MaxStrLen(AllocationAccount."No.")); + DistAccountNum := CopyStr(DistGPAccount.AcctNum.Trim(), 1, MaxStrLen(AllocationAccount."No.")); + + if not GLAccount.Get(BreakdownAccountNum) then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), StrSubstNo(AllocationAccountDistSkippedBecauseOfBreakdownGLMissingErr, BreakdownAccountNum)); + exit; + end; + + if not GLAccount.Get(DistAccountNum) then begin + GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(AllocationAccountMigrationCategoryTok, AccountNum), StrSubstNo(AllocationAccountDistSkippedBecauseOfDistributionGLMissingErr, DistAccountNum)); + exit; + end; + + LineNo := LineNo + 10000; + + Clear(AllocAccountDistribution); + AllocAccountDistribution.Validate("Allocation Account No.", AccountNum); + AllocAccountDistribution.validate("Line No.", LineNo); + AllocAccountDistribution.Validate("Account Type", AllocAccountDistribution."Account Type"::Variable); + + AllocAccountDistribution.Validate("Breakdown Account Type", AllocAccountDistribution."Breakdown Account Type"::"G/L Account"); + AllocAccountDistribution.Validate("Breakdown Account Number", BreakdownAccountNum); + + AllocAccountDistribution.Validate("Destination Account Type", AllocAccountDistribution."Destination Account Type"::"G/L Account"); + AllocAccountDistribution.Validate("Destination Account Number", DistAccountNum); + + case GPAccount."Balance For Calculation" of + GPAccount."Balance For Calculation"::YTD: + AllocAccountDistribution.Validate("Calculation Period", AllocAccountDistribution."Calculation Period"::"Balance at Date"); + GPAccount."Balance For Calculation"::Period: + AllocAccountDistribution.Validate("Calculation Period", AllocAccountDistribution."Calculation Period"::Month); + end; + + DimSetID := HelperFunctions.CreateDimSet(DistGPAccount.ACTNUMBR_1, DistGPAccount.ACTNUMBR_2, DistGPAccount.ACTNUMBR_3, DistGPAccount.ACTNUMBR_4, DistGPAccount.ACTNUMBR_5, DistGPAccount.ACTNUMBR_6, DistGPAccount.ACTNUMBR_7, DistGPAccount.ACTNUMBR_8); + AllocAccountDistribution.Validate("Dimension Set ID", DimSetID); + + AllocAccountDistribution.Insert(true); + end; } \ No newline at end of file diff --git a/Apps/W1/HybridGP/app/src/Migration/Customers/GPCustomerAddress.Table.al b/Apps/W1/HybridGP/app/src/Migration/Customers/GPCustomerAddress.Table.al index 8ccb14db9c..6caca92d48 100644 --- a/Apps/W1/HybridGP/app/src/Migration/Customers/GPCustomerAddress.Table.al +++ b/Apps/W1/HybridGP/app/src/Migration/Customers/GPCustomerAddress.Table.al @@ -2,7 +2,6 @@ namespace Microsoft.DataMigration.GP; using Microsoft.Finance.SalesTax; using Microsoft.Sales.Customer; -using System.Email; table 4048 "GP Customer Address" { @@ -79,8 +78,7 @@ table 4048 "GP Customer Address" ShipToAddress: Record "Ship-to Address"; Customer: Record Customer; GPSY01200: Record "GP SY01200"; - MailManagement: Codeunit "Mail Management"; - EmailAddress: Text[80]; + EmailAddressList: List of [Text]; TaxAreaCode: Code[20]; Exists: Boolean; begin @@ -111,13 +109,9 @@ table 4048 "GP Customer Address" if (CopyStr(ShipToAddress."Fax No.", 1, 14) = '00000000000000') then ShipToAddress."Fax No." := ''; - if GPSY01200.Get(CustomerEmailTypeCodeLbl, CUSTNMBR, ADRSCODE) then - EmailAddress := CopyStr(GPSY01200.GetSingleEmailAddress(MaxStrLen(ShipToAddress."E-Mail")), 1, MaxStrLen(ShipToAddress."E-Mail")); - -#pragma warning disable AA0139 - if MailManagement.ValidateEmailAddressField(EmailAddress) then - ShipToAddress."E-Mail" := EmailAddress; -#pragma warning restore AA0139 + EmailAddressList := GPSY01200.GetEmailAddresses(CustomerEmailTypeCodeLbl, Rec.CUSTNMBR, Rec.ADRSCODE, true); + if EmailAddressList.Count() > 0 then + ShipToAddress."E-Mail" := CopyStr(EmailAddressList.Get(1), 1, MaxStrLen(ShipToAddress."E-Mail")); if not Exists then ShipToAddress.Insert() diff --git a/Apps/W1/HybridGP/app/src/Migration/Customers/GPCustomerMigrator.codeunit.al b/Apps/W1/HybridGP/app/src/Migration/Customers/GPCustomerMigrator.codeunit.al index ef8ccd1ed1..9a05dc0eb3 100644 --- a/Apps/W1/HybridGP/app/src/Migration/Customers/GPCustomerMigrator.codeunit.al +++ b/Apps/W1/HybridGP/app/src/Migration/Customers/GPCustomerMigrator.codeunit.al @@ -3,6 +3,7 @@ namespace Microsoft.DataMigration.GP; using Microsoft.Finance.GeneralLedger.Account; using Microsoft.Foundation.Company; using Microsoft.Foundation.NoSeries; +using Microsoft.Foundation.Reporting; using Microsoft.Sales.Customer; using Microsoft.Sales.Document; using System.Integration; @@ -273,9 +274,6 @@ codeunit 4018 "GP Customer Migrator" var CompanyInformation: Record "Company Information"; GPKnownCountries: Record "GP Known Countries"; - GPRM00101: Record "GP RM00101"; - GPSY01200: Record "GP SY01200"; - Customer: Record Customer; GPCompanyAdditionalSettings: Record "GP Company Additional Settings"; DataMigrationErrorLogging: Codeunit "Data Migration Error Logging"; PaymentTermsFormula: DateFormula; @@ -328,11 +326,6 @@ codeunit 4018 "GP Customer Migrator" CustomerDataMigrationFacade.SetHomePage(COPYSTR(MigrationGPCustomer.INET2, 1, 80)); - GPRM00101.SetLoadFields(ADRSCODE); - if GPRM00101.Get(CustomerNo) then - if GPSY01200.Get(CustomerEmailTypeCodeLbl, GPRM00101.CUSTNMBR, GPRM00101.ADRSCODE) then - CustomerDataMigrationFacade.SetEmail(CopyStr(GPSY01200.GetAllEmailAddressesText(MaxStrLen(Customer."E-Mail")), 1, MaxStrLen(Customer."E-Mail"))); - if MigrationGPCustomer.STMTCYCL = true then CustomerDataMigrationFacade.SetPrintStatement(true); @@ -367,9 +360,41 @@ codeunit 4018 "GP Customer Migrator" CustomerDataMigrationFacade.SetTaxLiable(true); end; + MigrateEmailAddresses(CustomerNo, CustomerDataMigrationFacade); + CustomerDataMigrationFacade.ModifyCustomer(true); end; + local procedure MigrateEmailAddresses(CustomerNo: Code[20]; var CustomerDataMigrationFacade: Codeunit "Customer Data Migration Facade") + var + GPSY01200: Record "GP SY01200"; + GPRM00101: Record "GP RM00101"; + Customer: Record Customer; + CustomReportSelection: Record "Custom Report Selection"; + EmailAddressList: List of [Text]; + i: Integer; + begin + GPRM00101.SetLoadFields(ADRSCODE); + if not GPRM00101.Get(CustomerNo) then + exit; + + EmailAddressList := GPSY01200.GetEmailAddresses(CustomerEmailTypeCodeLbl, CustomerNo, GPRM00101.ADRSCODE, false); + if EmailAddressList.Count() > 0 then begin + CustomerDataMigrationFacade.SetEmail(CopyStr(EmailAddressList.Get(1), 1, MaxStrLen(Customer."E-Mail"))); + + if EmailAddressList.Count() > 1 then + For i := 2 to EmailAddressList.Count() do begin + Clear(CustomReportSelection); + CustomReportSelection.Validate("Source Type", Database::Customer); + CustomReportSelection.Validate("Source No.", CustomerNo); + CustomReportSelection.Validate("Report ID", 1306); // Sales - Invoice + CustomReportSelection.Validate(Usage, CustomReportSelection.Usage::"S.Invoice"); + CustomReportSelection."Send To Email" := CopyStr(EmailAddressList.Get(i), 1, MaxStrLen(CustomReportSelection."Send To Email")); + CustomReportSelection.Insert(true); + end; + end; + end; + local procedure SetPhoneAndFaxNumberIfValid(var MigrationGPCustomer: Record "GP Customer"; var CustomerDataMigrationFacade: Codeunit "Customer Data Migration Facade") var GPMigrationWarnings: Record "GP Migration Warnings"; diff --git a/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00100.Table.al b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00100.Table.al index fd37622638..2f23686d6d 100644 Binary files a/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00100.Table.al and b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00100.Table.al differ diff --git a/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00103.Table.al b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00103.Table.al new file mode 100644 index 0000000000..b542b08fab --- /dev/null +++ b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00103.Table.al @@ -0,0 +1,39 @@ +namespace Microsoft.DataMigration.GP; + +table 40198 "GP GL00103" +{ + DataClassification = CustomerContent; + fields + { + field(1; ACTINDX; Integer) + { + DataClassification = CustomerContent; + } + field(2; PRCNTAGE; Decimal) + { + DataClassification = CustomerContent; + } + field(3; DSTINDX; Integer) + { + DataClassification = CustomerContent; + } + field(4; DEX_ROW_ID; Integer) + { + DataClassification = CustomerContent; + } + field(100; "Dist. Is Posting Account"; Boolean) + { + FieldClass = FlowField; + CalcFormula = exist("GP GL00100" where(ACTINDX = field(DSTINDX), ACCTTYPE = const(1))); + Editable = false; + } + } + keys + { + key(Key1; ACTINDX, DSTINDX) + { + Clustered = true; + } + } +} + diff --git a/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00104.Table.al b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00104.Table.al new file mode 100644 index 0000000000..3dab2d7478 --- /dev/null +++ b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPGL00104.Table.al @@ -0,0 +1,53 @@ +namespace Microsoft.DataMigration.GP; + +table 40199 "GP GL00104" +{ + DataClassification = CustomerContent; + fields + { + field(1; ACTINDX; Integer) + { + DataClassification = CustomerContent; + } + field(2; SEPRATR1; Boolean) + { + DataClassification = CustomerContent; + } + field(3; DSTINDX; Integer) + { + DataClassification = CustomerContent; + } + field(4; SEPRATR2; Boolean) + { + DataClassification = CustomerContent; + } + field(5; BDNINDX; Integer) + { + DataClassification = CustomerContent; + } + field(6; DEX_ROW_ID; Integer) + { + DataClassification = CustomerContent; + } + field(100; "Dist. Is Posting Account"; Boolean) + { + FieldClass = FlowField; + CalcFormula = exist("GP GL00100" where(ACTINDX = field(DSTINDX), ACCTTYPE = const(1))); + Editable = false; + } + field(101; "Brkdn. Is Posting Account"; Boolean) + { + FieldClass = FlowField; + CalcFormula = exist("GP GL00100" where(ACTINDX = field(BDNINDX), ACCTTYPE = const(1))); + Editable = false; + } + } + keys + { + key(Key1; ACTINDX, DSTINDX, BDNINDX) + { + Clustered = true; + } + } +} + diff --git a/Apps/W1/HybridGP/app/src/Migration/GPTables/GPPopulateCombinedTables.Codeunit.al b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPPopulateCombinedTables.Codeunit.al index c64278eaf6..0152b366cb 100644 --- a/Apps/W1/HybridGP/app/src/Migration/GPTables/GPPopulateCombinedTables.Codeunit.al +++ b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPPopulateCombinedTables.Codeunit.al @@ -54,10 +54,12 @@ codeunit 40125 "GP Populate Combined Tables" GPGL40200: Record "GP GL40200"; GPSY00300: Record "GP SY00300"; GPAccount: Record "GP Account"; + GPGL00103: Record "GP GL00103"; + GPGL00104: Record "GP GL00104"; AccountDescription: Text; begin - GPGL00100.SetFilter(ACCTTYPE, '1|2'); - // Only Posting and Unit accounts + GPGL00100.SetRange(ACCTTYPE, 1, 3); + // Only Posting, Unit, and Allocation accounts if not GPGL00100.FindSet() then exit; @@ -96,6 +98,23 @@ codeunit 40125 "GP Populate Combined Tables" GPAccount.DirectPosting := GPGL00100.ACCTENTR; GPAccount.AccountSubcategoryEntryNo := GPGL00100.ACCATNUM; GPAccount.AccountType := GPGL00100.ACCTTYPE; + GPAccount."Sub Type" := GPAccount."Sub Type"::Standard; + GPAccount."Balance For Calculation" := GPAccount."Balance For Calculation"::YTD; + + if GPAccount.AccountType = 3 then begin + GPGL00103.SetRange(ACTINDX, GPAccount.AcctIndex); + + if not GPGL00103.IsEmpty() then + GPAccount."Sub Type" := GPAccount."Sub Type"::Fixed; + + GPGL00104.SetRange(ACTINDX, GPAccount.AcctIndex); + if not GPGL00104.IsEmpty() then + GPAccount."Sub Type" := GPAccount."Sub Type"::Variable; + end; + + if GPGL00100.BALFRCLC > 0 then + GPAccount."Balance For Calculation" := GPAccount."Balance For Calculation"::Period; + GPAccount.Insert(); until GPGL00100.Next() = 0; end; diff --git a/Apps/W1/HybridGP/app/src/Migration/GPTables/GPSY01200.Table.al b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPSY01200.Table.al index 0c79499291..949a93db28 100644 Binary files a/Apps/W1/HybridGP/app/src/Migration/GPTables/GPSY01200.Table.al and b/Apps/W1/HybridGP/app/src/Migration/GPTables/GPSY01200.Table.al differ diff --git a/Apps/W1/HybridGP/app/src/Migration/History/GPPopulateHistTables.Codeunit.al b/Apps/W1/HybridGP/app/src/Migration/History/GPPopulateHistTables.Codeunit.al index e8307fb2f0..d59e02cbfa 100644 --- a/Apps/W1/HybridGP/app/src/Migration/History/GPPopulateHistTables.Codeunit.al +++ b/Apps/W1/HybridGP/app/src/Migration/History/GPPopulateHistTables.Codeunit.al @@ -68,6 +68,7 @@ codeunit 40900 "GP Populate Hist. Tables" HistMigrationStatusMgmt.SetStatusFinished(); Commit(); + OnSnapshotCompleted(); end; local procedure PopulateGLDetail() @@ -133,6 +134,7 @@ codeunit 40900 "GP Populate Hist. Tables" GPGL20000: Record "GP GL20000"; GPGL00105: Record "GP GL00105"; HistGenJournalLine: Record "Hist. Gen. Journal Line"; + HistPayrollDetails: Record "Hist. Payroll Details"; OutlookSynchTypeConv: Codeunit "Outlook Synch. Type Conv"; InitialHistYear: Integer; SourceTableId: Integer; @@ -181,15 +183,24 @@ codeunit 40900 "GP Populate Hist. Tables" HistGenJournalLine."Custom2" := GPGL20000.User_Defined_Text02; if GPGL20000.SERIES <> GPPayrollSeriesId() then begin -#pragma warning disable AA0139 - HistGenJournalLine."Orig. Document No." := GPGL20000.ORDOCNUM.TrimEnd(); -#pragma warning restore AA0139 - HistGenJournalLine."Source No." := GPGL20000.ORMSTRID; - HistGenJournalLine."Source Name" := CopyStr(GPGL20000.ORMSTRNM, 1, MaxStrLen(HistGenJournalLine."Source Name")); + HistGenJournalLine."Orig. Document No." := CopyStr(GPGL20000.ORDOCNUM.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Orig. Document No.")); + HistGenJournalLine."Source No." := CopyStr(GPGL20000.ORMSTRID.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Source No.")); + HistGenJournalLine."Source Name" := CopyStr(GPGL20000.ORMSTRNM.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Source Name")); end; if HistGenJournalLine.Insert() then begin ReportLastSuccess(SourceTableId, LastSourceRecordId); + + if GPGL20000.SERIES = GPPayrollSeriesId() then + if GPCompanyAdditionalSettings.GetMigrateHistPayrollDetail() then begin + Clear(HistPayrollDetails); + HistPayrollDetails."Hist. Gen. Journal Line Key" := HistGenJournalLine."Primary Key"; + HistPayrollDetails."Orig. Document No." := CopyStr(GPGL20000.ORDOCNUM.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Orig. Document No.")); + HistPayrollDetails."Source No." := CopyStr(GPGL20000.ORMSTRID.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Source No.")); + HistPayrollDetails."Source Name" := CopyStr(GPGL20000.ORMSTRNM.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Source Name")); + HistPayrollDetails.Insert(); + end; + PopulateGLOpenYearItemTransaction(GPGL20000) end else ReportLastError(SourceTableId, LastSourceRecordId, "Hist. Migration Step Type"::"GP GL Journal Trx.", GPGL20000.TRXSORCE); @@ -206,6 +217,7 @@ codeunit 40900 "GP Populate Hist. Tables" GPGL30000: Record "GP GL30000"; GPGL00105: Record "GP GL00105"; HistGenJournalLine: Record "Hist. Gen. Journal Line"; + HistPayrollDetails: Record "Hist. Payroll Details"; OutlookSynchTypeConv: Codeunit "Outlook Synch. Type Conv"; InitialHistYear: Integer; SourceTableId: Integer; @@ -254,15 +266,24 @@ codeunit 40900 "GP Populate Hist. Tables" HistGenJournalLine."Custom2" := GPGL30000.User_Defined_Text02; if GPGL30000.SERIES <> GPPayrollSeriesId() then begin -#pragma warning disable AA0139 - HistGenJournalLine."Orig. Document No." := GPGL30000.ORDOCNUM.TrimEnd(); -#pragma warning restore AA0139 - HistGenJournalLine."Source No." := GPGL30000.ORMSTRID; - HistGenJournalLine."Source Name" := CopyStr(GPGL30000.ORMSTRNM, 1, MaxStrLen(HistGenJournalLine."Source Name")); + HistGenJournalLine."Orig. Document No." := CopyStr(GPGL30000.ORDOCNUM.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Orig. Document No.")); + HistGenJournalLine."Source No." := CopyStr(GPGL30000.ORMSTRID.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Source No.")); + HistGenJournalLine."Source Name" := CopyStr(GPGL30000.ORMSTRNM.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Source Name")); end; if HistGenJournalLine.Insert() then begin ReportLastSuccess(SourceTableId, LastSourceRecordId); + + if GPGL30000.SERIES = GPPayrollSeriesId() then + if GPCompanyAdditionalSettings.GetMigrateHistPayrollDetail() then begin + Clear(HistPayrollDetails); + HistPayrollDetails."Hist. Gen. Journal Line Key" := HistGenJournalLine."Primary Key"; + HistPayrollDetails."Orig. Document No." := CopyStr(GPGL30000.ORDOCNUM.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Orig. Document No.")); + HistPayrollDetails."Source No." := CopyStr(GPGL30000.ORMSTRID.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Source No.")); + HistPayrollDetails."Source Name" := CopyStr(GPGL30000.ORMSTRNM.TrimEnd(), 1, MaxStrLen(HistGenJournalLine."Source Name")); + HistPayrollDetails.Insert(); + end; + PopulateGLHistoricalYearItemTransaction(GPGL30000) end else ReportLastError(SourceTableId, LastSourceRecordId, "Hist. Migration Step Type"::"GP GL Journal Trx.", GPGL30000.TRXSORCE); @@ -1863,4 +1884,9 @@ codeunit 40900 "GP Populate Hist. Tables" local procedure OnBeforeRunGPPopulateHistTables(var IsHandled: Boolean; var OverrideCommitAfterXRecordCount: Integer) begin end; + + [IntegrationEvent(false, false)] + local procedure OnSnapshotCompleted() + begin + end; } \ No newline at end of file diff --git a/Apps/W1/HybridGP/app/src/Migration/Items/GPItemMigrator.codeunit.al b/Apps/W1/HybridGP/app/src/Migration/Items/GPItemMigrator.codeunit.al index a74d8f846a..1f351b86a5 100644 --- a/Apps/W1/HybridGP/app/src/Migration/Items/GPItemMigrator.codeunit.al +++ b/Apps/W1/HybridGP/app/src/Migration/Items/GPItemMigrator.codeunit.al @@ -144,16 +144,15 @@ codeunit 4019 "GP Item Migrator" if not ChartOfAccountsMigrated then exit; - if not GPCompanyAdditionalSettings.GetGLModuleEnabled() then - exit; - - if GPCompanyAdditionalSettings.GetMigrateOnlyInventoryMaster() then - exit; - if GPItem.Get(RecordIdToMigrate) then begin if not Sender.DoesItemExist(CopyStr(GPItem.No, 1, MaxStrLen(Item."No."))) then exit; + if not GPCompanyAdditionalSettings.GetGLModuleEnabled() or GPCompanyAdditionalSettings.GetMigrateOnlyInventoryMaster() then begin + SetItemAsBlockedIfNeeded(Item, GPItem, DataMigrationErrorLogging); + exit; + end; + if GPItem.ItemType = 0 then case GetCostingMethod(GPItem) of CostingMethodOption::Average: @@ -226,20 +225,25 @@ codeunit 4019 "GP Item Migrator" end; end; - DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(GPItem.RecordId)); - if GPItem.InActive then begin - Item.Reset(); - if Item.Get(GPItem.No) then begin - Item.Blocked := true; - Item.Modify(true); - end; - end; + SetItemAsBlockedIfNeeded(Item, GPItem, DataMigrationErrorLogging); end; if ErrorText <> '' then Error(ErrorText); end; + local procedure SetItemAsBlockedIfNeeded(var Item: Record Item; var GPItem: Record "GP Item"; var DataMigrationErrorLogging: Codeunit "Data Migration Error Logging") + begin + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(GPItem.RecordId)); + if GPItem.InActive then begin + Item.Reset(); + if Item.Get(GPItem.No) then begin + Item.Blocked := true; + Item.Modify(true); + end; + end; + end; + local procedure MigrateItemInventoryPostingGroupImp(var GPItem: Record "GP Item"; var Sender: Codeunit "Item Data Migration Facade") var GPIV00101: Record "GP IV00101"; @@ -555,7 +559,11 @@ codeunit 4019 "GP Item Migrator" var GeneralPostingSetup: Record "General Posting Setup"; AccountNumber: Code[20]; + InventoryAdjmtAccount: Code[20]; begin + if GeneralPostingSetup.Get('', DefaultPostingGroupCodeTxt) then + InventoryAdjmtAccount := GeneralPostingSetup."Inventory Adjmt. Account"; + if ItemDataMigrationFacade.CreateGeneralProductPostingSetupIfNeeded(PostingGroupCode, GeneralProdPostingGroupDescription, GeneralBusPostingGroupCode) then if GeneralPostingSetup.Get(GeneralBusPostingGroupCode, PostingGroupCode) then begin if CanAddGenProductPostingAccount(GPIV40400.IVSLSIDX, AccountNumber, '') then @@ -564,13 +572,13 @@ codeunit 4019 "GP Item Migrator" if CanAddGenProductPostingAccount(GPIV40400.IVSLDSIX, AccountNumber, '') then GeneralPostingSetup.Validate("Sales Line Disc. Account", AccountNumber); - if CanAddGenProductPostingAccount(GPIV40400.IVIVINDX, AccountNumber, '') then + if CanAddGenProductPostingAccount(GPIV40400.IVIVINDX, AccountNumber, InventoryAdjmtAccount) then GeneralPostingSetup.Validate("Purch. Account", AccountNumber); if CanAddGenProductPostingAccount(GPIV40400.IVCOGSIX, AccountNumber, '') then GeneralPostingSetup.Validate("COGS Account", AccountNumber); - if CanAddGenProductPostingAccount(GPIV40400.IVIVINDX, AccountNumber, '') then + if CanAddGenProductPostingAccount(GPIV40400.IVIVINDX, AccountNumber, InventoryAdjmtAccount) then GeneralPostingSetup.Validate("Direct Cost Applied Account", AccountNumber); if CanAddGenProductPostingAccount(GPIV40400.PURPVIDX, AccountNumber, '') then @@ -634,7 +642,7 @@ codeunit 4019 "GP Item Migrator" AccountNumber := DefaultAccountNo; if GPAccountIdx < 1 then - exit; + exit(AccountNumber <> ''); if (GLAccount.Get(HelperFunctions.GetGPAccountNumberByIndex(GPAccountIdx))) then AccountNumber := GLAccount."No."; diff --git a/Apps/W1/HybridGP/app/src/Migration/Support/HelperFunctions.codeunit.al b/Apps/W1/HybridGP/app/src/Migration/Support/HelperFunctions.codeunit.al index 851bc1ec4a..a5e0cc5732 100644 --- a/Apps/W1/HybridGP/app/src/Migration/Support/HelperFunctions.codeunit.al +++ b/Apps/W1/HybridGP/app/src/Migration/Support/HelperFunctions.codeunit.al @@ -562,6 +562,13 @@ codeunit 4037 "Helper Functions" GPItemMigrator.CreateItemCategories(); end; + local procedure CreateAllocationAccounts() + var + GPAccountMigrator: Codeunit "GP Account Migrator"; + begin + GPAccountMigrator.CreateAllocationAccounts(); + end; + procedure CreateSetupRecordsIfNeeded() var CompanyInformation: Record "Company Information"; @@ -642,6 +649,40 @@ codeunit 4037 "Helper Functions" NoSeriesLine.Insert(true); end; + local procedure UpdateConfiguredContactNoSeries() + var + MarketingSetup: Record "Marketing Setup"; + NoSeriesLine: Record "No. Series Line"; + GPRM00101: Record "GP RM00101"; + CustomerCount: Integer; + CountBufferOverCustomerCount: Integer; + NewMaxCount: BigInteger; + NewEndingNo: Code[20]; + begin + CustomerCount := GPRM00101.Count(); + CountBufferOverCustomerCount := 100000; + + // The default contact number series maxes out at 100,000. If there are less customers than that, we can exit. + if CustomerCount < 100000 then + exit; + + if not MarketingSetup.Get() then + exit; + + if MarketingSetup."Contact Nos." = '' then + exit; + + NoSeriesLine.SetRange("Series Code", MarketingSetup."Contact Nos."); + if not NoSeriesLine.FindFirst() then + exit; + + NewMaxCount := Round(CustomerCount * NoSeriesLine."Increment-by No." + (CountBufferOverCustomerCount * NoSeriesLine."Increment-by No."), 1000, '>'); + NewEndingNo := IncStr(NoSeriesLine."Starting No.", NewMaxCount); + + NoSeriesLine.Validate("Ending No.", NewEndingNo); + NoSeriesLine.Modify(true); + end; + internal procedure CalculateDueDateFormula(GPPaymentTerms: Record "GP Payment Terms"; Use_Discount_Calc: Boolean; Discount_Calc: Text[32]): Text[50] var working_number: integer; @@ -2042,6 +2083,7 @@ codeunit 4037 "Helper Functions" end; CreateNoSeries(); + UpdateConfiguredContactNoSeries(); exit(true) end; @@ -2080,6 +2122,7 @@ codeunit 4037 "Helper Functions" CreateKitItems(); CreateItemCategories(); + CreateAllocationAccounts(); exit(GPConfiguration.IsAllPostMigrationDataCreated()); end; diff --git a/Apps/W1/HybridGP/app/src/Migration/Support/PurchaseOrders/GPPOMigrator.codeunit.al b/Apps/W1/HybridGP/app/src/Migration/Support/PurchaseOrders/GPPOMigrator.codeunit.al index 30ee240338..a3ccba944e 100644 --- a/Apps/W1/HybridGP/app/src/Migration/Support/PurchaseOrders/GPPOMigrator.codeunit.al +++ b/Apps/W1/HybridGP/app/src/Migration/Support/PurchaseOrders/GPPOMigrator.codeunit.al @@ -169,9 +169,9 @@ codeunit 40108 "GP PO Migrator" ShouldCreateLine := true; ItemNo := CopyStr(GPPOP10110.ITEMNMBR.Trim(), 1, MaxStrLen(Item."No.")); - Item.SetLoadFields(Blocked); + Item.SetLoadFields(Blocked, "Purchasing Blocked"); if Item.Get(ItemNo) then begin - if Item.Blocked then + if (Item.Blocked or Item."Purchasing Blocked") then ShouldCreateLine := false end else if GPPOP10110.NONINVEN = 0 then diff --git a/Apps/W1/HybridGP/app/src/Migration/Vendors/GPVendorMigrator.codeunit.al b/Apps/W1/HybridGP/app/src/Migration/Vendors/GPVendorMigrator.codeunit.al index 261ee5552e..83cb8065a5 100644 --- a/Apps/W1/HybridGP/app/src/Migration/Vendors/GPVendorMigrator.codeunit.al +++ b/Apps/W1/HybridGP/app/src/Migration/Vendors/GPVendorMigrator.codeunit.al @@ -5,10 +5,10 @@ using Microsoft.Finance.GeneralLedger.Account; using Microsoft.Finance.GeneralLedger.Setup; using Microsoft.Foundation.Company; using Microsoft.Foundation.NoSeries; +using Microsoft.Foundation.Reporting; using Microsoft.Purchases.Document; using Microsoft.Purchases.Remittance; using Microsoft.Purchases.Vendor; -using System.Email; using System.Integration; codeunit 4022 "GP Vendor Migrator" @@ -293,8 +293,6 @@ codeunit 4022 "GP Vendor Migrator" GenBusinessPostingGroup: Record "Gen. Business Posting Group"; VendorPostingGroup: Record "Vendor Posting Group"; GPKnownCountries: Record "GP Known Countries"; - GPPM00200: Record "GP PM00200"; - GPSY01200: Record "GP SY01200"; GPCompanyAdditionalSettings: Record "GP Company Additional Settings"; GPMigrationWarnings: Record "GP Migration Warnings"; HelperFunctions: Codeunit "Helper Functions"; @@ -383,11 +381,6 @@ codeunit 4022 "GP Vendor Migrator" VendorDataMigrationFacade.SetHomePage(HomePage); - GPPM00200.SetLoadFields(VADDCDPR); - if GPPM00200.Get(VendorNo) then - if GPSY01200.Get(VendorEmailTypeCodeLbl, VendorNo, GPPM00200.VADDCDPR) then - VendorDataMigrationFacade.SetEmail(CopyStr(GPSY01200.GetAllEmailAddressesText(MaxStrLen(Vendor."E-Mail")), 1, MaxStrLen(Vendor."E-Mail"))); - if (ShipMethod <> '') then begin VendorDataMigrationFacade.CreateShipmentMethodIfNeeded(ShipMethod, ''); VendorDataMigrationFacade.SetShipmentMethodCode(ShipMethod); @@ -405,9 +398,41 @@ codeunit 4022 "GP Vendor Migrator" VendorDataMigrationFacade.SetTaxLiable(true); end; + MigrateEmailAddresses(VendorNo, VendorDataMigrationFacade); + VendorDataMigrationFacade.ModifyVendor(true); end; + local procedure MigrateEmailAddresses(VendorNo: Code[20]; var VendorDataMigrationFacade: Codeunit "Vendor Data Migration Facade") + var + GPSY01200: Record "GP SY01200"; + GPPM00200: Record "GP PM00200"; + Vendor: Record Vendor; + CustomReportSelection: Record "Custom Report Selection"; + EmailAddressList: List of [Text]; + i: Integer; + begin + GPPM00200.SetLoadFields(VADDCDPR); + if not GPPM00200.Get(VendorNo) then + exit; + + EmailAddressList := GPSY01200.GetEmailAddresses(VendorEmailTypeCodeLbl, VendorNo, GPPM00200.VADDCDPR, false); + if EmailAddressList.Count() > 0 then begin + VendorDataMigrationFacade.SetEmail(CopyStr(EmailAddressList.Get(1), 1, MaxStrLen(Vendor."E-Mail"))); + + if EmailAddressList.Count() > 1 then + For i := 2 to EmailAddressList.Count() do begin + Clear(CustomReportSelection); + CustomReportSelection.Validate("Source Type", Database::Vendor); + CustomReportSelection.Validate("Source No.", VendorNo); + CustomReportSelection.Validate("Report ID", 11383); // Export Electronic Payments + CustomReportSelection.Validate(Usage, CustomReportSelection.Usage::"V.Remittance"); + CustomReportSelection."Send To Email" := CopyStr(EmailAddressList.Get(i), 1, MaxStrLen(CustomReportSelection."Send To Email")); + CustomReportSelection.Insert(true); + end; + end; + end; + local procedure SetPhoneAndFaxNumberIfValid(var GPVendor: Record "GP Vendor"; var VendorDataMigrationFacade: Codeunit "Vendor Data Migration Facade") var GPMigrationWarnings: Record "GP Migration Warnings"; @@ -470,8 +495,7 @@ codeunit 4022 "GP Vendor Migrator" GPSY01200: Record "GP SY01200"; Vendor: Record Vendor; HelperFunctions: Codeunit "Helper Functions"; - MailManagement: Codeunit "Mail Management"; - EmailAddress: Text[80]; + EmailAddressList: List of [Text]; begin if not OrderAddress.Get(VendorNo, AddressCode) then begin OrderAddress."Vendor No." := VendorNo; @@ -489,13 +513,9 @@ codeunit 4022 "GP Vendor Migrator" OrderAddress."Post Code" := CopyStr(GPVendorAddress.ZIPCODE.TrimEnd(), 1, MaxStrLen(OrderAddress."Post Code")); OrderAddress.County := CopyStr(GPVendorAddress.STATE.TrimEnd(), 1, MaxStrLen(OrderAddress.County)); - if GPSY01200.Get(VendorEmailTypeCodeLbl, VendorNo, AddressCode) then - EmailAddress := CopyStr(GPSY01200.GetSingleEmailAddress(MaxStrLen(OrderAddress."E-Mail")), 1, MaxStrLen(OrderAddress."E-Mail")); - -#pragma warning disable AA0139 - if MailManagement.ValidateEmailAddressField(EmailAddress) then - OrderAddress."E-Mail" := EmailAddress; -#pragma warning restore AA0139 + EmailAddressList := GPSY01200.GetEmailAddresses(VendorEmailTypeCodeLbl, VendorNo, AddressCode, true); + if EmailAddressList.Count() > 0 then + OrderAddress."E-Mail" := CopyStr(EmailAddressList.Get(1), 1, MaxStrLen(OrderAddress."E-Mail")); OrderAddress.Modify(); end; @@ -506,8 +526,7 @@ codeunit 4022 "GP Vendor Migrator" GPSY01200: Record "GP SY01200"; Vendor: Record Vendor; HelperFunctions: Codeunit "Helper Functions"; - MailManagement: Codeunit "Mail Management"; - EmailAddress: Text[80]; + EmailAddressList: List of [Text]; begin if not RemitAddress.Get(AddressCode, VendorNo) then begin RemitAddress."Vendor No." := VendorNo; @@ -525,13 +544,9 @@ codeunit 4022 "GP Vendor Migrator" RemitAddress."Post Code" := CopyStr(GPVendorAddress.ZIPCODE.TrimEnd(), 1, MaxStrLen(RemitAddress."Post Code")); RemitAddress.County := CopyStr(GPVendorAddress.STATE.TrimEnd(), 1, MaxStrLen(RemitAddress.County)); - if GPSY01200.Get(VendorEmailTypeCodeLbl, VendorNo, AddressCode) then - EmailAddress := CopyStr(GPSY01200.GetSingleEmailAddress(MaxStrLen(RemitAddress."E-Mail")), 1, MaxStrLen(RemitAddress."E-Mail")); - -#pragma warning disable AA0139 - if MailManagement.ValidateEmailAddressField(EmailAddress) then - RemitAddress."E-Mail" := EmailAddress; -#pragma warning restore AA0139 + EmailAddressList := GPSY01200.GetEmailAddresses(VendorEmailTypeCodeLbl, VendorNo, AddressCode, true); + if EmailAddressList.Count() > 0 then + RemitAddress."E-Mail" := CopyStr(EmailAddressList.Get(1), 1, MaxStrLen(RemitAddress."E-Mail")); RemitAddress.Modify(); end; diff --git a/Apps/W1/HybridGP/app/src/codeunits/GPCloudMigration.codeunit.al b/Apps/W1/HybridGP/app/src/codeunits/GPCloudMigration.codeunit.al index 171062668b..a01da96e8e 100644 --- a/Apps/W1/HybridGP/app/src/codeunits/GPCloudMigration.codeunit.al +++ b/Apps/W1/HybridGP/app/src/codeunits/GPCloudMigration.codeunit.al @@ -248,6 +248,8 @@ codeunit 4025 "GP Cloud Migration" UpdateOrInsertRecord(Database::"GP CM20600", 'CM20600'); UpdateOrInsertRecord(Database::"GP GL00100", 'GL00100'); + UpdateOrInsertRecord(Database::"GP GL00103", 'GL00103'); + UpdateOrInsertRecord(Database::"GP GL00104", 'GL00104'); UpdateOrInsertRecord(Database::"GP GL00105", 'GL00105'); UpdateOrInsertRecord(Database::"GP GL10110", 'GL10110'); UpdateOrInsertRecord(Database::"GP GL10111", 'GL10111'); diff --git a/Apps/W1/HybridGP/app/src/codeunits/GPMigrationValidator.Codeunit.al b/Apps/W1/HybridGP/app/src/codeunits/GPMigrationValidator.Codeunit.al index fddb2c0a35..daf9168e86 100644 --- a/Apps/W1/HybridGP/app/src/codeunits/GPMigrationValidator.Codeunit.al +++ b/Apps/W1/HybridGP/app/src/codeunits/GPMigrationValidator.Codeunit.al @@ -702,8 +702,8 @@ codeunit 40903 "GP Migration Validator" PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line"; Vendor: Record Vendor; - GPPOHeaderValidationBuffer: Record "GP PO Validation Buffer"; - GPPOLineValidationBuffer: Record "GP PO Validation Buffer"; + TempGPPOHeaderValidationBuffer: Record "GP PO Validation Buffer"; + TempGPPOLineValidationBuffer: Record "GP PO Validation Buffer"; PONumber: Code[20]; EntityType: Text[50]; LineEntityType: Text[50]; @@ -723,14 +723,14 @@ codeunit 40903 "GP Migration Validator" PONumber := CopyStr(GPPOP10100.PONUMBER.TrimEnd(), 1, MaxStrLen(PurchaseHeader."No.")); if Vendor.Get(GPPOP10100.VENDORID) then - if not GPPOHeaderValidationBuffer.Get(PONumber) then begin - GPPOHeaderValidationBuffer."No." := PONumber; - GPPOHeaderValidationBuffer."Text 1" := CopyStr(GPPOP10100.VENDORID.TrimEnd(), 1, MaxStrLen(Vendor."No.")); - GPPOHeaderValidationBuffer."Date 1" := GPPOP10100.DOCDATE; - GPPOHeaderValidationBuffer.Insert(); - - if not PopulatePOLineBuffer(PONumber, GPPOLineValidationBuffer) then - GPPOHeaderValidationBuffer.Delete(); + if not TempGPPOHeaderValidationBuffer.Get(PONumber) then begin + TempGPPOHeaderValidationBuffer."No." := PONumber; + TempGPPOHeaderValidationBuffer."Text 1" := CopyStr(GPPOP10100.VENDORID.TrimEnd(), 1, MaxStrLen(Vendor."No.")); + TempGPPOHeaderValidationBuffer."Date 1" := GPPOP10100.DOCDATE; + TempGPPOHeaderValidationBuffer.Insert(); + + if not PopulatePOLineBuffer(PONumber, TempGPPOLineValidationBuffer) then + TempGPPOHeaderValidationBuffer.Delete(); end; MigrationValidationAssert.SetSourceRowValidated(ValidationSuiteIdTok, GPPOP10100); @@ -738,34 +738,34 @@ codeunit 40903 "GP Migration Validator" end; // Validate - Purchase Orders - if GPPOHeaderValidationBuffer.FindSet() then + if TempGPPOHeaderValidationBuffer.FindSet() then repeat - MigrationValidationAssert.SetContext(ValidationSuiteIdTok, EntityType, GPPOHeaderValidationBuffer."No."); + MigrationValidationAssert.SetContext(ValidationSuiteIdTok, EntityType, TempGPPOHeaderValidationBuffer."No."); - if not MigrationValidationAssert.ValidateRecordExists(Test_POEXISTS_Tok, PurchaseHeader.Get("Purchase Document Type"::Order, GPPOHeaderValidationBuffer."No."), StrSubstNo(MissingEntityTok, EntityType)) then + if not MigrationValidationAssert.ValidateRecordExists(Test_POEXISTS_Tok, PurchaseHeader.Get("Purchase Document Type"::Order, TempGPPOHeaderValidationBuffer."No."), StrSubstNo(MissingEntityTok, EntityType)) then continue; - MigrationValidationAssert.ValidateAreEqual(Test_POBUYFROMVEND_Tok, GPPOHeaderValidationBuffer."Text 1", PurchaseHeader."Buy-from Vendor No.", PurchaseOrderBuyFromVendorNoLbl); - MigrationValidationAssert.ValidateAreEqual(Test_POPAYTOVEND_Tok, GPPOHeaderValidationBuffer."Text 1", PurchaseHeader."Pay-to Vendor No.", PurchaseOrderPayToVendorNoLbl); - MigrationValidationAssert.ValidateAreEqual(Test_PODOCDATE_Tok, GPPOHeaderValidationBuffer."Date 1", PurchaseHeader."Document Date", DocumentDateLbl); + MigrationValidationAssert.ValidateAreEqual(Test_POBUYFROMVEND_Tok, TempGPPOHeaderValidationBuffer."Text 1", PurchaseHeader."Buy-from Vendor No.", PurchaseOrderBuyFromVendorNoLbl); + MigrationValidationAssert.ValidateAreEqual(Test_POPAYTOVEND_Tok, TempGPPOHeaderValidationBuffer."Text 1", PurchaseHeader."Pay-to Vendor No.", PurchaseOrderPayToVendorNoLbl); + MigrationValidationAssert.ValidateAreEqual(Test_PODOCDATE_Tok, TempGPPOHeaderValidationBuffer."Date 1", PurchaseHeader."Document Date", DocumentDateLbl); // Lines - GPPOLineValidationBuffer.Reset(); - GPPOLineValidationBuffer.SetRange("Parent No.", GPPOHeaderValidationBuffer."No."); - if GPPOLineValidationBuffer.FindSet() then + TempGPPOLineValidationBuffer.Reset(); + TempGPPOLineValidationBuffer.SetRange("Parent No.", TempGPPOHeaderValidationBuffer."No."); + if TempGPPOLineValidationBuffer.FindSet() then repeat - MigrationValidationAssert.SetContext(ValidationSuiteIdTok, LineEntityType, GPPOLineValidationBuffer."No."); + MigrationValidationAssert.SetContext(ValidationSuiteIdTok, LineEntityType, TempGPPOLineValidationBuffer."No."); PurchaseLine.SetRange("Document Type", "Purchase Document Type"::Order); - PurchaseLine.SetRange("Document No.", GPPOHeaderValidationBuffer."No."); - PurchaseLine.SetRange("No.", GPPOLineValidationBuffer."Text 1"); + PurchaseLine.SetRange("Document No.", TempGPPOHeaderValidationBuffer."No."); + PurchaseLine.SetRange("No.", TempGPPOLineValidationBuffer."Text 1"); if not MigrationValidationAssert.ValidateRecordExists(Test_POLINEEXISTS_Tok, PurchaseLine.FindFirst(), StrSubstNo(MissingEntityTok, LineEntityType)) then continue; - MigrationValidationAssert.ValidateAreEqual(Test_POLINEQTY_Tok, GPPOLineValidationBuffer."Decimal 1", PurchaseLine.Quantity, QuantityLbl, true); - MigrationValidationAssert.ValidateAreEqual(Test_POLINEQTYRECV_Tok, GPPOLineValidationBuffer."Decimal 2", PurchaseLine."Quantity Received", QuantityRecLbl, true); - until GPPOLineValidationBuffer.Next() = 0; - until GPPOHeaderValidationBuffer.Next() = 0; + MigrationValidationAssert.ValidateAreEqual(Test_POLINEQTY_Tok, TempGPPOLineValidationBuffer."Decimal 1", PurchaseLine.Quantity, QuantityLbl, true); + MigrationValidationAssert.ValidateAreEqual(Test_POLINEQTYRECV_Tok, TempGPPOLineValidationBuffer."Decimal 2", PurchaseLine."Quantity Received", QuantityRecLbl, true); + until TempGPPOLineValidationBuffer.Next() = 0; + until TempGPPOHeaderValidationBuffer.Next() = 0; end; local procedure PopulatePOLineBuffer(PONumber: Code[20]; var LineBuffer: Record "GP PO Validation Buffer"): Boolean @@ -794,9 +794,9 @@ codeunit 40903 "GP Migration Validator" ShouldCreateLine := true; ItemNo := CopyStr(GPPOP10110.ITEMNMBR.Trim(), 1, MaxStrLen(Item."No.")); - Item.SetLoadFields(Blocked); + Item.SetLoadFields(Blocked, "Purchasing Blocked"); if Item.Get(ItemNo) then begin - if Item.Blocked then + if (Item.Blocked or Item."Purchasing Blocked") then ShouldCreateLine := false end else if GPPOP10110.NONINVEN = 0 then diff --git a/Apps/W1/HybridGP/app/src/tables/GPCompanyAdditionalSettings.table.al b/Apps/W1/HybridGP/app/src/tables/GPCompanyAdditionalSettings.table.al index 4cda507d67..339b9f83cb 100644 --- a/Apps/W1/HybridGP/app/src/tables/GPCompanyAdditionalSettings.table.al +++ b/Apps/W1/HybridGP/app/src/tables/GPCompanyAdditionalSettings.table.al @@ -420,6 +420,7 @@ table 40105 "GP Company Additional Settings" Rec.Validate("Migrate Item Classes", false); Rec.Validate("Migrate Vendor Classes", false); Rec.Validate("Migrate Only GL Master", false); + Rec.Validate("Migrate Inactive Alloc. Accts.", false); if Rec."Migrate Bank Module" then Rec.Validate("Migrate Only Bank Master", true); @@ -491,6 +492,15 @@ table 40105 "GP Company Additional Settings" { DataClassification = SystemMetadata; } + field(48; "Migrate Inactive Alloc. Accts."; Boolean) + { + DataClassification = SystemMetadata; + } + field(49; "Migrate Hist. Payroll Detail"; Boolean) + { + DataClassification = SystemMetadata; + InitValue = true; + } } keys @@ -592,6 +602,12 @@ table 40105 "GP Company Additional Settings" exit(Rec."Migrate Kit Items"); end; + procedure GetMigrateInactiveAllocationAccounts(): Boolean + begin + GetSingleInstance(); + exit(Rec."Migrate Inactive Alloc. Accts."); + end; + // Classes procedure GetMigrateVendorClasses(): Boolean begin @@ -752,6 +768,12 @@ table 40105 "GP Company Additional Settings" exit(Rec."Migrate Hist. Purch. Trx."); end; + procedure GetMigrateHistPayrollDetail(): Boolean + begin + GetSingleInstance(); + exit(Rec."Migrate Hist. Payroll Detail"); + end; + procedure GetMigrateHistory(): Boolean begin GetSingleInstance(); diff --git a/Apps/W1/HybridGP/test/src/GPAccountTests.codeunit.al b/Apps/W1/HybridGP/test/src/GPAccountTests.codeunit.al index 6b5d80fb55..bc3435ec34 100644 --- a/Apps/W1/HybridGP/test/src/GPAccountTests.codeunit.al +++ b/Apps/W1/HybridGP/test/src/GPAccountTests.codeunit.al @@ -34,6 +34,8 @@ codeunit 139661 "GP Account Tests" StatisticalAccJournalLine: Record "Statistical Acc. Journal Line"; StatisticalLedgerEntry: Record "Statistical Ledger Entry"; GPMigrationWarings: Record "GP Migration Warnings"; + AllocationAccount: Record "Allocation Account"; + AllocAccountDistribution: Record "Alloc. Account Distribution"; HelperFunctions: Codeunit "Helper Functions"; StartTime: DateTime; begin @@ -68,6 +70,7 @@ codeunit 139661 "GP Account Tests" // [WHEN] Posting all transactions HelperFunctions.PostGLTransactions(); + HelperFunctions.CreatePostMigrationData(); Assert.RecordCount(GPMigrationWarings, 0); @@ -107,6 +110,44 @@ codeunit 139661 "GP Account Tests" StatisticalLedgerEntry.FindFirst(); Assert.AreEqual(10, StatisticalLedgerEntry.Amount, 'Statistical Account Ledger Entry amount is incorrect'); + + // Allocation Accounts + Assert.RecordCount(AllocationAccount, 2); + + // Fixed + Assert.IsTrue(AllocationAccount.Get('9011'), 'Missing Allocation Account 9011'); + Assert.AreEqual('Allocation Account - Fixed', AllocationAccount.Name, 'Incorrect Allocation Account name'); + Assert.AreEqual('Fixed', Format(AllocationAccount."Account Type"), 'Incorrect Allocation Account type'); + Assert.AreEqual('Split Amount', Format(AllocationAccount."Document Lines Split"), 'Incorrect Allocation Account split type'); + + AllocAccountDistribution.SetRange("Allocation Account No.", AllocationAccount."No."); + AllocAccountDistribution.SetRange("Account Type", AllocAccountDistribution."Account Type"::Fixed); + AllocAccountDistribution.SetRange("Line No.", 10000); + Assert.IsTrue(AllocAccountDistribution.FindFirst(), 'Could not find 1st line for Allocation Account 9011'); + Assert.AreEqual(25, AllocAccountDistribution.Share, 'Incorrect Allocation Account share (25%)'); + Assert.AreEqual('2106', AllocAccountDistribution."Destination Account Number", 'Incorrect Allocation Account destination account'); + + Clear(AllocAccountDistribution); + AllocAccountDistribution.SetRange("Allocation Account No.", AllocationAccount."No."); + AllocAccountDistribution.SetRange("Account Type", AllocAccountDistribution."Account Type"::Fixed); + AllocAccountDistribution.SetRange("Line No.", 20000); + Assert.IsTrue(AllocAccountDistribution.FindFirst(), 'Could not find 2nd line for Allocation Account 9011'); + Assert.AreEqual(75, AllocAccountDistribution.Share, 'Incorrect Allocation Account share (75%)'); + Assert.AreEqual('4125', AllocAccountDistribution."Destination Account Number", 'Incorrect Allocation Account destination account'); + + // Variable + Assert.IsTrue(AllocationAccount.Get('9012'), 'Missing Allocation Account 9012'); + Assert.AreEqual('Allocation Account - Variable', AllocationAccount.Name, 'Incorrect Allocation Account name'); + Assert.AreEqual('Variable', Format(AllocationAccount."Account Type"), 'Incorrect Allocation Account type'); + Assert.AreEqual('Split Amount', Format(AllocationAccount."Document Lines Split"), 'Incorrect Allocation Account split type'); + + Clear(AllocAccountDistribution); + AllocAccountDistribution.SetRange("Allocation Account No.", AllocationAccount."No."); + AllocAccountDistribution.SetRange("Account Type", AllocAccountDistribution."Account Type"::Variable); + AllocAccountDistribution.SetRange("Line No.", 10000); + Assert.IsTrue(AllocAccountDistribution.FindFirst(), 'Could not find line for Allocation Account 9012'); + Assert.AreEqual('2106', AllocAccountDistribution."Breakdown Account Number", 'Incorrect Allocation Account breakdown account'); + Assert.AreEqual('4125', AllocAccountDistribution."Destination Account Number", 'Incorrect Allocation Account destination account'); end; [Test] @@ -399,6 +440,8 @@ codeunit 139661 "GP Account Tests" StatisticalAccJournalBatch: Record "Statistical Acc. Journal Batch"; StatisticalAccount: Record "Statistical Account"; GPMigrationWarings: Record "GP Migration Warnings"; + AllocationAccount: Record "Allocation Account"; + AllocAccountDistribution: Record "Alloc. Account Distribution"; begin GPTestHelperFunctions.DeleteAllSettings(); GPAccount.DeleteAll(); @@ -417,6 +460,8 @@ codeunit 139661 "GP Account Tests" StatisticalAccJournalBatch.DeleteAll(); StatisticalAccount.DeleteAll(); GPMigrationWarings.DeleteAll(); + AllocAccountDistribution.DeleteAll(); + AllocationAccount.DeleteAll(); end; local procedure Migrate(var GPAccount: Record "GP Account") @@ -431,6 +476,10 @@ codeunit 139661 "GP Account Tests" end; local procedure CreateAccountData(var GPAccount: Record "GP Account") + var + GPGL00103: Record "GP GL00103"; + GPGL00104: Record "GP GL00104"; + GPGL00100: Record "GP GL00100"; begin Clear(GPAccount); GPAccount.AcctNum := '0000'; @@ -446,6 +495,11 @@ codeunit 139661 "GP Account Tests" GPAccount.AccountType := 1; GPAccount.Insert(true); + Clear(GPGL00100); + GPGL00100.ACTINDX := GPAccount.AcctIndex; + GPGL00100.ACCTTYPE := GPAccount.AccountType; + GPGL00100.Insert(true); + Clear(GPAccount); GPAccount.AcctNum := '1100'; GPAccount.AcctIndex := 1; @@ -460,6 +514,11 @@ codeunit 139661 "GP Account Tests" GPAccount.AccountType := 1; GPAccount.Insert(true); + Clear(GPGL00100); + GPGL00100.ACTINDX := GPAccount.AcctIndex; + GPGL00100.ACCTTYPE := GPAccount.AccountType; + GPGL00100.Insert(true); + Clear(GPAccount); GPAccount.AcctNum := '1200'; GPAccount.AcctIndex := 2; @@ -473,6 +532,11 @@ codeunit 139661 "GP Account Tests" GPAccount.AccountType := 1; GPAccount.Insert(true); + Clear(GPGL00100); + GPGL00100.ACTINDX := GPAccount.AcctIndex; + GPGL00100.ACCTTYPE := GPAccount.AccountType; + GPGL00100.Insert(true); + Clear(GPAccount); GPAccount.AcctNum := '1550'; GPAccount.AcctIndex := 3; @@ -486,6 +550,11 @@ codeunit 139661 "GP Account Tests" GPAccount.AccountType := 1; GPAccount.Insert(true); + Clear(GPGL00100); + GPGL00100.ACTINDX := GPAccount.AcctIndex; + GPGL00100.ACCTTYPE := GPAccount.AccountType; + GPGL00100.Insert(true); + Clear(GPAccount); GPAccount.AcctNum := '1555'; GPAccount.AcctIndex := 4; @@ -499,6 +568,11 @@ codeunit 139661 "GP Account Tests" GPAccount.AccountType := 1; GPAccount.Insert(true); + Clear(GPGL00100); + GPGL00100.ACTINDX := GPAccount.AcctIndex; + GPGL00100.ACCTTYPE := GPAccount.AccountType; + GPGL00100.Insert(true); + Clear(GPAccount); GPAccount.AcctNum := '2106'; GPAccount.AcctIndex := 5; @@ -513,6 +587,11 @@ codeunit 139661 "GP Account Tests" GPAccount.AccountType := 1; GPAccount.Insert(true); + Clear(GPGL00100); + GPGL00100.ACTINDX := GPAccount.AcctIndex; + GPGL00100.ACCTTYPE := GPAccount.AccountType; + GPGL00100.Insert(true); + Clear(GPAccount); GPAccount.AcctNum := '4125'; GPAccount.AcctIndex := 6; @@ -527,6 +606,11 @@ codeunit 139661 "GP Account Tests" GPAccount.AccountType := 1; GPAccount.Insert(true); + Clear(GPGL00100); + GPGL00100.ACTINDX := GPAccount.AcctIndex; + GPGL00100.ACCTTYPE := GPAccount.AccountType; + GPGL00100.Insert(true); + Clear(GPAccount); GPAccount.AcctNum := '9010'; GPAccount.AcctIndex := 99; @@ -535,6 +619,54 @@ codeunit 139661 "GP Account Tests" GPAccount.Active := true; GPAccount.AccountType := 2; GPAccount.Insert(true); + + Clear(GPGL00100); + GPGL00100.ACTINDX := GPAccount.AcctIndex; + GPGL00100.ACCTTYPE := GPAccount.AccountType; + GPGL00100.Insert(true); + + // Allocation accounts + + // Fixed + Clear(GPAccount); + GPAccount.AcctNum := '9011'; + GPAccount.AcctIndex := 100; + GPAccount.Name := 'Allocation Account - Fixed'; + GPAccount.SearchName := 'Allocation Account - Fixed'; + GPAccount.Active := true; + GPAccount.AccountType := 3; + GPAccount."Sub Type" := GPAccount."Sub Type"::Fixed; + GPAccount.Insert(true); + + Clear(GPGL00103); + GPGL00103.ACTINDX := GPAccount.AcctIndex; + GPGL00103.DSTINDX := 5; + GPGL00103.PRCNTAGE := 25; + GPGL00103.Insert(true); + + Clear(GPGL00103); + GPGL00103.ACTINDX := GPAccount.AcctIndex; + GPGL00103.DSTINDX := 6; + GPGL00103.PRCNTAGE := 75; + GPGL00103.Insert(true); + + // Variable + Clear(GPAccount); + GPAccount.AcctNum := '9012'; + GPAccount.AcctIndex := 101; + GPAccount.Name := 'Allocation Account - Variable'; + GPAccount.SearchName := 'Allocation Account - Variable'; + GPAccount.Active := true; + GPAccount.AccountType := 3; + GPAccount."Sub Type" := GPAccount."Sub Type"::Variable; + GPAccount."Balance For Calculation" := GPAccount."Balance For Calculation"::YTD; + GPAccount.Insert(true); + + Clear(GPGL00104); + GPGL00104.ACTINDX := GPAccount.AcctIndex; + GPGL00104.BDNINDX := 5; + GPGL00104.DSTINDX := 6; + GPGL00104.Insert(true); end; local procedure CreateDimensionData(var GPSegments: Record "GP Segments"; var GPCodes: Record "GP Codes") diff --git a/Apps/W1/HybridGP/test/src/GPDataMigrationTests.codeunit.al b/Apps/W1/HybridGP/test/src/GPDataMigrationTests.codeunit.al index 5ed89b1d2f..98e8adf7de 100644 --- a/Apps/W1/HybridGP/test/src/GPDataMigrationTests.codeunit.al +++ b/Apps/W1/HybridGP/test/src/GPDataMigrationTests.codeunit.al @@ -113,6 +113,7 @@ codeunit 139664 "GP Data Migration Tests" ShipToAddress: Record "Ship-to Address"; StandardSalesLine: Record "Standard Sales Line"; StandardCustomerSalesCode: Record "Standard Customer Sales Code"; + CustomReportSelection: Record "Custom Report Selection"; InitialGenJournalLineCount: Integer; CustomerCount: Integer; begin @@ -238,7 +239,14 @@ codeunit 139664 "GP Data Migration Tests" // [THEN] Email addresses are included with the addresses when they are valid Customer.SetRange("No.", '#1'); Customer.FindFirst(); - Assert.AreEqual('GoodEmailAddress@testing.tst;support@testing.tst', Customer."E-Mail", 'E-Mail of Migrated Customer is wrong'); + Assert.AreEqual('GoodEmailAddress@testing.tst', Customer."E-Mail", 'E-Mail of Migrated Customer is wrong'); + + CustomReportSelection.SetRange("Source Type", Database::Customer); + CustomReportSelection.SetRange("Source No.", Customer."No."); + CustomReportSelection.SetRange("Report ID", 1306); // Sales - Invoice + CustomReportSelection.SetRange(Usage, CustomReportSelection.Usage::"S.Invoice"); + Assert.IsTrue(CustomReportSelection.FindFirst(), 'Could not locate Custom Report Selection for Customer ' + Customer."No."); + Assert.AreEqual('support@testing.tst', CustomReportSelection."Send To Email", 'Extra email address not correct.'); Assert.IsTrue(ShipToAddress.Get('#1', 'PRIMARY'), 'Customer primary address does not exist.'); Assert.AreEqual('GoodEmailAddress@testing.tst', ShipToAddress."E-Mail", 'Customer primary address email was not set correctly.'); @@ -252,7 +260,6 @@ codeunit 139664 "GP Data Migration Tests" Assert.IsTrue(ShipToAddress.Get('#1', 'OTHER'), 'Customer other address does not exist.'); Assert.AreEqual('', ShipToAddress."E-Mail", 'Customer other address email should be empty.'); - // [THEN] Assigned sales codes/recurring lines will be correct. // Defined at Customer Class level @@ -302,47 +309,6 @@ codeunit 139664 "GP Data Migration Tests" Assert.AreEqual(CompanyNameLargeTxt, Customer.Name, 'Large Name of Migrated Customer is wrong'); end; - [Test] - [TransactionModel(TransactionModel::AutoRollback)] - procedure TestEmailAddressSelection() - begin - // [SCENARIO] Data migrated from GP contains records and email info in SY01200 - - Clear(GPSY01200); - GPSY01200.EmailToAddress := 'longeremailaddressshouldnotbeselected@test.net'; - GPSY01200.EmailCcAddress := 'ANOTHEREMAILADDRESS@test.net'; - GPSY01200.EmailBccAddress := 'anotheremailaddress@test.net'; - GPSY01200.INET1 := 'shortemail@test.net'; - - // [WHEN] 20 is the max length - // [THEN] The shorter email in INET1 will be selected - Assert.AreEqual('shortemail@test.net', GPSY01200.GetSingleEmailAddress(20), 'Incorrect email address. (20 max length)'); - Assert.AreEqual('shortemail@test.net', GPSY01200.GetAllEmailAddressesText(20), 'Incorrect multiple email text. (20 max length)'); - - // [WHEN] 50 is the max length - // [THEN] Only the EmailToAddress will be selected - Assert.AreEqual('longeremailaddressshouldnotbeselected@test.net', GPSY01200.GetSingleEmailAddress(50), 'Incorrect email address. (50 max length)'); - Assert.AreEqual('longeremailaddressshouldnotbeselected@test.net', GPSY01200.GetAllEmailAddressesText(50), 'Incorrect multiple email text. (50 max length)'); - - // [WHEN] 100 is the max length - // [THEN] The EmailToAddress will be selected since the max is large enough - Assert.AreEqual('longeremailaddressshouldnotbeselected@test.net', GPSY01200.GetSingleEmailAddress(100), 'Incorrect email address. (100 max length)'); - - // [THEN] All non-duplicate email addresses will be selected - Assert.AreEqual('longeremailaddressshouldnotbeselected@test.net;ANOTHEREMAILADDRESS@test.net;shortemail@test.net', GPSY01200.GetAllEmailAddressesText(100), 'Incorrect multiple email text. (100 max length)'); - - // [WHEN] The only valid email address is INET1, and it's within the max length boundary - Clear(GPSY01200); - GPSY01200.EmailToAddress := ''; - GPSY01200.EmailCcAddress := 'bad data;'; - GPSY01200.EmailBccAddress := ''; - GPSY01200.INET1 := 'OnlyEmailAddress@test.net'; - - // [THEN] The correct email address will be selected - Assert.AreEqual('OnlyEmailAddress@test.net', GPSY01200.GetSingleEmailAddress(80), 'Incorrect email address. (80 max length)'); - Assert.AreEqual('OnlyEmailAddress@test.net', GPSY01200.GetAllEmailAddressesText(80), 'Incorrect email address. (80 max length)'); - end; - [Test] [TransactionModel(TransactionModel::AutoRollback)] procedure TestReceivablesMasterDataOnly()