How single-line Journal Entry gets distributed into 2 in GL

knmknm Member Posts: 170
Hi,

I'm trying to find out how the single-line Journal Entry is being distributed into 2 GL Entry in NAV.
Is there a specific Codeunit that is handling this logic? Or is it some function within a Codeunit?

Thank you.

Kenji

Comments

  • jglathejglathe Member Posts: 639
    Hi Kenji,

    SplitJnlLine() in CU 12 does this. It gets called in the Code() function AFAIR.

    with best regards

    Jens


    ---
    I am here: http://maps.google.com/maps?ll=52.523624,13.376079
  • knmknm Member Posts: 170
    Hi Jens,

    Thank you so much for your respnse.
    I looked in the CU12, and couldn't find the SplitJnlLine() that you mentioned.
    I'm currently looking at my demo database in NAV2009R2 NA.

    Let me know if localized version has different logic. (which is less likely for G/L...)

    Thank you.

    Kenji
  • SPost29SPost29 Member Posts: 148
    If you look at CU 12 in the Code function you will see the code:
      IF "Account No." <> '' THEN
        CASE "Account Type" OF
          "Account Type"::"G/L Account":
            PostGLAcc;
          "Account Type"::Customer:
            PostCust;
          "Account Type"::Vendor:
            PostVend;
          "Account Type"::"Bank Account":
            PostBankAcc;
          "Account Type"::"Fixed Asset":
            PostFixedAsset;
          "Account Type"::"IC Partner":
            PostICPartner;
          END;
    
      IF "Bal. Account No." <> '' THEN BEGIN
        ExchAccGLJnlLine.RUN(GenJnlLine);
        IF "Account No." <> '' THEN
          CASE "Account Type" OF
            "Account Type"::"G/L Account":
              PostGLAcc;
            "Account Type"::Customer:
              PostCust;
            "Account Type"::Vendor:
              PostVend;
            "Account Type"::"Bank Account":
              PostBankAcc;
            "Account Type"::"Fixed Asset":
              PostFixedAsset;
            "Account Type"::"IC Partner":
              PostICPartner;
          END;
      END;
    
    This code posts to the acct and then to the balancing acct thus two entries.

    the SplitJnlLine function is part of codunit 22 Item Jnl. Post Line

    Steve
  • knmknm Member Posts: 170
    Hi Steve,

    Thank you for the clarification.
    I took a look a the code, and understood how the lines are getting split.
    And now I have another question with regards to this, do you know how the 2nd line is inheriting the Dimensions that were assigned to the 1st line.

    As an example, I took a look at the "PostGLAcc()", and couldn't find where it is defined.
    WITH GenJnlLine DO BEGIN
      // Post G/L entry
      InitGLEntry(
        "Account No.","Amount (LCY)",
        "Source Currency Amount",TRUE,"System-Created Entry");
      IF NOT "System-Created Entry" THEN
        IF "Posting Date" = NORMALDATE("Posting Date") THEN
          GLAcc.TESTFIELD("Direct Posting",TRUE);
      GLEntry."Gen. Posting Type" := "Gen. Posting Type";
      GLEntry."Bal. Account Type" := "Bal. Account Type";
      GLEntry."Bal. Account No." := "Bal. Account No.";
      GLEntry."No. Series" := "Posting No. Series";
      IF "Additional-Currency Posting" =
         "Additional-Currency Posting"::"Additional-Currency Amount Only"
      THEN BEGIN
        GLEntry."Additional-Currency Amount" := Amount;
        GLEntry.Amount := 0;
      END;
    
      InitVat;
      IF (GLEntry.Amount <> 0) OR (GLEntry."Additional-Currency Amount" <> 0) OR
         ("VAT Calculation Type" <> "VAT Calculation Type"::"Sales Tax")
      THEN
        InsertGLEntry(TRUE);
      PostJob;
      PostVAT;
    END;
    

    Thank you!

    Kenji
  • jglathejglathe Member Posts: 639
    Hi Kenji,

    I didn't remember correctly ;) When you take a look in CU366 Exchange Acc. G/L Journal Line, you'll see that all operations are done on the same record. The associated dimensions for this record are already copied into TempJnlLineDims and don't get changed, they are valid for the whole line.

    with best regards

    Jens
Sign In or Register to comment.