Which Navision code is posting sale & purchase values in GLs of GL Entry Table

Hello.

 

I am searching code in code unit 12, 21, 22 & 90 that is responsible for posting values in GL A/c No. in GL table at the time of Purchase and sale and i found function like InsertGLEntry() that is posting values from GLEntryTmp table type variable and this variable getting values from GLEntry table type variable and GLEntry variable getting values from GenJnlLine table type variable but unable to find actual codes that converting and assigning sale/purchase values according to GL Account nos.

So pls tell me where i can find it and share same codes ...

Thanks.

Parents Reply
  • PostExcise_Function.txt
    
    PostExcise(GenJnlLine : Record "Gen. Journal Line")
    WITH GenJnlLine DO BEGIN
      IF "Excise Amount" <> 0 THEN BEGIN
        IF "Gen. Posting Type" =  "Gen. Posting Type"::Purchase THEN BEGIN
          ExcisePostingSetup.SETRANGE("Excise Bus. Posting Group","Excise Bus. Posting Group");
          ExcisePostingSetup.SETRANGE("Excise Prod. Posting Group","Excise Prod. Posting Group");
          ExcisePostingSetup.SETRANGE("From Date",0D,GenJnlLine."Posting Date");
         IF ExcisePostingSetup.FIND('+') THEN
            IF (("Account Type" = "Account Type"::"Fixed Asset") OR
            (("Account Type" = "Account Type"::"G/L Account") AND ("Capital Item")))
            THEN BEGIN
               ExcisePostingSetup.TESTFIELD("Cenvat Cr. Receivable Account");
               InitGLEntry(ExcisePostingSetup."Cenvat Cr. Receivable Account",
               ROUND((("Excise Amount" - "ADC VAT Amount")/2) + "ADC VAT Amount"),
               ROUND((("Source Curr. Excise Amount" - "Source Curr. ADC VAT Amount")/2) + "Source Curr. ADC VAT Amount"),
               TRUE,"System-Created Entry");
               InsertGLEntry(TRUE);
    
               InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup."Cenvat Cr. Receivable Account",FALSE);
               ExcisePostingSetup.TESTFIELD("Cenvat Cr. (Deferred) Account");
               InitGLEntry(ExcisePostingSetup."Cenvat Cr. (Deferred) Account",
               ("Excise Amount" - ROUND((("Excise Amount"-"ADC VAT Amount")/ 2) + "ADC VAT Amount")),
               ("Source Curr. Excise Amount" - ROUND((("Source Curr. Excise Amount" - "Source Curr. ADC VAT Amount")/2) +
                "Source Curr. ADC VAT Amount")), TRUE,"System-Created Entry");
               InsertGLEntry(TRUE);
               InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup."Cenvat Cr. (Deferred) Account",TRUE);
           END ELSE BEGIN
             IF NOT Trading THEN BEGIN
               ExcisePostingSetup.TESTFIELD("Cenvat Cr. Receivable Account");
                 InitGLEntry(ExcisePostingSetup."Cenvat Cr. Receivable Account","Excise Amount","Source Curr. Excise Amount",
                 TRUE,"System-Created Entry");
                 InsertGLEntry(TRUE);
                 InsertExcise(GenJnlLine,ExcisePostingSetup."Cenvat Cr. Receivable Account");
             END ELSE BEGIN
               IF "Sales Return Order" THEN BEGIN
                  ExcisePostingSetup.TESTFIELD("Cenvat Transfered(Trading)");
                  InitGLEntry(ExcisePostingSetup."Cenvat Transfered(Trading)","Excise Amount","Source Curr. Excise Amount",
                  TRUE,"System-Created Entry");
                  InsertGLEntry(TRUE);
               END ELSE BEGIN
                 ExcisePostingSetup.TESTFIELD("Cenvat Cr. Receivable(Trading)");
                 InitGLEntry(ExcisePostingSetup."Cenvat Cr. Receivable(Trading)","Excise Amount" ,
                 "Source Curr. Excise Amount",TRUE,"System-Created Entry"); //FTS_AS_001 Modify Excise Amt
                 InsertGLEntry(TRUE);
                 //FTS_AS_001
                IF "ADC VAT Amount" <> 0 THEN BEGIN
                   InitGLEntry(ExcisePostingSetup."ADC VAT Account","ADC VAT Amount"
                   +"ADC VAT AmountClained"
                   ,"Source Curr. Excise Amount",
                   TRUE,"System-Created Entry");
                   InsertGLEntry(TRUE);
                END;
               //FTS_AS_001
              END;
             //InsertGLEntry(TRUE);//FTS_AS_01
             InsertExcise(GenJnlLine,ExcisePostingSetup."Cenvat Cr. Receivable(Trading)");//Sandeep
           END;
       END;
     END;
        IF "Gen. Posting Type" =  "Gen. Posting Type"::Sale THEN BEGIN
          ExcisePostingSetup.SETRANGE("Excise Bus. Posting Group","Excise Bus. Posting Group");
          ExcisePostingSetup.SETRANGE("Excise Prod. Posting Group","Excise Prod. Posting Group");
          ExcisePostingSetup.SETRANGE("From Date",0D,GenJnlLine."Posting Date");
          IF ExcisePostingSetup.FIND('+') THEN BEGIN
             IF "Document Type" = "Document Type" ::"Credit Memo" THEN BEGIN
               IF ("Account Type" = "Account Type"::"Fixed Asset") OR (("Account Type" = "Account Type"::"G/L Account") AND
               ("Capital Item"))
               THEN BEGIN
                 ExcisePostingSetup.TESTFIELD("Excise Payable Account");
                 InitGLEntry(ExcisePostingSetup."Excise Payable Account",
                 ROUND((("Excise Amount" - "ADC VAT Amount")/2) + "ADC VAT Amount"),
                 ROUND((("Source Curr. Excise Amount" - "Source Curr. ADC VAT Amount")/2) + "Source Curr. ADC VAT Amount"),
                 TRUE,"System-Created Entry");
                 InsertGLEntry(TRUE);
                 InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup."Excise Payable Account",FALSE);
                 ExcisePostingSetup.TESTFIELD("Cenvat Cr. (Deferred) Account");
                 InitGLEntry(ExcisePostingSetup."Cenvat Cr. (Deferred) Account",
                 ("Excise Amount" - ROUND((("Excise Amount"-"ADC VAT Amount")/ 2) + "ADC VAT Amount")),
                 ("Source Curr. Excise Amount" - ROUND((("Source Curr. Excise Amount" - "Source Curr. ADC VAT Amount")/2) +
                 "Source Curr. ADC VAT Amount")), TRUE,"System-Created Entry");
                 InsertGLEntry(TRUE);
                 InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup."Cenvat Cr. (Deferred) Account",TRUE);
              END ELSE BEGIN
                 IF NOT Trading THEN BEGIN
                    ExcisePostingSetup.TESTFIELD("Excise Payable Account");
                    InitGLEntry(ExcisePostingSetup."Excise Payable Account","Excise Amount","Source Curr. Excise Amount",
                    TRUE,"System-Created Entry");
                    InsertGLEntry(TRUE);
                    InsertExcise(GenJnlLine,ExcisePostingSetup."Excise Payable Account");
                END ELSE BEGIN
                  ExcisePostingSetup.TESTFIELD("Cenvat Transfered(Trading)");
                  InitGLEntry(ExcisePostingSetup."Cenvat Transfered(Trading)","Excise Amount","Source Curr. Excise Amount",
                  TRUE,"System-Created Entry");
                  InsertGLEntry(TRUE);
                  InsertExcise(GenJnlLine,ExcisePostingSetup."Cenvat Transfered(Trading)");
                END;
              END;
           END ELSE BEGIN
              IF NOT Trading THEN BEGIN
                ExcisePostingSetup.TESTFIELD("Excise Payable Account");
                InitGLEntry(ExcisePostingSetup."Excise Payable Account","Excise Amount","Source Curr. Excise Amount",
                TRUE,"System-Created Entry");
                InsertGLEntry(TRUE);
                InsertExcise(GenJnlLine,ExcisePostingSetup."Excise Payable Account");
              END ELSE BEGIN
                 ExcisePostingSetup.TESTFIELD("Cenvat Transfered(Trading)");
                 InitGLEntry(ExcisePostingSetup."Cenvat Transfered(Trading)","Excise Amount","Source Curr. Excise Amount",
                 TRUE,"System-Created Entry");
                 InsertGLEntry(TRUE);
                 //FTS_AS Code added to Create GL/Entry for "ADC VAT AMOUNT"
                 InitGLEntry(ExcisePostingSetup."ADC VAT Account",-(ABS(ROUND("ADC VAT Amount")))
                 +ABS(ROUND("ADC VAT AmountClained")),"Source Curr. Excise Amount",
                 TRUE,"System-Created Entry");
                 InsertGLEntry(TRUE);
                //RIL_AS
                {IF GenJnlLine."ADC VAT AmountClained" <> 0 THEN BEGIN
                InitGLEntry(ExcisePostingSetup."ADC Claim A/c","ADC VAT AmountClained","Source Curr. Excise Amount",
                TRUE,"System-Created Entry");
                InsertGLEntry(TRUE);
                END; }
              //RIL_AS
              IF GenJnlLine."SED PASS"  THEN    BEGIN
                InitGLEntry(ExcisePostingSetup."Custom Duty Account",+(ABS((ROUND("ADC VAT Amount")))
                +ABS(ROUND("ADC VAT AmountClained"))),"Source Curr. Excise Amount",
                TRUE,"System-Created Entry");
                InsertGLEntry(TRUE);
                END
             ELSE
             BEGIN
                 {InitGLEntry(ExcisePostingSetup."ADC Refund Due",-(ROUND("ADC VAT Amount")+
               ROUND("ADC VAT AmountClained")),"Source Curr. Excise Amount",
               TRUE,"System-Created Entry");}
               //RIL_AS
              IF GenJnlLine."ADC VAT AmountClained" <> 0 THEN BEGIN
                 InitGLEntry(ExcisePostingSetup."ADC Claim A/c",+(ABS(ROUND("ADC VAT AmountClained"))),"Source Curr. Excise Amount",
                 TRUE,"System-Created Entry");
                 InsertGLEntry(TRUE);
                 {InitGLEntry(ExcisePostingSetup."ADC Lapse A/c",-((ROUND("ADC VAT Amount"))),"Source Curr. Excise Amount",
                 TRUE,"System-Created Entry");
                 InsertGLEntry(TRUE); }
              END;
              InitGLEntry(ExcisePostingSetup."ADC Refund Due",+((ABS(ROUND("ADC VAT Amount")))),"Source Curr. Excise Amount",
               TRUE,"System-Created Entry");
              //RIL_AS
              //FTS_AS Code added to Create GL/Entry for "ADC VAT AMOUNT"
              InsertGLEntry(TRUE);
              END;
             InsertExcise(GenJnlLine,ExcisePostingSetup."Cenvat Transfered(Trading)");
    END;
    END;
    END;
    END;
    END
    //FTS_AS Code added to Create GL/Entry for "ADC VAT AMOUNT", Even Excise is not applicable.
    ELSE
    BEGIN
        ExPostingGrp.SETRANGE("Excise Bus. Posting Group","Excise Bus. Posting Group");
        ExPostingGrp.SETRANGE("Excise Prod. Posting Group","Excise Prod. Posting Group");
        ExPostingGrp.SETRANGE("From Date",0D,GenJnlLine."Posting Date");
        IF ExPostingGrp.FIND('-') THEN
          ExPostingGrp.TESTFIELD("ADC VAT Account");
          ExPostingGrp.TESTFIELD("ADC Refund Due");
          ExPostingGrp.TESTFIELD("ADC Claim A/c");
          ExPostingGrp.TESTFIELD("Custom Duty Account");
          IF GenJnlLine."ADC VAT AmountClained" <> 0 THEN
          InitGLEntry(ExPostingGrp."ADC VAT Account",
          -ABS(ABS(ROUND("ADC VAT Amount"))+ABS(ROUND("ADC VAT AmountClained")))
          ,"Source Curr. Excise Amount",
          TRUE,"System-Created Entry")
          ELSE
          InitGLEntry(ExPostingGrp."ADC VAT Account",-ABS(ABS(ROUND("ADC VAT Amount")
          )),"Source Curr. Excise Amount",
          TRUE,"System-Created Entry");
          InsertGLEntry(TRUE);
    //RIL_AS
        IF GenJnlLine."SED PASS" THEN BEGIN
           InitGLEntry(ExPostingGrp."Custom Duty Account",ABS(ROUND("ADC VAT Amount")),"Source Curr. Excise Amount",
           TRUE,"System-Created Entry");
           InsertGLEntry(TRUE);
       END
       ELSE
          {InitGLEntry(ExPostingGrp."ADC Refund Due",+ROUND("ADC VAT Amount") +
          ROUND("ADC VAT AmountClained"),"Source Curr. Excise Amount",
          TRUE,"System-Created Entry");}
         BEGIN
         IF GenJnlLine."ADC VAT AmountClained" <> 0 THEN BEGIN
             InitGLEntry(ExPostingGrp."ADC Claim A/c",+(ROUND("ADC VAT AmountClained")),"Source Curr. Excise Amount",
           TRUE,"System-Created Entry");
          InsertGLEntry(TRUE);
          { InitGLEntry(ExPostingGrp."ADC Lapse A/c",+(ROUND("ADC VAT Amount")
           ),"Source Curr. Excise Amount",
          TRUE,"System-Created Entry");
           InsertGLEntry(TRUE);}
         END;
        //ELSE BEGIN
           InitGLEntry(ExPostingGrp."ADC Refund Due",
           +ABS((ROUND("ADC VAT Amount")) ),"Source Curr. Excise Amount",
           TRUE,"System-Created Entry");
          InsertGLEntry(TRUE);  END;
         //END;
    END;
    //FTS_AS Code added to Create GL/Entry for "ADC VAT AMOUNT", Even Excise is not applicable.
    END;
    

    Thanx for your reply and explanation

    My purpose is posting of "Purchase Line"."Column Value" and "Sale Line"."Column Value" to G/L entry table against newly created GL.

    So i created new column in "Excise Posting Setup" table to mention new GL No. and trying to create new below function as created in above attachment for "ADC VAT Account".

    WITH GenJnlLine DO BEGIN

     IF "Excise Amount" <> 0 THEN BEGIN

       IF "Gen. Posting Type" =  "Gen. Posting Type"::Purchase THEN BEGIN

         ExcisePostingSetup.SETRANGE("Excise Bus. Posting Group","Excise Bus. Posting Group");

         ExcisePostingSetup.SETRANGE("Excise Prod. Posting Group","Excise Prod. Posting Group");

         ExcisePostingSetup.SETRANGE("From Date",0D,GenJnlLine."Posting Date");

        IF ExcisePostingSetup.FIND('+') THEN

           IF (("Account Type" = "Account Type"::"Fixed Asset") OR

           (("Account Type" = "Account Type"::"G/L Account") AND ("Capital Item")))

           THEN BEGIN

              ExcisePostingSetup.TESTFIELD("Cenvat Cr. Receivable Account");

              InitGLEntry(ExcisePostingSetup."Cenvat Cr. Receivable Account",

              ROUND((("Excise Amount" - "BED Amount")/2) + "BED Amount"),

              ROUND((("Source Curr. Excise Amount" - "Source Curr. BED Amount")/2) + "Source Curr. BED Amount"),

              TRUE,"System-Created Entry");

              InsertGLEntry(TRUE);

              InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup."Cenvat Cr. Receivable Account",FALSE);

              ExcisePostingSetup.TESTFIELD("Cenvat Cr. (Deferred) Account");

              InitGLEntry(ExcisePostingSetup."Cenvat Cr. (Deferred) Account",

              ("Excise Amount" - ROUND((("Excise Amount"-"BED Amount")/ 2) + "BED Amount")),

              ("Source Curr. Excise Amount" - ROUND((("Source Curr. Excise Amount" - "Source Curr. BED Amount")/2) +

               "Source Curr. BED Amount")), TRUE,"System-Created Entry");

              InsertGLEntry(TRUE);

              InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup."Cenvat Cr. (Deferred) Account",TRUE);

                 END ELSE

              IF "BED Amount" <> 0 THEN BEGIN

                  InitGLEntry(ExcisePostingSetup."BED Account","BED Amount"

                  ,"Source Curr. Excise Amount",

                  TRUE,"System-Created Entry");

                  InsertGLEntry(TRUE);

                END;  END;

    IF "Excise Amount" <> 0 THEN BEGIN

    IF "Gen. Posting Type" =  "Gen. Posting Type"::Purchase THEN BEGIN

       ExPostingGrp.SETRANGE("Excise Bus. Posting Group","Excise Bus. Posting Group");

       ExPostingGrp.SETRANGE("Excise Prod. Posting Group","Excise Prod. Posting Group");

       ExPostingGrp.SETRANGE("From Date",0D,GenJnlLine."Posting Date");

       IF ExPostingGrp.FIND('-') THEN BEGIN

         ExPostingGrp.TESTFIELD("BED Account");

          IF GenJnlLine."BED Amount" <> 0 THEN BEGIN

          InitGLEntry(ExPostingGrp."BED Account",ABS(ROUND("BED Amount")),"Source Curr. Excise Amount",

          TRUE,"System-Created Entry");

          InsertGLEntry(TRUE);

          END

          END;        END;END;   END;

Children
No Data
Related
Recommended