Page 1 of 1

Sobre TReport e Imagenes Impresas

PostPosted: Tue Jan 15, 2008 1:36 am
by cuatecatl82
Saludos a todos los Colegas del foro:

Tengo una duda sobre la clase TReport en la cual esta basada mi aplicaciòn, en ella muestro listados con imagenes con vistas previas en diferentes tipos de impresora: Laser, matriz de Puntos e Inyecciòn de tinta, mi pregunta es:

Es posible saber en que tipo de Impresora se esta generando el previewy el reporte, ya que con los diferentes tipos de impresoras las images se ven de diferente forma, mi idea es saber en que momento es laser u otro modelo para cambiar el tamaño y la ubicaciòn de la imagen para que no quede asì:

Laser:
<a href="http://img143.imageshack.us/my.php?image=73966719tw9.jpg" target="_blank"><img src="http://img143.imageshack.us/img143/2391/73966719tw9.th.jpg" border="0" alt="Free Image Hosting at www.ImageShack.us" /></a>

Matriz de Puntos:
<a href="http://img143.imageshack.us/my.php?image=29683568wd6.jpg" target="_blank"><img src="http://img143.imageshack.us/img143/3457/29683568wd6.th.jpg" border="0" alt="Free Image Hosting at www.ImageShack.us" /></a>

Saludos y Gracias..

PostPosted: Tue Jan 15, 2008 1:40 am
by cuatecatl82

PostPosted: Tue Jan 15, 2008 7:33 am
by Antonio Linares
Dany,

La Clase TReport contiene una DATA oDevice que es el dispositivo en el que se va a imprimir.

Puedes usar estos métodos:
<oReport>:PhyWidth(), <oReport>:PhyHeight()

ó directamente consultar a oDevice:
::nWidth := ::oDevice:nHorzRes()
::nHeight := ::oDevice:nVertRes()
::nLogPixX := ::oDevice:nLogPixelX()
::nLogPixY := ::oDevice:nLogPixelY()

PostPosted: Tue Jan 15, 2008 7:04 pm
by Patricio Avalos Aguirre
Dany

Yo lo hago de la siguiente manera

Code: Select all  Expand view
   if file( "imagen\vehiculo.bmp" )
      aRowCol := oPrn:Cmtr2Pix(nFila,6)
      aSize :=   oPrn:Cmtr2Pix(10,12)
      oPrn:SayBitmap( aRowCol[1], aRowCol[2], "imagen\vehiculo.bmp", aSize[2], aSize[1] )
   endif


espero que te sirva

PostPosted: Tue Jan 15, 2008 11:36 pm
by cuatecatl82
Gracias a ambos por contesta ya estoy probando ambas opciones, algo he de sacar de provecho..

Si de plano no doy con esto me comunico de nuevo al foro..

Saludos y de Nuevo Gracias de antemano...

PostPosted: Tue Jan 15, 2008 11:42 pm
by cuatecatl82
De nuevo aki molestando:

Patricio Avalos Aguirre:

Solo tengo una duda: donde tomo el valor de nFila en:
aRowCol := oRep:Cmtr2Pix(nFila,6)

Ya que al momento de generar el reporte truena porque no reconoce a esta variable..

Gracias..

PostPosted: Wed Jan 16, 2008 12:54 pm
by Patricio Avalos Aguirre
Dany

Yo utilizo PRINT

Code: Select all  Expand view
PRINT oPrn PREVIEW MODAL TO (ViewUsu():ordentrabajo)

y la varialble nFila es la posición de la Fila

te muestro todo el modulo para que lo veas, la imagen funciona en cualquier impresora, tanto en laser como en matriz

Code: Select all  Expand view
static Procedure PrnOT()
local oPrn, aFont[6], nFila, nRow, nCantLine, n, nTmp, aRowCol, aSize

if !MsgYesNo( "Desea imprimir OT" , "Usuario" )
   return
endif

PRINT oPrn PREVIEW MODAL TO (ViewUsu():ordentrabajo)
   DEFINE FONT aFont[1] NAME "COURIER NEW"          SIZE 0, -8         OF oPrn
   DEFINE FONT aFont[2] NAME "COURIER NEW"          SIZE 0, -10      OF oPrn
   DEFINE FONT aFont[3] NAME "ABADI MT CONDENSED" SIZE 0, -10    BOLD OF oPrn
   DEFINE FONT aFont[4] NAME "COURIER NEW"          SIZE 0, -8    BOLD OF oPrn
   DEFINE FONT aFont[5] NAME "COURIER NEW"          SIZE 0, -9    BOLD OF oPrn
   DEFINE FONT aFont[6] NAME "COURIER NEW"          SIZE 0, -8    BOLD UNDERLINE OF oPrn

   oPrn:SetPage(1)
   oPrn:cDocument := "Impresión orden de trabajo"
   oPrn:StartPage()

   oPrn:CmSay(0.7,1.5, "   WIN-INVENT", aFont[4] )
   oPrn:CmSay(1.0,1.5, Parame->Nom_emp,aFont[4] )
   oPrn:CmSay(1.0,15, "Fecha:"+dtoc(DateAds()),aFont[1] )
   oPrn:CmSay(1.3,1.5, Parame->Dir_Emp ,aFont[1] )
   oPrn:CmSay(1.3,15, "Hora :"+TimeAds(),aFont[1])
   oPrn:CmSay(1.6,1.5, Parame->Ciu_Emp, aFont[1] )
   oPrn:CmSay(1.9,1.5, Parame->Fon_Emp, aFont[1] )

   oPrn:CmSay(2.2,8, "ORDEN DE TRABAJO ("+ upper(ALLTRIM(Ot2Tipo( Docu_OT->Tip_OT )) ) + "  Nº " + Alltrim(Docu_OT->Num_OT)+")", aFont[3] )

   nFila := 3.5
   nRow  := 1.7

   oPrn:CmSay( nFila, 1.5, "Datos del Cliente", aFont[6] )
   oPrn:CmSay( nFila, 11.5, "Datos del Vehículo", aFont[6] ) ; nFila += .4

   oPrn:CmSay( nFila, nRow, "Rut         " + ":"+nRutVer(Docu_Ot->Rut_Cli), aFont[1] )

   if Docu_Ot->Sto_Cli > 0
      oPrn:CmSay( nFila, 11.7, "Nº Stock    " + ":"+ltrim(Str(Docu_Ot->Sto_Cli)), aFont[1] ) ; nFila += .3
   else
      oPrn:CmSay( nFila, 11.7, "Patente     " + ":"+Patente->Num_Pat, aFont[1] ) ; nFila += .3
   endif

   oPrn:CmSay( nFila, nRow, "Razon social" + ":"+Clientes->Nombre, aFont[1] )

   if Docu_Ot->Sto_Cli > 0
      oPrn:CmSay( nFila, 11.7, "Modelo      " + ":"+NumStock->Des_Stock, aFont[1] ) ; nFila += .3
   else
      oPrn:CmSay( nFila, 11.7, "Modelo      " + ":"+Patente->Modelo, aFont[1] ) ; nFila += .3
   endif

   oPrn:CmSay( nFila, nRow, "Dirección   " + ":"+Clientes->Dir_Cli,aFont[1] )

   if Docu_Ot->Sto_Cli > 0
      oPrn:CmSay( nFila, 11.7, "            " + "              ",    aFont[1] ) ; nFila += .3
   else
      oPrn:CmSay( nFila, 11.7, "Vim         " + ":"+Patente->Vin,    aFont[1] ) ; nFila += .3
   endif

   oPrn:CmSay( nFila, nRow, "Ciudad      " + ":"+VerTabla( "CIU"+Clientes->Ciu_Cli),aFont[1] )

   oPrn:CmSay( nFila, 11.7, "Kilometraje " + ":"+ltrim(str(Docu_Ot->KM_Cli)), aFont[1] ) ; nFila += .5

   oPrn:CmSay( nFila, 1.5, "Estado del vehículo (observaciones)", aFont[6] )
   oPrn:CmSay( nFila, 11.5, "Detalle del servicio", aFont[6] ) ; nFila += .4

   nTmp := nFila

   nCantLine := MlCount( Docu_OT->Estado_Veh, 45 )

   for n = 1 to nCantLine
      oPrn:CmSay( nFila, nRow, MemoLine( Docu_OT->Estado_Veh,45,n ), aFont[1] )
      if !empty( MemoLine( Docu_OT->Estado_Veh,45,n) )
         nFila += .3
      endif
   next

   nRow := 11.7
   nCantLine := MlCount( Docu_OT->Detalle_Ve, 50 )

   for n = 1 to nCantLine
      oPrn:CmSay( nTmp, nRow, MemoLine( Docu_OT->Detalle_Ve,50,n), aFont[1] )
      if !empty( MemoLine( Docu_OT->Detalle_Ve,50,n) )
         nTmp += .3
      endif
   next

   nFila := MAX( nFila, nTmp )
   nRow := 1.7
   nFila += .5

   oPrn:CmSay( nFila, 1.5, "**Accesorios del Vehiculo**", aFont[6] )
   oPrn:CmSay( nFila,11.5, "**Nivel de Bencina**", aFont[6] )   ; nFila += .5

   oPrn:CmSay( nFila, 1.7, "Documentos   ["+iif( Docu_OT->Documento, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Triangulos     ["+iif( Docu_OT->Triangulo, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila,11.7, iif( Docu_Ot->Nivel_Benc = 1, "1/4",;
                           iif( Docu_Ot->Nivel_Benc = 2, "1/4 - 1/2",;
                           iif( Docu_Ot->Nivel_Benc = 3, "1/2 - 3",;
                           iif( Docu_Ot->Nivel_Benc = 4, "3/4+", "" ) ) ) ), aFont[1] ) ; nFila += .5


   oPrn:CmSay( nFila, 1.7, "Llaves       ["+iif( Docu_OT->Llaves, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Rueda Repuesto ["+iif( Docu_OT->Rueda_Rep, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila,11.5, "**Cargo Orden de Trabajo**", aFont[6] )  ; nFila += .5

   oPrn:CmSay( nFila, 1.7, "Espejo Int.  ["+iif( Docu_OT->Espejo_In, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Gata           ["+iif( Docu_OT->Gata, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 11.7, iif( Docu_Ot->Cargo_OT = 1, "Cliente",;
                            iif( Docu_Ot->Cargo_OT = 2, "Cia.Seguro",;
                            iif( Docu_Ot->Cargo_OT = 3, "E.Garantía",;
                            iif( Docu_Ot->Cargo_OT = 4, "Otro Cliente", "" ) ) ) ), aFont[1] ) ; nFila += .5


   oPrn:CmSay( nFila, 1.7, "Espejo Ext.  ["+iif( Docu_OT->Espejo_Ex, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Herramientas   ["+iif( Docu_OT->Herramien, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 11.5, "**Fecha y Hora Ingreso Taller**", aFont[6] ) ; nFila += .5

   oPrn:CmSay( nFila, 1.7, "Plumillas    ["+iif( Docu_OT->Plumillas, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Cint.Seguridad ["+iif( Docu_OT->Cint_Segur, "SI", "NO" ) + "]", aFont[1] )// ; nFila += .5
   oPrn:CmSay( nFila,11.7, Dtoc( Docu_OT->Fec_OT ) + " / " + Docu_Ot->Hora, aFont[1] ) ; nFila += .5

   oPrn:CmSay( nFila, 1.7, "Pisos        ["+iif( Docu_OT->Pisos, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Tapa bencina   ["+iif( Docu_OT->Tapa_Benc, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 11.5, "**Compromiso de entrega**", aFont[6] ) ; nFila += .5

   oPrn:CmSay( nFila, 1.7, "Tapa Radiador["+iif( Docu_OT->Tapa_radia, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Tapa Rueda 1234["+iif( Docu_OT->Tapa_Rueda, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila,11.7, Dtoc( Docu_OT->Fec_Ent ) + " / " + Docu_Ot->Hora_Ent, aFont[1] ) ; nFila += .5

   oPrn:CmSay( nFila, 1.7, "Extintor     ["+iif( Docu_OT->Extintor, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Encendedor     ["+iif( Docu_OT->Encendedor, "SI", "NO" ) + "]", aFont[1] ) ; nFila += .5

   oPrn:CmSay( nFila, 1.7, "Botiquin     ["+iif( Docu_OT->Botiquin, "SI", "NO" ) + "]", aFont[1] )
   oPrn:CmSay( nFila, 5.5, "Antena         ["+iif( Docu_OT->Antena, "SI", "NO" ) + "]", aFont[1] ) ; nFila += .8

   if file( "imagen\vehiculo.bmp" )
      aRowCol := oPrn:Cmtr2Pix(nFila,6)
      aSize :=   oPrn:Cmtr2Pix(10,12)//m->x,m->y)
      oPrn:SayBitmap( aRowCol[1], aRowCol[2], "imagen\vehiculo.bmp", aSize[2], aSize[1] )//3000, 2000 )//m->x1, m->x2 )
   endif

   oPrn:CmSay( 25, 6.5, "   CLIENTE  ", aFont[6] )
   oPrn:CmSay( 25, 11.5, "  RECEPCIONISTA  ", aFont[6] )

   oPrn:EndPage()

ENDPRINT

aEval( aFont, { |x| x:End() } )

return
//--------------------------------------------------------------------------------------------------------




Espero que te sirva

PostPosted: Thu Jan 17, 2008 10:59 pm
by cuatecatl82
Gracias Patricio Avalos Aguirre, intentare con tu propuesta.
Muchas gracias..