C/AL Routine to Apply Entries

EwanEwan Member Posts: 54
Hi

Does anyone out there know of or has created a C/AL routine that can be used to apply ledger entries?

Answers

  • jglathejglathe Member Posts: 639
    He Ewan,

    yes. What kind of ledger entries do you want to apply?

    with best regards

    Jens
  • EwanEwan Member Posts: 54
    Hi

    I would like to create a routine that writes off historic small balances on the customer ledger.

    So my approach would be to import and post a set of sales journals to counter the balances.

    Next to create a report that when run applies the entries to each other on a 1 to 1 basis

    Kind regards

    Ewan
  • rmv_RUrmv_RU Member Posts: 119
    Ewan wrote:
    Hi
    I would like to create a routine that writes off historic small balances on the customer ledger.
    So my approach would be to import and post a set of sales journals to counter the balances.
    Next to create a report that when run applies the entries to each other on a 1 to 1 basis

    I have implemented functionality to manual write-off remaining amounts, caused multiply currencies in appled entreis.
    There are one form with two functions:

    SetEntry(VAR lCLE : Record "Cust. Ledger Entry")
    GET(lCLE."Entry No.");
    SETRECFILTER;
    CALCFIELDS(Amount, "Remaining Amount");
    IF Amount="Remaining Amount" THEN ERROR('Entry hasn't applied!');
    IF "Currency Code"='' THEN Currency.FIND('-')
    ELSE Currency.GET("Currency Code");
    IF Positive THEN BalanceAccountNo:=Currency."Realized Losses Acc."
    ELSE BalanceAccountNo:=Currency."Realized Gains Acc.";
    PostingDate:=lCLE."Posting Date"


    PostBalance()

    WITH GenJnlLine DO BEGIN
    INIT;
    "Document No.":=Rec."Document No.";
    "Account Type" := "Account Type"::Customer;
    VALIDATE("Account No.", Rec."Customer No.");
    "Posting Date":=PostingDate;
    Description := 'balance entry';
    "Bal. Account Type" := "Bal. Account Type"::"G/L Account";
    VALIDATE("Bal. Account No.",BalanceAccountNo);
    VALIDATE("Currency Code", Rec."Currency Code");
    IF Rec.Positive THEN BEGIN
    VALIDATE(Amount, -Rec."Remaining Amount");
    VALIDATE("Amount (LCY)",-Rec."Remaining Amt. (LCY)");
    END
    ELSE BEGIN
    VALIDATE(Amount, -Rec."Remaining Amount");
    VALIDATE("Amount (LCY)", -Rec."Remaining Amt. (LCY)");
    END;
    "Applies-to Doc. Type":=Rec."Document Type";
    "Applies-to Doc. No.":=Rec."Document No.";
    Description:=Desc;

    "Shortcut Dimension 1 Code":=Rec."Global Dimension 1 Code";
    "Shortcut Dimension 2 Code":=Rec."Global Dimension 2 Code";
    tempJnlLineDim.RESET;
    tempJnlLineDim.DELETEALL;
    LedgerEntryDim.SETRANGE("Table ID", DATABASE::"Cust. Ledger Entry");
    LedgerEntryDim.SETRANGE("Entry No.", Rec."Entry No.");

    DimMgt.CopyLedgEntryDimToJnlLineDim(LedgerEntryDim, tempJnlLineDim);
    GenJnlPostLine.RunWithCheck(GenJnlLine,tempJnlLineDim);
    CurrForm.CLOSE;
    END;
    Looking for part-time work.
    Nav, T-SQL.
  • EwanEwan Member Posts: 54
    Thank you for your help :D
Sign In or Register to comment.