Options

LS Retail Statement Post - Error with VAT Setup

voyager99voyager99 Member Posts: 15
Hi,

i hope that one of yours can help me, or can give a hint.

There are many Transactions with Trans. Sales Entries in the database.
The Statements are calculated.
At the Beginning of Posting, for example Line 2 of Statement Line, i get following Error.

The VAT Setup doesnt exist.
VAT Bus Group '', BLANK, VAT Prod. code = '' BLANK.

The Items are complete, the Customers are complete, the Store card hast Gen Bus Group and VAT Bus Group. ](*,)

Have anyone an idea :?: :idea:

LS Retail 4.0 - No PlusPOS, POS-Import 3-party-appl.

Thanks
voy

At least the info, in this database there are three companies, in two it works correct, without an error. Sames Objects ... ?

Answers

  • ara3nara3n Member Posts: 9,258
    The VAT Bus.Posting Group comes from Transaction Header table during posting of a statement. The transaction header "Bus.Posting Group" gets populated from Store."Store VAT Bus. Post. Gr.".
    It looks like when the transaction were inserted the store was not setup.
    You need to fix the transaction header table and populate the fields.


    Usually these fields are blank if you are using sales tax.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • voyager99voyager99 Member Posts: 15
    Hi ara3n,

    my the store card was setup with "Store VAT Bus. Post. Gr".
    And all Trans. Header have an "VAT Bus. Rel. Grp.".
    And all Items, where used while posting have gen.prod.grp. and vat prod.grp..

    any other ideas ?

    Voy

    Is there a limit with quantity of trans. in one Statement ?
  • ara3nara3n Member Posts: 9,258
    the code for posting statement in CU 9900457 is in here

    IF Transaction."To Account" THEN BEGIN
      GenPostingSetup.GET(CustomerRec."Gen. Bus. Posting Group",Item."Gen. Prod. Posting Group");
    END ELSE BEGIN
      GenPostingSetup.GET(Store."Store Gen. Bus. Post. Gr.",Item."Gen. Prod. Posting Group");
    END;
    VATPostingSetup.GET(Transaction."VAT Bus.Posting Group",Item."VAT Prod. Posting Group");
    
    


    Turn on the debugger and see where the error stops. Post the code in here.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,258
    btw, No there is no limit. Well there is a limit; the harddisk on your system.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • voyager99voyager99 Member Posts: 15
    Hi, i´ve turned on the debugger :)
    InitVat()
    WITH GenJnlLine DO
      IF "Gen. Posting Type" <> 0 THEN BEGIN // None                                    ##### at this line stops the debugger ! ####
        VATPostingSetup.GET("VAT Bus. Posting Group","VAT Prod. Posting Group");
        TESTFIELD("VAT Calculation Type",VATPostingSetup."VAT Calculation Type");
        CASE "VAT Posting" OF
          "VAT Posting"::"Automatische MwSt.-Buch.":
            BEGIN
              GLEntry."Gen. Bus. Posting Group" := "Gen. Bus. Posting Group";
              GLEntry."Gen. Prod. Posting Group" := "Gen. Prod. Posting Group";
              GLEntry."VAT Bus. Posting Group" := "VAT Bus. Posting Group";
              GLEntry."VAT Prod. Posting Group" := "VAT Prod. Posting Group";
              GLEntry."Reason Code" := "Reason Code"; //LS4.0
              GLEntry."Tax Area Code" := "Tax Area Code";
              GLEntry."Tax Liable" := "Tax Liable";
              GLEntry."Tax Group Code" := "Tax Group Code";
              GLEntry."Use Tax" := "Use Tax";
              CASE "VAT Calculation Type" OF
                "VAT Calculation Type"::"Normale MwSt.":
                  BEGIN
                    IF "VAT Difference" <> 0 THEN BEGIN
                      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");
                    END ELSE BEGIN
                      GLEntry.Amount := ROUND("Amount (LCY)" / (1 + VATPostingSetup."VAT %" / 100));
                      GLEntry."VAT Amount" := "Amount (LCY)" - GLEntry.Amount;
                      GLEntry."Additional-Currency Amount" :=
                        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");
                    END;
                  END;
                "VAT Calculation Type"::Erwerbsbesteuerung:
                  CASE "Gen. Posting Type" OF
                    "Gen. Posting Type"::Einkauf:
                      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");
                        END ELSE BEGIN
                          GLEntry."VAT Amount" := ROUND(GLEntry.Amount * VATPostingSetup."VAT %" / 100);
                          AddCurrGLEntryVATAmt :=
                            ROUND(
                              GLEntry."Additional-Currency Amount" * VATPostingSetup."VAT %" / 100,
                              AddCurrency."Amount Rounding Precision");
                        END;
                      END;
                    "Gen. Posting Type"::Verkauf:
                      BEGIN
                        GLEntry."VAT Amount" := 0;
                        AddCurrGLEntryVATAmt := 0;
                      END;
                  END;
                "VAT Calculation Type"::"Nur MwSt.":
                  BEGIN
                    CASE "Gen. Posting Type" OF
                      "Gen. Posting Type"::Verkauf:
                        BEGIN
                          VATPostingSetup.TESTFIELD("Sales VAT Account");
                          TESTFIELD("Account No.",VATPostingSetup."Sales VAT Account");
                        END;
                      "Gen. Posting Type"::Einkauf:
                        BEGIN
                          VATPostingSetup.TESTFIELD("Purchase VAT Account");
                          TESTFIELD("Account No.",VATPostingSetup."Purchase VAT Account");
                        END;
                    END;
                    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)");
                  END;
                "VAT Calculation Type"::Verkaufssteuer:
                  BEGIN
                    IF ("Gen. Posting Type" = "Gen. Posting Type"::Einkauf) AND
                       "Use Tax"
                    THEN BEGIN
                      GLEntry."VAT Amount" :=
                        ROUND(
                          SalesTaxCalculate.CalculateTax(
                            "Tax Area Code","Tax Group Code","Tax Liable",
                            "Posting Date","Amount (LCY)",Quantity,0));
                      GLEntry.Amount := "Amount (LCY)";
                    END ELSE BEGIN
                      GLEntry.Amount :=
                        ROUND(
                          SalesTaxCalculate.ReverseCalculateTax(
                            "Tax Area Code","Tax Group Code","Tax Liable",
                            "Posting Date","Amount (LCY)",Quantity,0));
                      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");
                  END;
              END;
            END;
          "VAT Posting"::"Manuelle MwSt.-Buch.":
            BEGIN
              IF GenJnlLine."Gen. Posting Type" <> GenJnlLine."Gen. Posting Type"::Ausgleich THEN BEGIN
                GLEntry."Gen. Bus. Posting Group" := "Gen. Bus. Posting Group";
                GLEntry."Gen. Prod. Posting Group" := "Gen. Prod. Posting Group";
                GLEntry."VAT Bus. Posting Group" := "VAT Bus. Posting Group";
                GLEntry."VAT Prod. Posting Group" := "VAT Prod. Posting Group";
                GLEntry."Tax Area Code" := "Tax Area Code";
                GLEntry."Tax Liable" := "Tax Liable";
                GLEntry."Tax Group Code" := "Tax Group Code";
                GLEntry."Use Tax" := "Use Tax";
                GLEntry."VAT Amount" := "VAT Amount (LCY)";
                IF "Source Currency Code" = GLSetup."Additional Reporting Currency" THEN
                  AddCurrGLEntryVATAmt := "Source Curr. VAT Amount"
                ELSE
                  AddCurrGLEntryVATAmt := CalcLCYToAddCurr("VAT Amount (LCY)");
              END;
            END;
        END;
      END;
    GLCalcAddCurrency(GLEntry."Additional-Currency Amount",TRUE);
    

    Here is my code, but it is default code of LS Retail 4.0.
    The GenJnlLine REC have no VAT Gen Bus code and no VAT Prod Grp. Code! In the Posting Buffer in Codeunit 99001457 there ist no VAT Gen Bus code and no VAT Prod Grp., too. :?:

    This error is only with one tender type !
    Where is the mistake in my tender type (setup) :-ken

    Voy
  • ara3nara3n Member Posts: 9,258
    Ok here is what I think the problem is. You have on the tender type setup a GL Account No. THe GL Account No. doesn't have the
    "VAT Bus. Posting Group"
    "VAT Prod. Posting Group"

    Please fix the GL account you should be set.

    Go to the store card. find the store. click on store button and select tender type. click on posting tab and lookup into the gl account. Go to GL card and make sure it has the correct setup.

    Also if you have a difference GL account No on tender type that it is setup correctly also.


    If that's not the case. do turn on the debugger and it will stop at the same place. paste the Call Stack in here.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • voyager99voyager99 Member Posts: 15
    Hi,

    i have checked the GL Accounts in the other companies. there were no Posting Type an no gen bus grp, and so on.
    Then i searched for the point, if the Posting Buffer loses the data of VAT Bus Post. Grp and VAT Prod. Post. Grp.
    It was in the trigger in cu statement post, where the tender type ist NOT Customer, then there is a validate of the GL Account. :-k

    I cleared the Fields in the GL Account on the register Posting and the posting of the statement have no error. \:D/

    Thanks for your help.

    Voy
  • ara3nara3n Member Posts: 9,258
    Great. I wish LS retail puts some more meaningful error in their code.
    It sucks to look at code to figure out what is not setup.
    Ahmed Rashed Amini
    Independent Consultant/Developer


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