Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing with version 25.0.22639.0 #26958

Merged
merged 7 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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.21703.0/base",
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/25.0.22639.0/base",
"country": "base",
"useProjectDependencies": true,
"repoVersion": "25.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ codeunit 31004 "Cust. Ledger Entry Handler CZZ"
IsHandled := true;
end;

[EventSubscriber(ObjectType::Report, Report::"Open Cust. Entries to Date CZL", 'OnBeforeGetReceivablesAccountNo', '', false, false)]
local procedure GetReceivablesAccountNoForOpenCustEntriesToDate(CustLedgerEntry: Record "Cust. Ledger Entry"; var GLAccountNo: Code[20]; var IsHandled: Boolean)
var
AdvanceLetterTemplateCZZ: Record "Advance Letter Template CZZ";
begin
if IsHandled then
exit;

if CustLedgerEntry."Advance Letter No. CZZ" = '' then
exit;

if CustLedgerEntry."Adv. Letter Template Code CZZ" <> '' then begin
AdvanceLetterTemplateCZZ.Get(CustLedgerEntry."Adv. Letter Template Code CZZ");
GLAccountNo := AdvanceLetterTemplateCZZ."Advance Letter G/L Account";
IsHandled := true;
end else begin
GLAccountNo := CustLedgerEntry.GetReceivablesAccNoCZL();
IsHandled := true;
end;
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"CustEntry-Apply Posted Entries", 'OnApplyCustEntryFormEntryOnAfterCheckEntryOpen', '', false, false)]
local procedure CheckAdvanceOnApplyCustEntryFormEntryOnAfterCheckEntryOpen(ApplyingCustLedgEntry: Record "Cust. Ledger Entry")
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ codeunit 31087 "Install Application CZZ"
AmtToDeduct: Decimal;
Continue: Boolean;
begin
if PurchAdvLetterHeaderCZZ.Status = PurchAdvLetterHeaderCZZ.Status::Closed then
exit;

AdvanceLetterLineRelation.SetRange(Type, AdvanceLetterLineRelation.Type::Purchase);
AdvanceLetterLineRelation.SetRange("Letter No.", PurchAdvLetterHeaderCZZ."No.");
if AdvanceLetterLineRelation.FindSet() then begin
Expand Down Expand Up @@ -857,6 +860,9 @@ codeunit 31087 "Install Application CZZ"
AmtToDeduct: Decimal;
Continue: Boolean;
begin
if SalesAdvLetterHeaderCZZ.Status = SalesAdvLetterHeaderCZZ.Status::Closed then
exit;

AdvanceLetterLineRelation.SetRange(Type, AdvanceLetterLineRelation.Type::Sale);
AdvanceLetterLineRelation.SetRange("Letter No.", SalesAdvLetterHeaderCZZ."No.");
if AdvanceLetterLineRelation.FindSet() then begin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// ------------------------------------------------------------------------------------------------
// 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.AdvancePayments;

using Microsoft.Finance.Currency;
using Microsoft.Finance.GeneralLedger.Journal;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Setup;
using Microsoft.Foundation.Enums;

codeunit 31157 "Non-Deductible VAT CZZ"
{
var
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
NonDeductibleVATCZL: Codeunit "Non-Deductible VAT CZL";

procedure IsNonDeductibleVATEnabled(): Boolean
var
VATSetup: Record "VAT Setup";
begin
if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then
exit(false);
VATSetup.Get();
exit(VATSetup."Use For Advances CZZ");
end;

internal procedure GetNonDeductibleVATPct(AdvancePostingBuffer: Record "Advance Posting Buffer CZZ"; ToDate: Date): Decimal
begin
exit(GetNonDeductibleVATPct(
AdvancePostingBuffer."VAT Bus. Posting Group",
AdvancePostingBuffer."VAT Prod. Posting Group",
"General Posting Type"::Purchase, ToDate));
end;

procedure GetNonDeductibleVATPct(VATBusPostGroupCode: Code[20]; VATProdPostGroupCode: Code[20]; GeneralPostingType: Enum "General Posting Type"; ToDate: Date): Decimal
begin
if not IsNonDeductibleVATEnabled() then
exit(0);
exit(NonDeductibleVATCZL.GetNonDeductibleVATPct(VATBusPostGroupCode, VATProdPostGroupCode, GeneralPostingType, ToDate));
end;

internal procedure Calculate(var AdvancePostingBufferCZZ: Record "Advance Posting Buffer CZZ")
var
Currency: Record Currency;
begin
if not IsNonDeductibleVATEnabled() then
exit;
Currency.InitRoundingPrecision();
UpdateNonDeductibleAmounts(
AdvancePostingBufferCZZ."Non-Deductible VAT Base", AdvancePostingBufferCZZ."Non-Deductible VAT Amount",
AdvancePostingBufferCZZ."VAT Base Amount", AdvancePostingBufferCZZ."VAT Amount",
AdvancePostingBufferCZZ."Non-Deductible VAT %", Currency."Amount Rounding Precision");
UpdateNonDeductibleAmounts(
AdvancePostingBufferCZZ."Non-Deductible VAT Base ACY", AdvancePostingBufferCZZ."Non-Deductible VAT Amount ACY",
AdvancePostingBufferCZZ."VAT Base Amount (ACY)", AdvancePostingBufferCZZ."VAT Amount (ACY)",
AdvancePostingBufferCZZ."Non-Deductible VAT %", Currency."Amount Rounding Precision");
end;

local procedure UpdateNonDeductibleAmounts(var NonDeductibleBase: Decimal; var NonDeductibleAmount: Decimal; VATBase: Decimal; VATAmount: Decimal; NonDeductibleVATPct: Decimal; AmountRoundingPrecision: Decimal)
begin
if not IsNonDeductibleVATEnabled() then begin
NonDeductibleBase := 0;
NonDeductibleAmount := 0;
exit;
end;
NonDeductibleBase :=
Round(VATBase * NonDeductibleVATPct / 100, AmountRoundingPrecision);
NonDeductibleAmount :=
Round(VATAmount * NonDeductibleVATPct / 100, AmountRoundingPrecision);
end;

internal procedure Copy(var GenJournalLine: Record "Gen. Journal Line"; AdvancePostingBufferCZZ: Record "Advance Posting Buffer CZZ")
begin
GenJournalLine."Non-Deductible VAT %" := AdvancePostingBufferCZZ."Non-Deductible VAT %";
GenJournalLine."Non-Deductible VAT Base" := AdvancePostingBufferCZZ."Non-Deductible VAT Base";
GenJournalLine."Non-Deductible VAT Amount" := AdvancePostingBufferCZZ."Non-Deductible VAT Amount";
GenJournalLine."Non-Deductible VAT Base LCY" := AdvancePostingBufferCZZ."Non-Deductible VAT Base ACY";
GenJournalLine."Non-Deductible VAT Amount LCY" := AdvancePostingBufferCZZ."Non-Deductible VAT Amount ACY";
end;
}
Loading
Loading