
Hello,
I would like to set an entry in the cash receipt journal from my AL Extension.
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!
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