Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can preview those SELECTED, but not Print those SELECTED
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01221933
Message ID:
01223156
Views:
19
>Is it possible without using FILTER? I'm not sure report does respect filter settings.
>
>>>Move focus of the grid before priting.

Here is the code at the present....
LOCAL lcRxCaption,lcPharmacy,lcPhone, llMarked, lcSetExact

Thisform.cntActions.txtDrugFilter.Enabled = .T.
Thisform.cntActions.txtDrugFilter.SetFocus

llMarked = .F.

*TMT This code below is from the lblOrderBy click method... modified slightly to not show the messagebox in it...
STORE SET('EXACT') TO lcSetExact
SET EXACT OFF 

Thisform.mousepointer = 11
Thisform.m_Actions(2)
ThisForm.txtStatus.value = "Printing Patient Medical Reports..."

SELECT rx
*TMT 05/04/2007 Added to set the environment so that the report will see the rx table correctly and be 
*able to print the marked records...

*!*	IF Thisform.p_OrderBy = 1
*!*		SET ORDER TO filldate IN rx
*!*	ELSE
*!*		SET ORDER TO decendrx IN rx
*!*	ENDIF
*!*	SET KEY TO (STR(Thisform.p_patient_id))
GO TOP 
*

*Count the number of marked records in this filter range
DO WHILE NOT EOF('rx')
	IF marked = .T.
		llMarked = .T.
		EXIT 
	ENDIF
	SKIP  
ENDDO 

IF llMarked
	SELECT rx
	Thisform.cntActions.txtDrugFilter.Enabled = .T.
	Thisform.cntActions.txtDrugFilter.Visible = .T.
	Thisform.cntActions.txtDrugFilter.SetFocus
	
	REPORT FORM RxPMR FOR marked = .T. NOCONSOLE TO PRINTER PREVIEW 

	Thisform.cntActions.txtDrugFilter.Enabled = .F.
	Thisform.grdProfile.SetFocus
ELSE
	MESSAGEBOX("There are no Rx's selected to print the Patient Medical Report" + CHR(13) + ;
		"(To select a Rx, check it)",64,"Cannot Print PMR(s)")
ENDIF 

Thisform.cntActions.txtDrugFilter.Enabled = .F.
Thisform.grdProfile.SetFocus

Thisform.mousepointer = 0
ThisForm.txtStatus.value = ""

IF Thisform.p_OrderBy = 1
	SET ORDER TO filldate IN rx
ELSE
	SET ORDER TO decendrx IN rx
ENDIF

SELECT rx
SET KEY TO (STR(Thisform.p_patient_id))

IF Thisform.p_viewtype = 1
	SELECT refill
	SET FILTER TO INLIST(status,0,1,4,5)	&& 4 Included so batch Rx's cant be refilled

	SET EXACT OFF
	lcFilter = IIF(NOT EMPTY(Thisform.p_buffer),;
			Thisform.p_previousdrugfilter + " AND UPPER(drug.name) = '" + ;
			ALLTRIM(UPPER(Thisform.p_buffer)) + "' IN Rx",;
			Thisform.p_previousdrugfilter + " IN Rx")
	SELECT Rx
	SET FILTER TO &lcFilter
	GO TOP IN rx
ELSE
	SELECT refill
	SET FILTER TO 
	
	SELECT rx

	SET EXACT OFF
	lcFilter = IIF(NOT EMPTY(Thisform.p_buffer),;
		"UPPER(drug.name) = '" + ;
		ALLTRIM(UPPER(Thisform.p_buffer)) + "' IN Rx","")
	SELECT Rx
	SET FILTER TO &lcFilter
	GO TOP IN rx
ENDIF
*Thisform.grdProfile.refresh()

Thisform.m_UpdateStaticArea()
Thisform.MousePointer = 0
SET EXACT &lcSetExact

ThisForm.grdProfile.Refresh()
Thisform.m_Actions(1)
The Report itself does not have a Data Environment.

Still, the report will preview correctly on the screen... but does not print anything but a blank sheet when you select to print at that point.

Also.... I tried a different printer for the Windows Default printer for it to print to.

I changed to a Dot-matrix Okdidata Microline 320 and it printed a blank sheet, also.

BUT... when I changed the default Windows printer back to the Lexmark T-644 Laser Jet.... the report went back AGAIN to the Okidate dotmatrix printer!!! It totally ignored the Windows default, and went with what it last used!!!!

How is that possible??????? I am so........... confused!! (Could it be the Tag fields in the report???)
Tommy Tillman A+ NetWork+ MCP
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform