Dificultad con METERS

Dificultad con METERS

Postby José Camilo » Tue Aug 22, 2023 12:22 pm

Buenos días!!!
Presento un dialogo con 2 Meters y 2 botones.
Al oprimir ACEPTAR ejecuta un listado que lee datos de 2 bases, la idea es que en cada METER se refleje el avance de dicha lectura.
El primer METER trabaja perfectamente, el segundo METER NO LOGRO que muestre el avance y creo haber probado de todas las formas y no veo cual es el problema.
este es mi código. si alguien ve mi ERROR agradecería me lo cuente.

Gracias.

function lstVentas2()
...

Private oMeter1
Private oMeter2
Private nActual1 := 0
Private nActual2 := 0
Private xtotCli := 0
Private xTotVtas := 0
Private oMensaje, cMensaje:=''

.....

if veoclifor(@nCliente,@cVeoCli,.t.)

if nCliente = 0
xTotCli := CliFor->(LastRec())
else
xTotCli := 1
endif

select DetVtaF
set filter to str(DetVtaF->Cliente,4) = str(CliFor->CodCliente,4) .and. DetVtaF->FecVenta>=dDesde .and. DetVtaF->FecVenta<=dHasta

DetVtaF->(DbGoTop())
set relation to Articulo into ArtFor
while !DetVtaF->(Eof())
xTotVtas += 1
DetVtaF->(DbSkip())
end
DEFINE DIALOG oDlgMed RESOURCE "Medidores"
REDEFINE SAY oMensaje PROMPT cmensaje ID Med_Mensaje OF oDlgMed color colorfw->ForeSay, colorfw->FondoSay
REDEFINE METER oMeter1 VAR nActual1 TOTAL xtotCli ID Med_Meter1 of oDlgMed
REDEFINE METER oMeter2 VAR nActual2 TOTAL xTotVtas ID Med_Meter2 of oDlgMed
REDEFINE BTNBMP oBtnAcep ID Med_Aceptar OF oDlgMed FILENAME "ACEPTAR.BMP" ACTION (LstVtasXCli(nCliente,cVeoCli,dDesde,dHasta, @oMensaje,@cMensaje),oDlgMed:end())
REDEFINE BTNBMP oBtnCanc ID Med_Cancelar OF oDlgMed FILENAME "CANCELA.BMP" CANCEL ACTION oDlgMed:End()
ACTIVATE DIALOG oDlgMed CENTERED
endif
dbcloseall()
return NIL
*-----------------------------------------------------------------------------------*
*----------------------------------------------------------------------------------------------*
/***
* emito informe de Ventas
*
*/
*
function lstVtasXCli(nCliente,cVeoCli,dDesde,dHasta,oMensaje,cMensaje)
local nhoja := 0

....

if lsigo
PRINT oPrn NAME "Ventas de Formularios" PREVIEW MODAL
if Empty( oPrn:hDC )
MsgStop( "Impresora Fuera de Linea" )
return nil
endif

....

while !CliFor->(Eof())
cMensaje := left(CliFor->RazonSoc,15)
oMensaje:Refresh()
//msginfo(str(Clifor->Codcliente,4),'Cliente')
if prow == 0
prow+=nrowstep
oPrn:Say(prow, pcol*4 ,'Fecha de Emisión: ' + dtoc( date() ),oCour_n_10)

......

prow+=nrowstep*1.5
endif

select DetVtaF

DetVtaF->(DbGoTop())
if DetVtaF->Cliente#0
oPrn:Say(prow, pcol*6 ,CliFor->RazonSoc,oCour_b_10)
prow+=nrowstep
else
Clifor->(DbSkip())
oMeter1:Set(nActual1+1)
oMeter1:Refresh()
loop
endif
oPrn:Say(prow, pcol*6 ,dtoc(DetVtaF->FecVenta),oCour_b_10)
dQueFec:=DetVtaF->FecVenta
prow+=nrowstep
While !DetVtaF->(EoF())
oMeter2:Set(nActual2+1)
oMeter2:Refresh()
oPrn:Say(prow, pcol*19 ,ArtFor->Abrevia),oCour_n_10)
prow+=nrowstep
if DetVtaF->TipoDoc#2
nTotCli += DetVtaF->TotVenta
.....
endif
if prow > nRowStep*55
oPrn:Line(pRow ,ncolStep,pRow,ncolstep*77)
EndPage
Page
PROW:=0
if prow == 0
prow+=nrowstep
oPrn:Say(prow, pcol*4 ,'Fecha de Emisión: ' + dtoc( date() ),oCour_n_10)
.....
prow+=nrowstep*1.5
endif
endif
DetVtaF->(DbSkip())

if !dQueFec=DetVtaF->FecVenta
prow+=nrowstep/2
......
endif
end
CLiFor->(DbSkip())
oMeter1:Set(nActual1+1)
oMeter1:Refresh()
nActual2 := 0
oMeter2:Set(nActual2)
oMeter2:Refresh()

end
oPrn:Line(pRow ,ncolStep,pRow,ncolstep*77)
....
endpage
EndPrint
endif
return NIL
*------------------------------------------------------------------------------*
José Camilo
 
Posts: 180
Joined: Wed Apr 07, 2021 3:56 pm

Re: Dificultad con METERS

Postby cmsoft » Tue Aug 22, 2023 12:45 pm

Puedes probar con:
Code: Select all  Expand view

While !DetVtaF->(EoF())
nActual2 ++
oMeter2:Set(nActual2)
oMeter2:Refresh()
...
 

y lo mismo deberias hacer para el nActual1
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Dificultad con METERS

Postby José Camilo » Tue Aug 22, 2023 1:38 pm

Buen día Cesar!!!
Gracias por tu tiempo.
Probé tu sugerencia pero sigue igual.
El primer meter muestra el avance de forma correcta pero el segundo ni se entera.

Gracias
José Camilo
 
Posts: 180
Joined: Wed Apr 07, 2021 3:56 pm

Re: Dificultad con METERS

Postby karinha » Tue Aug 22, 2023 1:58 pm

Code: Select all  Expand view

// C:\FWH..\SAMPLES\JCAMILO.PRG

FUNCTION lstVentas2()

   ...
   PRIVATE oMeter1
   PRIVATE oMeter2
   PRIVATE nActual1 := 0
   PRIVATE nActual2 := 0
   PRIVATE xtotCli  := 0
   PRIVATE xTotVtas := 0
   PRIVATE oMensaje, cMensaje := ''

   .....

   IF veoclifor( @nCliente, @cVeoCli, .T. )

      IF nCliente = 0

         xTotCli := CliFor->( LastRec() )

      ELSE

         xTotCli := 1

      ENDIF

      SELECT DetVtaF

      SET FILTER TO Str( DetVtaF->Cliente, 4 ) = Str( CliFor->CodCliente, 4 ) ;
         .AND. DetVtaF->FecVenta >= dDesde .AND. DetVtaF->FecVenta <= dHasta

      // USE INDEX ON... TEMPORARY / MEMORY es mejor y mas rapido.

      DetVtaF->( dbGoTop() )

      SET RELATION TO Articulo into ArtFor

      WHILE !DetVtaF->( Eof() )

         SYSREFRESH()

         xTotVtas += 1

         DetVtaF->( dbSkip() )

      ENDDO

      DEFINE DIALOG oDlgMed RESOURCE "Medidores"

      REDEFINE SAY oMensaje PROMPT cmensaje ID Med_Mensaje OF oDlgMed COLOR colorfw->ForeSay, colorfw->FondoSay

      REDEFINE METER oMeter1 VAR nActual1 TOTAL xtotCli ID Med_Meter1 of oDlgMed

      REDEFINE METER oMeter2 VAR nActual2 TOTAL xTotVtas ID Med_Meter2 of oDlgMed

      REDEFINE BTNBMP oBtnAcep ID Med_Aceptar OF oDlgMed FILENAME "ACEPTAR.BMP" ACTION ( LstVtasXCli( nCliente, cVeoCli, dDesde, dHasta, @oMensaje, @cMensaje ), oDlgMed:end() )

      REDEFINE BTNBMP oBtnCanc ID Med_Cancelar OF oDlgMed FILENAME "CANCELA.BMP" CANCEL ACTION oDlgMed:End()

      ACTIVATE DIALOG oDlgMed CENTERED

   ENDIF

   dbCloseAll()

RETURN NIL
/***
* emito informe de Ventas
*
*/

FUNCTION lstVtasXCli( nCliente, cVeoCli, dDesde, dHasta, oMensaje, cMensaje )

   LOCAL nhoja := 0

   ....

   IF lsigo

      PRINT oPrn NAME "Ventas de Formularios" PREVIEW MODAL

      IF Empty( oPrn:hDC )

         MsgStop( "Impresora Fuera de Linea" )

         RETURN NIL

      ENDIF

      ....

      WHILE !CliFor->( Eof() )

         SYSREFRESH()

         cMensaje := Left( CliFor->RazonSoc, 15 )
         oMensaje:Refresh()

         // msginfo(str(Clifor->Codcliente,4),'Cliente')
         IF prow == 0

            prow += nrowstep
            oPrn:Say( prow, pcol * 4, 'Fecha de Emisión: ' + DToC( Date() ), oCour_n_10 )

            ......

            prow += nrowstep * 1.5

         ENDIF

         SELECT DetVtaF

         DetVtaF->( dbGoTop() )

         IF DetVtaF->Cliente # 0

            oPrn:Say( prow, pcol * 6, CliFor->RazonSoc, oCour_b_10 )

            prow += nrowstep

         ELSE

            Clifor->( dbSkip() )

            //oMeter1:Set( nActual1 + 1 )
            //oMeter1:Refresh()

            ++nActual1

            oMeter1:Set(nActual1)
            oMeter1:Refresh()

            LOOP

         ENDIF

         oPrn:Say( prow, pcol * 6, DToC( DetVtaF->FecVenta ), oCour_b_10 )

         dQueFec := DetVtaF->FecVenta

         prow += nrowstep

         WHILE !DetVtaF->( Eof() )

            SYSREFRESH()

            //oMeter2:Set( nActual2 + 1 )
            //oMeter2:Refresh()

            ++nActual2

            oMeter2:Set(nActual2)
            oMeter2:Refresh()

            oPrn:Say( prow, pcol * 19, ArtFor->Abrevia ), oCour_n_10 )

            prow += nrowstep

            IF DetVtaF->TipoDoc # 2

               nTotCli += DetVtaF->TotVenta
               .....

            ENDIF

            IF prow > nRowStep * 55

               oPrn:Line( pRow, ncolStep, pRow, ncolstep * 77 )

               ENDPAGE

               PAGE // NEW PAGE

               PROW := 0

               IF prow == 0

                  prow += nrowstep

                  oPrn:Say( prow, pcol * 4, 'Fecha de Emisión: ' + DToC( Date() ), oCour_n_10 )
                  .....
                  prow += nrowstep * 1.5

               ENDIF

            ENDIF

            DetVtaF->( dbSkip() )

            IF !dQueFec = DetVtaF->FecVenta

               prow += nrowstep / 2
               ......
            ENDIF

         ENDDO

         CLiFor->( dbSkip() )

         // oMeter1:Set( nActual1 + 1 )
         // oMeter1:Refresh()

         ++nActual1

         // O:
         // nActual1 := nActual1 + 1

         oMeter1:Set(nActual1)
         oMeter1:Refresh()

         nActual2 := 0

         oMeter2:Set( nActual2 )
         oMeter2:Refresh()

      ENDDO

      oPrn:Line( pRow, ncolStep, pRow, ncolstep * 77 )
      ....

      ENDPAGE

      ENDPRINT

   ENDIF

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Dificultad con METERS

Postby José Camilo » Tue Aug 22, 2023 2:12 pm

Buen día Joao!!!
Gracias por tu tiempo también.
Con tus cambios tampoco logro hacer funcionar el segundo METER.
Gracias.
José Camilo
 
Posts: 180
Joined: Wed Apr 07, 2021 3:56 pm

Re: Dificultad con METERS

Postby karinha » Tue Aug 22, 2023 2:38 pm

Mira \samples:

TESTMEX**

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests