Page 1 of 1

Report filter dates

Posted: Wed Oct 07, 2020 4:07 pm
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 ?

Re: Report filter dates

Posted: Wed Oct 07, 2020 4:46 pm
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.) ) }
 

Re: Report filter dates

Posted: Wed Oct 07, 2020 5:41 pm
by Silvio.Falconi
thanks

Re: Report filter dates

Posted: Wed Oct 07, 2020 6:00 pm
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 !!!!!!!!!!!!!

Re: Report filter dates

Posted: Wed Oct 07, 2020 6:33 pm
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

Re: Report filter dates

Posted: Wed Oct 07, 2020 7:17 pm
by Silvio.Falconi
RESOLVED



Image