mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-07 07:36:54 +01:00
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>
This commit is contained in:
parent
639b6d1870
commit
fa63d5526c
38 changed files with 1064 additions and 124 deletions
|
|
@ -0,0 +1,60 @@
|
|||
// Demonstration only; independently authored, not copied from BaseApp.
|
||||
codeunit 50100 "Post Transfer Journal"
|
||||
{
|
||||
procedure PostTransferBatch(TemplateName: Code[10]; BatchName: Code[10])
|
||||
var
|
||||
JournalLine: Record "Gen. Journal Line";
|
||||
LastGLEntry: Record "G/L Entry";
|
||||
NextEntryNo: Integer;
|
||||
begin
|
||||
JournalLine.SetRange("Journal Template Name", TemplateName);
|
||||
JournalLine.SetRange("Journal Batch Name", BatchName);
|
||||
if JournalLine.Count() <> 1 then
|
||||
Error(SingleTransferErr);
|
||||
JournalLine.FindFirst();
|
||||
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("Posting Date");
|
||||
JournalLine.TestField("Document No.");
|
||||
JournalLine.TestField(Amount);
|
||||
JournalLine.TestField("Currency Code", '');
|
||||
JournalLine.TestField("Gen. Posting Type", JournalLine."Gen. Posting Type"::" ");
|
||||
JournalLine.TestField("Bal. Gen. Posting Type", JournalLine."Bal. Gen. Posting Type"::" ");
|
||||
|
||||
LastGLEntry.LockTable();
|
||||
if LastGLEntry.FindLast() then
|
||||
NextEntryNo := LastGLEntry."Entry No." + 1
|
||||
else
|
||||
NextEntryNo := 1;
|
||||
InsertLedgerRow(JournalLine, NextEntryNo, JournalLine."Account No.", JournalLine.Amount);
|
||||
InsertLedgerRow(JournalLine, NextEntryNo + 1, JournalLine."Bal. Account No.", -JournalLine.Amount);
|
||||
end;
|
||||
|
||||
local procedure InsertLedgerRow(JournalLine: Record "Gen. Journal Line"; EntryNo: Integer; AccountNo: Code[20]; Amount: Decimal)
|
||||
var
|
||||
GLEntry: Record "G/L Entry";
|
||||
begin
|
||||
GLEntry.Init();
|
||||
GLEntry."Entry No." := EntryNo;
|
||||
GLEntry."G/L Account No." := AccountNo;
|
||||
GLEntry."Posting Date" := JournalLine."Posting Date";
|
||||
GLEntry."Document Type" := JournalLine."Document Type";
|
||||
GLEntry."Document No." := JournalLine."Document No.";
|
||||
GLEntry."Source Code" := JournalLine."Source Code";
|
||||
GLEntry."Journal Batch Name" := JournalLine."Journal Batch Name";
|
||||
GLEntry."Dimension Set ID" := JournalLine."Dimension Set ID";
|
||||
GLEntry."Global Dimension 1 Code" := JournalLine."Shortcut Dimension 1 Code";
|
||||
GLEntry."Global Dimension 2 Code" := JournalLine."Shortcut Dimension 2 Code";
|
||||
GLEntry.Amount := Amount;
|
||||
if Amount > 0 then
|
||||
GLEntry."Debit Amount" := Amount
|
||||
else
|
||||
GLEntry."Credit Amount" := -Amount;
|
||||
GLEntry.Insert(true);
|
||||
end;
|
||||
|
||||
var
|
||||
SingleTransferErr: Label 'Use a journal batch containing exactly one self-balancing G/L transfer.';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue