bcquality/microsoft/knowledge/finance/normal-vat-journal-amount-includes-vat.bad.al
Jesper Schulz-Wedde 07e324ddbc
Some checks failed
Validate knowledge index / validate-index (push) Has been cancelled
Validate AL review fixtures / validate-review-fixtures (push) Has been cancelled
Validate skill index and report schemas / validate-contract (push) Has been cancelled
Validate frontmatter and structure / validate (push) Has been cancelled
Add source-verified Finance knowledge and review domain (#57)
* Add Finance posting domain-knowledge pilot

Adds three atomic domain-rule knowledge files under community/knowledge/finance/ as a pilot for Type-A (normative) Business Central domain knowledge: post through the posting engine, treat posted ledger entries as immutable, and treat the Dimension Set ID as the source of truth for dimensions. Includes a good/bad AL sample pair for the posting rule.

These encode BC-specific invariants that LLMs reliably get wrong, fitting the existing remedial/atomic knowledge grain with no schema or contract changes. Passes the repo frontmatter validator and is discovered by the knowledge index.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Clarify editable operational fields on posted ledger entries

Addresses review feedback from @JeremyVyska on PR #57: the immutability rule applies to financial content, not the whole entry. Reframes the Description around financial content and gives the operational-field exception (payment/application data, on-hold, applies-to, communication fields edited via CustEntry-Edit/VendEntry-Edit and the ledger entry pages) its own paragraph in Best Practice instead of understating it as a narrow set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Expand Finance pilot into a source-verified review domain

Move Finance knowledge to the Microsoft-owned layer, add nine scoped rules with eighteen AL samples, and register bounded Finance review with complete paired evaluation coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Fix Finance review applicability and ownership boundaries

Remove application-area gating and later VAT-field dependencies, align dynamic shared conventions, separate SCM ownership, and keep journal examples focused on the intended invariant.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Remove logo branding (#194)

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Add title and description to README

* Add foundational AL developer knowledge (#195)

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Clarify locale-safe DateFormula Evaluate inputs (#193)

* Clarify locale-safe DateFormula Evaluate inputs

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Normalize DateFormula article sections

Keep the analyzer-gap explanation in Description and its scoped probe evidence in References, without a novel Validation section. Normative guidance and fixtures are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Add SCM functional knowledge domain (#192)

* Add SCM functional knowledge domain

Introduce nine source-backed rules with original AL sample pairs, bounded SCM review routing, and complete positive/clean evaluation coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Normalize SCM knowledge and review ownership

Align article and AL sample conventions, keep BC facts separate from review mechanics, and clarify reciprocal Finance ownership without bespoke shared test assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-21 10:20:41 +02:00

54 lines
2.7 KiB
AL

// Demonstration only; independently authored, not copied from BaseApp.
codeunit 50108 "Import Purchase Journal Total"
{
procedure ImportExampleTotal(TemplateName: Code[10]; BatchName: Code[10]; LineNo: Integer)
var
JournalLine: Record "Gen. Journal Line";
VATPostingSetup: Record "VAT Posting Setup";
GeneralLedgerSetup: Record "General Ledger Setup";
SourceInvoice: JsonObject;
NetToken: JsonToken;
VATToken: JsonToken;
GrossToken: JsonToken;
ImportedNet: Decimal;
ImportedVAT: Decimal;
ImportedGross: Decimal;
begin
SourceInvoice.ReadFrom('{"netAmount":100,"vatAmount":25,"grossAmount":125}');
SourceInvoice.Get('netAmount', NetToken);
SourceInvoice.Get('vatAmount', VATToken);
SourceInvoice.Get('grossAmount', GrossToken);
ImportedNet := NetToken.AsValue().AsDecimal();
ImportedVAT := VATToken.AsValue().AsDecimal();
ImportedGross := GrossToken.AsValue().AsDecimal();
if ImportedGross <> ImportedNet + ImportedVAT then
Error(TotalsErr);
JournalLine.Get(TemplateName, BatchName, LineNo);
JournalLine.TestField("Account Type", JournalLine."Account Type"::"G/L Account");
JournalLine.TestField("Bal. Account Type", JournalLine."Bal. Account Type"::"G/L Account");
JournalLine.TestField("Account No.");
JournalLine.TestField("Bal. Account No.");
JournalLine.TestField("Currency Code", '');
JournalLine.TestField("Gen. Posting Type", JournalLine."Gen. Posting Type"::Purchase);
JournalLine.TestField("VAT Posting", JournalLine."VAT Posting"::"Automatic VAT Entry");
JournalLine.TestField("VAT Calculation Type", JournalLine."VAT Calculation Type"::"Normal VAT");
JournalLine.TestField("VAT %", 25);
JournalLine.TestField("VAT Difference", 0);
JournalLine.TestField("Bal. Gen. Posting Type", JournalLine."Bal. Gen. Posting Type"::" ");
JournalLine.TestField("Bal. VAT %", 0);
VATPostingSetup.Get(JournalLine."VAT Bus. Posting Group", JournalLine."VAT Prod. Posting Group");
VATPostingSetup.TestField("VAT Calculation Type", VATPostingSetup."VAT Calculation Type"::"Normal VAT");
VATPostingSetup.TestField("VAT %", 25);
VATPostingSetup.TestField("Unrealized VAT Type", VATPostingSetup."Unrealized VAT Type"::" ");
GeneralLedgerSetup.Get();
GeneralLedgerSetup.TestField("Additional Reporting Currency", '');
GeneralLedgerSetup.TestField("Amount Rounding Precision", 0.01);
JournalLine.Validate(Amount, ImportedNet);
JournalLine.Modify(true);
end;
var
TotalsErr: Label 'The invoice total must equal its net amount plus VAT.';
}