Skip to content

Commit 3374be8

Browse files
authored
1 parent f0062fd commit 3374be8

File tree

174 files changed

+3049
-13926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+3049
-13926
lines changed

.github/AL-Go-Settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"runs-on": "windows-latest",
77
"cacheImageName": "",
88
"UsePsSession": false,
9-
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/28.0.43307.0/base",
9+
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/28.0.43704.0/base",
1010
"country": "base",
1111
"useProjectDependencies": true,
1212
"repoVersion": "28.0",

Apps/CZ/AdvancePaymentsLocalization/app/Src/Codeunits/AltCustVATRegImplCZZ.Codeunit.al

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ codeunit 11732 "Alt. Cust. VAT Reg. Impl. CZZ" implements "Alt. Cust. VAT Reg. A
3232
DontShowMsg: Label 'Don''t show';
3333
AddAltCustVATRegNotificationNameTok: Label 'Suggest an alternative customer VAT registration from sales advance letter';
3434
AddAltCustVATRegNotificationDescTok: Label 'Suggest the user to add an alternative customer VAT registration when choosing a VAT country different from the customer''s';
35+
DiffVATRegNoMsg: Label 'The VAT Registration No. in the sales advance letter is different than the one in the document.';
36+
DiffVATRegNoNotificationNameTxt: Label 'Different VAT Registration No. in sales advance letter';
37+
DiffVATRegNoNotificationDescriptionTxt: Label 'Warn if VAT Registration No. in sales advance letter is different than in the document.';
3538

3639
procedure Init(var SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ"; xSalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ")
3740
begin
@@ -276,6 +279,32 @@ codeunit 11732 "Alt. Cust. VAT Reg. Impl. CZZ" implements "Alt. Cust. VAT Reg. A
276279
exit('34c4fa1d-07b6-450b-b524-0d367b1e6221')
277280
end;
278281

282+
procedure ThrowDiffVATRegNoNotification()
283+
var
284+
MyNotifications: Record "My Notifications";
285+
Notification: Notification;
286+
begin
287+
if not MyNotifications.IsEnabled(DiffVATRegNoNotificationId()) then
288+
exit;
289+
Notification.Id(DiffVATRegNoNotificationId());
290+
Notification.Message(DiffVATRegNoMsg);
291+
Notification.AddAction(DontShowMsg, Codeunit::"Alt. Cust. VAT Reg. Impl. CZZ", 'DisableDiffVATRegNoNotification');
292+
Notification.Send();
293+
end;
294+
295+
procedure DisableDiffVATRegNoNotification(Notification: Notification)
296+
var
297+
MyNotifications: Record "My Notifications";
298+
begin
299+
if not MyNotifications.Disable(Notification.Id()) then
300+
MyNotifications.InsertDefault(Notification.Id(), DiffVATRegNoNotificationNameTxt, DiffVATRegNoNotificationDescriptionTxt, false);
301+
end;
302+
303+
local procedure DiffVATRegNoNotificationId(): Text
304+
begin
305+
exit('150bf347-91ac-4e52-8520-e8024bf08e4c');
306+
end;
307+
279308
[IntegrationEvent(false, false)]
280309
local procedure OnAfterBuildFieldChangeBuffer(var TempChangeLogEntry: Record "Change Log Entry" temporary; SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ");
281310
begin

Apps/CZ/AdvancePaymentsLocalization/app/Src/Codeunits/InstallApplicationCZZ.Codeunit.al

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ using Microsoft.CashFlow.Forecast;
1111
using Microsoft.CashFlow.Setup;
1212
using Microsoft.CashFlow.Worksheet;
1313
using Microsoft.EServices.EDocument;
14+
using Microsoft.Finance.CashDesk;
1415
using Microsoft.Finance.FinancialReports;
1516
using Microsoft.Finance.GeneralLedger.Journal;
1617
using Microsoft.Finance.VAT.Ledger;
1718
using Microsoft.Finance.VAT.Reporting;
1819
using Microsoft.Finance.VAT.Setup;
20+
using Microsoft.Foundation.AuditCodes;
1921
using Microsoft.Foundation.Company;
2022
using Microsoft.Foundation.Reporting;
2123
using Microsoft.Purchases.History;
2224
using Microsoft.Purchases.Payables;
2325
using Microsoft.Sales.History;
2426
using Microsoft.Sales.Receivables;
2527
using System.Upgrade;
26-
using Microsoft.Finance.CashDesk;
2728

2829
#pragma warning disable AL0432
2930
codeunit 31087 "Install Application CZZ"
@@ -57,6 +58,8 @@ codeunit 31087 "Install Application CZZ"
5758
var
5859
InstallApplicationsMgtCZL: Codeunit "Install Applications Mgt. CZL";
5960
AppInfo: ModuleInfo;
61+
CloseAdvanceSourceCodeTxt: Label 'CLADVANCE', MaxLength = 10;
62+
CloseAdvanceSourceCodeDescriptionTxt: Label 'Close Advance Letter', MaxLength = 100;
6063

6164
trigger OnInstallAppPerCompany()
6265
begin
@@ -80,6 +83,7 @@ codeunit 31087 "Install Application CZZ"
8083
CopyVendorLedgerEntries();
8184
MoveIncomingDocument();
8285
ModifyReportSelections();
86+
InitSourceCodeSetup();
8387
end;
8488

8589
local procedure CopyCustomerLedgerEntries()
@@ -203,6 +207,7 @@ codeunit 31087 "Install Application CZZ"
203207
begin
204208
InitAdvancePaymentsReportSelections();
205209
ModifyReportSelections();
210+
CreateSourceCodeSetup();
206211

207212
DataClassEvalHandlerCZZ.ApplyEvaluationClassificationsForPrivacy();
208213
UpgradeTag.SetAllUpgradeTags();
@@ -217,4 +222,48 @@ codeunit 31087 "Install Application CZZ"
217222
ReportSelectionHandlerCZZ.InsertRepSelection(Enum::"Report Selection Usage"::"Sales Advance Letter CZZ", '1', Report::"Sales - Advance Letter CZZ");
218223
ReportSelectionHandlerCZZ.InsertRepSelection(Enum::"Report Selection Usage"::"Sales Advance VAT Document CZZ", '1', Report::"Sales - Advance VAT Doc. CZZ");
219224
end;
225+
226+
local procedure CreateSourceCodeSetup()
227+
var
228+
SourceCodeSetup: Record "Source Code Setup";
229+
PrevSourceCodeSetup: Record "Source Code Setup";
230+
begin
231+
if not SourceCodeSetup.Get() then
232+
exit;
233+
PrevSourceCodeSetup := SourceCodeSetup;
234+
if SourceCodeSetup."Close Advance Letter CZZ" = '' then
235+
InsertSourceCode(SourceCodeSetup."Close Advance Letter CZZ", CloseAdvanceSourceCodeTxt, CloseAdvanceSourceCodeDescriptionTxt);
236+
237+
if SourceCodeSetup."Close Advance Letter CZZ" <> PrevSourceCodeSetup."Close Advance Letter CZZ" then
238+
SourceCodeSetup.Modify();
239+
end;
240+
241+
local procedure InitSourceCodeSetup()
242+
var
243+
SourceCodeSetup: Record "Source Code Setup";
244+
PrevSourceCodeSetup: Record "Source Code Setup";
245+
begin
246+
if not SourceCodeSetup.Get() then begin
247+
SourceCodeSetup.Init();
248+
SourceCodeSetup.Insert();
249+
end;
250+
PrevSourceCodeSetup := SourceCodeSetup;
251+
InsertSourceCode(SourceCodeSetup."Close Advance Letter CZZ", CloseAdvanceSourceCodeTxt, CloseAdvanceSourceCodeDescriptionTxt);
252+
253+
if SourceCodeSetup."Close Advance Letter CZZ" <> PrevSourceCodeSetup."Close Advance Letter CZZ" then
254+
SourceCodeSetup.Modify();
255+
end;
256+
257+
local procedure InsertSourceCode(var SourceCodeDefCode: Code[10]; "Code": Code[10]; Description: Text[100])
258+
var
259+
SourceCode: Record "Source Code";
260+
begin
261+
SourceCodeDefCode := Code;
262+
if SourceCode.Get(Code) then
263+
exit;
264+
SourceCode.Init();
265+
SourceCode.Code := Code;
266+
SourceCode.Description := Description;
267+
SourceCode.Insert();
268+
end;
220269
}

Apps/CZ/AdvancePaymentsLocalization/app/Src/Codeunits/PurchAdvLetterPostCZZ.Codeunit.al

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ codeunit 31142 "Purch. Adv. Letter-Post CZZ"
11561156
AdvanceLetterApplicationCZZ: Record "Advance Letter Application CZZ";
11571157
AdvanceLetterTemplateCZZ: Record "Advance Letter Template CZZ";
11581158
PurchAdvLetterEntryCZZ: Record "Purch. Adv. Letter Entry CZZ";
1159+
SourceCodeSetup: Record "Source Code Setup";
11591160
NoSeriesBatch: Codeunit "No. Series - Batch";
11601161
NextEntryNo: Integer;
11611162
GetDocNoFromNoSeries: Boolean;
@@ -1185,6 +1186,11 @@ codeunit 31142 "Purch. Adv. Letter-Post CZZ"
11851186
NextEntryNo := GenJnlPostLine.GetNextEntryNo();
11861187
end;
11871188

1189+
if AdvancePostingParametersCZZ."Source Code" = '' then begin
1190+
SourceCodeSetup.Get();
1191+
AdvancePostingParametersCZZ."Source Code" := SourceCodeSetup."Close Advance Letter CZZ";
1192+
end;
1193+
11881194
PurchAdvLetterEntryCZZ.SetRange("Purch. Adv. Letter No.", PurchAdvLetterHeaderCZZ."No.");
11891195
PurchAdvLetterEntryCZZ.SetRange("Entry Type", PurchAdvLetterEntryCZZ."Entry Type"::Payment);
11901196
PurchAdvLetterEntryCZZ.SetRange(Cancelled, false);
@@ -1247,6 +1253,7 @@ codeunit 31142 "Purch. Adv. Letter-Post CZZ"
12471253
GenJournalLine."Document Date" := AdvancePostingParametersCZZ."Document Date";
12481254
GenJournalLine."VAT Reporting Date" := AdvancePostingParametersCZZ."VAT Date";
12491255
GenJournalLine."Original Doc. VAT Date CZL" := AdvancePostingParametersCZZ."Original Document VAT Date";
1256+
GenJournalLine."Source Code" := AdvancePostingParametersCZZ."Source Code";
12501257
GenJournalLine."Adv. Letter No. (Entry) CZZ" := PurchAdvLetterEntryCZZ."Purch. Adv. Letter No.";
12511258
GenJournalLine."Use Advance G/L Account CZZ" := true;
12521259
GenJournalLine.SetCurrencyFactor(
@@ -1298,6 +1305,7 @@ codeunit 31142 "Purch. Adv. Letter-Post CZZ"
12981305
GenJournalLine."Document Date" := AdvancePostingParametersCZZ."Document Date";
12991306
GenJournalLine."VAT Reporting Date" := AdvancePostingParametersCZZ."VAT Date";
13001307
GenJournalLine."Original Doc. VAT Date CZL" := AdvancePostingParametersCZZ."Original Document VAT Date";
1308+
GenJournalLine."Source Code" := AdvancePostingParametersCZZ."Source Code";
13011309
GenJournalLine.SetCurrencyFactor(
13021310
AdvancePostingParametersCZZ."Currency Code", AdvancePostingParametersCZZ."Currency Factor");
13031311
GenJournalLine.Amount := RemainingAmount;

Apps/CZ/AdvancePaymentsLocalization/app/Src/Codeunits/SalesAdvLetterPostCZZ.Codeunit.al

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ codeunit 31143 "Sales Adv. Letter-Post CZZ"
10041004
AdvanceLetterApplicationCZZ: Record "Advance Letter Application CZZ";
10051005
AdvanceLetterTemplateCZZ: Record "Advance Letter Template CZZ";
10061006
SalesAdvLetterEntryCZZ: Record "Sales Adv. Letter Entry CZZ";
1007+
SourceCodeSetup: Record "Source Code Setup";
10071008
NoSeriesBatch: Codeunit "No. Series - Batch";
10081009
NextEntryNo: Integer;
10091010
GetDocNoFromNoSeries: Boolean;
@@ -1033,6 +1034,11 @@ codeunit 31143 "Sales Adv. Letter-Post CZZ"
10331034
NextEntryNo := GenJnlPostLine.GetNextEntryNo();
10341035
end;
10351036

1037+
if AdvancePostingParametersCZZ."Source Code" = '' then begin
1038+
SourceCodeSetup.Get();
1039+
AdvancePostingParametersCZZ."Source Code" := SourceCodeSetup."Close Advance Letter CZZ";
1040+
end;
1041+
10361042
SalesAdvLetterEntryCZZ.SetRange("Sales Adv. Letter No.", SalesAdvLetterHeaderCZZ."No.");
10371043
SalesAdvLetterEntryCZZ.SetRange("Entry Type", SalesAdvLetterEntryCZZ."Entry Type"::Payment);
10381044
SalesAdvLetterEntryCZZ.SetRange(Cancelled, false);
@@ -1095,6 +1101,7 @@ codeunit 31143 "Sales Adv. Letter-Post CZZ"
10951101
GenJournalLine."Document Date" := AdvancePostingParametersCZZ."Document Date";
10961102
GenJournalLine."VAT Reporting Date" := AdvancePostingParametersCZZ."VAT Date";
10971103
GenJournalLine."Original Doc. VAT Date CZL" := AdvancePostingParametersCZZ."Original Document VAT Date";
1104+
GenJournalLine."Source Code" := AdvancePostingParametersCZZ."Source Code";
10981105
GenJournalLine."Adv. Letter No. (Entry) CZZ" := SalesAdvLetterEntryCZZ."Sales Adv. Letter No.";
10991106
GenJournalLine."Use Advance G/L Account CZZ" := true;
11001107
GenJournalLine.SetCurrencyFactor(
@@ -1146,6 +1153,7 @@ codeunit 31143 "Sales Adv. Letter-Post CZZ"
11461153
GenJournalLine."Document Date" := AdvancePostingParametersCZZ."Document Date";
11471154
GenJournalLine."VAT Reporting Date" := AdvancePostingParametersCZZ."VAT Date";
11481155
GenJournalLine."Original Doc. VAT Date CZL" := AdvancePostingParametersCZZ."Original Document VAT Date";
1156+
GenJournalLine."Source Code" := AdvancePostingParametersCZZ."Source Code";
11491157
GenJournalLine.SetCurrencyFactor(
11501158
AdvancePostingParametersCZZ."Currency Code", AdvancePostingParametersCZZ."Currency Factor");
11511159
GenJournalLine.Amount := -RemainingAmount;

Apps/CZ/AdvancePaymentsLocalization/app/Src/Codeunits/VATRepDateMgtHandlerCZZ.Codeunit.al

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ codeunit 31127 "VAT Rep. Date Mgt. Handler CZZ"
6666
UpdateRelatedGLEntries(VATEntry);
6767
end;
6868

69+
[EventSubscriber(ObjectType::Codeunit, Codeunit::"VAT Orig.Doc.VAT Date Mgt. CZL", 'OnAfterUpdateOrigDocVATDate', '', false, false)]
70+
local procedure UpdateAdvanceLedgerEntriesOnAfterUpdateOrigDocVATDate(VATEntry: Record "VAT Entry")
71+
var
72+
PurchAdvLetterEntry: Record "Purch. Adv. Letter Entry CZZ";
73+
begin
74+
if VATEntry.Type <> VATEntry.Type::Purchase then
75+
exit;
76+
77+
PurchAdvLetterEntry.SetCurrentKey("Document No.", "Posting Date");
78+
PurchAdvLetterEntry.SetRange("Document No.", VATEntry."Document No.");
79+
PurchAdvLetterEntry.SetRange("Posting Date", VATEntry."Posting Date");
80+
PurchAdvLetterEntry.SetFilter("Original Document VAT Date", '<>%1', 0D);
81+
PurchAdvLetterEntry.ModifyAll("Original Document VAT Date", VATEntry."Original Doc. VAT Date CZL");
82+
end;
83+
6984
local procedure FilterRelatedVATEntries(VATEntry: Record "VAT Entry"; var RelatedVATEntry: Record "VAT Entry")
7085
begin
7186
RelatedVATEntry.SetFilter("Entry No.", '<>%1', VATEntry."Entry No.");
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
pageextension 31279 "Source Code Setup CZZ" extends "Source Code Setup"
2+
{
3+
layout
4+
{
5+
addlast(General)
6+
{
7+
field("Close Advance Letter CZZ"; Rec."Close Advance Letter CZZ")
8+
{
9+
ApplicationArea = Basic, Suite;
10+
}
11+
}
12+
}
13+
}

Apps/CZ/AdvancePaymentsLocalization/app/Src/Pages/AdvanceLetterApplEditCZZ.Page.al

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ page 31175 "Advance Letter Appl. Edit CZZ"
3030
if Rec."Advance Letter No." <> '' then begin
3131
TempAdvanceLetterApplication.Get(Rec."Advance Letter Type", Rec."Advance Letter No.", Rec."Document Type", Rec."Document No.");
3232
Rec.CopyFrom(TempAdvanceLetterApplication);
33-
end
33+
Rec.CheckVATRegistrationNoDifference();
34+
end;
3435
end;
3536

3637
trigger OnLookup(var Text: Text): Boolean
@@ -39,6 +40,7 @@ page 31175 "Advance Letter Appl. Edit CZZ"
3940

4041
if Page.RunModal(Page::"Advance Letter Application CZZ", TempAdvanceLetterApplication) = Action::LookupOK then begin
4142
Rec.CopyFrom(TempAdvanceLetterApplication);
43+
Rec.CheckVATRegistrationNoDifference();
4244
OnAfterOnLookupAdvanceLetterNo(Rec);
4345
end;
4446
end;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tableextension 31076 "Source Code Setup CZZ" extends "Source Code Setup"
2+
{
3+
fields
4+
{
5+
field(11760; "Close Advance Letter CZZ"; Code[10])
6+
{
7+
Caption = 'Close Advance Letter';
8+
DataClassification = CustomerContent;
9+
TableRelation = "Source Code";
10+
ToolTip = 'Specifies the source code for closing sales and purchase advance letters.';
11+
}
12+
}
13+
}

Apps/CZ/AdvancePaymentsLocalization/app/Src/Tables/AdvanceLetterApplicationCZZ.Table.al

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,29 @@ table 31007 "Advance Letter Application CZZ"
503503
end;
504504
end;
505505

506+
procedure CheckVATRegistrationNoDifference()
507+
var
508+
SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ";
509+
SalesHeader: Record "Sales Header";
510+
AltCustVATRegImplCZZ: Codeunit "Alt. Cust. VAT Reg. Impl. CZZ";
511+
begin
512+
if "Advance Letter Type" <> "Advance Letter Type"::Sales then
513+
exit;
514+
515+
SalesAdvLetterHeaderCZZ.Get("Advance Letter No.");
516+
case "Document Type" of
517+
"Adv. Letter Usage Doc.Type CZZ"::"Sales Order":
518+
SalesHeader.Get(SalesHeader."Document Type"::Order, "Document No.");
519+
"Adv. Letter Usage Doc.Type CZZ"::"Sales Invoice":
520+
SalesHeader.Get(SalesHeader."Document Type"::Invoice, "Document No.");
521+
else
522+
exit;
523+
end;
524+
525+
if SalesAdvLetterHeaderCZZ."VAT Registration No." <> SalesHeader."VAT Registration No." then
526+
AltCustVATRegImplCZZ.ThrowDiffVATRegNoNotification();
527+
end;
528+
506529
[IntegrationEvent(false, false)]
507530
local procedure OnGetPossiblePurchAdvanceOnBeforeInsertNewAdvanceLetterApplication(var NewAdvanceLetterApplicationCZZ: Record "Advance Letter Application CZZ"; AdvanceLetterApplicationCZZ: Record "Advance Letter Application CZZ")
508531
begin

0 commit comments

Comments
 (0)