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:
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.
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).
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.
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.
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.
Just to add to the needed changes.
Had to start using Performer 8 and change function CreateTempJobJnlLine in table 39.
Added Type::resource next to G/L and Item.
Thanks for the guide. I'm just a beginner and stuff like this helps a lot!
Comments
I always say it's not possible and can think of some pitfalls if the customer starts using it. Am i correct?
Have you heard of Prozac?
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:
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
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).
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
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
Because of the new dimensions some code has to be replaced:
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
After ResJnlPostLine.RunWithCheck(ResJnlLine); in codeunit 90 I added:
And in codeunit 1001 in function InsertPurchLine:
And in codeunit 1004 in function FromPurchaseLineToJnlLine:
That's it. First tests are ok. Not yet tested completely.
Tino Ruijs
Microsoft Dynamics NAV specialist
Had to change function CreateTempJobJnlLine in table 39.
Added Type::resource next to G/L and Item.
Tino Ruijs
Microsoft Dynamics NAV specialist
Thanks for the guide. I'm just a beginner and stuff like this helps a lot!