-
Notifications
You must be signed in to change notification settings - Fork 696
Expand file tree
/
Copy pathCreateATGLAccounts.Codeunit.al
More file actions
132 lines (108 loc) · 7.12 KB
/
CreateATGLAccounts.Codeunit.al
File metadata and controls
132 lines (108 loc) · 7.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.DemoData.Localization;
using Microsoft.DemoData.Common;
using Microsoft.DemoData.FixedAsset;
using Microsoft.DemoData.HumanResources;
using Microsoft.DemoData.Jobs;
using Microsoft.DemoData.Manufacturing;
using Microsoft.DemoData.Service;
using Microsoft.DemoTool.Helpers;
using Microsoft.Inventory.Setup;
codeunit 11140 "Create AT GL Accounts"
{
InherentPermissions = X;
InherentEntitlements = X;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Create Common GL Account", 'OnAfterAddGLAccountsForLocalization', '', false, false)]
local procedure ModifyCommonGLAccounts()
var
InventorySetup: Record "Inventory Setup";
ContosoGLAccount: Codeunit "Contoso GL Account";
CommonGLAccount: Codeunit "Create Common GL Account";
begin
InventorySetup.Get();
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.CustomerDomesticName(), '2020');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.VendorDomesticName(), '3320');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.SalesDomesticName(), '4010');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.PurchaseDomesticName(), '5510');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.SalesVATStandardName(), '3520');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.PurchaseVATStandardName(), '2520');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.DirectCostAppliedRawMatName(), '5130');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.DirectCostAppliedRetailName(), '5030');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.OverheadAppliedRawMatName(), '5140');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.OverheadAppliedRetailName(), '5040');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.PurchaseVarianceRawMatName(), '5145');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.PurchaseVarianceRetailName(), '5045');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.InventoryAdjRawMatName(), '5120');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.InventoryAdjRetailName(), '5030');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.RawMaterialsName(), '1110');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.PurchRawMatDomName(), '5540');
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.ResalesName(), '1610');
if InventorySetup."Expected Cost Posting to G/L" then
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.ResaleInterimName(), '1620')
else
ContosoGLAccount.AddAccountForLocalization(CommonGLAccount.ResaleInterimName(), '');
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Create Svc GL Account", 'OnAfterAddGLAccountsForLocalization', '', false, false)]
local procedure ModifyServiceGLAccounts()
var
ContosoGLAccount: Codeunit "Contoso GL Account";
SvcGLAccount: Codeunit "Create Svc GL Account";
begin
ContosoGLAccount.AddAccountForLocalization(SvcGLAccount.ServiceContractSaleName(), '4280');
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Create Mfg GL Account", 'OnAfterAddGLAccountsForLocalization', '', false, false)]
local procedure ModifyManufacturingGLAccounts()
var
ContosoGLAccount: Codeunit "Contoso GL Account";
MfgGLAccount: Codeunit "Create Mfg GL Account";
begin
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.DirectCostAppliedCapName(), '5230');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.OverheadAppliedCapName(), '5240');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.PurchaseVarianceCapName(), '5245');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.MaterialVarianceName(), '5310');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.CapacityVarianceName(), '5320');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.SubcontractedVarianceName(), '5330');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.CapOverheadVarianceName(), '5340');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.MfgOverheadVarianceName(), '5350');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.MaterialNonInvVarianceName(), '5315');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.FinishedGoodsName(), '1510');
ContosoGLAccount.AddAccountForLocalization(MfgGLAccount.WIPAccountFinishedGoodsName(), '1410');
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Create FA GL Account", 'OnAfterAddGLAccountsForLocalization', '', false, false)]
local procedure ModifyFixedAssetGLAccounts()
var
ContosoGLAccount: Codeunit "Contoso GL Account";
FAGLAccount: Codeunit "Create FA GL Account";
begin
ContosoGLAccount.AddAccountForLocalization(FAGLAccount.IncreasesDuringTheYearName(), '0530');
ContosoGLAccount.AddAccountForLocalization(FAGLAccount.DecreasesDuringTheYearName(), '0540');
ContosoGLAccount.AddAccountForLocalization(FAGLAccount.AccumDepreciationBuildingsName(), '0550');
ContosoGLAccount.AddAccountForLocalization(FAGLAccount.MiscellaneousName(), '7740');
ContosoGLAccount.AddAccountForLocalization(FAGLAccount.DepreciationEquipmentName(), '7030');
ContosoGLAccount.AddAccountForLocalization(FAGLAccount.GainsAndLossesName(), '4630');
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Create HR GL Account", 'OnAfterAddGLAccountsForLocalization', '', false, false)]
local procedure ModifyHumanResourcesGLAccounts()
var
ContosoGLAccount: Codeunit "Contoso GL Account";
HRGLAccount: Codeunit "Create HR GL Account";
begin
ContosoGLAccount.AddAccountForLocalization(HRGLAccount.EmployeesPayableName(), '3680');
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Create Job GL Account", 'OnAfterAddGLAccountsForLocalization', '', false, false)]
local procedure ModifyJobGLAccounts()
var
ContosoGLAccount: Codeunit "Contoso GL Account";
JobGLAccount: Codeunit "Create Job GL Account";
begin
ContosoGLAccount.AddAccountForLocalization(JobGLAccount.WIPInvoicedSalesName(), '1431');
ContosoGLAccount.AddAccountForLocalization(JobGLAccount.WIPJobCostsName(), '1420');
ContosoGLAccount.AddAccountForLocalization(JobGLAccount.JobSalesAppliedName(), '4040');
ContosoGLAccount.AddAccountForLocalization(JobGLAccount.RecognizedSalesName(), '4250');
ContosoGLAccount.AddAccountForLocalization(JobGLAccount.JobCostsAppliedName(), '5270');
ContosoGLAccount.AddAccountForLocalization(JobGLAccount.RecognizedCostsName(), '5260');
end;
}