MsgMeter

MsgMeter

Postby juan_arroyo_t » Sun Oct 07, 2018 12:53 am

Si alguien pudiera ayudarme

Estoy tratando de usando MsgMeter en la generación de un reporte, me aparece un cuadro de dialogo que debe ser del msgmeter
pero no veo la barra de avance

Este es mi prg
Code: Select all  Expand view
/* -------------------------------------------------------------------------
PROGRAMA : ------------------------------    LISCAP.PRG
PROPOSITO : -----------------------------    LISTADO DE CAPTURA DE INVENTARIO
                                             FISICO DE MARBETE Y/O DE HOJAS DE
                                             TOMA DE INVENTARIO
APLICACION : ----------------------------    INVENTARIOS FISICOS
FECHA : ---------------------------------    28/08/14 J.A.T.
-----------------------------------------------------------------------------*/


# include "fivewin.ch"

FUNCTION LisCapFis()
   LOCAL oDlg, oRad
   LOCAL aoBtn := { nil, nil }
   LOCAL cTitulo := "Listado de captura de inventario fisico"

   dbCloseAll()

   if !net_use( "cat",,, oApp:xDatos ) .or. ;
      !net_use( "mar",,, oApp:xDatos ) .or. ;
      !net_use( "smar",,,oApp:xDatos )
      dbCloseAll(); RETURN NIL
   endif

   nOpcion := 1

   DEFINE DIALOG oDlg RESOURCE "DLG_LIS_CAP_FIS" TITLE cTitulo

   REDEFINE RADIO oRad VAR nOpcion    ID 501, 502 OF oDlg UPDATE

   REDEFINE BUTTONBMP aoBtn[1] ID 400 OF oDlg ;
      PROMPT "A&ceptar " ;
      BITMAP "BTN_OK" TEXTRIGHT ;
      ACTION ( if( nOpcion = 1, ;
                 MsgMeter( { || EmiRepMar() },, ), ;
                 MsgMeter( { || EmiRepRef() },, ) ), oDlg:END() ) ;
      MESSAGE "Aceptar" UPDATE
      aoBtn[1]:cToolTip := "Presione para Continuar"

   REDEFINE BUTTONBMP aoBtn[2] ID 401 OF oDlg ;
      PROMPT "&Cancelar " BITMAP "BTN_CAN" TEXTRIGHT ;
      ACTION oDlg:End() ;
      MESSAGE "Cancelar" UPDATE CANCEL
      aoBtn[2]:cToolTip := "Presione para Cancelar"

   ACTIVATE DIALOG oDlg CENTERED ON INIT oninit( oDlg )

   DBCloseAll()

RETURN NIL

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

STATIC FUNCTION Cabeceras( oPrn, oFontD, oFontC, cTitRep1, cTitRep2 )
   oPrn:CmSay( nRow, 10.7, oApp:cEmpresa, oFontC,,,,2 )
   nRow += 0.4
   oPrn:CmSay( nRow, 10.7, cTitRep1, oFontC,,,,2 )
   nRow += 0.4
   oPrn:CmSay( nRow, 02.5, "Fecha: " + dToc( Date() ), oFontC )
   oPrn:CmSay( nRow, 10.7, cTitRep2, oFontC,,,,2 )
   oPrn:CmSay( nRow, 18.0, "Pagina :  " + AllTrim( Str( oPrn:nPage ) ), oFontC )
   nRow += 0.40
   LinePrint( oPrn, nRow, 1.0, nRow, 21.0 )
   nRow+=0.3
   IF nOpcion = 1
      oPrn:CmSay( nRow, 01.5, "Marb",  oFontC,,,,2 )
   ELSE
      oPrn:CmSay( nRow, 01.5, "Hoja",  oFontC,,,,2 )
   ENDIF
   oPrn:CmSay( nRow, 02.0, "Modelo",   oFontC )
   oPrn:CmSay( nRow, 05.5, "Cantidad", oFontC,,,,1 )

   IF nOpcion = 1
      oPrn:CmSay( nRow, 06.5, "Marb",  oFontC,,,,2 )
   ELSE
      oPrn:CmSay( nRow, 06.5, "Hoja",  oFontC,,,,2 )
   ENDIF
   oPrn:CmSay( nRow, 07.0, "Modelo",   oFontC )
   oPrn:CmSay( nRow, 10.5, "Cantidad", oFontC,,,,1 )

   IF nOpcion = 1
      oPrn:CmSay( nRow, 11.5, "Marb",  oFontC,,,,2 )
   ELSE
      oPrn:CmSay( nRow, 11.5, "Hoja",  oFontC,,,,2 )
   ENDIF
   oPrn:CmSay( nRow, 12.0, "Modelo",   oFontC )
   oPrn:CmSay( nRow, 15.5, "Cantidad", oFontC,,,,1 )

   IF nOpcion = 1
      oPrn:CmSay( nRow, 16.5, "Marb",  oFontC,,,,2 )
   ELSE
      oPrn:CmSay( nRow, 16.5, "Hoja",  oFontC,,,,2 )
   ENDIF
   oPrn:CmSay( nRow, 17.0, "Modelo",   oFontC )
   oPrn:CmSay( nRow, 20.5, "Cantidad", oFontC,,,,1 )

   nRow+=0.4
   LinePrint( oPrn, nRow, 1.0, nRow, 21.0 )
   nRow+=0.5
RETURN NIL

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

STATIC FUNCTION EmiRepMar()
   LOCAL oPrn, oFontC, oFontD, nContador
   LOCAL nRegIni, nRegFin, nCols, nColMar, nColCla, nColCan
   LOCAL cTitRep1, cTitRep2
   LOCAL cTitulo := "Listado de captura de inventario fisico"
   LOCAL nTotReg := 0, nRegAnt
   LOCAL nTotFis := 0

   cTitRep1 := "REPORTE DE CAPTURA DE INVENTARIO FISICO"
   cTitRep2 := "POR MARBETE"

   mar->(OrdSetFocus(3))
   mar->(dbgotop())

   PRINT oPrn NAME cTitulo /*FROM USER*/ PREVIEW

      If Empty( oPrn:hDC )
         Return NIL
      End

      DEFINE FONT oFontC NAME "Tahoma" SIZE 0, -8 BOLD OF oPrn
      DEFINE FONT oFontD NAME "Tahoma" SIZE 0, -7 OF oPrn
      DEFINE PEN oPen WIDTH 2 OF oPrn

      oPrn:lPrvModal := .T.

      PAGE
         nRow := 1
         Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
         nContador := 1
         do while !mar->(EOF())
            nRegIni := mar->(recno())
            nCols := 1
            //nContador := 1
            nColMar     := 01.5
            nColCla    := 02.0
            nColCan     := 05.5
            do while nCols <= 4
               oPrn:CmSay( nRow, nColMar, mar->reflis,                            oFontD,,,,2 )
               oPrn:CmSay( nRow, nColCla, mar->clave,                            oFontD )
               oPrn:CmSay( nRow, nColCan, TRANSFORM(mar->cant_fis,"9,999.99"),    oFontD,,,,1 )
               LinePrint( oPrn, nRow, 01.0, nRow, 20.5 )
               nTotReg += 1
               nTotFis += mar->cant_fis
               nRegFin := mar->(recno())
               nCols += 1
               nColMar += 5
               nColCla += 5
               nColCan += 5
               mar->(dbskip(65))
               if mar->(eof())
                  exit
               endif
            enddo

            nRow += 0.35
            nContador += 1

            if nContador > 65
               if nCols > 4
                  mar->(dbgoto(nRegFin))
                  mar->(dbskip())
                  if !mar->(eof())
                     oPrn:EndPage()
                     oPrn:StartPage()
                     nRow := 1
                     nContador := 1
                     Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
                     mar->(dbgoto(nRegFin))
                     mar->(dbskip())
                  endif
               endif
            else
               mar->(dbgoto(nRegIni))
               mar->(dbskip())
            endif

         enddo

         LinePrint( oPrn, nRow, 01.0, nRow, 20.5 )
         nRow += 0.20
         if nRow >= 26
            oPrn:EndPage()
            oPrn:StartPage()
            nRow := 1
            Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
         endif
         oPrn:CmSay( nRow+0.20, 06.0, "Total de registros --> ", oFontD,,,,1 )
         oPrn:CmSay( nRow+0.20, 06.5, AllTrim(Transform(nTotReg,"99,999")),oFontD )
         nRow += 0.60
         if nRow >= 26
            oPrn:EndPage()
            oPrn:StartPage()
            nRow := 1
            Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
         endif

         oPrn:CmSay( nRow, 06.0, "Total de físico --> ", oFontD,,,,1 )
         oPrn:CmSay( nRow, 06.5, AllTrim(Transform(nTotFis,"999,999.99")),oFontD )

      ENDPAGE
   ENDPRINT
   oFontC:End()
   oFontD:End()
   oPen:End()

RETURN NIL

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

STATIC FUNCTION EmiRepRef()
   LOCAL oPrn, oFontC, oFontD, nContador
   LOCAL nRegIni, nRegFin, nCols, nColMar, nColCla, nColCan
   LOCAL cTitRep1, cTitRep2
   LOCAL cTitulo := "Listado de captura de inventario fisico"
   LOCAL nTotReg := 0, nRegAnt

   cTitRep1 := "REPORTE DE CAPTURA DE INVENTARIO FISICO"
   cTitRep2 := "HOJAS DE TOMA DE INVENTARIO"

   smar->(dbgotop())

   PRINT oPrn NAME cTitulo /*FROM USER*/ PREVIEW

      If Empty( oPrn:hDC )
         Return NIL
      End

      DEFINE FONT oFontC NAME "Tahoma" SIZE 0, -8 BOLD OF oPrn
      DEFINE FONT oFontD NAME "Tahoma" SIZE 0, -7 OF oPrn
      DEFINE PEN oPen WIDTH 2 OF oPrn

      oPrn:lPrvModal := .T.

      PAGE
         nRow := 1
         Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
         nContador := 1
         do while !smar->(EOF())
            nRegIni := smar->(recno())
            nCols := 1
            //nContador := 1
            nColMar     := 01.5
            nColCla    := 02.0
            nColCan     := 05.5
            do while nCols <= 4
               oPrn:CmSay( nRow, nColMar, smar->reflis,                            oFontD,,,,2 )
               oPrn:CmSay( nRow, nColCla, smar->clave,                            oFontD )
               oPrn:CmSay( nRow, nColCan, TRANSFORM(smar->cant_fis,"9,999.99"),    oFontD,,,,1 )
               LinePrint( oPrn, nRow, 01.0, nRow, 20.5 )
               nTotReg += 1
               nRegFin := smar->(recno())
               nCols += 1
               nColMar += 5
               nColCla += 5
               nColCan += 5
               smar->(dbskip(65))
               if smar->(eof())
                  exit
               endif
            enddo

            nRow += 0.35
            nContador += 1
            if nContador > 65
               if nCols > 4
                  smar->(dbgoto(nRegFin))
                  smar->(dbskip())
                  if !smar->(eof())
                     oPrn:EndPage()
                     oPrn:StartPage()
                     nRow := 1
                     nContador := 1
                     Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
                     smar->(dbgoto(nRegFin))
                     smar->(dbskip())
                    endif
                 endif

            else
               smar->(dbgoto(nRegIni))
               smar->(dbskip())
            endif

         enddo

         LinePrint( oPrn, nRow, 01.0, nRow, 20.5 )
         nRow += 0.20
         if nRow >= 26
            oPrn:EndPage()
            oPrn:StartPage()
            nRow := 1
            Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
         endif

         oPrn:CmSay( nRow, 04.0, "Total de registros --> " + STR(nTotReg),oFontD )

      ENDPAGE
   ENDPRINT
   oFontC:End()
   oFontD:End()
   oPen:End()

RETURN nil

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

STATIC FUNCTION MsgMeter( bAction, cMsg, cTitle )

   local oDlg, oMeter, oText, oBtn, oFont
   local lEnd := .f., lCancel := .f.
   local nVal := 0

   DEFAULT bAction := { || nil },;
           cMsg := "Processing...", cTitle := "Please, wait"

   DEFINE FONT oFont NAME GetSysFont() SIZE 0, -8

   DEFINE DIALOG oDlg FROM 5, 5 TO 13, 45 TITLE cTitle FONT oFont

   @ 00.20, 00.50  SAY   oText  VAR cMsg SIZE 130, 20 OF oDlg
   @ 02.00, 00.50  METER oMeter VAR nVal TOTAL 10 SIZE 150, 10 OF oDlg

   @ 02.40, 10.40  BUTTON oBtn PROMPT "&Cancelar" OF oDlg ACTION ( lEnd:= .t., lCancel:= .t. ) SIZE 32, 11

   // This block gets evaluated only the first time the DialogBox is painted !!!
   oDlg:bStart = { || Eval( bAction, oMeter, oText, oDlg, @lEnd, oBtn ),;
                      lEnd := .t., oDlg:End() }

   ACTIVATE DIALOG oDlg CENTERED VALID lEnd

   oFont:End()

return lCancel

 


De antemano les agradezco

Saludos
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: MsgMeter

Postby FranciscoA » Sun Oct 07, 2018 3:24 am

Hola Juan. Esto es solo una idea. Probalo.
Code: Select all  Expand view

 MsgMeter( { | oMeter, oText, oDlg, lEnd | ;
            EmiRepMar(oMeter, oText, oDlg, @lEnd) },, )

STATIC FUNCTION EmiRepMar( oMeter, oText, oDlg, lEnd )
oMeter:nTotal: = mar->(Reccount())

 do while !mar->(EOF())
    EVAL ( oMeter:Set( mar->(Recno()) ), SysRefresh(), ! lEnd )  //EVERY 20
 


Así lo uso en funciones de indexacion:
Code: Select all  Expand view
//----------------------
Function IndCATALOGO()
DBSELECTAREA("CATALOGO")

  MsgMeter( { | oMeter, oText, oDlg, lEnd | ;
             BuildIndex( oMeter, oText, oDlg, @lEnd,;
             "CATALOGO->CUENTA","CATALOGO" ) },;
            "Integrando Indice CATALOGO", "Aguarde un momento por favor" )
  SysRefresh()
Return NIL

//----------------------------------------------------------------------------//
function BuildIndex( oMeter, oText, oDlg, lEnd, Campos, xIndice, lUnique )
DEFAULT lUnique:=.f.

    oMeter:nTotal = RecCount()
  if !lUnique
    INDEX ON &(Campos) TO &(xIndice) ;
    EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )
  else
    INDEX ON &(Campos) TO &(xIndice) UNIQUE ;
    EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )
  endif
return nil

//----------------------------------------------------------------------------//
function MsgMeter( bAction, cMsg, cTitle, lBoton )
   local oDlg, oMeter, oText, oBtn, oFont
   local lEnd := .f., lCancel := .f.
   local nVal := 0

   DEFAULT bAction := { || nil },;
           cMsg := "Procesando...", cTitle := "Aguarde por favor",;
           lBoton := .f.

   DEFINE DIALOG oDlg RESOURCE "MSGMETER" COLOR "W+/B" TRANSPARENT
   REDEFINE SAY ID 111 OF oDlg
   REDEFINE SAY oText VAR cMsg ID 110 OF oDlg
   REDEFINE METER oMeter VAR nVal TOTAL 10 ID 130 OF oDlg

 if lBoton
   @  2.8,  18  BUTTON oBtn PROMPT "&Cancel" OF oDlg ;
      ACTION ( lEnd:= .t., lCancel:= .t. ) SIZE 32, 11
 endif

   // This block gets evaluated only the first time the DialogBox is painted !!!
   oDlg:bStart = { || Eval( bAction, oMeter, oText, oDlg, @lEnd, oBtn ),;
                      lEnd := .t., oDlg:End() }

   ACTIVATE DIALOG oDlg CENTERED ;
      VALID lEnd
return lCancel
 


Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: MsgMeter

Postby juan_arroyo_t » Sun Oct 07, 2018 5:40 pm

Francisco

Me da este mensaje de error, no se que estoy haciendo mal

Error description: Error BASE/1004 Class: 'NIL' has no exported method: EVAL
Args:
[ 1] = U
[ 2] = L .T.
[ 3] = L .T.

Stack Calls
===========
Called from: => EVAL( 0 )
Called from: Source\LisCap.prg => EMIREPMAR( 141 )
Called from: Source\LisCap.prg => (b)LISCAPFIS( 37 )
Called from: Source\LisCap.prg => (b)MSGMETER( 347 )

Estoy llamando desde la function LisCapFis()

ACTION ( if( nOpcion = 1, ;
MsgMeter( { | oMeter, oText, oDlg, lEnd | EmiRepMar(oMeter, oText, oDlg, @lEnd) },, ), ;
MsgMeter( { | oMeter, oText, oDlg, lEnd | EmiRepRef(oMeter, oText, oDlg, @lEnd) },, ) ), oDlg:END() ) ;

En EmiRepMar
STATIC FUNCTION EmiRepMar( oMeter, oText, oDlg, lEnd )
-----------
-----------
oMeter:nTotal := mar->(Reccount())
-----------------
-----------------
do while !mar->(EOF())

EVAL ( oMeter:Set( mar->(Recno()) ), SysRefresh(), ! lEnd ) //EVERY 20
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: MsgMeter

Postby Antonio Linares » Mon Oct 08, 2018 6:43 am

Juan,

Estás intentando hacer Eval() de una expresión que no es un codeblock
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: MsgMeter

Postby juan_arroyo_t » Mon Oct 08, 2018 7:09 pm

Antonio

Funcionó perfecto, este es mi codigo
Code: Select all  Expand view


# include "fivewin.ch"

FUNCTION LisCapFis()
   LOCAL oDlg, oRad
   LOCAL aoBtn := { nil, nil }
   LOCAL cTitulo := "Listado de captura de inventario fisico"

   dbCloseAll()

   if !net_use( "cat",,, oApp:xDatos ) .or. ;
      !net_use( "mar",,, oApp:xDatos ) .or. ;
      !net_use( "smar",,,oApp:xDatos )
      dbCloseAll(); RETURN NIL
   endif

   nOpcion := 1

   DEFINE DIALOG oDlg RESOURCE "DLG_LIS_CAP_FIS" TITLE cTitulo

   REDEFINE RADIO oRad VAR nOpcion    ID 501, 502 OF oDlg UPDATE

   REDEFINE BUTTONBMP aoBtn[1] ID 400 OF oDlg ;
      PROMPT "A&ceptar " ;
      BITMAP "BTN_OK" TEXTRIGHT ;
      ACTION ( iif( nOpcion = 1, ;
                  MsgMeter( { | oMeter, oText, oDlg, lEnd | EmiRepMar(oMeter, oText, oDlg, @lEnd) },, ), ;
                  MsgMeter( { | oMeter, oText, oDlg, lEnd | EmiRepRef(oMeter, oText, oDlg, @lEnd) },, ) ), ;
                  oDlg:End() ) ;
      MESSAGE "Aceptar" UPDATE
      aoBtn[1]:cToolTip := "Presione para Continuar"

   REDEFINE BUTTONBMP aoBtn[2] ID 401 OF oDlg ;
      PROMPT "&Cancelar " BITMAP "BTN_CAN" TEXTRIGHT ;
      ACTION oDlg:End() ;
      MESSAGE "Cancelar" UPDATE CANCEL
      aoBtn[2]:cToolTip := "Presione para Cancelar"

   ACTIVATE DIALOG oDlg CENTERED ON INIT oninit( oDlg )

   DBCloseAll()

RETURN NIL

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

STATIC FUNCTION EmiRepMar( oMeter, oText, oDlg, lEnd )
   LOCAL oPrn, oFontC, oFontD, nContador
   LOCAL nRegIni, nRegFin, nCols, nColMar, nColCla, nColCan
   LOCAL cTitRep1, cTitRep2
   LOCAL cTitulo := "Listado de captura de inventario fisico"
   LOCAL nTotReg := 0, nRegAnt
   LOCAL nTotFis := 0
   LOCAL bSentencia := { || oMeter:Set( mar->(RecNo())) }

   oMeter:nTotal := mar->(Reccount())

   cTitRep1 := "REPORTE DE CAPTURA DE INVENTARIO FISICO"
   cTitRep2 := "POR MARBETE"

   mar->(OrdSetFocus(3))
   mar->(dbgotop())

   PRINT oPrn NAME cTitulo /*FROM*/ USER PREVIEW

      If Empty( oPrn:hDC )
         Return NIL
      End

      DEFINE FONT oFontC NAME "Tahoma" SIZE 0, -8 BOLD OF oPrn
      DEFINE FONT oFontD NAME "Tahoma" SIZE 0, -7 OF oPrn
      DEFINE PEN oPen WIDTH 2 OF oPrn

      oPrn:lPrvModal := .T.

      PAGE
         nRow := 1
         Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
         nContador := 1
         do while !mar->(EOF())

            EVAL ( bSentencia, SysRefresh(), ! lEnd )  //EVERY 20

            nRegIni := mar->(recno())
            nCols := 1
            //nContador := 1
            nColMar     := 01.5
            nColCla    := 02.0
            nColCan     := 05.5
            do while nCols <= 4
               oPrn:CmSay( nRow, nColMar, mar->marbete,                            oFontD,,,,2 )
               oPrn:CmSay( nRow, nColCla, mar->clave,                            oFontD )
               oPrn:CmSay( nRow, nColCan, TRANSFORM(mar->cant_fis,"9,999.99"),    oFontD,,,,1 )
               LinePrint( oPrn, nRow, 01.0, nRow, 20.5 )
               nTotReg += 1
               nTotFis += mar->cant_fis
               nRegFin := mar->(recno())
               nCols += 1
               nColMar += 5
               nColCla += 5
               nColCan += 5
               mar->(dbskip(65))
               if mar->(eof())
                  exit
               endif
            enddo

            nRow += 0.35
            nContador += 1
            if nContador > 65
               if nCols > 4
                  mar->(dbgoto(nRegFin))
                  mar->(dbskip())
                  if !mar->(eof())
                     oPrn:EndPage()
                     oPrn:StartPage()
                     nRow := 1
                     nContador := 1
                     Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
                     mar->(dbgoto(nRegFin))
                     mar->(dbskip())
                  endif
               endif

            else
               mar->(dbgoto(nRegIni))
               mar->(dbskip())
            endif

         enddo

         IF nRow >= 26
            oPrn:EndPage()
            oPrn:StartPage()
            nRow := 1
            Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
         endif

         oPrn:CmSay( nRow, 06.0, "Total de registros --> ", oFontD,,,,1 )
         oPrn:CmSay( nRow, 06.5, AllTrim(Transform(nTotReg,"99,999")),oFontD )
         oPrn:CmSay( nRow+0.40, 06.0, "Total de físico --> ", oFontD,,,,1 )
         oPrn:CmSay( nRow+0.40, 06.5, AllTrim(Transform(nTotFis,"999,999.99")),oFontD )

      ENDPAGE
   ENDPRINT
   oFontC:End()
   oFontD:End()
   oPen:End()

RETURN NIL

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

STATIC FUNCTION EmiRepRef( oMeter, oText, oDlg, lEnd )
   LOCAL oPrn, oFontC, oFontD, nContador
   LOCAL nRegIni, nRegFin, nCols, nColMar, nColCla, nColCan
   LOCAL cTitRep1, cTitRep2
   LOCAL cTitulo := "Listado de captura de inventario fisico"
   LOCAL nTotReg := 0, nRegAnt
   LOCAL bSentencia := { || oMeter:Set( smar->(RecNo())) }

   oMeter:nTotal := smar->(Reccount())

   cTitRep1 := "REPORTE DE CAPTURA DE INVENTARIO FISICO"
   cTitRep2 := "HOJAS DE TOMA DE INVENTARIO"

   smar->(dbgotop())

   PRINT oPrn NAME cTitulo /*FROM USER*/ PREVIEW

      If Empty( oPrn:hDC )
         Return NIL
      End

      DEFINE FONT oFontC NAME "Tahoma" SIZE 0, -8 BOLD OF oPrn
      DEFINE FONT oFontD NAME "Tahoma" SIZE 0, -7 OF oPrn
      DEFINE PEN oPen WIDTH 2 OF oPrn

      oPrn:lPrvModal := .T.

      PAGE
         nRow := 1
         Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
         nContador := 1
         do while !smar->(EOF())

            EVAL ( bSentencia, SysRefresh(), ! lEnd )  //EVERY 20

            nRegIni := smar->(recno())
            nCols := 1
            //nContador := 1
            nColMar     := 01.5
            nColCla    := 02.0
            nColCan     := 05.5
            do while nCols <= 4
               oPrn:CmSay( nRow, nColMar, smar->reflis,                            oFontD,,,,2 )
               oPrn:CmSay( nRow, nColCla, smar->clave,                            oFontD )
               oPrn:CmSay( nRow, nColCan, TRANSFORM(smar->cant_fis,"9,999.99"),    oFontD,,,,1 )
               LinePrint( oPrn, nRow, 01.0, nRow, 20.5 )
               nTotReg += 1
               nRegFin := smar->(recno())
               nCols += 1
               nColMar += 5
               nColCla += 5
               nColCan += 5
               smar->(dbskip(65))
               if smar->(eof())
                  exit
               endif
            enddo

            nRow += 0.35
            nContador += 1
            if nContador > 65
               if nCols > 4
                  smar->(dbgoto(nRegFin))
                  smar->(dbskip())
                  if !smar->(eof())
                     oPrn:EndPage()
                     oPrn:StartPage()
                     nRow := 1
                     nContador := 1
                     Cabeceras( oPrn, oFontC, oFontD, cTitRep1, cTitRep2 )
                     smar->(dbgoto(nRegFin))
                     smar->(dbskip())
                    endif
                 endif

            else
               smar->(dbgoto(nRegIni))
               smar->(dbskip())
            endif

         enddo

         LinePrint( oPrn, nRow, 01.0, nRow, 20.5 )
         oPrn:CmSay( nRow+0.20, 04.0, "Total de registros --> " + STR(nTotReg),oFontD )

      ENDPAGE
   ENDPRINT
   oFontC:End()
   oFontD:End()
   oPen:End()

RETURN .T.

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

// FIN DE : LISCAP.PRG

 


Noto algo cuando la barra del meter esta avanzando
imagen
https://1drv.ms/v/s!AgM94kAKnz9CkVtSjFHJKEOCMy1U

Por favor comentame si estas instrucciones son correctas

LOCAL bSentencia := { || oMeter:Set( smar->(RecNo())) }
EVAL ( bSentencia, SysRefresh(), ! lEnd ) //EVERY 20

Saludos
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: MsgMeter

Postby FranciscoA » Tue Oct 09, 2018 1:12 am

Juan,
//-------------------------------------
// Imprimir y msgmeter()
// el meter se ve mientras se crean las pag del meta file
// falta controlarlo mientras imprime
Code: Select all  Expand view
//------------------------------------//
FUNCTION PrnMsgMet()
  MsgMeter( { | oMeter, oText, oDlg, lEnd | ;
              PrnMsgMeter( oMeter, oText, oDlg, @lEnd ) },, )

Return NIL
//--------------------------------------
FUNCTION PrnMsgMeter(oMeter, oText, oDlg, lEnd )
   LOCAL oPrn, nRow:=0, nRowStep, nColStep, nCol1, nCol2, nPag:=0

   DBSELECTAREA("MAEPRODT")
   dbsetOrder(1)
   DBGOTOP()

   PRINT oPrn NAME "prueba" PREVIEW

   nRowStep := oPrn:nVertRes() / 40    // LINEAS
   nColStep := oPrn:nHorzRes() / 80    // COLUMNAS

   nCol1 := nColStep*4      
   nCol2 := nColStep*14

   oMeter:nTotal = RecCount()

   While !eof()
       nRow := 1
       nPag += 1
     PAGE
       nRow += nRowStep*2  
       oPrn:Say( nRow, nCol1, "Page No." +str(nPag,3) )
       nRow += nRowStep*2  
       While nRow <= nRowStep*20
          oMeter:Set( RecNo() )
          oMeter:Refresh()  //SysRefresh()
          oPrn:Say( nRow, nCol1, field->codigo )
          oPrn:Say( nRow, nCol2, field->descrip )
          dbskip()
          nRow += nRowStep
       Enddo
     ENDPAGE
   Enddo

   ENDPRINT
Return nil  


Saludos
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: MsgMeter

Postby juan_arroyo_t » Tue Oct 09, 2018 3:52 am

Francisco

Muchas gracias por tu ayuda

La intención de usar MsgMeter (antes lo tenia con MsgRun) es la de ver el avance antes de que aparezca el preview sobre todo en reportes largos.

En el post donde estoy respondiendo al de Antonio y donde pegue un link de un video donde muestro el avance del meter me da la impresión de que no es normal (lo comparo con la rutina que tengo para regenerar los indices).

Estuve batallando un poco con la instrucción EVAL ( oMeter:Set( mar->(Recno()) ), SysRefresh(), ! lEnd ) //EVERY 20 hasta que me aclaró Antonio que esto debía contener la evaluacion de un bloque de codigo

Viste el video ?

Por favor enviame tus comentarios

Saludos
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: MsgMeter

Postby FranciscoA » Tue Oct 09, 2018 3:09 pm

Hola Juan.
Ese comportamiento raro parece ser porque retornas al registro inicial:
Code: Select all  Expand view
           else
               (cAlias)->(dbgoto(nRegIni))
 

Por favor prueba modificando lo siguiente:
Code: Select all  Expand view
  //bSentencia := { || oMeter:Set( (cAlias)->(RecNo()) ) }
   bSentencia := { || oMeter:Set( nTotReg ) }
 

He probado tu codigo y con esta modificacion no se observa el comportamiento raro.
Saludos.

P.D.
Con cual programa hiciste el video?
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: MsgMeter

Postby juan_arroyo_t » Tue Oct 09, 2018 5:07 pm

Francisco

Funcionó perfecto

Pagina de programa de video
https://obsproyect.com

link del video
https://1drv.ms/v/s!AgM94kAKnz9CkVzNfoBAZh69qVwm

El programa de grabacion de videos lo he utilizado muy poco pero se me hace muy bueno y es free

Cualquier cosa hay tienes mi correo

Muchas gracias por tu ayuda

Saludos
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: MsgMeter

Postby FranciscoA » Tue Oct 09, 2018 8:32 pm

Me alegro de que te sirviera.
Gracias por el link .
Saludos
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 84 guests