-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutoPostingErrors.Report.al
2235 lines (2102 loc) · 111 KB
/
AutoPostingErrors.Report.al
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Finance.GeneralLedger.Journal;
using Microsoft.Bank.BankAccount;
using Microsoft.CRM.Campaign;
using Microsoft.CRM.Team;
using Microsoft.Finance.Currency;
using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Account;
using Microsoft.Finance.GeneralLedger.Setup;
using Microsoft.Finance.VAT.Setup;
using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.FixedAsset;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
using Microsoft.FixedAssets.Setup;
using Microsoft.Foundation.NoSeries;
using Microsoft.Foundation.PaymentTerms;
using Microsoft.Foundation.Period;
using Microsoft.HumanResources.Employee;
using Microsoft.Intercompany.BankAccount;
using Microsoft.Intercompany.GLAccount;
using Microsoft.Intercompany.Partner;
using Microsoft.Projects.Project.Job;
using Microsoft.Purchases.Payables;
using Microsoft.Purchases.Vendor;
using Microsoft.Purchases.Setup;
using Microsoft.Sales.Customer;
using Microsoft.Sales.Receivables;
using Microsoft.Sales.Setup;
using System.Integration;
using System.Security.User;
using System.Utilities;
report 6250 "Auto Posting Errors"
{
Caption = 'Auto Posting Errors';
ProcessingOnly = true;
MaximumDatasetSize = 1000000;
ExecutionTimeout = '12:00:00';
MaximumDocumentCount = 500;
dataset
{
dataitem("Gen. Journal Batch"; "Gen. Journal Batch")
{
DataItemTableView = sorting("Journal Template Name", Name);
column(JnlTmplName_GenJnlBatch; "Journal Template Name")
{
}
column(Name_GenJnlBatch; Name)
{
}
column(CompanyName; COMPANYPROPERTY.DisplayName())
{
}
column(GeneralJnlTestCaption; GeneralJnlTestLbl)
{
}
dataitem("Integer"; "Integer")
{
DataItemTableView = sorting(Number) where(Number = const(1));
PrintOnlyIfDetail = true;
column(JnlTemplateName_GenJnlBatch; "Gen. Journal Batch"."Journal Template Name")
{
}
column(JnlName_GenJnlBatch; "Gen. Journal Batch".Name)
{
}
column(GenJnlLineFilter; GenJnlLineFilter)
{
}
column(GenJnlLineFilterTableCaption; "Gen. Journal Line".TableCaption + ': ' + GenJnlLineFilter)
{
}
column(Number_Integer; Number)
{
}
column(PageNoCaption; PageNoLbl)
{
}
column(JnlTmplNameCaption_GenJnlBatch; "Gen. Journal Batch".FieldCaption("Journal Template Name"))
{
}
column(JournalBatchCaption; JnlBatchNameLbl)
{
}
column(PostingDateCaption; PostingDateLbl)
{
}
column(DocumentTypeCaption; DocumentTypeLbl)
{
}
column(DocNoCaption_GenJnlLine; "Gen. Journal Line".FieldCaption("Document No."))
{
}
column(AccountTypeCaption; AccountTypeLbl)
{
}
column(AccNoCaption_GenJnlLine; "Gen. Journal Line".FieldCaption("Account No."))
{
}
column(AccNameCaption; AccNameLbl)
{
}
column(DescCaption_GenJnlLine; "Gen. Journal Line".FieldCaption(Description))
{
}
column(PostingTypeCaption; GenPostingTypeLbl)
{
}
column(GenBusPostGroupCaption; GenBusPostingGroupLbl)
{
}
column(GenProdPostGroupCaption; GenProdPostingGroupLbl)
{
}
column(AmountCaption_GenJnlLine; "Gen. Journal Line".FieldCaption(Amount))
{
}
column(BalAccNoCaption_GenJnlLine; "Gen. Journal Line".FieldCaption("Bal. Account No."))
{
}
column(BalLCYCaption_GenJnlLine; "Gen. Journal Line".FieldCaption("Balance (LCY)"))
{
}
dataitem("Gen. Journal Line"; "Gen. Journal Line")
{
DataItemLink = "Journal Template Name" = field("Journal Template Name"), "Journal Batch Name" = field(Name);
DataItemLinkReference = "Gen. Journal Batch";
DataItemTableView = sorting("Journal Template Name", "Journal Batch Name", "Line No.");
RequestFilterFields = "Posting Date";
column(PostingDate_GenJnlLine; Format("Posting Date"))
{
}
column(DocType_GenJnlLine; "Document Type")
{
}
column(DocNo_GenJnlLine; "Document No.")
{
}
column(ExtDocNo_GenJnlLine; "External Document No.")
{
}
column(AccountType_GenJnlLine; "Account Type")
{
}
column(AccountNo_GenJnlLine; "Account No.")
{
}
column(AccName; AccName)
{
}
column(Description_GenJnlLine; Description)
{
}
column(GenPostType_GenJnlLine; "Gen. Posting Type")
{
}
column(GenBusPosGroup_GenJnlLine; "Gen. Bus. Posting Group")
{
}
column(GenProdPostGroup_GenJnlLine; "Gen. Prod. Posting Group")
{
}
column(Amount_GenJnlLine; Amount)
{
}
column(CurrencyCode_GenJnlLine; "Currency Code")
{
}
column(BalAccNo_GenJnlLine; "Bal. Account No.")
{
}
column(BalanceLCY_GenJnlLine; "Balance (LCY)")
{
}
column(AmountLCY; AmountLCY)
{
}
column(BalanceLCY; BalanceLCY)
{
}
column(AmountLCY_GenJnlLine; "Amount (LCY)")
{
}
column(JnlTmplName_GenJnlLine; "Journal Template Name")
{
}
column(JnlBatchName_GenJnlLine; "Journal Batch Name")
{
}
column(LineNo_GenJnlLine; "Line No.")
{
}
column(TotalLCYCaption; AmountLCYLbl)
{
}
dataitem(DimensionLoop; "Integer")
{
DataItemTableView = sorting(Number) where(Number = filter(1 ..));
column(DimText; DimText)
{
}
column(Number_DimensionLoop; Number)
{
}
column(DimensionsCaption; DimensionsLbl)
{
}
trigger OnAfterGetRecord()
begin
if Number = 1 then begin
if not DimSetEntry.FindSet() then
CurrReport.Break();
end else
if not Continue then
CurrReport.Break();
DimText := GetDimensionText(DimSetEntry);
end;
trigger OnPreDataItem()
begin
if not ShowDim then
CurrReport.Break();
DimSetEntry.Reset();
DimSetEntry.SetRange("Dimension Set ID", "Gen. Journal Line"."Dimension Set ID")
end;
}
dataitem("Gen. Jnl. Allocation"; "Gen. Jnl. Allocation")
{
DataItemLink = "Journal Template Name" = field("Journal Template Name"), "Journal Batch Name" = field("Journal Batch Name"), "Journal Line No." = field("Line No.");
DataItemTableView = sorting("Journal Template Name", "Journal Batch Name", "Journal Line No.", "Line No.");
column(AccountNo_GenJnlAllocation; "Account No.")
{
}
column(AccountName_GenJnlAllocation; "Account Name")
{
}
column(AllocationQuantity_GenJnlAllocation; "Allocation Quantity")
{
}
column(AllocationPct_GenJnlAllocation; "Allocation %")
{
}
column(Amount_GenJnlAllocation; Amount)
{
}
column(JournalLineNo_GenJnlAllocation; "Journal Line No.")
{
}
column(LineNo_GenJnlAllocation; "Line No.")
{
}
column(JournalBatchName_GenJnlAllocation; "Journal Batch Name")
{
}
column(AccountNoCaption_GenJnlAllocation; FieldCaption("Account No."))
{
}
column(AccountNameCaption_GenJnlAllocation; FieldCaption("Account Name"))
{
}
column(AllocationQuantityCaption_GenJnlAllocation; FieldCaption("Allocation Quantity"))
{
}
column(AllocationPctCaption_GenJnlAllocation; FieldCaption("Allocation %"))
{
}
column(AmountCaption_GenJnlAllocation; FieldCaption(Amount))
{
}
column(Recurring_GenJnlTemplate; GenJnlTemplate.Recurring)
{
}
dataitem(DimensionLoopAllocations; "Integer")
{
DataItemTableView = sorting(Number) where(Number = filter(1 ..));
column(AllocationDimText; AllocationDimText)
{
}
column(Number_DimensionLoopAllocations; Number)
{
}
column(DimensionAllocationsCaption; DimensionAllocationsLbl)
{
}
trigger OnAfterGetRecord()
begin
if Number = 1 then begin
if not DimSetEntry.FindFirst() then
CurrReport.Break();
end else
if not Continue then
CurrReport.Break();
AllocationDimText := GetDimensionText(DimSetEntry);
end;
trigger OnPreDataItem()
begin
if not ShowDim then
CurrReport.Break();
DimSetEntry.Reset();
DimSetEntry.SetRange("Dimension Set ID", "Gen. Jnl. Allocation"."Dimension Set ID")
end;
}
}
dataitem(ErrorLoop; "Integer")
{
DataItemTableView = sorting(Number);
column(ErrorTextNumber; ErrorText[Number])
{
}
column(WarningCaption; WarningLbl)
{
}
trigger OnPostDataItem()
begin
ErrorCounter := 0;
end;
trigger OnPreDataItem()
begin
SetRange(Number, 1, ErrorCounter);
end;
}
trigger OnAfterGetRecord()
var
DimMgt: Codeunit DimensionManagement;
TableID: array[10] of Integer;
No: array[10] of Code[20];
begin
if "Currency Code" = '' then
"Amount (LCY)" := Amount;
UpdateLineBalance();
AccName := '';
BalAccName := '';
if not EmptyLine() then begin
MakeRecurringTexts("Gen. Journal Line");
AmountError := false;
if ("Account No." = '') and ("Bal. Account No." = '') then
AddError(StrSubstNo(Text001Txt, FieldCaption("Account No."), FieldCaption("Bal. Account No.")))
else
if ("Account Type" <> "Account Type"::"Fixed Asset") and
("Bal. Account Type" <> "Bal. Account Type"::"Fixed Asset")
then
TestFixedAssetFields("Gen. Journal Line");
CheckICDocument();
OnAfterGetGenJnlLineAccount("Gen. Journal Line");
OnAfterGetGenJnlLineBalanceAccount("Gen. Journal Line");
if ("Account No." <> '') and
not "System-Created Entry" and
(Amount = 0) and
not GenJnlTemplate.Recurring and
not "Allow Zero-Amount Posting" and
("Account Type" <> "Account Type"::"Fixed Asset")
then
WarningIfZeroAmt("Gen. Journal Line");
CheckRecurringLine("Gen. Journal Line");
CheckAllocations("Gen. Journal Line");
OnAfterGetGenJnlLinePostingDate("Gen. Journal Line");
if "Document Date" <> 0D then
if ("Document Date" <> NormalDate("Document Date")) and
(("Account Type" <> "Account Type"::"G/L Account") or
("Bal. Account Type" <> "Bal. Account Type"::"G/L Account"))
then
AddError(
StrSubstNo(
Text013Txt, FieldCaption("Document Date")));
if "Document No." = '' then
AddError(StrSubstNo(Text002Txt, FieldCaption("Document No.")))
else
if "Gen. Journal Batch"."No. Series" <> '' then begin
if (LastEntrdDocNo <> '') and
("Document No." <> LastEntrdDocNo) and
("Document No." <> IncStr(LastEntrdDocNo))
then
AddError(Text016Txt);
LastEntrdDocNo := "Document No.";
end;
if ("Account Type" in ["Account Type"::Customer, "Account Type"::Vendor, "Account Type"::"Fixed Asset"]) and
("Bal. Account Type" in ["Bal. Account Type"::Customer, "Bal. Account Type"::Vendor, "Bal. Account Type"::"Fixed Asset"])
then
AddError(
StrSubstNo(
Text017Txt,
FieldCaption("Account Type"), FieldCaption("Bal. Account Type")));
if Amount * "Amount (LCY)" < 0 then
AddError(
StrSubstNo(
Text008Txt, FieldCaption("Amount (LCY)"), FieldCaption(Amount)));
OnAfterGetGenJnlLineAccountType("Gen. Journal Line");
if ("Account No." <> '') and ("Bal. Account No." <> '') then begin
PurchPostingType := false;
SalesPostingType := false;
end;
if "Account No." <> '' then
CheckAccountTypes("Account Type", AccName);
if "Bal. Account No." <> '' then begin
CODEUNIT.Run(CODEUNIT::"Exchange Acc. G/L Journal Line", "Gen. Journal Line");
CheckAccountTypes("Account Type", BalAccName);
CODEUNIT.Run(CODEUNIT::"Exchange Acc. G/L Journal Line", "Gen. Journal Line");
end;
if not DimMgt.CheckDimIDComb("Dimension Set ID") then
AddError(DimMgt.GetDimCombErr());
TableID[1] := DimMgt.TypeToTableID1("Account Type".AsInteger());
No[1] := "Account No.";
TableID[2] := DimMgt.TypeToTableID1("Bal. Account Type".AsInteger());
No[2] := "Bal. Account No.";
TableID[3] := DATABASE::Job;
No[3] := "Job No.";
TableID[4] := DATABASE::"Salesperson/Purchaser";
No[4] := "Salespers./Purch. Code";
TableID[5] := DATABASE::Campaign;
No[5] := "Campaign No.";
if not DimMgt.CheckDimValuePosting(TableID, No, "Dimension Set ID") then
AddError(DimMgt.GetDimValuePostingErr());
end;
CheckBalance();
AmountLCY += "Amount (LCY)";
BalanceLCY += "Balance (LCY)";
end;
trigger OnPreDataItem()
begin
CopyFilter("Journal Batch Name", "Gen. Journal Batch".Name);
GenJnlLineFilter := GetFilters();
GenJnlTemplate.Get("Gen. Journal Batch"."Journal Template Name");
if GenJnlTemplate.Recurring then begin
if GetFilter("Posting Date") <> '' then
AddError(
StrSubstNo(
Text000Txt,
FieldCaption("Posting Date")));
SetRange("Posting Date", 0D, WorkDate());
if GetFilter("Expiration Date") <> '' then
AddError(
StrSubstNo(
Text000Txt,
FieldCaption("Expiration Date")));
SetFilter("Expiration Date", '%1 | %2..', 0D, WorkDate());
end;
if "Gen. Journal Batch"."No. Series" <> '' then begin
NoSeries.Get("Gen. Journal Batch"."No. Series");
LastEntrdDocNo := '';
LastEntrdDate := 0D;
end;
TempGenJournalLineCustVendIC.Reset();
TempGenJournalLineCustVendIC.DeleteAll();
VATEntryCreated := false;
GenJnlLine2.Reset();
GenJnlLine2.CopyFilters("Gen. Journal Line");
TempGLAccNetChange.DeleteAll();
end;
}
dataitem(ReconcileLoop; "Integer")
{
DataItemTableView = sorting(Number);
column(GLAccNetChangeNo; TempGLAccNetChange."No.")
{
}
column(GLAccNetChangeName; TempGLAccNetChange.Name)
{
}
column(GLAccNetChangeNetChangeJnl; TempGLAccNetChange."Net Change in Jnl.")
{
}
column(GLAccNetChangeBalafterPost; TempGLAccNetChange."Balance after Posting")
{
}
column(ReconciliationCaption; ReconciliationLbl)
{
}
column(NoCaption; NoLbl)
{
}
column(NameCaption; NameLbl)
{
}
column(NetChangeinJnlCaption; NetChangeinJnlLbl)
{
}
column(BalafterPostingCaption; BalafterPostingLbl)
{
}
trigger OnAfterGetRecord()
begin
if Number = 1 then
TempGLAccNetChange.Find('-')
else
TempGLAccNetChange.Next();
end;
trigger OnPostDataItem()
begin
TempGLAccNetChange.DeleteAll();
end;
trigger OnPreDataItem()
begin
SetRange(Number, 1, TempGLAccNetChange.Count);
end;
}
}
trigger OnPreDataItem()
begin
GLSetup.Get();
SalesSetup.Get();
PurchSetup.Get();
AmountLCY := 0;
BalanceLCY := 0;
end;
}
}
requestpage
{
SaveValues = true;
layout
{
area(content)
{
group(Options)
{
Caption = 'Options';
field(ShowDim; ShowDim)
{
ApplicationArea = Dimensions;
Caption = 'Show Dimensions';
ToolTip = 'Specifies if you want dimensions information for the journal lines to be included in the report.';
}
}
}
}
actions
{
}
}
labels
{
}
var
GLSetup: Record "General Ledger Setup";
SalesSetup: Record "Sales & Receivables Setup";
PurchSetup: Record "Purchases & Payables Setup";
UserSetup: Record "User Setup";
AccountingPeriod: Record "Accounting Period";
GLAcc: Record "G/L Account";
Currency: Record Currency;
Cust: Record Customer;
Vend: Record Vendor;
BankAccPostingGr: Record "Bank Account Posting Group";
BankAcc: Record "Bank Account";
GenJnlTemplate: Record "Gen. Journal Template";
GenJnlLine2: Record "Gen. Journal Line";
TempGenJnlLine: Record "Gen. Journal Line" temporary;
TempGenJournalLineCustVendIC: Record "Gen. Journal Line" temporary;
GenJnlAlloc: Record "Gen. Jnl. Allocation";
OldCustLedgEntry: Record "Cust. Ledger Entry";
OldVendLedgEntry: Record "Vendor Ledger Entry";
VATPostingSetup: Record "VAT Posting Setup";
NoSeries: Record "No. Series";
FA: Record "Fixed Asset";
ICPartner: Record "IC Partner";
DeprBook: Record "Depreciation Book";
FADeprBook: Record "FA Depreciation Book";
FASetup: Record "FA Setup";
TempGLAccNetChange: Record "G/L Account Net Change" temporary;
DimSetEntry: Record "Dimension Set Entry";
Employee: Record Employee;
DataMigrationError: Record "Data Migration Error";
GenJnlLineFilter: Text;
AllowPostingFrom: Date;
AllowPostingTo: Date;
AllowFAPostingFrom: Date;
AllowFAPostingTo: Date;
LastDate: Date;
LastDocType: Enum "Gen. Journal Document Type";
LastDocNo: Code[20];
LastEntrdDocNo: Code[20];
LastEntrdDate: Date;
BalanceLCY: Decimal;
AmountLCY: Decimal;
DocBalance: Decimal;
DocBalanceReverse: Decimal;
DateBalance: Decimal;
DateBalanceReverse: Decimal;
TotalBalance: Decimal;
TotalBalanceReverse: Decimal;
AccName: Text[100];
LastLineNo: Integer;
AmountError: Boolean;
ErrorCounter: Integer;
ErrorText: array[50] of Text[250];
TempErrorText: Text[250];
BalAccName: Text[100];
VATEntryCreated: Boolean;
CustPosting: Boolean;
VendPosting: Boolean;
SalesPostingType: Boolean;
PurchPostingType: Boolean;
DimText: Text[75];
AllocationDimText: Text[75];
ShowDim: Boolean;
Continue: Boolean;
CurrentICPartner: Code[20];
Text000Txt: Label '%1 cannot be filtered when you post recurring journals.', Comment = '%1=Posting or Expiration Date';
Text001Txt: Label '%1 or %2 must be specified.', Comment = '%1=Account Number, %2=Balance Account Number';
Text002Txt: Label '%1 must be specified.', Comment = '%1=Gen. Posting Type';
Text003Txt: Label '%1 + %2 must be %3.', Comment = '%1=VAT Amount, %2=VAT Base Amount, %3=Amont';
Text004Txt: Label '%1 must be " " when %2 is %3.', Comment = '%1=Gen. Posting Type field caption, %2=Account Type field caption, %3=Account Type';
Text005Txt: Label '%1, %2, %3 or %4 must not be completed when %5 is %6.', Comment = '%1=Gen. Bus. Posting Group field caption, %2=Gen. Bus. Posting Group field caption, %3=VAT Bus. Posting Group field caption, %4=VAT Bus. Posting Group field caption, %5=Account Type field caption, %6=Account Type';
Text006Txt: Label '%1 must be negative.', Comment = '%1=GenJnlLine Amount field caption';
Text007Txt: Label '%1 must be positive.', Comment = '%1=GenJnlLine Amount field caption';
Text008Txt: Label '%1 must have the same sign as %2.', Comment = '%1=Amount LCY, %2=Amount';
Text009Txt: Label '%1 cannot be specified.', Comment = '%1=Job No.';
Text010Txt: Label '%1 must be Yes.', Comment = '%1=Check Printed';
Text011Txt: Label '%1 + %2 must be -%3.', Comment = '%1=Bal. VAT Amount, %2=Bal. VAT Base Amount, %3=Amont';
Text012Txt: Label '%1 must have a different sign than %2.', Comment = '%1=Sales/Purch. LCY, %2=Amount';
Text013Txt: Label '%1 must only be a closing date for G/L entries.', Comment = '%1=Posting or Document Date';
Text014Txt: Label '%1 is not within your allowed range of posting dates.', Comment = '%1=Posting Date';
Text015Txt: Label 'The lines are not listed according to Posting Date because they were not entered in that order.';
Text016Txt: Label 'There is a gap in the number series.';
Text017Txt: Label '%1 or %2 must be G/L Account or Bank Account.', Comment = '%1=Account Type, %2=Bal. Account Type';
Text018Txt: Label '%1 must be 0.', Comment = '%1=Payment Discount Percent';
Text019Txt: Label '%1 cannot be specified when using recurring journals.', Comment = '%1=Bal. Account No.';
Text020Txt: Label '%1 must not be %2 when %3 = %4.', Comment = '%1=Recurring Method field caption, %2=Recurring Method, %3=Bal. Account Type field caption, %4=Bal. Account Type';
Text021Txt: Label 'Allocations can only be used with recurring journals.';
Text022Txt: Label 'Specify %1 in the %2 allocation lines.', Comment = '%1=GenJnlAlloc. Account No. field caption, %2=GenJnlAlloc. Count';
Text024Txt: Label '%1 %2 posted on %3, must be separated by an empty line.', Comment = '%1 - document type, %2 - document number, %3 - posting date';
Text025Txt: Label '%1 %2 is out of balance by %3.', Comment = '%1=LastDocType, %2=LastDocNo, %3=DocBalance';
Text026Txt: Label 'The reversing entries for %1 %2 are out of balance by %3.', Comment = '%1=LastDocType, %2=LastDocNo, %3=DocBalanceReverse';
Text027Txt: Label 'As of %1, the lines are out of balance by %2.', Comment = '%1=LastDate, %2=DateBalance';
Text028Txt: Label 'As of %1, the reversing entries are out of balance by %2.', Comment = '%1=LastDate, %2=DateBalanceReverse';
Text029Txt: Label 'The total of the lines is out of balance by %1.', Comment = '%1=TotalBalance';
Text030Txt: Label 'The total of the reversing entries is out of balance by %1.', Comment = '%1=TotalBalance';
Text031Txt: Label '%1 %2 does not exist.', Comment = '%1=GLAcc.TableCaption(), %2=Account No.';
Text032Txt: Label '%1 must be %2 for %3 %4.', Comment = '%1=GLAcc. Account Type field caption, %2=GLAcc.Account Type, %3=GLAcc. table caption, %4=Account No.';
Text036Txt: Label '%1 %2 %3 does not exist.', Comment = '%1=VATPostingSetup table caption, %2=VAT Bus. Posting Group, %3=VAT Prod. Posting Group';
Text037Txt: Label '%1 must be %2.', Comment = '%1=VAT Calculation Type field caption, %2=VATPostingSetup.VAT Calculation Type';
Text038Txt: Label 'The currency %1 cannot be found. Check the currency table.', Comment = '%1=Currency Code';
Text039Txt: Label 'Sales %1 %2 already exists.', Comment = '%1=Document Type, %2=Document No.';
Text040Txt: Label 'Purchase %1 %2 already exists.', Comment = '%1=Document Type, %2=Document No.';
Text041Txt: Label '%1 must be entered.', Comment = '%1=External Document No. field caption';
Text042Txt: Label '%1 must not be filled when %2 is different in %3 and %4.', Comment = '%1=Bank Payment Type, %2=Currency Code, %3=TABLECAPTION, %4= BankAcc. Table caption';
Text043Txt: Label '%1 %2 must not have %3 = %4.', Comment = '%1=FA.TableCaption(), %2=Account No., %3=FA.Budgeted Asset field caption, %4=TRUE';
Text044Txt: Label '%1 must not be specified in fixed asset journal lines.', Comment = '%1=Job No. field caption';
Text045Txt: Label '%1 must be specified in fixed asset journal lines.', Comment = '%1=FA Posting Type field caption';
Text046Txt: Label '%1 must be different than %2.', Comment = '%1=Depreciation Book Code field caption, %2=Duplicate in Depreciation Book field caption';
Text047Txt: Label '%1 and %2 must not both be %3.', Comment = '%1=Account Type field caption, %2=Bal. Account Type field caption, %3=Account Type';
Text049Txt: Label '%1 must not be specified when %2 = %3.', Comment = '%1=Gen. Posting Type field caption, 2%=FA Posting Type field caption, %3=FA Posting Type';
Text050Txt: Label 'must not be specified together with %1 = %2.', Comment = '%1=FA Posting Type field caption, %2=FA Posting Type';
Text051Txt: Label '%1 must be identical to %2.', Comment = '%1=Posting Date field caption,%2=FA Posting Date';
Text052Txt: Label '%1 cannot be a closing date.', Comment = '%1=FA Posting Date field caption';
Text053Txt: Label '%1 is not within your range of allowed posting dates.', Comment = '%1=FA Posting Date field caption';
Text054Txt: Label 'Insurance integration is not activated for %1 %2.', Comment = '%1=Depreciation Book Code field caption,%2=Depreciation Book Code';
Text055Txt: Label 'must not be specified when %1 is specified.', Comment = '%1=FA Error Entry No. field caption';
Text056Txt: Label 'When G/L integration is not activated, %1 must not be posted in the general journal.', Comment = '%1=FA Posting Type';
Text057Txt: Label 'When G/L integration is not activated, %1 must not be specified in the general journal.', Comment = '%1=Depr. until FA Posting Date field caption';
Text058Txt: Label '%1 must not be specified.', Comment = '%1=FA Posting Type field caption';
Text059Txt: Label 'The combination of Customer and Gen. Posting Type Purchase is not allowed.';
Text060Txt: Label 'The combination of Vendor and Gen. Posting Type Sales is not allowed.';
Text061Txt: Label 'The Balance and Reversing Balance recurring methods can be used only with Allocations.';
Text062Txt: Label '%1 must not be 0.', Comment = '%1=GenJnlLine Amount';
Text064Txt: Label '%1 %2 is already used in line %3 (%4 %5).', Comment = '%1=GenJnlLine External Document No. field caption, %2=GenJnlLine External Document No., %3=TempGenJnlLine Line No., %4=GenJnlLine Document No.field caption, %5=TempGenJnlLine Document No.';
Text065Txt: Label '%1 must not be blocked with type %2 when %3 is %4.', Comment = '%1=Account Type, %2=Cust.Blocked, %3=Document Type field caption, %4=Document Type';
Text066Txt: Label 'You cannot enter G/L Account or Bank Account in both %1 and %2.', Comment = '%1=Account No. field caption, %2=Bal. Account No. field caption';
Text067Txt: Label '%1 %2 is linked to %3 %4.', Comment = '%1=Customer table caption, %2=Account No., %3=ICPartner table caption, %4=IC Partner Code';
Text069Txt: Label '%1 must not be specified when %2 is %3.', Comment = '%1=IC Partner G/L Acc. No. field caption, %2=IC Direction field caption, %3=IC Direction';
Text070Txt: Label '%1 must not be specified when the document is not an intercompany transaction.', Comment = '%1=IC Partner G/L Acc. No. field caption';
Text071Txt: Label '%1 %2 does not exist.', Comment = '%1=Job table caption, %2=Job No.';
Text072Txt: Label '%1 must not be %2 for %3 %4.', Comment = '%1=Job Blocked field caption, %2=Job Blocked, %3=Job table caption, %4=Job No.';
Text073Txt: Label '%1 %2 already exists.', Comment = '%1=Document No. field caption, %2=Document No.';
PostingErrorTxt: Label 'Posting error on batch %1- Document Number %2 %3', Comment = '%1=Gen. Journal Line Journal Batch Name, %2=Gen. Journal Line Document No., %3=Text';
GPMigrationTypeTxt: Label 'Great Plains', Locked = true;
GeneralJnlTestLbl: Label 'General Journal - Test';
PageNoLbl: Label 'Page';
JnlBatchNameLbl: Label 'Journal Batch';
PostingDateLbl: Label 'Posting Date';
DocumentTypeLbl: Label 'Document Type';
AccountTypeLbl: Label 'Account Type';
AccNameLbl: Label 'Name';
GenPostingTypeLbl: Label 'Gen. Posting Type';
GenBusPostingGroupLbl: Label 'Gen. Bus. Posting Group';
GenProdPostingGroupLbl: Label 'Gen. Prod. Posting Group';
AmountLCYLbl: Label 'Total (LCY)';
DimensionsLbl: Label 'Dimensions';
WarningLbl: Label 'Warning!';
ReconciliationLbl: Label 'Reconciliation';
NoLbl: Label 'No.';
NameLbl: Label 'Name';
NetChangeinJnlLbl: Label 'Net Change in Jnl.';
BalafterPostingLbl: Label 'Balance after Posting';
DimensionAllocationsLbl: Label 'Allocation Dimensions';
local procedure CheckRecurringLine(GenJnlLine2: Record "Gen. Journal Line")
begin
with GenJnlLine2 do
if GenJnlTemplate.Recurring then begin
if "Recurring Method" = "Gen. Journal Recurring Method"::" " then
AddError(StrSubstNo(Text002Txt, FieldCaption("Recurring Method")));
if Format("Recurring Frequency") = '' then
AddError(StrSubstNo(Text002Txt, FieldCaption("Recurring Frequency")));
if "Bal. Account No." <> '' then
AddError(
StrSubstNo(
Text019Txt,
FieldCaption("Bal. Account No.")));
case "Recurring Method" of
"Recurring Method"::"V Variable", "Recurring Method"::"RV Reversing Variable",
"Recurring Method"::"F Fixed", "Recurring Method"::"RF Reversing Fixed":
WarningIfZeroAmt("Gen. Journal Line");
"Recurring Method"::"B Balance", "Recurring Method"::"RB Reversing Balance":
WarningIfNonZeroAmt("Gen. Journal Line");
end;
if "Recurring Method".AsInteger() > "Recurring Method"::"V Variable".AsInteger() then begin
if "Account Type" = "Account Type"::"Fixed Asset" then
AddError(
StrSubstNo(
Text020Txt,
FieldCaption("Recurring Method"), "Recurring Method",
FieldCaption("Account Type"), "Account Type"));
if "Bal. Account Type" = "Bal. Account Type"::"Fixed Asset" then
AddError(
StrSubstNo(
Text020Txt,
FieldCaption("Recurring Method"), "Recurring Method",
FieldCaption("Bal. Account Type"), "Bal. Account Type"));
end;
end else begin
if "Recurring Method" <> "Gen. Journal Recurring Method"::" " then
AddError(StrSubstNo(Text009Txt, FieldCaption("Recurring Method")));
if Format("Recurring Frequency") <> '' then
AddError(StrSubstNo(Text009Txt, FieldCaption("Recurring Frequency")));
end;
end;
local procedure CheckAllocations(GenJnlLine2: Record "Gen. Journal Line")
begin
with GenJnlLine2 do begin
if "Recurring Method" in
["Recurring Method"::"B Balance",
"Recurring Method"::"RB Reversing Balance"]
then begin
GenJnlAlloc.Reset();
GenJnlAlloc.SetRange("Journal Template Name", "Journal Template Name");
GenJnlAlloc.SetRange("Journal Batch Name", "Journal Batch Name");
GenJnlAlloc.SetRange("Journal Line No.", "Line No.");
if not GenJnlAlloc.FindFirst() then
AddError(Text061Txt);
end;
GenJnlAlloc.Reset();
GenJnlAlloc.SetRange("Journal Template Name", "Journal Template Name");
GenJnlAlloc.SetRange("Journal Batch Name", "Journal Batch Name");
GenJnlAlloc.SetRange("Journal Line No.", "Line No.");
GenJnlAlloc.SetFilter(Amount, '<>0');
if GenJnlAlloc.FindFirst() then
if not GenJnlTemplate.Recurring then
AddError(Text021Txt)
else begin
GenJnlAlloc.SetRange("Account No.", '');
if GenJnlAlloc.FindFirst() then
AddError(
StrSubstNo(
Text022Txt,
GenJnlAlloc.FieldCaption("Account No."), GenJnlAlloc.Count));
end;
end;
end;
local procedure MakeRecurringTexts(var GenJnlLine2: Record "Gen. Journal Line")
begin
with GenJnlLine2 do
if ("Posting Date" <> 0D) and ("Account No." <> '') and ("Recurring Method" <> "Gen. Journal Recurring Method"::" ") then
AccountingPeriod.MakeRecurringTexts("Posting Date", "Document No.", Description);
end;
local procedure CheckBalance()
var
GenJnlLine: Record "Gen. Journal Line";
NextGenJnlLine: Record "Gen. Journal Line";
begin
GenJnlLine := "Gen. Journal Line";
LastLineNo := "Gen. Journal Line"."Line No.";
NextGenJnlLine := "Gen. Journal Line";
if NextGenJnlLine.Next() = 0 then;
MakeRecurringTexts(NextGenJnlLine);
with GenJnlLine do
if not EmptyLine() then begin
DocBalance := DocBalance + "Balance (LCY)";
DateBalance := DateBalance + "Balance (LCY)";
TotalBalance := TotalBalance + "Balance (LCY)";
if "Recurring Method".AsInteger() >= "Recurring Method"::"RF Reversing Fixed".AsInteger() then begin
DocBalanceReverse := DocBalanceReverse + "Balance (LCY)";
DateBalanceReverse := DateBalanceReverse + "Balance (LCY)";
TotalBalanceReverse := TotalBalanceReverse + "Balance (LCY)";
end;
LastDocType := "Document Type";
LastDocNo := "Document No.";
LastDate := "Posting Date";
if TotalBalance = 0 then
VATEntryCreated := false;
if GenJnlTemplate."Force Doc. Balance" then begin
VATEntryCreated :=
VATEntryCreated or
(("Account Type" = "Account Type"::"G/L Account") and ("Account No." <> '') and
("Gen. Posting Type" in ["Gen. Posting Type"::Purchase, "Gen. Posting Type"::Sale])) or
(("Bal. Account Type" = "Bal. Account Type"::"G/L Account") and ("Bal. Account No." <> '') and
("Bal. Gen. Posting Type" in ["Bal. Gen. Posting Type"::Purchase, "Bal. Gen. Posting Type"::Sale]));
TempGenJournalLineCustVendIC.IsCustVendICAdded(GenJnlLine);
if (TempGenJournalLineCustVendIC.Count > 1) and VATEntryCreated then
AddError(
StrSubstNo(
Text024Txt,
"Document Type", "Document No.", "Posting Date"));
end;
end;
with NextGenJnlLine do begin
if (LastDate <> 0D) and (LastDocNo <> '') and
(("Posting Date" <> LastDate) or
("Document Type" <> LastDocType) or
("Document No." <> LastDocNo) or
("Line No." = LastLineNo))
then begin
if GenJnlTemplate."Force Doc. Balance" then begin
case true of
DocBalance <> 0:
AddError(StrSubstNo(Text025Txt, LastDocType, LastDocNo, DocBalance));
DocBalanceReverse <> 0:
AddError(StrSubstNo(Text026Txt, LastDocType, LastDocNo, DocBalanceReverse));
end;
DocBalance := 0;
DocBalanceReverse := 0;
end;
if ("Posting Date" <> LastDate) or
("Document Type" <> LastDocType) or ("Document No." <> LastDocNo)
then begin
TempGenJournalLineCustVendIC.Reset();
TempGenJournalLineCustVendIC.DeleteAll();
VATEntryCreated := false;
CustPosting := false;
VendPosting := false;
SalesPostingType := false;
PurchPostingType := false;
end;
end;
if (LastDate <> 0D) and (("Posting Date" <> LastDate) or ("Line No." = LastLineNo)) then begin
case true of
DateBalance <> 0:
AddError(
StrSubstNo(
Text027Txt,
LastDate, DateBalance));
DateBalanceReverse <> 0:
AddError(
StrSubstNo(
Text028Txt,
LastDate, DateBalanceReverse));
end;
DocBalance := 0;
DocBalanceReverse := 0;
DateBalance := 0;
DateBalanceReverse := 0;
end;
if "Line No." = LastLineNo then begin
case true of
TotalBalance <> 0:
AddError(
StrSubstNo(
Text029Txt,
TotalBalance));
TotalBalanceReverse <> 0:
AddError(
StrSubstNo(
Text030Txt,
TotalBalanceReverse));
end;
DocBalance := 0;
DocBalanceReverse := 0;
DateBalance := 0;
DateBalanceReverse := 0;
TotalBalance := 0;
TotalBalanceReverse := 0;
LastDate := 0D;
LastDocType := LastDocType::" ";
LastDocNo := '';
end;
end;
end;
local procedure AddError(Text: Text[250])
begin
ErrorCounter := ErrorCounter + 1;
ErrorText[ErrorCounter] := Text;
if DataMigrationError.FindLast() then
DataMigrationError.Id := DataMigrationError.Id + 1
else
DataMigrationError.Id := 1;
DataMigrationError.Init();
DataMigrationError."Migration Type" := GPMigrationTypeTxt;
DataMigrationError."Error Message" :=
StrSubstNo(PostingErrorTxt, "Gen. Journal Line"."Journal Batch Name", "Gen. Journal Line"."Document No.", Text);
DataMigrationError.Insert();
end;
local procedure ReconcileGLAccNo(GLAccNo: Code[20]; ReconcileAmount: Decimal)
begin
if not TempGLAccNetChange.Get(GLAccNo) then begin
GLAcc.Get(GLAccNo);
GLAcc.CalcFields("Balance at Date");
TempGLAccNetChange.Init();
TempGLAccNetChange."No." := GLAcc."No.";
TempGLAccNetChange.Name := GLAcc.Name;
TempGLAccNetChange."Balance after Posting" := GLAcc."Balance at Date";
TempGLAccNetChange.Insert();
end;
TempGLAccNetChange."Net Change in Jnl." := TempGLAccNetChange."Net Change in Jnl." + ReconcileAmount;
TempGLAccNetChange."Balance after Posting" := TempGLAccNetChange."Balance after Posting" + ReconcileAmount;
TempGLAccNetChange.Modify();
end;
local procedure CheckGLAcc(var GenJnlLine: Record "Gen. Journal Line"; var AccName: Text[100])
begin
with GenJnlLine do
if not GLAcc.Get("Account No.") then
AddError(
StrSubstNo(
Text031Txt,
GLAcc.TableCaption(), "Account No."))
else begin
AccName := GLAcc.Name;
if GLAcc.Blocked then
AddError(
StrSubstNo(
Text032Txt,
GLAcc.FieldCaption(Blocked), false, GLAcc.TableCaption(), "Account No."));
if GLAcc."Account Type" <> GLAcc."Account Type"::Posting then begin
GLAcc."Account Type" := GLAcc."Account Type"::Posting;
AddError(
StrSubstNo(
Text032Txt,
GLAcc.FieldCaption("Account Type"), GLAcc."Account Type", GLAcc.TableCaption(), "Account No."));
end;
if not "System-Created Entry" then
if "Posting Date" = NormalDate("Posting Date") then
if not GLAcc."Direct Posting" then
AddError(
StrSubstNo(
Text032Txt,
GLAcc.FieldCaption("Direct Posting"), true, GLAcc.TableCaption(), "Account No."));
if "Gen. Posting Type" <> "Gen. Posting Type"::" " then begin
case "Gen. Posting Type" of
"Gen. Posting Type"::Sale:
SalesPostingType := true;
"Gen. Posting Type"::Purchase: