Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

How this code will work

(0) ShareShare
ReportReport
Posted on by 3,027

Hi

   How this will work

Pline is Structured order Line Details
Pack is Purchase Line

PLine.SETFILTER("Document No.",PoNo);
PLine.SETRANGE(PkLine1."Tax/Charge Group",'PACK');
IF PLine.FINDFIRST THEN
  IF PLine."Calculation Type" = PkLine1."Calculation Type"::Percentage THEN BEGIN
    Pack.RESET;
    Pack.SETRANGE("Document No.","Purchase Header"."No.");
    IF Pack.FINDFIRST THEN
      Pack.CALCSUMS(PackLine.Amount);
   Pkg += (Pack.Amount * PLine."Calculation Value") / 100;
   END ELSE BEGIN
    REPEAT
      Pkg += PLine.Amount;
    UNTIL PLine.NEXT=0;
  END;


Thanks

*This post is locked for comments

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,749 on at
    RE: How this code will work

    If it finds the PLLine then it will execute the IF condition and if that is true it will execute that piece of code and will exit else it will loop through the lines. You can set breakpoints use debugger and check it.

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: How this code will work

    For how this code work you can set breakpoint and activate debugger to check how it works . It will help you also to understand the logic

    It will display the value based on condition PLine.Calculation Type

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: How this code will work

    Hi

       Pkline1 is same as Pline wrongly written Pkline1.  How if-else condition works

    Thanks

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,749 on at
    RE: How this code will work

    What do you mean how this will work ? what PKLine1 in the above code ? 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans