Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I know if report is printed?
Message
 
À
08/08/2006 03:42:03
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
01140994
Message ID:
01143843
Vues:
49
Hi Agnes,

Thanks for sharing your code which helps me to get my job done. Now I am binding to the OnPreviewClose event of the Listener and be able to know if a report is printed or not in a strict forward manner. The logic is simpler in my case as all the reports are previewed first before printing so I don't have to bind to the CancelReport event and I don't have to be compatible with VFP8 neither. Btw I couldn't find any reference to the Listener CancelReport event in the Help file though...

I was thinking of binding to the cmdPrint button in the Preview toolbar and remove the Print menu item in the popup menu, but couldn't get the binding code working because I have to bind after I run REPORT FORM NOWAIT so that the listener.PreviewContainer.oForm is instantiated, but the NOWAIT will make the unbinding difficult. Your solution is simpler and more maintainable.


>Hi, PDMFJI,
>
>I like to give you my solution. It works for me. But it is a little tricky.
>For the first we have a problem with Reportbehavior 90.
>
>We need to decide if we print with or without preview.. Because of the Rendering system there are small differnces. For non preview reports we need simply to check if te report is not canceled via ESC. In preview the report is completely rendered on the point we decide to print so no report band or the like is activated.
>
>What I do is a small trick with eventbinding
>
>I need a method called "ReportEnd"like
>
>LPARAMETERS;
> tlPrint
>
>*FYI:
>#DEFINE dcPrintWindow_uk	'Printing...'
>#DEFINE dcPrintWindow_deu	'Drucken...'
>
>LOCAL;
> lnEvents AS INTEGER,;
> lnEvent  AS INTEGER,;
> llEvent  AS BOOLEAN
>
>LOCAL ARRAY;
> laAvents(1,3)
>
>lnEvents = AEVENTS(laEvents,THIS)
>
>FOR lnEvent = 1 TO lnEvents
> IF laEvents(lnEvent,1) AND LOWER(laEvents(lnEvent,4))=('reportend') THEN
>  llEvent = True
>  EXIT
> ENDIF &&laEvents(lnEvent,1) AND LOWER(laEvents(lnEvent,4))=('reportend')
>ENDFOR &&lnEvent
>
>IF llEvent THEN
> IF !EMPTY(AEVENTS(laEvents,0)) THEN
>*supress VFP 8 style call from frx, if the summary band still holds the call
>  DO CASE
>   CASE !laEvents(1,1).BASECLASS='Reportlistener'
>   CASE LOWER(laEvents(1,2))=('cancelreport')
>    THIS.glPrinted = False
>   CASE LOWER(laEvents(1,2))=('onpreviewclose') AND !tlPrint
>    THIS.glPrinted = False
>  ENDCASE
> ENDIF &&!EMPTY(AEVENTS(laEvents,0))
>ELSE &&llEvent
>*this is for REPORTBEHAVIOR 80 and needs a call to this method in summary band
> THIS.glPrinted = ;
>  WEXIST(dcPrintWindow_Deu) OR;
>  WEXIST(dcPrintWindow_Uk)
>ENDIF &&llEvent
>
>I call the report from a form like:
>
>toListener = .NULL.
>DO (_REPORTOUTPUT) WITH tnListenerType,toListener
>
>THIS.glPrinted = .T.
>BINDEVENT(toListener,'CancelReport'  ,THIS,'ReportEnd',1)
>BINDEVENT(toListener,'OnPreviewClose',THIS,'ReportEnd',1)
>
>REPORT FORM myReport OBJECT toListener
>
>UNBINDEVENTS(toListener,'OnPreviewClose',THIS,'ReportEnd')
>UNBINDEVENTS(toListener,'CancelReport'  ,THIS,'ReportEnd')
>
>*If THIS.glPrinted is false, the report was not send to any spooler
>
>
>
>HTH
>
>Agnes
>
>>I tried the technique in the mentioned message but found that it only works when ReportBehaviour=80:
>>
>>The following works, i.e. llprinted set to "2" when printed:
>> report form xxx to printer prompt preview
>>
>>But the followind doesn't, llprinted still set to "1" even when printed:
>> report form xxx to printer prompt object type 1
>>
>>Am I doing something wrong here?
>>
>>
>>>Check Message #984462
>>>
>>>
>>>>Oh in my case, it is good enough to assume "sent to spooler" == "report printed", all I want to make sure is that the user is not just previewing it and then close the preview window without printing the report.
>>>>
>>>>So how do I find out if a report is sent to the spooler?
>>>>
>>>>
>>>>
>>>>>>Hi Borislav, thanks for your feedback.
>>>>>>
>>>>>>I have a database field that needed to be updated when a report is physically printed. So I guess my best bet is to disable the print button in the print preview toolbar (I am using VFP9) and have another button or menu item for the user to print the report straight to the printer then.
>>>>>>
>>>>>>I am wondering is there a better way?
>>>>>>
>>>>>>>>Hi all,
>>>>>>>>
>>>>>>>>Is there a way to know that a report is physically printed rather then just previewing it?
>>>>>>>>
>>>>>>>>Thanks in advance.
>>>>>>>
>>>>>>>You could know if the report is sent to spooler, but physically printed - no (w/o asking the user).
>>>>>
>>>>>You didn't have to disable Print button, you still can know that the report is SEND to the spooler. BUT you are not able to know if the report is Physicaly printed. What happens if the report is sent to spoolre , but the printer is off and then user just delete the printer job?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform