Skip to content

Commit

Permalink
Syncing with version 25.0.20906.0 (#26687)
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperSchulz authored Jun 19, 2024
1 parent 5d9a4d3 commit 1cd5eb1
Show file tree
Hide file tree
Showing 125 changed files with 4,995 additions and 1,216 deletions.
2 changes: 1 addition & 1 deletion .github/AL-Go-Settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"runs-on": "windows-latest",
"cacheImageName": "",
"UsePsSession": false,
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/25.0.20074.0/base",
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/25.0.20906.0/base",
"country": "base",
"useProjectDependencies": true,
"repoVersion": "25.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,11 @@ codeunit 31003 "Gen.Jnl.-Post Line Handler CZZ"

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnBeforeCreateGLEntriesForTotalAmountsV19', '', false, false)]
local procedure GenJnlPostLineOnBeforeCreateGLEntriesForTotalAmounts(GenJournalLine: Record "Gen. Journal Line"; var GLAccNo: Code[20])
var
SalesAdvLetterManagement: Codeunit "SalesAdvLetterManagement CZZ";
PurchAdvLetterManagement: Codeunit "PurchAdvLetterManagement CZZ";
begin
if not GenJournalLine."Use Advance G/L Account CZZ" then
exit;

case GenJournalLine."Account Type" of
GenJournalLine."Account Type"::Customer:
GLAccNo := SalesAdvLetterManagement.GetAdvanceGLAccount(GenJournalLine);
GenJournalLine."Account Type"::Vendor:
GLAccNo := PurchAdvLetterManagement.GetAdvanceGLAccount(GenJournalLine);
end;
GLAccNo := GenJournalLine.GetAdvanceGLAccountNoCZZ();
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnBeforePostApply', '', false, false)]
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
AdvanceLetterLinkCZZ.GetLetterLink(TempAdvanceLetterLinkBufferCZZ);
TempAdvanceLetterLinkBufferCZZ.SetFilter(Amount, '>0');
if not TempAdvanceLetterLinkBufferCZZ.IsEmpty() then begin
PostingDate := GetPostingDateUI(CustLedgerEntry."Posting Date");
PostingDate := CustLedgerEntry."Posting Date";
if not GetPostingDateUI(PostingDate) then
exit;
if PostingDate = 0D then
Error(PostingDateEmptyErr);
LinkAdvancePayment(CustLedgerEntry, TempAdvanceLetterLinkBufferCZZ, PostingDate);
Expand Down Expand Up @@ -266,7 +268,9 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
var
PostingDate: Date;
begin
PostingDate := GetPostingDateUI(CustLedgerEntry."Posting Date");
PostingDate := CustLedgerEntry."Posting Date";
if not GetPostingDateUI(PostingDate) then
exit;
if PostingDate = 0D then
Error(PostingDateEmptyErr);

Expand All @@ -277,7 +281,9 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
var
PostingDate: Date;
begin
PostingDate := GetPostingDateUI(CustLedgerEntry."Posting Date");
PostingDate := CustLedgerEntry."Posting Date";
if not GetPostingDateUI(PostingDate) then
exit;
if PostingDate = 0D then
Error(PostingDateEmptyErr);

Expand All @@ -303,7 +309,8 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
InsertedEntryNo := SalesAdvLetterPostCZZ.PostAdvancePayment(
CustLedgerEntry, PostedGenJournalLine, GenJnlPostLine, AdvancePostingParametersCZZ);
end;

#if not CLEAN25
[Obsolete('Replaced by GetAdvanceGLAccountNoCZZ function in GenJournalLine.', '25.0')]
procedure GetAdvanceGLAccount(var GenJournalLine: Record "Gen. Journal Line"): Code[20]
var
SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ";
Expand All @@ -315,6 +322,7 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
AdvanceLetterTemplateCZZ.TestField("Advance Letter G/L Account");
exit(AdvanceLetterTemplateCZZ."Advance Letter G/L Account");
end;
#endif

procedure PostAdvancePaymentVAT(var SalesAdvLetterEntryCZZ: Record "Sales Adv. Letter Entry CZZ"; PostingDate: Date)
begin
Expand Down Expand Up @@ -367,11 +375,18 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"

InitVATAmountLine(TempAdvancePostingBufferCZZ, SalesAdvLetterEntryCZZ."Sales Adv. Letter No.", SalesAdvLetterEntryCZZ.Amount, SalesAdvLetterEntryCZZ."Currency Factor");

TempAdvancePostingBufferCZZ.Reset();
TempAdvancePostingBufferCZZ.SetRange("Auxiliary Entry", false);
if TempAdvancePostingBufferCZZ.IsEmpty() then
DocumentNo := SalesAdvLetterHeaderCZZ."No.";
TempAdvancePostingBufferCZZ.Reset();

if Silently or not GuiAllowed then begin
DocumentNo := NoSeries.GetNextNo(AdvanceLetterTemplateCZZ."Advance Letter Invoice Nos.", PostingDate);
if DocumentNo = '' then
DocumentNo := NoSeries.GetNextNo(AdvanceLetterTemplateCZZ."Advance Letter Invoice Nos.", PostingDate);
TempAdvancePostingBufferCZZ.SetFilter(Amount, '<>0');
end else begin
VATDocumentCZZ.InitSalesDocument(AdvanceLetterTemplateCZZ."Advance Letter Invoice Nos.", '',
VATDocumentCZZ.InitSalesDocument(AdvanceLetterTemplateCZZ."Advance Letter Invoice Nos.", DocumentNo,
SalesAdvLetterHeaderCZZ."Document Date", PostingDate, VATDate, 0D,
SalesAdvLetterHeaderCZZ."Currency Code", SalesAdvLetterEntryCZZ."Currency Factor", '', TempAdvancePostingBufferCZZ);
if VATDocumentCZZ.RunModal() <> Action::OK then
Expand Down Expand Up @@ -447,18 +462,28 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"

local procedure BufferAdvanceLines(SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ"; var AdvancePostingBufferCZZ: Record "Advance Posting Buffer CZZ")
var
AdvanceLetterTemplateCZZ: Record "Advance Letter Template CZZ";
SalesAdvLetterLineCZZ: Record "Sales Adv. Letter Line CZZ";
TempAdvancePostingBufferCZZ: Record "Advance Posting Buffer CZZ" temporary;
begin
AdvancePostingBufferCZZ.Reset();
AdvancePostingBufferCZZ.DeleteAll();

AdvanceLetterTemplateCZZ.Get(SalesAdvLetterHeaderCZZ."Advance Letter Code");

SalesAdvLetterLineCZZ.SetRange("Document No.", SalesAdvLetterHeaderCZZ."No.");
SalesAdvLetterLineCZZ.SetFilter(Amount, '<>0');
if SalesAdvLetterLineCZZ.FindSet() then
repeat
TempAdvancePostingBufferCZZ.PrepareForSalesAdvLetterLine(SalesAdvLetterLineCZZ);
AdvancePostingBufferCZZ.Update(TempAdvancePostingBufferCZZ);

if (not AdvanceLetterTemplateCZZ."Post VAT Doc. for Rev. Charge") and
(AdvancePostingBufferCZZ."VAT Calculation Type" = "Tax Calculation Type"::"Reverse Charge VAT")
then begin
AdvancePostingBufferCZZ."Auxiliary Entry" := true;
AdvancePostingBufferCZZ.Modify();
end;
until SalesAdvLetterLineCZZ.Next() = 0;
end;

Expand Down Expand Up @@ -517,7 +542,9 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
begin
CustLedgerEntry.TestField("Advance Letter No. CZZ");

PostingDate := GetPostingDateUI(CustLedgerEntry."Posting Date");
PostingDate := CustLedgerEntry."Posting Date";
if not GetPostingDateUI(PostingDate) then
exit;
if PostingDate = 0D then
Error(PostingDateEmptyErr);

Expand All @@ -537,7 +564,9 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
PostingDate: Date;
begin
CustLedgerEntry.Get(SalesAdvLetterEntryCZZ."Cust. Ledger Entry No.");
PostingDate := GetPostingDateUI(CustLedgerEntry."Posting Date");
PostingDate := CustLedgerEntry."Posting Date";
if not GetPostingDateUI(PostingDate) then
exit;
if PostingDate = 0D then
Error(PostingDateEmptyErr);
UnlinkAdvancePayment(SalesAdvLetterEntryCZZ, PostingDate);
Expand Down Expand Up @@ -911,6 +940,8 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
NoSeries: Codeunit "No. Series";
GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line";
AdvPaymentCloseDialog: Page "Adv. Payment Close Dialog CZZ";
DocumentNo: Code[20];
SourceCode: Code[10];
VATDate: Date;
PostingDate: Date;
CurrencyFactor: Decimal;
Expand Down Expand Up @@ -939,15 +970,29 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
TempAdvancePostingBufferCZZ.Modify();
until SalesAdvLetterEntryCZZ2.Next() = 0;

VATEntry.Get(SalesAdvLetterEntryCZZ."VAT Entry No.");
SalesAdvLetterHeaderCZZ.Get(SalesAdvLetterEntryCZZ."Sales Adv. Letter No.");
AdvanceLetterTemplateCZZ.Get(SalesAdvLetterHeaderCZZ."Advance Letter Code");

// find VAT entry of the VAT document due to source code
SourceCode := '';
VATEntry.SetRange("Document No.", SalesAdvLetterEntryCZZ."Document No.");
VATEntry.SetRange("Posting Date", SalesAdvLetterEntryCZZ."Posting Date");
if VATEntry.FindFirst() then
SourceCode := VATEntry."Source Code";

TempAdvancePostingBufferCZZ.Reset();
TempAdvancePostingBufferCZZ.SetRange("Auxiliary Entry", false);
if TempAdvancePostingBufferCZZ.IsEmpty() then
DocumentNo := SalesAdvLetterHeaderCZZ."No.";
TempAdvancePostingBufferCZZ.Reset();

if DocumentNo = '' then
DocumentNo := NoSeries.GetNextNo(AdvanceLetterTemplateCZZ."Advance Letter Cr. Memo Nos.", WorkDate());

Clear(AdvancePostingParametersCZZ);
AdvancePostingParametersCZZ."Document Type" := "Gen. Journal Document Type"::"Credit Memo";
AdvancePostingParametersCZZ."Document No." :=
NoSeries.GetNextNo(AdvanceLetterTemplateCZZ."Advance Letter Cr. Memo Nos.", WorkDate());
AdvancePostingParametersCZZ."Source Code" := VATEntry."Source Code";
AdvancePostingParametersCZZ."Document No." := DocumentNo;
AdvancePostingParametersCZZ."Source Code" := SourceCode;
AdvancePostingParametersCZZ."Posting Description" := SalesAdvLetterHeaderCZZ."Posting Description";
AdvancePostingParametersCZZ."Posting Date" := PostingDate;
AdvancePostingParametersCZZ."Document Date" := PostingDate;
Expand Down Expand Up @@ -1162,8 +1207,10 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
if TempAdvancePostingBufferCZZ2.FindSet() then
repeat
VATPostingSetup.Get(TempAdvancePostingBufferCZZ2."VAT Bus. Posting Group", TempAdvancePostingBufferCZZ2."VAT Prod. Posting Group");
PostUnrealizedExchangeRate(SalesAdvLetterEntryCZZ, SalesAdvLetterHeaderCZZ, VATPostingSetup, TempAdvancePostingBufferCZZ2.Amount, TempAdvancePostingBufferCZZ2."VAT Amount",
SalesAdvLetterEntryCZZ."Entry No.", DetEntryNo, DocumentNo, ToDate, ToDate, PostDescription, GenJnlPostLine, false, false);
PostUnrealizedExchangeRate(SalesAdvLetterEntryCZZ, SalesAdvLetterHeaderCZZ, VATPostingSetup,
TempAdvancePostingBufferCZZ2.Amount, TempAdvancePostingBufferCZZ2."VAT Amount",
SalesAdvLetterEntryCZZ."Entry No.", DetEntryNo, DocumentNo, ToDate, ToDate, PostDescription,
GenJnlPostLine, false, false, TempAdvancePostingBufferCZZ2."Auxiliary Entry");
until TempAdvancePostingBufferCZZ2.Next() = 0;

SalesAdvLetterPostCZZ.BufferAdvanceVATLines(SalesAdvLetterEntryCZZ, TempAdvancePostingBufferCZZ1, 0D);
Expand Down Expand Up @@ -1218,8 +1265,10 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
end;

VATPostingSetup.Get(SalesAdvLetterEntryCZZ3."VAT Bus. Posting Group", SalesAdvLetterEntryCZZ3."VAT Prod. Posting Group");
PostUnrealizedExchangeRate(SalesAdvLetterEntryCZZ, SalesAdvLetterHeaderCZZ, VATPostingSetup, -AmountToPost, -VATAmountToPost,
SalesAdvLetterEntryCZZ2."Entry No.", 0, DocumentNo, SalesAdvLetterEntryCZZ3."Posting Date", SalesAdvLetterEntryCZZ3."VAT Date", PostDescription, GenJnlPostLine, false, false);
PostUnrealizedExchangeRate(SalesAdvLetterEntryCZZ, SalesAdvLetterHeaderCZZ, VATPostingSetup,
-AmountToPost, -VATAmountToPost, SalesAdvLetterEntryCZZ2."Entry No.", 0, DocumentNo,
SalesAdvLetterEntryCZZ3."Posting Date", SalesAdvLetterEntryCZZ3."VAT Date", PostDescription,
GenJnlPostLine, false, false, SalesAdvLetterEntryCZZ3."Auxiliary Entry");
until SalesAdvLetterEntryCZZ3.Next() = 0;
until SalesAdvLetterEntryCZZ2.Next() = 0;
end;
Expand All @@ -1228,7 +1277,7 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"

local procedure PostUnrealizedExchangeRate(var SalesAdvLetterEntryCZZ: Record "Sales Adv. Letter Entry CZZ"; var SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ"; var VATPostingSetup: Record "VAT Posting Setup";
Amount: Decimal; VATAmount: Decimal; RelatedEntryNo: Integer; RelatedDetEntryNo: Integer; DocumentNo: Code[20]; PostingDate: Date; VATDate: Date; PostDescription: Text[100]; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line";
Correction: Boolean; Preview: Boolean)
Correction: Boolean; Preview: Boolean; AuxiliaryEntry: Boolean)
var
AdvancePostingParametersCZZ: Record "Advance Posting Parameters CZZ";
begin
Expand All @@ -1240,21 +1289,23 @@ codeunit 31002 "SalesAdvLetterManagement CZZ"
AdvancePostingParametersCZZ."Temporary Entries Only" := Preview;

SalesAdvLetterPostCZZ.PostUnrealizedExchangeRate(
SalesAdvLetterHeaderCZZ, SalesAdvLetterEntryCZZ, VATPostingSetup, Amount, VATAmount, RelatedEntryNo, RelatedDetEntryNo, Correction, GenJnlPostLine, AdvancePostingParametersCZZ);
SalesAdvLetterHeaderCZZ, SalesAdvLetterEntryCZZ, VATPostingSetup, Amount, VATAmount,
RelatedEntryNo, RelatedDetEntryNo, Correction, AuxiliaryEntry, GenJnlPostLine, AdvancePostingParametersCZZ);
end;

local procedure GetPostingDateUI(DefaultPostingDate: Date): Date
local procedure GetPostingDateUI(var PostingDate: Date): Boolean
var
GetPostingDateCZZ: Page "Get Posting Date CZZ";
PostingDate: Date;
begin
if not GuiAllowed() then
exit(DefaultPostingDate);
exit(true);

GetPostingDateCZZ.SetValues(PostingDate);
if GetPostingDateCZZ.RunModal() <> Action::OK then
exit(false);

GetPostingDateCZZ.SetValues(DefaultPostingDate);
if GetPostingDateCZZ.RunModal() = Action::OK then
GetPostingDateCZZ.GetValues(PostingDate);
exit(PostingDate);
GetPostingDateCZZ.GetValues(PostingDate);
exit(true);
end;
#if not CLEAN24
#pragma warning disable AL0432
Expand Down
Loading

0 comments on commit 1cd5eb1

Please sign in to comment.