Direct Links to Ledger Entries

vinodalathvinodalath Member Posts: 14
Can anyone help on the below?

From the Ledger Entries screen, clicking on a particular transaction line should open the Posted Sales Invoice form with the invoice details.

Thanks,

Vinod

Answers

  • DaveTDaveT Member Posts: 1,039
    Hi Vinod,

    You can acheive this with code. You will need to do this for each type but here's sample code
        CLEAR( PostedSalesInvoice );
        PostedSalesInv.SETRANGE( "No.", CLE."Document no." );
        PostedSalesInvoice.LOOKUPMODE(TRUE );
        PostedSalesInvoice.SETTABLEVIEW( PostedSalesInv );
        PostedSalesInvoice.RUNMODAL;
    
    where CLE is a record variable of Customer ledger entry
    PostedSalesInv is a record variable of Posted Sales Invoice
    PostedSalesInvoice is a form of Posted Sales Invoice

    Welcome to Mibuso :wink:
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • kinekine Member Posts: 12,562
    vinodalath wrote:
    Can anyone help on the below?

    From the Ledger Entries screen, clicking on a particular transaction line should open the Posted Sales Invoice form with the invoice details.

    Thanks,

    Vinod

    1) Just clicking on the line is not enough in NAV to open something... you need to use some button or button with hotkey to open it.
    2) For same result you can use the Navigate functionality
    3) Are you talking about GL Ledger entries or Item Ledger Entries?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DaveTDaveT Member Posts: 1,039
    Hi Kamil,

    Can you not acheive the "double click" using a button with default property to yes ? ... Works for me :wink:
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • kinekine Member Posts: 12,562
    DaveT wrote:
    Hi Kamil,

    Can you not acheive the "double click" using a button with default property to yes ? ... Works for me :wink:

    Ok, but what if I double-click outside the table box or on some edit box (like some header fields etc.)?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DaveTDaveT Member Posts: 1,039
    Hi Kamil,

    Ok fair point but Vinod did say
    From the Ledger Entries screen, clicking on a particular transaction line
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • SavatageSavatage Member Posts: 7,142
    kine wrote:
    2) For same result you can use the Navigate functionality

    Click On entry->Navigate->Posted Sales Invoice->Show->Shft-F5

    I guess they want to eliminate a click or 2 :whistle:

    Navigate works fine no need to reinvent it. As stated above if you use code you have to plan for all the types.....

    Do you want credits to show the posted credit?
    Payments to show you the Deposit?
    What if it was just a journal entry?

    For me I would do something like...OnLookup of the Document No add code. (Using code snipit from above :))
    CASE "Document Type" OF "Document Type"::"Credit Memo":
     BEGIN
        CLEAR(PostedCreditForm);
        PostedCreditInv.SETFILTER(PostedCreditInv."No.","Document No.");
        PostedCreditForm.LOOKUPMODE(TRUE );
        PostedCreditForm.SETTABLEVIEW(PostedCreditInv);
        PostedCreditForm.RUNMODAL;
     END
    END;
    CASE "Document Type" OF "Document Type"::Invoice:
     BEGIN
        CLEAR(PostedSalesForm);
        PostedSalesInv.SETFILTER(PostedSalesInv."No.","Document No.");
        PostedSalesForm.LOOKUPMODE(TRUE );
        PostedSalesForm.SETTABLEVIEW(PostedSalesInv);
        PostedSalesForm.RUNMODAL;
     END
    END;
    CASE "Document Type" OF "Document Type"::Payment:
     BEGIN
        CLEAR(PostedPaymentForm);
        PostedPaymentInv.SETFILTER(PostedPaymentInv."No.","Document No.");
        PostedPaymentForm.LOOKUPMODE(TRUE );
        PostedPaymentForm.SETTABLEVIEW(PostedPaymentInv);
        PostedPaymentForm.RUNMODAL;
     END
    END;
    

    PostedSalesInv-Record-Sales Invoice Header
    PostedCreditInv-Record-Sales Cr.Memo Header
    PostedSalesForm-Form-Posted Sales Invoice
    PostedCreditForm-Form-Posted Sales Credit Memo
    PostedPaymentInv-Record-Posted Deposit Header
    PostedPaymentForm-Form-Posted Deposits
    CLE-Record-Cust. Ledger Entry

    Now all you have to do is use the lookup on the Document No of the CLE's and it will bring you to the Inv,Credit or payment

    **note your Deposit tables might vary from mine
    Someone will probably come by and convert this to 3 lines of code :lol::lol:
  • vinodalathvinodalath Member Posts: 14
    Thanks for all the replies. The below code worked for us.

    Added the following code to a button c/al code. Had to create two Global Variables InvoiceHeader & CreditMemoHeader in the Cust Ledger Entry Form.


    IF "Document Type" = "Document Type"::Invoice THEN
    BEGIN
    InvoiceHeader.GET("Document No.");
    FORM.RUN(FORM::"Posted Sales Invoice", InvoiceHeader);
    END
    ELSE IF "Document Type" = "Document Type"::"Credit Memo" THEN
    BEGIN
    CreditMemoHeader.GET("Document No.");
    FORM.RUN(FORM::"Posted Sales Credit Memo", CreditMemoHeader);
    END;
Sign In or Register to comment.