Skip to content

Bug 637507: [master] [Report 743 VAT Reconciliation Report] Incorrect VAT Base and Amount when using Non-Deductible VAT#9260

Open
AleksanderGladkov wants to merge 1 commit into
mainfrom
bugs/637507-master-VAT-Reconciliation-Report-Non-Deductible-VAT
Open

Bug 637507: [master] [Report 743 VAT Reconciliation Report] Incorrect VAT Base and Amount when using Non-Deductible VAT#9260
AleksanderGladkov wants to merge 1 commit into
mainfrom
bugs/637507-master-VAT-Reconciliation-Report-Non-Deductible-VAT

Conversation

@AleksanderGladkov

@AleksanderGladkov AleksanderGladkov commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

ISSUE:
The VAT Reconciliation Report always includes the Non-Deductible VAT in the reported base and VAT amounts, with no way to report the deductible portion only.

SOLUTION:
Added a "VAT Amount Type" option to the report letting the user choose between including Non-Deductible VAT or reporting deductible VAT only.

TESTS:
Added scenarios covering both options.

Fixes AB#637507

Ports changes from ADO bug 637506 (VAT Reconciliation Report - Non-Deductible VAT).
@AleksanderGladkov AleksanderGladkov requested a review from a team July 8, 2026 16:39
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

All applicable sub-skills completed; al-ui-review was not-applicable (no page/control-add-in files in diff); al-security-review and al-privacy-review found no applicable knowledge for this diff.

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

@AleksanderGladkov AleksanderGladkov requested a review from a team July 8, 2026 16:48
@AleksanderGladkov AleksanderGladkov added the Finance GitHub request for Finance area label Jul 8, 2026
@AleksanderGladkov AleksanderGladkov changed the title Bug 637507: new option for exclude NDV in VAT Reconciliation Report Bug 637507: [master] [Report 743 VAT Reconciliation Report] Incorrect VAT Base and Amount when using Non-Deductible VAT Jul 8, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 1

Recommendation: Request Changes

What this PR does

This PR adds a request-page option to Report 743 so users can keep the current full VAT amounts or show only the deductible VAT part. The default enum value keeps the existing include-NDV behavior.

The arithmetic uses the right VAT Entry fields for the two built-in options, and the tests cover several purchase, journal, reverse charge, and sales paths. The remaining issue is that the report still calculates from each G/L Entry - VAT Entry Link. In NDV postings, one VAT Entry can be linked from more than one G/L Entry, so the same deductible amount can still be counted more than once in report totals.

Suggestions

S1 - Deduplicate VAT entries before summing
The report still loops by G/L Entry and adds VATEntry.Base / VATEntry.Amount for every G/L Entry - VAT Entry Link. In NDV postings, the same VAT Entry can be linked from more than one G/L Entry, so the report can still count the deductible amount more than once. Track processed VAT Entry numbers for the relevant report scope, or calculate from VAT Entry directly before producing the totals.

S2 - Assert totals for both amount types
The new tests filter the dataset to one GLAccountNo_GLEntry row and do not check report totals or extra rows. Add assertions for the summed Purchase VAT / Base Amount Purchase VAT with both Include Non-Deductible VAT and Deductible VAT Only, especially the 75% NDV purchase invoice and journal cases. Otherwise a duplicated row can still pass the tests.

S3 - Make the option enum closed
The new enum is Extensible = true, but the report only handles the two built-in values. An extension value will silently behave like Deductible VAT Only. Make the enum non-extensible, or add explicit handling for unknown values.

Risk assessment and necessity

Risk: This is a VAT report change, so wrong values can affect tax review and reconciliation. The change does not add or move event subscribers, so there is no publisher dependency to verify. The default option is backward compatible, but the report totals remain risky until duplicated VAT Entry links are handled.

Necessity: The linked Bug has a concrete repro for Non-Deductible VAT in Report 743, and the scenario is important enough to fix. Adding a deductible-only option is a reasonable small scope, but the fix must also prove that 75% NDV totals reconcile and that the old include-NDV option still behaves as intended.


[AI-PR-REVIEW] version=1 system=github pr=9260 round=1 by=alexei-dobriansky at=2026-07-08 lastSha=4f780151ae68250e98b9c065c92d70dad5f9a11c suggestions=S1,S2,S3

GLAccNo: Code[20];
DocNo: Code[20];
begin
// [SCENARIO 637506] Purchase invoice with 100% Non-Deductible VAT reports 0 deductible base and VAT with "Deductible VAT Only"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you miss the AI tag or you just did not use the AL test agent/skill?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't use the skill I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants