Bug en Clase Printer?

Bug en Clase Printer?

Postby Armando Picon » Wed May 03, 2006 5:46 pm

Amigos

Acabo de fijarme que al utilizar la clase tprinter tanto en FW2.0d así como en FW24 (modificado para correr con xHarbour 0.99.6 - gracias a Patrick Fan) en la confección de un listado se "come" los primeros registros de la DBF y envia el siguiente mensaje "the temporal metafile could not be created". Después sigue y crea las páginas siguientes pero a partir de la No. 1 normalmente.

No se a qué se debe este comportamiento, pero me hace pensar que debe ser un bug.

Agradeceré muchissssimo a quien me oriente a cómo solucionar la falla ya que es urgente!!! :cry:

Por si las moscas... envió mi codigo:

/* Listar la base de datos del padron */
#include "fivewin.ch"
#include "report.ch"

PROCEDURE listar( oDlg )
LOCAL nReg := 1
LOCAL Fil := 5
LOCAL Col := 0
LOCAL nCol := 115 // columnas que tiene el papel
LOCAL nFil := 64 // filas que tiene el papel
LOCAL LstCol := 112 // ultima columna a utilizar
LOCAL LstFil := 59 // ultima fila para datos
LOCAL nFil1 := 0
LOCAL c, f, cMedio
LOCAL oFnt1, oFnt2, oFnt3, oPen1
*
LOCAL nPag := 0
LOCAL oPrn
LOCAL cDate := STR( DAY( DATE() )) + " de " + ;
sp_mes( MONTH( DATE() ) ) + " del " +;
str(Year(DATE()))
LOCAL TITULO:="LISTADO GENERAL DE REPUESTOS"
LOCAL nLongTit, nMedio
LOCAL aPagos //:= {}

DBSELECTAREA("STOCK")
nReg := RECNO()

PRINTER oPrn PrEVIEW MODAL

oPrn:setup()

IF EMPTY(oPrn:hDC)
MsgStop("Impresora no lista","ATENTO")
RETURN NIL
ENDIF

* características del papel
oPrn:SetPage( 10 ) // Papel A4==>10
oPrn:SetLandScape() // Orientacion echada

* Factor de resolución para columnas y filas
c:= oPrn:nHorzRes()/nCol
f:= oPrn:nVertRes()/nFil
cMedio := INT(LstCol / 2) + 1

DEFINE FONT oFnt1 NAME "Sans Serif" SIZE 0,-16 OF oPrn
DEFINE FONT oFnt2 NAME "Sans Serif" SIZE 0,-12 OF oPrn
DEFINE FONT oFnt3 NAME "Sans Serif" SIZE 0,-9 OF oPrn

DBGOTOP()
DO WHILE !EOF()

DO CASE

CASE Fil == 0

oPrn:Startpage()
Fil++
Fil++
Fil++
Fil++
nPag := oPrn:nPage
oPrn:Say(Fil*f, (cMedio - ( LEN(TITULO)/2 ))*c, TITULO, oFnt2)
Fil++
Fil++
oPrn:Say(Fil*f, (cMedio - ( LEN(oApp:membrete)/2 ))*c, oApp:membrete, oFnt2)
Fil++
Fil++
* Linea separador de titulo - encabezados
oPrn:Line(Fil*f,000*c, Fil*f, LstCol*c)
nFil1 := Fil
Fil++
* cabecera de columnas
oPrn:Say(Fil*f, 001*c, "ANDM" , oFnt3 ) // ANDAMIO
oPrn:Say(Fil*f, 005*c, "CASL" , oFnt3 ) // CASILLA
oPrn:Say(Fil*f, 011*c, "CODIGO" , oFnt3 ) // CODIGO
oPrn:Say(Fil*f, 024*c, "PROC" , oFnt3 ) // PROCEDENCIA
oPrn:Say(Fil*f, 030*c, "NOMBRE" , oFnt3 ) // NOMBRE
oPrn:Say(Fil*f, 061*c, "UNIDAD" , oFnt3 ) // UNIDAD DE MEDIDA
oPrn:Say(Fil*f, 069*c, "PREC.VTA" , oFnt3 ) // PRECIO DE VENTA
oPrn:Say(Fil*f, 079*c, "DSCTO" , oFnt3 ) // DESCUENTO EN VALOR
oPrn:Say(Fil*f, 089*c, "IGV" , oFnt3 ) // IGV DE PRECIO-DCTO
oPrn:Say(Fil*f, 099*c, "PREC.PUBLICO.", oFnt3 ) // PRECIO FACTURADO
Fil++
oPrn:Say(Fil*f, 069*c, " US$ " , oFnt3 ) // PRECIO DE VENTA
oPrn:Say(Fil*f, 079*c, " US$ " , oFnt3 ) // DESCUENTO EN VALOR
oPrn:Say(Fil*f, 089*c, "US$" , oFnt3 ) // IGV DE PRECIO-DCTO
oPrn:Say(Fil*f, 099*c, " US$ ", oFnt3 ) // PRECIO FACTURADO
Fil++
Fil++
* Linea separadora entre encabezados e impresion de datos
oPrn:Line(Fil*f,000*c, Fil*f, LstCol*c)
Fil++

CASE Fil > LstFil
Fil++
* Linea de cierre de impresion de datos
oPrn:Line(Fil*f,000*c, Fil*f, LstCol*c)

* Linea verticales de impresion de datos
oPrn:Line(nFil1*f,000*c, Fil*f,000*c)
oPrn:Line(nFil1*f,005*c, Fil*f,005*c)
oPrn:Line(nFil1*f,009*c, Fil*f,009*c)
oPrn:Line(nFil1*f,022*c, Fil*f,022*c)
oPrn:Line(nFil1*f,028*c, Fil*f,028*c)
oPrn:Line(nFil1*f,059*c, Fil*f,059*c)
oPrn:Line(nFil1*f,067*c, Fil*f,067*c)
oPrn:Line(nFil1*f,077*c, Fil*f,077*c)
oPrn:Line(nFil1*f,087*c, Fil*f,087*c)
oPrn:Line(nFil1*f,097*c, Fil*f,097*c)
oPrn:Line(nFil1*f,LstCol*c, Fil*f,LstCol*c)

* Fin cuadro de impresion de datos
Fil++
oPrn:Say(Fil*f, 002*c, "Pag. No. : ", oFnt3 )
oPrn:Say(Fil*f, 014*c, ALLTRIM(STR(nPag,10,0)), oFnt3 )
Fil++
oPrn:endpage()
Fil := 0

OTHER
oPrn:Say(Fil*f, 002*c, STOCK->ANDAMIO, oFnt3 )
oPrn:Say(Fil*f, 006*c, STOCK->CASILLA, oFnt3 )
oPrn:Say(Fil*f, 010*c, STOCK->CODIGO , oFnt3 )
oPrn:Say(Fil*f, 023*c, STOCK->ORIG , oFnt3 )
oPrn:Say(Fil*f, 029*c, STOCK->NOMBRE , oFnt3 )
oPrn:Say(Fil*f, 060*c, STOCK->UNIDAD , oFnt3 )
oPrn:Say(Fil*f, 075*c, TRANSFORM(STOCK->XPRECIOV,"@ 99,999.999"), oFnt3,,,,1 ) // PRECIO DE VENTA
oPrn:Say(Fil*f, 085*c, TRANSFORM(STOCK->XDCTO ,"@ 99,999.999"), oFnt3,,,,1 ) // DESCUENTO EN VALOR
oPrn:Say(Fil*f, 095*c, TRANSFORM(STOCK->XIGV ,"@ 99,999.999"), oFnt3,,,,1 ) // IGV DE PRECIO-DCTO
oPrn:Say(Fil*f, 105*c, TRANSFORM(STOCK->XPRECIOF,"@ 999,999.99"), oFnt3,,,,1 ) // PRECIO FACTURADO

Fil++
SKIP

ENDCASE

ENDDO
*
Fil++
* Linea de cierre de impresion de datos
oPrn:Line(Fil*f,000*c, Fil*f, LstCol*c)

* Linea verticales de impresion de datos
oPrn:Line(nFil1*f,000*c, Fil*f,000*c)
oPrn:Line(nFil1*f,005*c, Fil*f,005*c)
oPrn:Line(nFil1*f,009*c, Fil*f,009*c)
oPrn:Line(nFil1*f,022*c, Fil*f,022*c)
oPrn:Line(nFil1*f,028*c, Fil*f,028*c)
oPrn:Line(nFil1*f,059*c, Fil*f,059*c)
oPrn:Line(nFil1*f,067*c, Fil*f,067*c)
oPrn:Line(nFil1*f,077*c, Fil*f,077*c)
oPrn:Line(nFil1*f,087*c, Fil*f,087*c)
oPrn:Line(nFil1*f,097*c, Fil*f,097*c)
oPrn:Line(nFil1*f,LstCol*c, Fil*f,LstCol*c)
* Fin cuadro de impresion de datos
Fil++
oPrn:Say(Fil*f, 002*c, "Pag. No. : ", oFnt3 )
oPrn:Say(Fil*f, 014*c, ALLTRIM(STR(nPag,10,0)), oFnt3 )
oPrn:endpage()

ENDPRINT


oFnt1:End()
oFnt2:End()
oFnt3:End()
oPrn:SetPortrait() // Orientacion parada
oPrn:End()

DBGOTOP()
DBGOTO( nReg )

RETURN
*

/*
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄ¿
³ANDM CASL CODIGO PROC NOMBRE UNIDAD PREC.VTA DSCTO IGV PREC.FACT.³³
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ
12 123 123456789012 12345 123456789012345678901234567890 1234567 12345.789 12345.789 12345.789 123457.89
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
1 2 3 4 5 6 7 8 9 0 1
*/
/*
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
1 2 3 4 5 6 7 8 9 0 1
------------------------------------------------------------------------
ITEMS DATOS
------------------------------------------------------------------------
Cliente----: 12345678901 123456789012345678901234567890123456789012345
Dirección--: 123456789012345678901234567890123456789012345
123456789012345678901234567890123456789012345
123456789012345678901234567890123456789012345
Teléfono---: 123456789012

Loc.Entrega: 123456789012345678901234567890123456789012345
Dirección--: 123456789012345678901234567890123456789012345
Teléfono---: 123456789012
------------------------------------------------------------------------
NOM_CLIENT" ,"C", 45,0},; // nombre del cliente
DIR_CLIENT" ,"C", 45,0},; // direccion1 del cliente
DIR_CLIEN2" ,"C", 45,0},; // direccion2 del cliente
DIR_CLIEN3" ,"C", 45,0},; // direccion3 del cliente
LOC_CLIENT" ,"C", 45,0},; // local de entrega
LOC_DIRCLI" ,"C", 45,0},; // direc. local de entrega
TF1_CLIENT" ,"C", 12,0},; // telefono cliente
TF2_CLIENT" ,"C", 12,0} ; // telefono local de entrega

*/
User avatar
Armando Picon
 
Posts: 446
Joined: Mon Dec 26, 2005 9:11 pm
Location: Lima, Peru

Re: Bug en Clase Printer?

Postby Armando Picon » Fri May 05, 2006 10:09 pm

Amigos, pido perdón por la falsa alarma. No es un bug sino un error mio (no inicializé correctamente la variable "Fil").

El codigo puede ser utilizado como plantilla ejemplo cuando tengan que elaborar una lista de productos, con formato utilizando la clase tprinter.

/* Listar la base de datos del padron de productos
Autor: Econ. Armando Picón S., Lima, Perú
*/
#include "fivewin.ch"
#include "report.ch"

PROCEDURE listar( oDlg )
LOCAL nReg := 1
LOCAL Fil := 0 // aqui estuvo el error
LOCAL Col := 0
LOCAL nCol := 115 // columnas que tiene el papel
LOCAL nFil := 64 // filas que tiene el papel
LOCAL LstCol := 112 // ultima columna a utilizar
LOCAL LstFil := 59 // ultima fila para datos
LOCAL nFil1 := 0
LOCAL c, f, cMedio
LOCAL oFnt1, oFnt2, oFnt3, oPen1
*
LOCAL nPag := 0
LOCAL oPrn
LOCAL cDate := STR( DAY( DATE() )) + " de " + ;
sp_mes( MONTH( DATE() ) ) + " del " +;
str(Year(DATE()))
LOCAL TITULO:="LISTADO GENERAL DE REPUESTOS"
LOCAL nLongTit, nMedio
//LOCAL aPagos //:= {} // esto también fue error, no se utiliza

DBSELECTAREA("STOCK")
nReg := RECNO()

PRINTER oPrn PrEVIEW MODAL

oPrn:setup()

IF EMPTY(oPrn:hDC)
MsgStop("Impresora no lista","ATENTO")
RETURN NIL
ENDIF

* características del papel
oPrn:SetPage( 10 ) // Papel A4==>10
oPrn:SetLandScape() // Orientacion echada

* Factor de resolución para columnas y filas
c:= oPrn:nHorzRes()/nCol
f:= oPrn:nVertRes()/nFil
cMedio := INT(LstCol / 2) + 1

DEFINE FONT oFnt1 NAME "Sans Serif" SIZE 0,-16 OF oPrn
DEFINE FONT oFnt2 NAME "Sans Serif" SIZE 0,-12 OF oPrn
DEFINE FONT oFnt3 NAME "Sans Serif" SIZE 0,-9 OF oPrn

DBGOTOP()
DO WHILE !EOF()

DO CASE

CASE Fil == 0

oPrn:Startpage()
Fil++
Fil++
Fil++
Fil++
nPag := oPrn:nPage
oPrn:Say(Fil*f, (cMedio - ( LEN(TITULO)/2 ))*c, TITULO, oFnt2)
Fil++
Fil++
oPrn:Say(Fil*f, (cMedio - ( LEN(oApp:membrete)/2 ))*c, oApp:membrete, oFnt2)
Fil++
Fil++
* Linea separador de titulo - encabezados
oPrn:Line(Fil*f,000*c, Fil*f, LstCol*c)
nFil1 := Fil
Fil++
* cabecera de columnas
oPrn:Say(Fil*f, 001*c, "ANDM" , oFnt3 ) // ANDAMIO
oPrn:Say(Fil*f, 005*c, "CASL" , oFnt3 ) // CASILLA
oPrn:Say(Fil*f, 011*c, "CODIGO" , oFnt3 ) // CODIGO
oPrn:Say(Fil*f, 024*c, "PROC" , oFnt3 ) // PROCEDENCIA
oPrn:Say(Fil*f, 030*c, "NOMBRE" , oFnt3 ) // NOMBRE
oPrn:Say(Fil*f, 061*c, "UNIDAD" , oFnt3 ) // UNIDAD DE MEDIDA
oPrn:Say(Fil*f, 069*c, "PREC.VTA" , oFnt3 ) // PRECIO DE VENTA
oPrn:Say(Fil*f, 079*c, "DSCTO" , oFnt3 ) // DESCUENTO EN VALOR
oPrn:Say(Fil*f, 089*c, "IGV" , oFnt3 ) // IGV DE PRECIO-DCTO
oPrn:Say(Fil*f, 099*c, "PREC.PUBLICO.", oFnt3 ) // PRECIO FACTURADO
Fil++
oPrn:Say(Fil*f, 069*c, " US$ " , oFnt3 ) // PRECIO DE VENTA
oPrn:Say(Fil*f, 079*c, " US$ " , oFnt3 ) // DESCUENTO EN VALOR
oPrn:Say(Fil*f, 089*c, "US$" , oFnt3 ) // IGV DE PRECIO-DCTO
oPrn:Say(Fil*f, 099*c, " US$ ", oFnt3 ) // PRECIO FACTURADO
Fil++
Fil++
* Linea separadora entre encabezados e impresion de datos
oPrn:Line(Fil*f,000*c, Fil*f, LstCol*c)
Fil++

CASE Fil > LstFil
Fil++
* Linea de cierre de impresion de datos
oPrn:Line(Fil*f,000*c, Fil*f, LstCol*c)

* Linea verticales de impresion de datos
oPrn:Line(nFil1*f,000*c, Fil*f,000*c)
oPrn:Line(nFil1*f,005*c, Fil*f,005*c)
oPrn:Line(nFil1*f,009*c, Fil*f,009*c)
oPrn:Line(nFil1*f,022*c, Fil*f,022*c)
oPrn:Line(nFil1*f,028*c, Fil*f,028*c)
oPrn:Line(nFil1*f,059*c, Fil*f,059*c)
oPrn:Line(nFil1*f,067*c, Fil*f,067*c)
oPrn:Line(nFil1*f,077*c, Fil*f,077*c)
oPrn:Line(nFil1*f,087*c, Fil*f,087*c)
oPrn:Line(nFil1*f,097*c, Fil*f,097*c)
oPrn:Line(nFil1*f,LstCol*c, Fil*f,LstCol*c)

* Fin cuadro de impresion de datos
Fil++
oPrn:Say(Fil*f, 002*c, "Pag. No. : ", oFnt3 )
oPrn:Say(Fil*f, 014*c, ALLTRIM(STR(nPag,10,0)), oFnt3 )
Fil++
oPrn:endpage()
Fil := 0

OTHER
oPrn:Say(Fil*f, 002*c, STOCK->ANDAMIO, oFnt3 )
oPrn:Say(Fil*f, 006*c, STOCK->CASILLA, oFnt3 )
oPrn:Say(Fil*f, 010*c, STOCK->CODIGO , oFnt3 )
oPrn:Say(Fil*f, 023*c, STOCK->ORIG , oFnt3 )
oPrn:Say(Fil*f, 029*c, STOCK->NOMBRE , oFnt3 )
oPrn:Say(Fil*f, 060*c, STOCK->UNIDAD , oFnt3 )
oPrn:Say(Fil*f, 075*c, TRANSFORM(STOCK->XPRECIOV,"@ 99,999.999"), oFnt3,,,,1 ) // PRECIO DE VENTA
oPrn:Say(Fil*f, 085*c, TRANSFORM(STOCK->XDCTO ,"@ 99,999.999"), oFnt3,,,,1 ) // DESCUENTO EN VALOR
oPrn:Say(Fil*f, 095*c, TRANSFORM(STOCK->XIGV ,"@ 99,999.999"), oFnt3,,,,1 ) // IGV DE PRECIO-DCTO
oPrn:Say(Fil*f, 105*c, TRANSFORM(STOCK->XPRECIOF,"@ 999,999.99"), oFnt3,,,,1 ) // PRECIO FACTURADO

Fil++
SKIP

ENDCASE

ENDDO
*
Fil++
* Linea de cierre de impresion de datos
oPrn:Line(Fil*f,000*c, Fil*f, LstCol*c)

* Linea verticales de impresion de datos
oPrn:Line(nFil1*f,000*c, Fil*f,000*c)
oPrn:Line(nFil1*f,005*c, Fil*f,005*c)
oPrn:Line(nFil1*f,009*c, Fil*f,009*c)
oPrn:Line(nFil1*f,022*c, Fil*f,022*c)
oPrn:Line(nFil1*f,028*c, Fil*f,028*c)
oPrn:Line(nFil1*f,059*c, Fil*f,059*c)
oPrn:Line(nFil1*f,067*c, Fil*f,067*c)
oPrn:Line(nFil1*f,077*c, Fil*f,077*c)
oPrn:Line(nFil1*f,087*c, Fil*f,087*c)
oPrn:Line(nFil1*f,097*c, Fil*f,097*c)
oPrn:Line(nFil1*f,LstCol*c, Fil*f,LstCol*c)
* Fin cuadro de impresion de datos
Fil++
oPrn:Say(Fil*f, 002*c, "Pag. No. : ", oFnt3 )
oPrn:Say(Fil*f, 014*c, ALLTRIM(STR(nPag,10,0)), oFnt3 )
oPrn:endpage()

ENDPRINT


oFnt1:End()
oFnt2:End()
oFnt3:End()
oPrn:SetPortrait() // Orientacion parada
oPrn:End()

DBGOTOP()
DBGOTO( nReg )

RETURN
*

/*
Formulario de la lista Productos

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄ¿
³ANDM CASL CODIGO PROC NOMBRE UNIDAD PREC.VTA DSCTO IGV PREC.FACT.³³
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ
12 123 123456789012 12345 123456789012345678901234567890 1234567 12345.789 12345.789 12345.789 123457.89
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
1 2 3 4 5 6 7 8 9 0 1

Caracteristicas de la base de datos
=======================
Cliente----: 12345678901 123456789012345678901234567890123456789012345
Dirección--: 123456789012345678901234567890123456789012345
123456789012345678901234567890123456789012345
123456789012345678901234567890123456789012345
Teléfono---: 123456789012

Loc.Entrega: 123456789012345678901234567890123456789012345
Dirección--: 123456789012345678901234567890123456789012345
Teléfono---: 123456789012
------------------------------------------------------------------------
NOM_CLIENT" ,"C", 45,0},; // nombre del cliente
DIR_CLIENT" ,"C", 45,0},; // direccion1 del cliente
DIR_CLIEN2" ,"C", 45,0},; // direccion2 del cliente
DIR_CLIEN3" ,"C", 45,0},; // direccion3 del cliente
LOC_CLIENT" ,"C", 45,0},; // local de entrega
LOC_DIRCLI" ,"C", 45,0},; // direc. local de entrega
TF1_CLIENT" ,"C", 12,0},; // telefono cliente
TF2_CLIENT" ,"C", 12,0} ; // telefono local de entrega

*/
User avatar
Armando Picon
 
Posts: 446
Joined: Mon Dec 26, 2005 9:11 pm
Location: Lima, Peru


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 137 guests