class to make Report with tdatabase

class to make Report with tdatabase

Postby Silvio.Falconi » Fri May 31, 2019 8:37 am

I tried to make a report with tdatabase and I have this error


Code: Select all  Expand view
#include "fivewin.ch"
#include "report.ch"

REQUEST DBFCDX

STATIC oReport


Function test()

  RDDSetDefault( 'DBFCDX' )

      SET DATE FORMAT "dd/mm/yyyy"
      SET DATE ITALIAN
      SET CENTURY ON
      SET EPOCH TO ( YEAR( DATE() ) - 50 )



TRepTariffe():New():Attivare()

return nil

//-------------------------------------------------//

CLASS TRepTariffe
   DATA cPath init cFilePath(GetModuleFileName( GetInstance() ))  + "Data\"
   DATA oReport
   DATA oTariffeReport
   DATA oFont

   METHOD New() CONSTRUCTOR
   METHOD Attivare()

END CLASS

METHOD New() CLASS TRepTariffe

     ::oTariffeReport:= TDatabase():Open( , ::cPath+"
TARIFFE", "DBFCDX", .t. )
     ::oTariffeReport:setorder(1)


     /*
     ::oTariffeReport:Exec( < ||
     SET FILTER TO  FIELD->IDLISTINO = strzero(nListino,2)
      return nil
              > )
       */

     // xbrowser ::oTariffeReport

   DEFINE FONT ::oFont NAME "
Tahoma" SIZE 0,-10



   REPORT ::oReport                            ;
      TITLE  "
ELENCO TARIFFE"             ;
      FONT   ::oFont                           ;
      HEADER "
Data: "  + DTOC( DATE() )      ,;
           "
stabilimento bagno"                      ,;
           "
stabilimento bagno"                    ,;
           "
1234567890"      LEFT            ;
      FOOTER "
Pagina: " + STR( ::oReport:nPage, 3 ) RIGHT  ;
      PREVIEW

   COLUMN TITLE "
TIPO  "       DATA ::oTariffeReport:tipo
   COLUMN TITLE "
ELEMENTO   "  DATA ::oTariffeReport:elemento
   COLUMN TITLE "
SERVIZIO"     DATA ::oTariffeReport:servizio
   COLUMN TITLE "
SETTORE  "    DATA ::oTariffeReport:settore
   COLUMN TITLE "
GIORNI"       DATA ::oTariffeReport:giorni
   COLUMN TITLE "
PREZZO   "    DATA ::oTariffeReport:costo     PICTURE "99,999.99" RIGHT  SHADOW

   END REPORT

   RETURN Self

//---------------------------------------------------------------//

METHOD Attivare() CLASS TRepTariffe

   ::oTariffeReport:GoTop()

   ::oReport:bSkip := { || ::oTariffeReport:Skip(1) }
   ::oReport:Cellview()

   ACTIVATE REPORT ::oReport  WHILE !::oTariffeReport:eof()

   ::oFont:End()

   ::oTariffeReport:Close()

RETURN NIL























Now print one page ok and one blank as you can see here

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: class to make Report with tdatabase

Postby leandro » Fri May 31, 2019 9:36 pm

Mira si ayuda

Code: Select all  Expand view
********************
*IMPRIME EN PANTALLA
********************
PROC pIPCaj()
local oReport,nLinea := 1, nHasta := oRsCajaRg:RECORDCOUNT(), ;
nBookMark := oRsCajaRg:BookMark
oRsCajaRg:MoveFirst()
uFec:=dtoc(date())
uTim:=subs(time(),1,8)

REPORT oReport CAPTION "TABLA CONTROL CAJAS"  HEADER "CIUDADELA","NIT:"+"-","TABLA CONTROL DE DOCUMENTOS","Página Número: " + STR (oReport:nPage, 3),"Fecha Reporte: "+uFec+" - Hora: "+uTim;
CENTER  PREVIEW
  COLUMN TITLE "Código" DATA oRsCajaRg:Fields("kk_codigo"):value SIZE 9
  COLUMN TITLE "Nombre" DATA oRsCajaRg:Fields("kk_nombre"):value SIZE 25
END REPORT

oReport:bWhile := { || nLinea <= nHasta }
oReport:oDevice:SetPortrait()
oReport:oDevice:lPrvModal := .T.
IF oReport:lCreated
  oReport:bSkip := { | | nLinea++, oRsCajaRg:MoveNext() }
ENDIF

ACTIVATE REPORT oReport ;
ON END oRsCajaRg:BookMark := nBookMark
oRsCajaRg:REQUERY()
oBrwCReg:Refresh()
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: class to make Report with tdatabase

Postby Silvio.Falconi » Sat Jun 01, 2019 7:25 am

STRANGE.....

this morning I add

DEFINE PEN ::oPen1 WIDTH 1 COLOR CLR_HGRAY
DEFINE PEN ::oPen2 WIDTH 1 COLOR CLR_BLACK

and

REPORT ::oReport ;
TITLE "ELENCO TARIFFE LISTINO ALTA STAGIONE" ;
FONT ::oFont ;
PEN ::oPen1,;
::oPen2
;
HEADER "Data: " + DTOC( DATE() ) ,;
"stabilimento bagno" ,;
"stabilimento bagno" ,;
"1234567890" LEFT ;
FOOTER "Pagina: " + STR( ::oReport:nPage, 3 ) RIGHT ;
PREVIEW



and now seem print ok as you can see here ...very very strange

Image

Someone among the Gurus and Masters (Nages, CNavarro, Linares ...) can explain to me why it didn't work before and now with the addition of only the Pen it seems that it prints everything well?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: class to make Report with tdatabase

Postby James Bott » Wed Jun 05, 2019 2:54 pm

It looks like the top and bottom margins may be set too narrow.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: class to make Report with tdatabase

Postby Silvio.Falconi » Thu Jun 06, 2019 6:43 am

I was not talking about the margins, I was talking about the fact that he first printed a page and a white page, then inserting the pages he printed part of the archive
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: class to make Report with tdatabase

Postby James Bott » Thu Jun 06, 2019 4:09 pm

Silvio,

I was just saying that if you try to print past the margin you could get a page feed, and thus a blank page. Just a thought. Easy to test.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: wilsongamboa and 50 guests