No. of times a report is printed.

Sapphire123Sapphire123 Member Posts: 112
Hi All:

I'm trying to display a variable on the Sales Order Form, that displays the total number of time the Order Confirmation" report is printed.

:-k I was thinking of... incrementing the "No. Printed" Variable in the Sales Header table, each time I push the "Print" button from the Order Confirmation report. But, I'm not sure where to code this..

I understand that, "Print, Preview, Cancel, and Help" are all default buttons off any report, how do I access the "Print" button's OnPush Tigger?

Any suggestions?
Thanks...

Comments

  • ara3nara3n Member Posts: 9,256
    Check the sales invoice report on posted documents, it already does that for sales invoices.

    There is variable called Currreport.preview, that returns a boolean if you are actually printing.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SavatageSavatage Member Posts: 7,142
    I use a "No. Printed" on the sales header too.

    On the Order Confirmation Report on the Sales header Dataitem
    put

    OnAfterGetRecord()
    "No. Printed" := "No. Printed" + 1;

    You could Create a new counter just for the confirmation's as compared to Picking tickets. :-k
  • Sapphire123Sapphire123 Member Posts: 112
    Thanks so much!!
    (Sales Invoice won't work .. just because I need it on the Sales Order Form...)
  • SavatageSavatage Member Posts: 7,142
    He knows the sales invoice won't work for you.

    The suggestion was to check out the sales invoice report because it also has a "No. Printed" finctionality. Which you can see how it is done there and apply it to the sales order.
  • ara3nara3n Member Posts: 9,256
    Savatage wrote:
    He knows the sales invoice won't work for you.

    The suggestion was to check out the sales invoice report because it also has a "No. Printed" finctionality. Which you can see how it is done there and apply it to the sales order.

    Thanks for clarifying that.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Sapphire123Sapphire123 Member Posts: 112
    Oh sorry.. I guess I read it too fast... :)
    Thanks..
  • Sapphire123Sapphire123 Member Posts: 112
    Hey.. :|

    I guess i really spoke to soon..

    I used Order Confirmation just as an example to describe my situation. When I retested it, i noticed, "No. Printed" is an auto incremented variable by the system when you print the report, no need for any code change (note: the variable ONLY increments when you print an Order Confirmation Report)

    ... and when I tried to put the following code PrCtr := PrCtr + 1; under the Sales Header (dataitem) OnAfterGetReport (for the report I wanted to keep a track of.), nothing happens

    I also tried reading a bit on currentreport.preview... variable, but - it didn't seem to do what I need..

    navision does alot of behind the scene processing, e.g. counting the number of sales invoices/order confirmations printed per SI/SO respecti...
    how do I see this code

    thanks in advance..
  • matttraxmatttrax Member Posts: 2,309
    Just turn on the debugger and breakpoint on triggers and step through the code.
  • jlandeenjlandeen Member Posts: 524
    There are a number of codeunits that appear to do this (note my comments are from version 5.0) CDU 313 through CDU 320 all update Printed counts on documents. You could use the Where used function of the Developers Toolkit to track down any processes that use these to find examples.

    One word of caution: becareful about your record locking and updating in reports. If you lock a record at the beginning of a report being printed but don't commit it ever...that record is locked through the whole process. So make sure to do your table locks & updates (inlc. commits) either at the beginning OR end of the report to avoid impacting other users.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • SavatageSavatage Member Posts: 7,142
    ... and when I tried to put the following code PrCtr := PrCtr + 1; under the Sales Header (dataitem) OnAfterGetReport (for the report I wanted to keep a track of.), nothing happens

    Off the top of my head..
    If you want to create a new field that just counts Confirmation reports.

    You need to add your new field to the sales header
    "ConfCounter" type integer

    on the Confirmation Report
    OnAfterGetRecord()
    "ConfCounter" := "ConfCounter" + 1;

    You will need a "Sales Header".MODIFY;
    to set the change on the Sales header.
Sign In or Register to comment.