INCONSISTENT error on the G/L entry table when issuing

2»

Comments

  • AsallaiAsallai Member Posts: 141
    I've got this one from MS, use at ease if you have same trouble.

    The issue resolved in 5.01.
    Code fix:
    OBJECT: Codeunit 12 - Gen. Jnl.-Post

    Function InitVat
    //old code

    GLEntry.Amount := "VAT Base Amount (LCY)";
    GLEntry."VAT Amount" := "Amount (LCY)" - GLEntry.Amount;
    GLEntry."Additional-Currency Amount" := "Source Curr. VAT Base Amount";
    IF "Source Currency Code" = GLSetup."Additional Reporting Currency" THEN
    AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr(GLEntry."VAT Amount");


    //new code

    GLEntry.Amount := "VAT Base Amount (LCY)";
    GLEntry."VAT Amount" := "Amount (LCY)" - GLEntry.Amount;
    GLEntry."Additional-Currency Amount" := "Source Curr. VAT Base Amount";
    IF ("Source Currency Code" = GLSetup."Additional Reporting Currency") AND
    ("Currency Factor" = "VAT Currency Factor") THEN
    AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr(GLEntry."VAT Amount");



    //old code

    ROUND(
    "Source Currency Amount" / (1 + VATPostingSetup."VAT %" / 100),
    AddCurrency."Amount Rounding Precision");
    IF "Source Currency Code" = GLSetup."Additional Reporting Currency" THEN
    AddCurrGLEntryVATAmt := "Source Currency Amount" - GLEntry."Additional-Currency Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr(GLEntry."VAT Amount");


    //new code

    ROUND(
    "Source Currency Amount" / (1 + VATPostingSetup."VAT %" / 100),
    AddCurrency."Amount Rounding Precision");
    IF ("Source Currency Code" = GLSetup."Additional Reporting Currency") AND
    ("Currency Factor" = "VAT Currency Factor") THEN
    AddCurrGLEntryVATAmt := "Source Currency Amount" - GLEntry."Additional-Currency Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr(GLEntry."VAT Amount");



    //old code

    BEGIN
    IF "VAT Difference" <> 0 THEN BEGIN
    GLEntry."VAT Amount" := "VAT Amount (LCY)";
    IF "Source Currency Code" = GLSetup."Additional Reporting Currency" THEN
    AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr(GLEntry."VAT Amount");


    //new code

    BEGIN
    IF "VAT Difference" <> 0 THEN BEGIN
    GLEntry."VAT Amount" := "VAT Amount (LCY)";
    IF ("Source Currency Code" = GLSetup."Additional Reporting Currency") AND
    ("Currency Factor" = "VAT Currency Factor") THEN
    AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr(GLEntry."VAT Amount");



    //old code

    GLEntry.Amount := 0;
    GLEntry."Additional-Currency Amount" := 0;
    GLEntry."VAT Amount" := "Amount (LCY)";
    IF "Source Currency Code" = GLSetup."Additional Reporting Currency" THEN
    AddCurrGLEntryVATAmt := "Source Currency Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr("Amount (LCY)");


    //new code

    GLEntry.Amount := 0;
    GLEntry."Additional-Currency Amount" := 0;
    GLEntry."VAT Amount" := "Amount (LCY)";
    IF ("Source Currency Code" = GLSetup."Additional Reporting Currency") AND
    ("Currency Factor" = "VAT Currency Factor") THEN
    AddCurrGLEntryVATAmt := "Source Currency Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr("Amount (LCY)");



    //old code

    GLEntry."VAT Amount" := "Amount (LCY)" - GLEntry.Amount;
    END;
    GLEntry."Additional-Currency Amount" := "Source Curr. VAT Base Amount";
    IF "Source Currency Code" = GLSetup."Additional Reporting Currency" THEN
    AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr(GLEntry."VAT Amount");


    //new code

    GLEntry."VAT Amount" := "Amount (LCY)" - GLEntry.Amount;
    END;
    GLEntry."Additional-Currency Amount" := "Source Curr. VAT Base Amount";
    IF ("Source Currency Code" = GLSetup."Additional Reporting Currency") AND
    ("Currency Factor" = "VAT Currency Factor") THEN
    AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr(GLEntry."VAT Amount");


    //old code

    ROUND(GLEntry."VAT Amount" * "Currency Factor" / "VAT Currency Factor");
    END;
    END;
    IF "Source Currency Code" = GLSetup."Additional Reporting Currency" THEN
    AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr("VAT Amount (LCY)");


    //new code

    ROUND(GLEntry."VAT Amount" * "Currency Factor" / "VAT Currency Factor");
    END;
    END;
    IF ("Source Currency Code" = GLSetup."Additional Reporting Currency") AND
    ("Currency Factor" = "VAT Currency Factor") THEN
    AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
    ELSE
    AddCurrGLEntryVATAmt := CalcLCYToAddCurr("VAT Amount (LCY)");



    Function GLCalcAddCurrency
    ========================
    //old code

    (GenJnlLine."Additional-Currency Posting" = GenJnlLine."Additional-Currency Posting"::None)
    THEN BEGIN
    IF (GenJnlLine."Source Currency Code" = GLSetup."Additional Reporting Currency") AND
    UseAddCurrAmount
    THEN
    GLEntry."Additional-Currency Amount" := AddCurrAmount


    //new code

    (GenJnlLine."Additional-Currency Posting" = GenJnlLine."Additional-Currency Posting"::None)
    THEN BEGIN
    IF (GenJnlLine."Source Currency Code" = GLSetup."Additional Reporting Currency") AND
    (GenJnlLine."Currency Factor" = GenJnlLine."VAT Currency Factor") AND
    UseAddCurrAmount
    THEN
    GLEntry."Additional-Currency Amount" := AddCurrAmount
  • asemberengasembereng Member Posts: 220
    Is it possible to upload the entire codeUnits instead of bits and pieces? Thank you for your help.
  • ara3nara3n Member Posts: 9,256
    The code above is only a fix to some BUG to a certain version.


    I would ignore it.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • asemberengasembereng Member Posts: 220
    Do you have a better one that's fixes the problem?
  • Alex_ChowAlex_Chow Member Posts: 5,063
    asembereng wrote:
    Do you have a better one that's fixes the problem?

    Tell us where is the consistent error is originating.
  • AsallaiAsallai Member Posts: 141
    No, I'm using v4.0 ! The MS support is get this code above from 5.01! Because they are solved this in that version.
  • pranav-joshipranav-joshi Member Posts: 46
    Hi,

    In Navision when you do any transaction that related to accounts then system it self will take care that what ever entry generated due to that transaction must have Total Dr. and Total Cr. same, and if this is not same then it generate INCONSISTENCY Error in code unit no. 12 go to Line GLEntry.INSERT and put Message box below it and see what amout hits to which account by then you should atleast come to know which amount is wrong and then you can track that by debuging.


    :lol:
    Pranav
    Intech Systems Pvt. Ltd.

    Pranav Joshi
    MS Dynamics NAV Consultant
    SBS Group Desert Mountain (Formerly Silverware Inc.)
  • ara3nara3n Member Posts: 9,256
    It's funny the other day I used this at a client, and the problem was the order. Tax was set to be taxable on the header, but the some of the lines were not checked. By unchecking and checking the flag, it solved the problem but the inconsistency gl entries shows why it was the case.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • asemberengasembereng Member Posts: 220
    Its been awhile since i last visited this post but i am still having this problem. The client is not willing to upgrade to NAV 5 but wants this issue to be fixed. Anymore ideas??
  • ara3nara3n Member Posts: 9,256
    Get a copy of the db. Get the PO that causes the inconsistency and start debugging.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • asemberengasembereng Member Posts: 220
    what is PO?
    thank you
  • ara3nara3n Member Posts: 9,256
    by PO I meant the transaction that is causing the inconsistency. Basically what the user does that allows him to get the error.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.