Options

Posting Date from Purchase Invoice

nvermanverma Member Posts: 396
How can I get the posting Date from the Posted Invoice form (Purchase Header) to Fixed Asset form (specifically to the subform and display the value in the Depreciation Start Date).

I have tried following the code using the debugger and tried to step through it, but I gave up when the Debugger crashed in the middle (after I had been debugging it for about 75 minutes).

Is there an easier way of doing this. It is bring in the Book Value in the subform after it is done posting it, I just cant seem to find the exact location where it is doing that. Once I know where that is happening I can then figure out a way of setting the Posting Date to the Depreciation Start Date field.

Does anyone have a better way of bringing in the Posting Date from the Purchase Invoice to Fixed Asset subform? or what codeunit is used to calculate the Book value field in the Fixed Asset form (FA depreciation subform)???

Comments

  • Options
    skullaskulla Member Posts: 140
    In codeunit 12 - Gen. Jnl.-Post Line there is a function called PostFixedAsset and from there it will call 5632 where it will create FA Ledger Entry. You can include your code in 5632 or 5620 codeunits. I will let you decide where you want to place your code. I hope this gave you some direction.
  • Options
    udayrmerudayrmer Member Posts: 171
    You have "FA Posting Date" field in Purchase Line, it will be flowed to "FA Ledger Entry"'s "FA Posting Date".

    In general case "FA Posting Date" & "Posting Date" are same.
    Uday Mer | MS Dynamics NAV Techno-Functional Consultant
  • Options
    nvermanverma Member Posts: 396
    I was thinking about writing the code to the "Code" trigger (Codeunit : 5632)
    FADeprBook."Depreciation Starting Date" := FALedgerEntry."Posting Date";
    

    This should have done the trick, but it doesnt bring in the value. So i tried debugging it, and FALedgerEntry has the appropriate value but its not assigning it to the FADeprBook. Any Idea why. I thought it wasnt updating the table..so i tried: FADeprBook.Modify, but that just throws an error.

    I am pretty sure I am doing something very retarded.


    ******I think I messed it up. I was trying something out and now I am getting this error message in the codeunit that was working perfectly fine before: The record valriable must belong to 5621 and not to 5601.

    I deleted all the experimental code that I wrote, and still its giving me this message.****

    UPDATE:- I couldnt resolve that error issue and didnt really want to waste any more time on the error message. Before doing any of the changes, I made a backup. So I just replaced the file with the backup.
  • Options
    KYDutchieKYDutchie Member Posts: 345
    nverma,

    please do not modify NAV to "automate" that the posting date of the Fixed Assets Purchase order is copied into the start date of the depreciation period. It is easier and cheaper to instruct the user how to find that date and manually type it in. You can add a "posted purchase line" list form on one of the buttons, filtered to PO Line Type to "Fixed Asset" and to Depreciation Book Code to the FA Depreciation Book Code. But you can also just point the user to Form 7185 and teach them how to filter.

    But the way you were doing it in codeunit 5632 would change the Depreciation Start date each time a FALedgEntry was posted.

    Please be careful making modifications like this.

    Thanks,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
Sign In or Register to comment.