Imprimir infome directo a impresora sin vista previa

Muy estimado devilzito :
te agradeceria muchisimo si me ayudaras a imprimir un
reporte directo a impresora,
 por medio de un programa deshabilite
el icono de la impresora en la barra report preview pero ahora no encuentro
la forma de imprimir el informe, ya que me aparece la opcion de impresoras imprimo
y aparece el informe en la impresora pero no lo imprme.
en si es un ticket  y no se necesita impresion previa.
por tu atencion
gracias
demetrio
[email protected]

1 respuesta

Respuesta
1
local Impresora as string
impresora='ibm propinter'
report form MiReporte to printer (impresora)
Donde el valor de la variable impresora es el nombre de windows que tiene tu impresora en el panel de control.
muy estimado devilzito :
probe tu codigo pero no me acepta grabar me da un eror
mira esta es mi instrucion a un botom de comando
en el evento click hasa ahi llego a la vista previa sin deshabilitar la barra vista prevew, no quiero pasar por la vista previa
quiero la impresion directa mi impresora es panasonic kx-p1695
if empty (thisform.txtfecha2.value)
messagebox("No selecciono ningun registro para Imprimir",32,"Error")
thisform.command2.setfocus
else
cid=thisform.txtcId.value
fecha=thisform.txtfecha2.value
cnomprod=thisform.Grdcuentas1.value
entrada=thisform.Grdcuentas1.value
precio=thisform.Grdcuentas1.value
report form cobro.FRX preview
endif
echame la mano inserta tu variable o dime donde la pongo ya que probablemete
la este declarando en un lugar equivocado
gracias anticipadas por tu ayuda
demetrio
Qudaría así:
local impresora as string
impresora='Oki C3400'
set printer to name (impresora)
if empty (thisform.txtfecha2.value)
messagebox("No selecciono ningun registro para Imprimir",32,"Error")
thisform.command2.setfocus
else
cid=thisform.txtcId.value
fecha=thisform.txtfecha2.value
cnomprod=thisform.Grdcuentas1.value
entrada=thisform.Grdcuentas1.value
precio=thisform.Grdcuentas1.value
report form cobro.FRX  TO PRINTER
set printer to
Endif
Procura poner el valor a la variable impresora con el nombre de windows de la impresora tuya.
Suerte
Muy estimado Devilzito :
antes que nada una disculpa por no contestar a tiempo tu respuesta
en la primera opcion qu me diste funciono ya que me diste la  idea y
resulta que mi reporte estaba mal configurado
 y no era la impresora pero de cualquier forma de agradesco la atencion
que me diste.
aprovechando te informo que investigando encontre un codigo que te da microsoft
para quitar la barra de impresion previa en los reportes la probe y si funciona
te la anexo al calce.
gracias
y te deceo una feliz navidad y prospero año nuevo
*----------- START CODE
*
*-----------------------------------
* AUTHOR: Trevor Hancock
* CREATED: 02/24/05 02:47:08 PM
* ABSTRACT:
* Shows how to disable printing from
* PREVIEW when you use object-assisted
* reporting in VFP9.
*
* Also includes a workaround for problem
* where the PREVIEW toolbar does not
* recognize the TextOnToolbar or
* PrintFromPreview settings between
* toolbar displays during same preview.
*-----------------------------------
*-- Defines whether to alllow for
*-- printing during preview. Used to set
*-- the "AllowPrintfromPreview" property
*-- of the object-assisted preview container
*-- later in this code.
#DEFINE PrintFromPreview .F.
LOCAL loPreviewContainer AS FORM, ;
loReportListener AS REPORTLISTENER, ;
loExHandler AS ExtensionHandler OF SYS(16)
*-- Get a preview container from the
*-- .APP registered to handle object-assisted
*-- report previewing.
loPreviewContainer = NULL
DO (_REPORTPREVIEW) WITH loPreviewContainer
*-- Create a PREVIEW listener
loReportListener = NEWOBJECT('ReportListener')
loReportListener.LISTENERTYPE = 1 &&Preview
*-- Link the Listener and preview container
loReportListener.PREVIEWCONTAINER = loPreviewContainer
*-- Changing this property prevents printing from the Preview toolbar
*-- and from right-clicking on the preview container, and then clicking "print".
*-- This property is not in the VFP9 documentation at this point.
loPreviewContainer.AllowPrintfromPreview = PrintFromPreview
*-- Controls appearance of text on some of the
*-- Preview toolbar buttons. .F. is the default.
*-- Included here just to show that it is an available option.
loPreviewContainer.TextOnToolbar = .T.
*-- Create an extension handler and hook it to the
*-- preview container. This will let you manipulate
*-- properties of the container and its Preview toolbar
loExHandler = NEWOBJECT('ExtensionHandler')
loPreviewContainer.SetExtensionHandler( loExHandler )
IF formisobject(_SCREEN.activeform)
REPORT FORM ;
HOME() + 'Samples\Solution\Reports\cobro.frx' TO PRINTER NOCONSOLE
***OBJECT loReportListener
RELEASE loPreviewContainer, loReportListener, loExHandler
ENDIF
*-------------------------
*-------------------------
DEFINE CLASS ExtensionHandler AS CUSTOM
*-- Ref to the Preview Container's Preview Form
PreviewForm = NULL
*-- Here you implement (hook into) the PreviewForm_Assign
*-- event of the preview container's parent proxy
PROCEDURE PreviewForm_Assign( loRef )
*-- Perform default behavior: assign obj ref.
THIS.PreviewForm = loRef
*-- Grab the obj ref to the preview form and bind to its
*-- ShowToolbar() method. This lets the
*-- STB_Handler() method of this extension handler
*-- to run code whenever the Preview toolbar is shown
*-- by the PreviewForm.ShowToolbar() method.
IF !ISNULL( loRef )
BINDEVENT(THIS.PreviewForm, ;
'ShowToolbar', THIS, 'STB_Handler')
ENDIF
ENDPROC
PROCEDURE STB_Handler(lEnabled)
*-- Here you work around the setting
*-- persistence problem in the Preview toolbar.
*-- The Preview toolbar class (frxpreviewtoolbar)
*-- already has code that you can use to enforce
*-- setting's persistence; it is just not called. Here,
*-- you call it.
WITH THIS.PreviewForm.TOOLBAR
.REFRESH()
*-- When you call frxpreviewtoolbar::REFRESH(), the
*-- toolbar caption is set to its Preview form,
*-- which differs from typical behavior. You must revert that
*-- to be consistent. If you did not do this,
*-- you would see " - Page 2" appended to the toolbar
*-- caption if you skipped pages.
.CAPTION = THIS.PreviewForm.formCaption
ENDWITH
ENDPROC
?
*-- A preview container requires these methods
*-- to be implemented in an associated preview extension handler.
*-- They are not used in this example, but still must be here.
PROCEDURE AddBarsToMenu( cPopup, iNextBar )
PROCEDURE SHOW( iStyle )
ENDPROC
PROCEDURE HandledKeyPress( nKeyCode, nShiftAltCtrl )
RETURN .F.
ENDPROC
PROCEDURE PAINT
ENDPROC
PROCEDURE RELEASE
RETURN .T.
ENDPROC
ENDDEFINE
*
*
*----------- END CODE
Y si no hay más que agregar cerremos la pregunta.
Igual que el Señor te bendiga.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas