Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ codeunit 42003 "GP Populate Vendor 1099 Data"
var
GPPM00200: Record "GP PM00200";
begin
GPPM00200.SetRange(TEN99TYPE, 2, 5);
if not GPPM00200.FindSet() then
exit;

Expand All @@ -115,17 +114,13 @@ codeunit 42003 "GP Populate Vendor 1099 Data"
if IRS1099Code <> '' then
AssignIRS1099CodeToVendor(Vendor, IRS1099Code);

if GPPM00200.TXIDNMBR <> '' then
Vendor.Validate("Federal ID No.", GPPM00200.TXIDNMBR.TrimEnd());
if GPPM00200.TXIDNMBR <> '' then begin
Vendor.Validate("Federal ID No.", CopyStr(GPPM00200.TXIDNMBR.TrimEnd(), 1, MaxStrLen(Vendor."Federal ID No.")));
Vendor.Modify();
end;

if (IRS1099Code <> '') or (GPPM00200.TXIDNMBR <> '') then begin
Vendor.Validate("Tax Identification Type", Vendor."Tax Identification Type"::"Legal Entity");
if Vendor.Modify() then
AddVendor1099Values(Vendor)
else
LogLastError(Vendor."No.");
end else
LogVendorSkipped(Vendor."No.");
if GPPM00200.TEN99TYPE > 1 then
AddVendor1099Values(Vendor);
end;

local procedure VendorAlreadyHasIRS1099CodeAssigned(var Vendor: Record Vendor): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ codeunit 4017 "GP Account Migrator"
DescriptionTrxTxt: Label 'Migrated transaction', Locked = true;
BeginningBalanceTrxTxt: Label 'Beginning Balance', Locked = true;
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.';

[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)
Expand Down Expand Up @@ -155,6 +157,7 @@ codeunit 4017 "GP Account Migrator"
GenJournalLine: Record "Gen. Journal Line";
GPFiscalPeriods: Record "GP Fiscal Periods";
GPCompanyAdditionalSettings: Record "GP Company Additional Settings";
GPMigrationWarnings: Record "GP Migration Warnings";
DataMigrationFacadeHelper: Codeunit "Data Migration Facade Helper";
HelperFunctions: Codeunit "Helper Functions";
BeginningBalance: Decimal;
Expand Down Expand Up @@ -188,39 +191,42 @@ codeunit 4017 "GP Account Migrator"
exit;

PostingGroupCode := PostingGroupCodeTxt + Format(InitialYear) + 'BB';
if GPFiscalPeriods.Get(0, InitialYear) then begin
DataMigrationFacadeHelper.CreateGeneralJournalBatchIfNeeded(CopyStr(PostingGroupCode, 1, 10), '', '');
DataMigrationFacadeHelper.CreateGeneralJournalLine(
GenJournalLine,
PostingGroupCode,
PostingGroupCode,
BeginningBalanceTrxTxt,
GenJournalLine."Account Type"::"G/L Account",
CopyStr(GPAccount.AcctNum, 1, 20),
GPFiscalPeriods.PERIODDT,
0D,
BeginningBalance,
BeginningBalance,
'',
''
);

ACTNUMBR_1 := GPGL10111.ACTNUMBR_1;
ACTNUMBR_2 := GPGL10111.ACTNUMBR_2;
ACTNUMBR_3 := GPGL10111.ACTNUMBR_3;
ACTNUMBR_4 := GPGL10111.ACTNUMBR_4;
ACTNUMBR_5 := GPGL10111.ACTNUMBR_5;
ACTNUMBR_6 := GPGL10111.ACTNUMBR_6;
ACTNUMBR_7 := GPGL10111.ACTNUMBR_7;
ACTNUMBR_8 := GPGL10111.ACTNUMBR_8;

if HelperFunctions.AreAllSegmentNumbersEmpty(ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8) then
HelperFunctions.GetSegmentNumbersFromGPAccountIndex(GPGL10111.ACTINDX, ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8);

DimSetID := HelperFunctions.CreateDimSet(ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8);
GenJournalLine.Validate("Dimension Set ID", DimSetID);
GenJournalLine.Modify(true);
if not GPFiscalPeriods.Get(0, InitialYear) then begin
GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(FiscalYearMissingContextTxt, GPAccount.AcctNum, InitialYear), FiscalYearMissingMessageTxt);
exit;
end;

DataMigrationFacadeHelper.CreateGeneralJournalBatchIfNeeded(CopyStr(PostingGroupCode, 1, 10), '', '');
DataMigrationFacadeHelper.CreateGeneralJournalLine(
GenJournalLine,
PostingGroupCode,
PostingGroupCode,
BeginningBalanceTrxTxt,
GenJournalLine."Account Type"::"G/L Account",
CopyStr(GPAccount.AcctNum, 1, 20),
GPFiscalPeriods.PERIODDT,
0D,
BeginningBalance,
BeginningBalance,
'',
''
);

ACTNUMBR_1 := GPGL10111.ACTNUMBR_1;
ACTNUMBR_2 := GPGL10111.ACTNUMBR_2;
ACTNUMBR_3 := GPGL10111.ACTNUMBR_3;
ACTNUMBR_4 := GPGL10111.ACTNUMBR_4;
ACTNUMBR_5 := GPGL10111.ACTNUMBR_5;
ACTNUMBR_6 := GPGL10111.ACTNUMBR_6;
ACTNUMBR_7 := GPGL10111.ACTNUMBR_7;
ACTNUMBR_8 := GPGL10111.ACTNUMBR_8;

if HelperFunctions.AreAllSegmentNumbersEmpty(ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8) then
HelperFunctions.GetSegmentNumbersFromGPAccountIndex(GPGL10111.ACTINDX, ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8);

DimSetID := HelperFunctions.CreateDimSet(ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8);
GenJournalLine.Validate("Dimension Set ID", DimSetID);
GenJournalLine.Modify(true);
end;

local procedure CreateStatisticalAccountBeginningBalanceImp(GPAccount: Record "GP Account")
Expand All @@ -232,6 +238,7 @@ codeunit 4017 "GP Account Migrator"
StatisticalAccJournalBatch: Record "Statistical Acc. Journal Batch";
StatisticalAccJournalLine: Record "Statistical Acc. Journal Line";
StatisticalAccJournalLineCurrent: Record "Statistical Acc. Journal Line";
GPMigrationWarnings: Record "GP Migration Warnings";
HelperFunctions: Codeunit "Helper Functions";
InitialYear: Integer;
BeginningBalance: Decimal;
Expand Down Expand Up @@ -268,43 +275,46 @@ codeunit 4017 "GP Account Migrator"
exit;

DocumentNo := PostingGroupCodeTxt + Format(InitialYear) + 'BB';
if GPFiscalPeriods.Get(0, InitialYear) then begin
if not StatisticalAccJournalBatch.Get('', DocumentNo) then begin
StatisticalAccJournalBatch.Validate(Name, DocumentNo);
StatisticalAccJournalBatch.Insert(true);
end;

StatisticalAccJournalLineCurrent.SetRange("Journal Batch Name", StatisticalAccJournalBatch.Name);
if StatisticalAccJournalLineCurrent.FindLast() then
LineNum := StatisticalAccJournalLineCurrent."Line No." + 10000
else
LineNum := 10000;

StatisticalAccJournalLine.Validate("Journal Batch Name", DocumentNo);
StatisticalAccJournalLine.Validate("Line No.", LineNum);
StatisticalAccJournalLine.Validate("Document No.", DocumentNo);
StatisticalAccJournalLine.Validate(Description, CopyStr(BeginningBalanceTrxTxt, 1, MaxStrLen(StatisticalAccJournalLine.Description)));
StatisticalAccJournalLine.Validate("Statistical Account No.", CopyStr(GPAccount.AcctNum, 1, MaxStrLen(StatisticalAccJournalLine."Statistical Account No.")));
StatisticalAccJournalLine.Validate("Posting Date", GPFiscalPeriods.PERIODDT);
StatisticalAccJournalLine.Validate(Amount, BeginningBalance);
StatisticalAccJournalLine.Insert();

ACTNUMBR_1 := GPGL10111.ACTNUMBR_1;
ACTNUMBR_2 := GPGL10111.ACTNUMBR_2;
ACTNUMBR_3 := GPGL10111.ACTNUMBR_3;
ACTNUMBR_4 := GPGL10111.ACTNUMBR_4;
ACTNUMBR_5 := GPGL10111.ACTNUMBR_5;
ACTNUMBR_6 := GPGL10111.ACTNUMBR_6;
ACTNUMBR_7 := GPGL10111.ACTNUMBR_7;
ACTNUMBR_8 := GPGL10111.ACTNUMBR_8;

if HelperFunctions.AreAllSegmentNumbersEmpty(ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8) then
HelperFunctions.GetSegmentNumbersFromGPAccountIndex(GPGL10111.ACTINDX, ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8);

DimSetID := HelperFunctions.CreateDimSet(ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8);
StatisticalAccJournalLine.Validate("Dimension Set ID", DimSetID);
StatisticalAccJournalLine.Modify(true);
if not GPFiscalPeriods.Get(0, InitialYear) then begin
GPMigrationWarnings.InsertWarning(MigrationLogAreaTxt, StrSubstNo(FiscalYearMissingContextTxt, GPAccount.AcctNum, InitialYear), FiscalYearMissingMessageTxt);
exit;
end;

if not StatisticalAccJournalBatch.Get('', DocumentNo) then begin
StatisticalAccJournalBatch.Validate(Name, DocumentNo);
StatisticalAccJournalBatch.Insert(true);
end;

StatisticalAccJournalLineCurrent.SetRange("Journal Batch Name", StatisticalAccJournalBatch.Name);
if StatisticalAccJournalLineCurrent.FindLast() then
LineNum := StatisticalAccJournalLineCurrent."Line No." + 10000
else
LineNum := 10000;

StatisticalAccJournalLine.Validate("Journal Batch Name", DocumentNo);
StatisticalAccJournalLine.Validate("Line No.", LineNum);
StatisticalAccJournalLine.Validate("Document No.", DocumentNo);
StatisticalAccJournalLine.Validate(Description, CopyStr(BeginningBalanceTrxTxt, 1, MaxStrLen(StatisticalAccJournalLine.Description)));
StatisticalAccJournalLine.Validate("Statistical Account No.", CopyStr(GPAccount.AcctNum, 1, MaxStrLen(StatisticalAccJournalLine."Statistical Account No.")));
StatisticalAccJournalLine.Validate("Posting Date", GPFiscalPeriods.PERIODDT);
StatisticalAccJournalLine.Validate(Amount, BeginningBalance);
StatisticalAccJournalLine.Insert();

ACTNUMBR_1 := GPGL10111.ACTNUMBR_1;
ACTNUMBR_2 := GPGL10111.ACTNUMBR_2;
ACTNUMBR_3 := GPGL10111.ACTNUMBR_3;
ACTNUMBR_4 := GPGL10111.ACTNUMBR_4;
ACTNUMBR_5 := GPGL10111.ACTNUMBR_5;
ACTNUMBR_6 := GPGL10111.ACTNUMBR_6;
ACTNUMBR_7 := GPGL10111.ACTNUMBR_7;
ACTNUMBR_8 := GPGL10111.ACTNUMBR_8;

if HelperFunctions.AreAllSegmentNumbersEmpty(ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8) then
HelperFunctions.GetSegmentNumbersFromGPAccountIndex(GPGL10111.ACTINDX, ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8);

DimSetID := HelperFunctions.CreateDimSet(ACTNUMBR_1, ACTNUMBR_2, ACTNUMBR_3, ACTNUMBR_4, ACTNUMBR_5, ACTNUMBR_6, ACTNUMBR_7, ACTNUMBR_8);
StatisticalAccJournalLine.Validate("Dimension Set ID", DimSetID);
StatisticalAccJournalLine.Modify(true);
end;

procedure MigrateAccountDetails(GPAccount: Record "GP Account"; var GLAccDataMigrationFacade: Codeunit "GL Acc. Data Migration Facade")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace Microsoft.DataMigration.GP;

using Microsoft.Sales.Customer;
using System.Email;
using Microsoft.Finance.SalesTax;

table 4048 "GP Customer Address"
{
Expand Down Expand Up @@ -80,6 +81,7 @@ table 4048 "GP Customer Address"
GPSY01200: Record "GP SY01200";
MailManagement: Codeunit "Mail Management";
EmailAddress: Text[80];
TaxAreaCode: Code[20];
Exists: Boolean;
begin
if Customer.Get(Rec.CUSTNMBR) then begin
Expand All @@ -97,7 +99,11 @@ table 4048 "GP Customer Address"
ShipToAddress."Fax No." := CopyStr(Rec.FAX.TrimEnd(), 1, MaxStrLen(ShipToAddress."Fax No."));
ShipToAddress."Post Code" := CopyStr(Rec.ZIP.TrimEnd(), 1, MaxStrLen(ShipToAddress."Post Code"));
ShipToAddress.County := CopyStr(Rec.STATE.TrimEnd(), 1, MaxStrLen(ShipToAddress.County));
ShipToAddress."Tax Area Code" := CopyStr(Rec.TAXSCHID.TrimEnd(), 1, MaxStrLen(ShipToAddress."Tax Area Code"));

TaxAreaCode := CopyStr(Rec.TAXSCHID.TrimEnd(), 1, MaxStrLen(ShipToAddress."Tax Area Code"));
CreateTaxAreaIfNeeded(TaxAreaCode);

ShipToAddress."Tax Area Code" := TaxAreaCode;

if (CopyStr(ShipToAddress."Phone No.", 1, 14) = '00000000000000') then
ShipToAddress."Phone No." := '';
Expand All @@ -120,6 +126,18 @@ table 4048 "GP Customer Address"
end;
end;

local procedure CreateTaxAreaIfNeeded(CodeToSet: Code[20])
var
TaxArea: Record "Tax Area";
begin
if TaxArea.Get(CodeToSet) then
exit;

Clear(TaxArea);
TaxArea.Validate(Code, CodeToSet);
TaxArea.Insert(true);
end;

var
CustomerEmailTypeCodeLbl: Label 'CUS', Locked = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace Microsoft.DataMigration.GP;

using Microsoft.CRM.Outlook;
using Microsoft.DataMigration;
using Microsoft.Finance.Currency;
using Microsoft.Finance.GeneralLedger.Setup;
using Microsoft.Inventory.Item;

Expand Down Expand Up @@ -370,6 +371,8 @@ codeunit 40125 "GP Populate Combined Tables"
GPCustomer.TAXSCHID := GPRM00101.TAXSCHID.Trim();
GPCustomer.UPSZONE := GPRM00101.UPSZONE.Trim();
GPCustomer.TAXEXMT1 := GPRM00101.TAXEXMT1.Trim();
GPCustomer.CUSTCLAS := GPRM00101.CUSTCLAS.Trim();
GPCustomer.RMSLSACC := GPRM00101.RMSLSACC;
#pragma warning restore AA0139

if GPRM00101.PHONE1.Contains('E+') then
Expand Down Expand Up @@ -530,13 +533,14 @@ codeunit 40125 "GP Populate Combined Tables"
internal procedure PopulateGPVendors()
var
GPPM00200Vendor: Record "GP PM00200";
GPPM00201VendorSum: Record "GP PM00201";
GPSY01200NetAddresses: Record "GP SY01200";
GPVendor: Record "GP Vendor";
GPCompanyMigrationSettings: Record "GP Company Migration Settings";
GPCompanyAdditionalSettings: Record "GP Company Additional Settings";
begin
GPPM00200Vendor.SetFilter(VENDSTTS, '1|3');
if GPCompanyMigrationSettings.Get(CompanyName()) then
if GPCompanyMigrationSettings."Migrate Inactive Vendors" then
GPPM00200Vendor.SetRange(VENDSTTS);
if GPCompanyAdditionalSettings.GetMigrateInactiveVendors() then
GPPM00200Vendor.SetRange(VENDSTTS);

if not GPPM00200Vendor.FindSet() then
exit;
Expand Down Expand Up @@ -571,7 +575,10 @@ codeunit 40125 "GP Populate Combined Tables"
GPVendor.TAXSCHID := GPPM00200Vendor.TAXSCHID.TrimEnd();
GPVendor.UPSZONE := GPPM00200Vendor.UPSZONE.TrimEnd();
GPVendor.TXIDNMBR := GPPM00200Vendor.TXIDNMBR.TrimEnd();
#pragma warning restore AA0139
GPVendor.VNDCLSID := GPPM00200Vendor.VNDCLSID.TrimEnd();
#pragma warning restore AA0139

GPVendor.PMPRCHIX := GPPM00200Vendor.PMPRCHIX;

if GPPM00200Vendor.PHNUMBR1.Contains('E+') then
GPVendor.PHNUMBR1 := '00000000000000'
Expand Down Expand Up @@ -647,18 +654,12 @@ codeunit 40125 "GP Populate Combined Tables"
local procedure ShouldAddItemToStagingTable(var GPIV00101: Record "GP IV00101"): Boolean
var
GPCompanyAdditionalSettings: Record "GP Company Additional Settings";
InActive: Boolean;
begin
if not GPCompanyAdditionalSettings.GetMigrateKitItems() then
if GPIV00101.ITEMTYPE = 3 then
exit(false);

if GPIV00101.ITEMTYPE = 2 then
InActive := true
else
InActive := GPIV00101.INACTIVE;

if InActive then
if GPIV00101.INACTIVE then
if not GPCompanyAdditionalSettings.GetMigrateInactiveItems() then
exit(false);

Expand Down Expand Up @@ -695,14 +696,21 @@ codeunit 40125 "GP Populate Combined Tables"
GPIV40201InventoryUom: Record "GP IV40201";
DummyItem: Record Item;
GPMC40000: Record "GP MC40000";
GPCompanyAdditionalSettings: Record "GP Company Additional Settings";
FoundCurrency: Boolean;
begin
GPItem.ITEMNMBR := GPIV00101Inventory.ITEMNMBR;
GPItem.No := CopyStr(GPIV00101Inventory.ITEMNMBR.TrimEnd(), 1, MaxStrLen(DummyItem."No."));
GPItem.Description := CopyStr(GPIV00101Inventory.ITEMDESC.TrimEnd(), 1, MaxStrLen(GPItem.Description));
GPItem.SearchDescription := CopyStr(GPIV00101Inventory.ITEMDESC.TrimEnd(), 1, MaxStrLen(GPItem.SearchDescription));
#pragma warning disable AA0139
GPItem.ShortName := GPIV00101Inventory.ITEMNMBR.TrimEnd();
#pragma warning restore AA0139

case GPCompanyAdditionalSettings.GetItemDesc2Source() of
"GP Item Desc. 2 Source"::"Short Description":
GPItem.ShortName := CopyStr(GPIV00101Inventory.ITMSHNAM.TrimEnd(), 1, MaxStrLen(GPItem.ShortName)); // ITMSHNAM = Item Short Name
"GP Item Desc. 2 Source"::"Generic Description":
GPItem.ShortName := CopyStr(GPIV00101Inventory.ITMGEDSC.TrimEnd(), 1, MaxStrLen(GPItem.ShortName)); // ITMGEDSC = Item Generic Description
end;

case GPIV00101Inventory.ITEMTYPE of
1, 2:
GPItem.ItemType := 0;
Expand Down
8 changes: 8 additions & 0 deletions Apps/W1/HybridGP/app/src/Migration/Items/GPIV00101.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ table 40116 "GP IV00101"
{
DataClassification = CustomerContent;
}
field(4; ITMSHNAM; Text[15])
{
DataClassification = CustomerContent;
}
field(5; ITEMTYPE; Integer)
{
DataClassification = CustomerContent;
}
field(6; ITMGEDSC; Text[11])
{
DataClassification = CustomerContent;
}
field(7; STNDCOST; Decimal)
{
AutoFormatType = 0;
Expand Down
5 changes: 5 additions & 0 deletions Apps/W1/HybridGP/app/src/Migration/Items/GPItem.table.al
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ table 4095 "GP Item"
Caption = 'Item Tracking Code';
DataClassification = CustomerContent;
}
field(17; ITEMNMBR; Text[31])
{
Caption = 'ITEMNMBR';
DataClassification = CustomerContent;
}
}

keys
Expand Down
Loading
Loading