NetTalk Central

Author Topic: before print report  (Read 3908 times)

terryho

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
before print report
« on: May 23, 2011, 08:54:57 PM »
Hi

    I make a print button in the browse box. After I push the print button, I want to do something before the report procedure. Which is I want after push the print button, do some procedure to prepare the report, print the report in pdf and then display the pdf report in web page.

    I had work on various embeds point in browse procedure and the print procedure and can not figure out.

    Would you mind to advise what I can do?

    Regards

Terry Ho

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: before print report
« Reply #1 on: May 23, 2011, 09:13:27 PM »
Hi Terry,

Have a look at the serve document example.

I use this method to generate all my reports.

So on your button on the browse, add the URL for the servedocument procedure. I usually pass the name of the report with the URL. In the serve doc procedure I then get the name of the report from the URL and can run some custom code before passing it off to my report procedure. After the PDF or HTML is generated the program returns to the serve doc procedure which push's the file out to the browser.

I use List and Label to generate the reports so there may be an easier way to do what you want if using Clarion report or PDF Tools etc

HTH's

Kevin

terryho

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Re: before print report
« Reply #2 on: May 23, 2011, 11:54:57 PM »
Hi Kelvin

    Thanks you advise. But I still can not make it, would you mind to provide some example to follow!

    What I current working on.

    I create a NetWebPage procedure, the the "process code" embed point, I put the following code :

       Glo:PrintfileName = 'C:\TEMP\FILECOVERRPT.PDF'
   Loc:PrintFileName = CLIP(Glo:PrintfileName)
   Loc:RefNo = p_web.GetSessionValue('CLT:RefNo')
   Glo:FRBFilter = 'CLT:RefNo = ' & Loc:RefNo
   CLT:RefNo = Loc:RefNo
   IF NOT ACCESS:CLIENT.FETCH(CLT:RefNo_key)
      FIL:CODE = CLT:FileType
      IF NOT ACCESS:FILETYPE.FETCH(FIL:KFIL_CODE)
         IF FIL:FileCoverName <> ''
            CLEAR(FRB::ReportSearchPath)
            FRB::ReportFileName = CLIP(FIL:FileCoverName)
            FRB::ReportEditAction = FALSE
            START(FileCover,25000)
           
         END
      END
   END

   After running the above code, a blank page is display on the browse. It is because the "FileCover" procedure is still running. The report does not create at the moment. My "FileCover" procedure is using FominTools report builder (FRB) to build the report and use WpdfControl to make the PDF file.
After close the blank page, the report will make and in the temp directory.

    I don't know how to make the report make first and then call the NetWebPage procedure to display the pdf file. I try different method and can not figure out.

     Regards

Terry Ho

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: before print report
« Reply #3 on: May 24, 2011, 02:02:07 AM »
Hi Terry,

>> After I push the print button, I want to do something before the report procedure.

No, the push button is in the Browser - and the JavaScript there calls the Report Procedure.
By this point the Browse no longer exists on the server side.

So if you need to do something to prepare the report procedure, then put that in the INIT method of the report procedure. Search the report procedure for p_web - and you'll find an embed point which you can use.

cheers
Bruce

terryho

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Re: before print report
« Reply #4 on: May 31, 2011, 08:45:52 PM »
Hi Bruce,

    Thanks your hints.

    Now I can make normal clarion report to work with wpdfcontrol template. The following is the process :
    1. in normal clarion report, just like NetTalk web server pdf example.
    2. Add wpdfcontol template in program global extension (this is for license control)
    3. In the report procedure, add wpdfcontrol template into the procedure extension
    4. Use default value and pdf file name
    5. In the following embed point
 
        ThisWindow.AskPreview PROCEDURE

        ! Start of "WindowManager Method Executable Code Section"
        ! [Priority 1000]
 
        PDFname = clip(p_web.site.WebFolderPath) & '\' & loc:PDFName  ! tell the wpdfcontrol to save on this path and file name
        KS:SaveToPdf = 1   ! tell wpdfcontrol to save in pdf file

 
     6. add the above two line
     

     With the above input, you can make normal clarion report support with wpdfcontrol template.

     After I can make wpdfcontrol to work with FRB, then I will make a sample under the above method for the newsgroup reference.

     Thanks your help.

     Regards

Terry Ho