How to enable the purchases of Resources in Dynamics NAV?

AdministratorAdministrator Posts: 2,425Member, Moderator, Administrator
edited 2014-04-17 in How Tos section
How to enable the purchases of Resources in Dynamics NAV?

http://www.mibuso.com/howtoinfo.asp?FileID=20

Discuss this How To here.

Comments

  • BlackTigerBlackTiger Posts: 1,203Member
    What is a point to post this "helpful" how-to?
    Each NAV developer knows how to do it. It's task for beginners.
    "You can’t just ask customers what they want and then try to give that to them.
    By the time you get it built, they’ll want something new.” Steve Jobs
  • Luc_VanDyckLuc_VanDyck AartselaarPosts: 3,632Member, Moderator, Administrator
    So you are saying that How To's for beginners should not be posted. Don't you forget you were once a beginner also.
    No support using PM or e-mail - Please use this forum. || Search is your friend
    NAV TechDays 2019: 21 & 22 November 2019, Antwerp (Belgium)
  • BlackTigerBlackTiger Posts: 1,203Member
    Ok. In this case let's post "how-to" for... EVERYTHING...

    Posting of exact "code" as "how-to" has a big danger. Most of "beginners" will think it's a "the only holy way" to do something and will stop to think and invent and to have own opinion.
    "You can’t just ask customers what they want and then try to give that to them.
    By the time you get it built, they’ll want something new.” Steve Jobs
  • ajhvdbajhvdb Posts: 672Member
    I never implemented this but like the howto, thx.

    I always say it's not possible and can think of some pitfalls if the customer starts using it. Am i correct?
  • BlackTigerBlackTiger Posts: 1,203Member
    ajhvdb wrote:
    I never implemented this but like the howto, thx.

    I always say it's not possible and can think of some pitfalls if the customer starts using it. Am i correct?

    You're quite extraordinary man! :) Seriously!
    Most of "consultants" I know will tell "ofcoz it's possible!" before asking developer or anybody else with NAV knowledge. :D

    PS: Of cause everything is possible in NAV, but...
    1. Sometimes it's stupid
    2. Sometimes it doesn't worth spent resources
    "You can’t just ask customers what they want and then try to give that to them.
    By the time you get it built, they’ll want something new.” Steve Jobs
  • David_SingletonDavid_Singleton Posts: 5,454Member
    BlackTiger wrote:
    What is a point to post this "helpful" how-to?
    Each NAV developer knows how to do it. It's task for beginners.


    Have you heard of Prozac? :mrgreen:
    David Singleton
  • garakgarak Posts: 3,263Member
    good post. it gives a good start point to implement the resources on purchase.
    Hope no customer of mine, which i have sold this customized add-on for some times, find this how to ;-) then they see, that my settle time is to "heavy" :whistle:
    Do you make it right, it works too!
  • Alex_ChowAlex_Chow Posts: 5,063Member
    One thing I might add to this add-on (if it hasn't been mentioned already) is that don't just download the objects and import it into your database. You will need a developer license in order to put this mod in.
  • mgmmgm Posts: 126Member
    ehhh (I almost don't dare to ask),
    Just some beginners questions:
    - Where are Job Ledger Entries created?
    - What version is it made for?
    Since 5.0 a Job has a Task and Planning Lines. I don't see anything with that.
    (I must admit I did not try the code yet).
  • zoranpzoranp Posts: 3Member
    Hi,

    I love this code. I'm just sorry that mibuso didn't exist when I started to "adapt" NAV.

    But going back to the topic - your how-to is not complete. You forgot to mention these:
    - you need to include table 5110
    - you need to change OptionString and OptionCaption of field Type on forms 54,55,97,98,5165,5168,6641 and include Resource otherwise it will not show in these forms
    - what about Requisition Lines and changes to Calculate Plan batch job?
    - what about using Resource Costs?
    - what about adding Purchase option also to Res. Journal Line?

    These are all things that you have to consider before enabling purchase of resources.

    Greetings,
    Zoran
  • chadchad Posts: 25Member
    Very helpful topic specially for begginers modifying purchases. :)
  • MeriMeri Posts: 29Member
    :D :D Hi everyone :)

    I saw the code for purchasing Resources and it is very very helpfull but I cannot understand the folloing two rows:

    ResJnlLine."Unit Price" := PurchLine.Amount/PurchLine.Quantity;
    ResJnlLine."Total Price" := PurchLine.Amount;

    Why the Purchase Price and the Purchase Amount are taken for Unit Price and Total Price while posting (aren't the Unit Price and Total Price related to sales transactions? After posting the Purchase transaction in the Resource Ledger Entry the Unit Cost/Total Cost and the Unit Price/Total Price have same values. Why is that?

    I did post Purchase Entry with the Resource Jounral and the Unit Price/Total Price are left blank in the RLE if there isn't defined Unit Price on the Resource Card or if there is defined Unit Price in the Resource card are filled with the Unit Pirce form the Resource Card which means in the two cases are different than the Unit Cost/Total Cost.

    Can somebody explain? :oops:

    Thanks in advance :)
  • tinoruijstinoruijs Posts: 1,226Member
    Just implemented this in NAV 2013 R2.
    Because of the new dimensions some code has to be replaced:
              //TempJnlLineDim.DELETEALL;
              //TempDocDim.RESET;
              //TempDocDim.SETRANGE("Table ID",DATABASE::"Purchase Line");
              //TempDocDim.SETRANGE("Line No.",PurchLine."Line No.");
              //DimMgt.CopyDocDimToJnlLineDim(TempDocDim,TempJnlLineDim);
              ResJnlLine."Dimension Set ID" := PurchLine."Dimension Set ID";
    

    Much easier than before. :-)

    Now I only have to find out why there are no Job Ledger Entries created when posting an invoice to a Job.. :-(

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • tinoruijstinoruijs Posts: 1,226Member
    tinoruijs wrote:
    Now I only have to find out why there are no Job Ledger Entries created when posting an invoice to a Job.. :-(

    After ResJnlPostLine.RunWithCheck(ResJnlLine); in codeunit 90 I added:
              // RS TRU 19-02-2014 BEGIN
              IF (PurchLine."Job No." <> '') THEN BEGIN;
                CreateJobPurchLine(JobPurchLine,PurchLine,"Prices Including VAT");
                JobPostLine.InsertPurchLine(PurchHeader,PurchInvHeader,PurchCrMemoHeader,JobPurchLine,SrcCode);
              END;
              // RS TRU 19-02-2014 END
    

    And in codeunit 1001 in function InsertPurchLine:
    // RS TRU 19-02-2014 BEGIN
    //IF (PurchLine.Type <> PurchLine.Type::Item) AND (PurchLine.Type <> PurchLine.Type::"G/L Account") THEN
    //  EXIT;
    IF (PurchLine.Type <> PurchLine.Type::Item) AND 
       (PurchLine.Type <> PurchLine.Type::"G/L Account") AND
       (PurchLine.Type <> PurchLine.Type::Resource) THEN
      EXIT;
    // RS TRU 19-02-2014 END
    

    And in codeunit 1004 in function FromPurchaseLineToJnlLine:
      // RS TRU 19-02-2014 BEGIN
      //IF Type = Type::"G/L Account" THEN
      //  JobJnlLine.VALIDATE(Type,JobJnlLine.Type::"G/L Account")
      //ELSE
      //  JobJnlLine.VALIDATE(Type,JobJnlLine.Type::Item);
      CASE Type OF
        Type::"G/L Account": JobJnlLine.VALIDATE(Type,JobJnlLine.Type::"G/L Account");
        Type::Item: JobJnlLine.VALIDATE(Type,JobJnlLine.Type::Item);
        Type::Resource: JobJnlLine.VALIDATE(Type,JobJnlLine.Type::Resource);
      END;
      // RS TRU 19-02-2014 END
    

    That's it. First tests are ok. Not yet tested completely.

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • tinoruijstinoruijs Posts: 1,226Member
    Just to add to the needed changes.
    Had to change function CreateTempJobJnlLine in table 39.
    Added Type::resource next to G/L and Item.

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • MoiresMoires Posts: 1Member
    Thanks for the guide. I'm just a beginner and stuff like this helps a lot!
Sign In or Register to comment.