-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathCreateCommonGLAccount.Codeunit.al
More file actions
290 lines (234 loc) · 12.4 KB
/
Copy pathCreateCommonGLAccount.Codeunit.al
File metadata and controls
290 lines (234 loc) · 12.4 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
// ------------------------------------------------------------------------------------------------
// 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.Common;
using Microsoft.DemoTool.Helpers;
using Microsoft.Finance.GeneralLedger.Account;
using Microsoft.Inventory.Setup;
codeunit 5135 "Create Common GL Account"
{
InherentEntitlements = X;
InherentPermissions = X;
trigger OnRun()
var
GLAccountIndent: Codeunit "W1 G/L Account Indent";
begin
AddGLAccountsForLocalization();
ContosoGLAccount.InsertGLAccount(CustomerDomestic(), CustomerDomesticName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Assets, Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(VendorDomestic(), VendorDomesticName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Liabilities, Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(RawMaterials(), RawMaterialsName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Assets, Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(DirectCostAppliedRetail(), DirectCostAppliedRetailName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(OverheadAppliedRetail(), OverheadAppliedRetailName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(PurchaseVarianceRetail(), PurchaseVarianceRetailName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(DirectCostAppliedRawMat(), DirectCostAppliedRawMatName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(OverheadAppliedRawMat(), OverheadAppliedRawMatName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(PurchaseVarianceRawMat(), PurchaseVarianceRawMatName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(PurchRawMatDom(), PurchRawMatDomName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(InventoryAdjRawMat(), InventoryAdjRawMatName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(InventoryAdjRetail(), InventoryAdjRetailName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(SalesDomestic(), SalesDomesticName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Income, Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(PurchaseDomestic(), PurchaseDomesticName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::"Cost of Goods Sold", Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(SalesVATStandard(), SalesVATStandardName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Liabilities, Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(PurchaseVATStandard(), PurchaseVATStandardName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Assets, Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(Resale(), ResalesName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Assets, Enum::"G/L Account Type"::Posting);
ContosoGLAccount.InsertGLAccount(ResaleInterim(), ResaleInterimName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Assets, Enum::"G/L Account Type"::Posting);
GLAccountIndent.Indent();
end;
local procedure AddGLAccountsForLocalization()
var
InventorySetup: Record "Inventory Setup";
begin
InventorySetup.Get();
ContosoGLAccount.AddAccountForLocalization(CustomerDomesticName(), '2310');
ContosoGLAccount.AddAccountForLocalization(VendorDomesticName(), '5410');
ContosoGLAccount.AddAccountForLocalization(RawMaterialsName(), '2130');
ContosoGLAccount.AddAccountForLocalization(DirectCostAppliedRetailName(), '7191');
ContosoGLAccount.AddAccountForLocalization(OverheadAppliedRetailName(), '7192');
ContosoGLAccount.AddAccountForLocalization(PurchaseVarianceRetailName(), '7193');
ContosoGLAccount.AddAccountForLocalization(DirectCostAppliedRawMatName(), '7291');
ContosoGLAccount.AddAccountForLocalization(OverheadAppliedRawMatName(), '7292');
ContosoGLAccount.AddAccountForLocalization(PurchaseVarianceRawMatName(), '7293');
ContosoGLAccount.AddAccountForLocalization(PurchRawMatDomName(), '7210');
ContosoGLAccount.AddAccountForLocalization(InventoryAdjRawMatName(), '7270');
ContosoGLAccount.AddAccountForLocalization(InventoryAdjRetailName(), '7170');
ContosoGLAccount.AddAccountForLocalization(SalesDomesticName(), '6110');
ContosoGLAccount.AddAccountForLocalization(PurchaseDomesticName(), '7110');
ContosoGLAccount.AddAccountForLocalization(SalesVATStandardName(), '5610');
ContosoGLAccount.AddAccountForLocalization(PurchaseVATStandardName(), '5630');
ContosoGLAccount.AddAccountForLocalization(ResalesName(), '2110');
if InventorySetup."Expected Cost Posting to G/L" then
ContosoGLAccount.AddAccountForLocalization(ResaleInterimName(), '2111')
else
ContosoGLAccount.AddAccountForLocalization(ResaleInterimName(), '');
OnAfterAddGLAccountsForLocalization();
end;
var
ContosoGLAccount: Codeunit "Contoso GL Account";
CustomerDomesticLbl: Label 'Customers Domestic', MaxLength = 100;
VendorDomesticLbl: Label 'Vendors Domestic', MaxLength = 100;
RawMaterialsLbl: Label 'Raw Materials', MaxLength = 100;
OverheadAppliedRetailLbl: Label 'Overhead Applied, Retail', MaxLength = 100;
PurchaseVarianceRetailLbl: Label 'Purchase Variance, Retail', MaxLength = 100;
DirectCostAppliedRawMatLbl: Label 'Direct Cost Applied, Raw Materials', MaxLength = 100;
DirectCostAppliedRetailLbl: Label 'Direct Cost Applied, Retail', MaxLength = 100;
OverheadAppliedRawMatLbl: Label 'Overhead Applied, Raw Materials', MaxLength = 100;
PurchaseVarianceRawMatLbl: Label 'Overhead Applied, Raw Materials', MaxLength = 100;
PurchRawMatDomLbl: Label 'Purchase, Raw Materials - Domestic', MaxLength = 100;
InventoryAdjRawMatLbl: Label 'Inventory Adjustment, Raw Materials', MaxLength = 100;
InventoryAdjRetailLbl: Label 'Inventory Adjustment, Retail', MaxLength = 100;
SalesDomesticLbl: Label 'Sales, Retail - Domestic', MaxLength = 100;
PurchaseDomesticLbl: Label 'Purch., Retail - Domestic', MaxLength = 100;
SalesVATLbl: Label 'Sales VAT Standard', MaxLength = 100;
PurchaseVATLbl: Label 'Purchase VAT Standard', MaxLength = 100;
ResaleLbl: Label 'Resale', MaxLength = 100;
ResaleInterimLbl: Label 'Resale (Interim)', MaxLength = 100;
procedure CustomerDomestic(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(CustomerDomesticName()));
end;
procedure CustomerDomesticName(): Text[100]
begin
exit(CustomerDomesticLbl);
end;
procedure VendorDomestic(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(VendorDomesticName()));
end;
procedure VendorDomesticName(): Text[100]
begin
exit(VendorDomesticLbl);
end;
procedure RawMaterials(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(RawMaterialsName()));
end;
procedure RawMaterialsName(): Text[100]
begin
exit(RawMaterialsLbl);
end;
procedure DirectCostAppliedRetail(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(DirectCostAppliedRetailName()));
end;
procedure DirectCostAppliedRetailName(): Text[100]
begin
exit(DirectCostAppliedRetailLbl);
end;
procedure OverheadAppliedRetail(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(OverheadAppliedRetailName()));
end;
procedure OverheadAppliedRetailName(): Text[100]
begin
exit(OverheadAppliedRetailLbl);
end;
procedure PurchaseVarianceRetail(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(PurchaseVarianceRetailName()));
end;
procedure PurchaseVarianceRetailName(): Text[100]
begin
exit(PurchaseVarianceRetailLbl);
end;
procedure DirectCostAppliedRawMat(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(DirectCostAppliedRawMatName()));
end;
procedure DirectCostAppliedRawMatName(): Text[100]
begin
exit(DirectCostAppliedRawMatLbl);
end;
procedure OverheadAppliedRawMat(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(OverheadAppliedRawMatName()));
end;
procedure OverheadAppliedRawMatName(): Text[100]
begin
exit(OverheadAppliedRawMatLbl);
end;
procedure PurchaseVarianceRawMat(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(PurchaseVarianceRawMatName()));
end;
procedure PurchaseVarianceRawMatName(): Text[100]
begin
exit(PurchaseVarianceRawMatLbl);
end;
procedure PurchRawMatDom(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(PurchRawMatDomName()));
end;
procedure PurchRawMatDomName(): Text[100]
begin
exit(PurchRawMatDomLbl);
end;
procedure InventoryAdjRawMat(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(InventoryAdjRawMatName()));
end;
procedure InventoryAdjRawMatName(): Text[100]
begin
exit(InventoryAdjRawMatLbl);
end;
procedure InventoryAdjRetail(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(InventoryAdjRetailName()));
end;
procedure InventoryAdjRetailName(): Text[100]
begin
exit(InventoryAdjRetailLbl);
end;
procedure SalesDomestic(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(SalesDomesticName()));
end;
procedure SalesDomesticName(): Text[100]
begin
exit(SalesDomesticLbl);
end;
procedure PurchaseDomestic(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(PurchaseDomesticName()));
end;
procedure PurchaseDomesticName(): Text[100]
begin
exit(PurchaseDomesticLbl);
end;
procedure SalesVATStandard(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(SalesVATStandardName()));
end;
procedure SalesVATStandardName(): Text[100]
begin
exit(SalesVATLbl);
end;
procedure PurchaseVATStandard(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(PurchaseVATStandardName()));
end;
procedure PurchaseVATStandardName(): Text[100]
begin
exit(PurchaseVATLbl);
end;
procedure Resale(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(ResalesName()));
end;
procedure ResalesName(): Text[100]
begin
exit(ResaleLbl);
end;
procedure ResaleInterim(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(ResaleInterimName()));
end;
procedure ResaleInterimName(): Text[100]
begin
exit(ResaleInterimLbl);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterAddGLAccountsForLocalization()
begin
end;
}