Report filter dates

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Report filter dates

Post by Silvio.Falconi »

I wish print a report from a day to a day
I'm using Tcalex class and citas.dbf

the user select the date pick and when the report is activated

ACTIVATE REPORT oRep FOR dDesde <= citas->dStart .AND. citas->dend <= dHasta

but not execute this command but print only the one date

Code: Select all


function  Imprime(  dFecha )

   local oRep
   local oFont1, oFont2, acor, oDlg1, oGet1, oGet2, oGet3, oBot1, oBot2
   local lRep    := .f.
   local dDesde
   local dHasta
   local mestado := 1


   Local  nBottom   := 12
   Local  nRight    := 60
   Local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local  nHeight := nBottom * DLG_CHARPIX_H
   local  oBtnPrt,oBtnExit
   local  aGet[3]


   DEFAULT dFecha := oApp():oCalex:dDateSelected

   dDesde := dFecha
   dHasta := dFecha  + 7

   DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
   DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD



   DEFINE DIALOG oDlg1          ;
         SIZE nWidth, nHeight   PIXEL  ;
         TITLE "Stampa appuntamenti"

            oDlg1:lHelpIcon := .F.
            oDlg1:nStyle    := nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )
           * oDlg1:SetFont( oFont1 )



             @ 12, 05 SAY "Stato:"                   OF oDlg1 PIXEL SIZE 50,12
             @ 10, 45 COMBOBOX oGet1 VAR mestado OF oDlg1 SIZE 60,12 PIXEL ;
                                 ITEMS { "Tutte", "Solo pendenti", "Solo effettuate" }

             @ 44,05     SAY "Data Inizio"            OF oDlg1  SIZE 50,10 PIXEL      TRANSPARENT
             @ 44,108    SAY "Data Fine"              OF oDlg1  SIZE 50,10 PIXEL      TRANSPARENT
             @ 42,45  DTPICKER oGet2 VAR  dDesde  OF oDlg1  SIZE 50,10 PIXEL UPDATE
             @ 42,148 DTPICKER oGet3 VAR dHasta   OF oDlg1  SIZE 50,10 PIXEL UPDATE



         @ 70, 92  BUTTON oBtnPrev ;
                PROMPT  "&Stampa"  OF oDlg1 PIXEL SIZE 45, 12 ;
                ACTION  oDlg1:end( IDOK )

          @ 70, 188 BUTTON oBtnExit;
                PROMPT "&Annulla"   OF  oDlg1 PIXEL SIZE 45, 12 ;
                ACTION  oDlg1:end( IDCANCEL )


          ACTIVATE DIALOG oDlg1 CENTER

    IF oDlg1:nresult == IDOK


   REPORT oRep ;
       TITLE "Appuntamenti" + " dal " + DTOC( dDesde ) + " al " + DTOC( dHasta ) LEFT ;
       FONT  oFont1, oFont2 ;
       HEADER OemToAnsi( "01" ) RIGHT ;
       FOOTER "pagina: " + STR( oRep:nPage, 3 ) ,"Data: " + DToc( DATE() ) LEFT ;
       PREVIEW CAPTION "Appuntamenti"


   COLUMN TITLE "Codice"      DATA citas->idx     SIZE 07 FONT 1
   COLUMN TITLE "Cliente"     DATA Left( citas->subject, 40 ) SIZE 20 FONT 1
   COLUMN TITLE "Data"        DATA citas->dStart SIZE 08 FONT 2
   COLUMN TITLE "Da"          DATA TRANSFORM( citas->start, "999:99" ) SIZE 05 FONT 1 RIGHT
   COLUMN TITLE "a"           DATA TRANSFORM( citas->end,   "999:99" ) SIZE 05 FONT 1 RIGHT
   COLUMN TITLE "Note"        DATA citas->text    SIZE 25 FONT 1 MEMO
   COLUMN TITLE "Data"        DATA citas->dend SIZE 08 FONT 2


   // Digo que el titulo lo escriba con al letra 2

   oRep:oTitle:aFont[1] := {|| 2 }
   oRep:oTitle:aFont[1] := {|| 2 }
   oRep:bInit           := {|| citas->( DbGoTop() ) }

   //oRep:bSkip := {|| ( ::cAlias )->Skip() }

   END REPORT

   ACTIVATE REPORT oRep FOR  dDesde <= citas->dStart .AND. citas->dend <=  dHasta  ;
                    ON POSTEND  (oRep:Say(1, 'Totale appuntamenti: '+Tran(oRep:nCounter, '@ 999,999'), 1) )
    endif                

   RETURN nil
//-------------------------------------------------------------------------------------------//
How I can resolve it ?



I tried with EmadDbu and the filter run ok

Image


I made the same on fwh source why not run ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
artu01
Posts: 306
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: Report filter dates

Post by artu01 »

Silvio:
Add it

Code: Select all

select citas
index on dtos(fecha) tag 1 temporary
...
...
...


oRep:bInit           := {|| citas->( DbGoTop(), citas->(dbseek(dtos(dDesde),.t.) ) }
 
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report filter dates

Post by Silvio.Falconi »

thanks
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report filter dates

Post by Silvio.Falconi »

Now run ok only I not understood why ncounter give me a number bad

Code: Select all

ON POSTEND  (oRep:Say(1, 'Totale appuntamenti: '+Tran(oRep:nCounter, '@ 999,999'), 1) )
I tried to make a report from 08/10 to 09/10

Image

give me 229 records ??????

I see only 19 records !!!!!!!!!!!!!
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report filter dates

Post by Silvio.Falconi »

on METHOD Skip( n ) CLASS TReport

we found

::nCounter++

ok

but there is a bfor codeblock it must execute the skip of the ncounter for the bfor codeblock and not entire the archive
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report filter dates

Post by Silvio.Falconi »

RESOLVED



Image
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply