web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Business Central forum

Post an Entry into Cash Receipt Journal from AL Extension

(0) ShareShare
ReportReport
Posted on by 45

Hello,

I would like to set an entry in the cash receipt journal from my AL Extension.

CashReceiptJournalExample.jpg

Does anyone know, what codeunit and record i can use for that ?


We have an external software for cash payments, and i would like to mark the posted sales invoice as payed for amount X or at least set the entry in the journal for manual validation from my accounting staff.

thanks for your help!

Categories:
I have the same question (0)
  • Suggested answer
    -Chris- Profile Picture
    45 on at

    for anyone who is in need for this ....

    var
            JnlTemplate: Record "Gen. Journal Template";
            JnlBatch: Record "Gen. Journal Batch";
            JnlLine: Record "Gen. Journal Line";
            frmCashReceiptJournal: Page 255;
    
        begin
            JnlTemplate.Get('ZAHLGEING');
            JnlBatch.Get(JnlTemplate.Name, 'KASSA');
    
            JnlLine."Journal Template Name" := JnlTemplate.Name;
            JnlLine."Journal Batch Name" := JnlBatch.Name;
            JnlLine.Init;
    
            if AmountBar > 0 then begin
    
    
                JnlLine."Journal Template Name" := JnlTemplate.Name;
                JnlLine."Journal Batch Name" := JnlBatch.Name;
                JnlLine.SetUpNewLine(JnlLine, 0, true);
    
                JnlLine.GetNewLineNo(JnlLine."Journal Template Name", JnlLine."Journal Batch Name");
                JnlLine."Line No." := JnlLine.GetNewLineNo(JnlLine."Journal Template Name", JnlLine."Journal Batch Name");
                JnlLine."Posting Date" := WorkDate();
                JnlLine."Document Type" := JnlLine."Document Type"::Payment;
                JnlLine."Account Type" := JnlLine."Account Type"::Customer;
                JnlLine."Account No." := "Customer No";
                JnlLine."Shortcut Dimension 2 Code" := "Customer Dimension";
                JnlLine.Validate("Shortcut Dimension 2 Code");
    
                JnlLine."Bal. Account No." := '2710';
    
                JnlLine."Applies-to Doc. Type" := JnlLine."Applies-to Doc. Type"::Invoice;
                JnlLine."Applies-to Doc. No." := "Invoice No";
                JnlLine.Validate("Applies-to Doc. No.");
    
                JnlLine.Amount := -AmountBar;
                JnlLine.Description := "Customer No"   ' - '   "Invoice No";
    
    
    
                JnlLine.Description := "Customer No"   ' - '   "Invoice No";
                JnlLine.ValidateApplyRequirements(JnlLine);
                JnlLine.Validate(Amount);
                JnlLine.insert;
            end;
        end;

    to do this a little better, you should store, template and batch name in the database, as well as your cash G/L account

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans