Xbrowse no Actualiza Datos

Xbrowse no Actualiza Datos

Postby remtec » Wed Jul 15, 2020 5:31 pm

Hola Amigo

Necesito de su ayuda.

Tengo un Xbrowse que debo se debe actualizar por medio de una variable.

Cuando digito el Rut, despues de validar, debe actualizar los datos del xbrowse y no logro hacerlo, estoy tratando de usar OrdScope.

Muchos Saludos.
Antonio

Dejo el codigo:
Code: Select all  Expand view

        Local Rut_Pac1:=Spac(12)
...
..
            Abre_dbf("GeneCoti",3,.f.,"GeneC")
            Set Inde to GeneCoti
                DbSetorder(2)
            cAlias="GeneC"

            (cAlias)->(OrdScope(0, Rut_Pac1))
            (cAlias)->(OrdScope(1, Rut_Pac1))
            (cAlias)->(DbGotop())
            Define Font oFont1 Name "Arial" Size 0,25    BOLD
            Define Font oFont2 Name "Arial" Size 0,-14    BOLD
            Gra:=0

            DEFINE DIALOG oDlgBus RESOURCE "BUSCA_COTI"     STYLE nOr( WS_POPUP, WS_VISIBLE, WS_DLGFRAME )     COLORS RGB( 138, 4, 4)

            REDEFINE SAY oSay1 ID 4004 PROMPT "COTIZACIONES REALIZADAS" OF oDlgBus FONT oFont1  COLORS RGB( 56, 76, 170)

            REDEFINE SAY oSay3 ID 4011 PROMPT "Rut Paciente" OF oDlgBus FONT oFont2    RIGHT

            REDEFINE SAY oSay4 ID 4005 PROMPT "Nombre" OF oDlgBus FONT oFont2  RIGHT

            // Este Get es el encargado de Actualizar el Xbrowse
            Redefine Get oRut VAR Rut_Pac1 ID 4008 PICTURE "@R ##.###.####!" FONT oFont2 OF oDlgBus COLOR RGB(0,0,128), RGB(159,233,255);
            WHEN  ( oRut:oGet:Picture := "@KR #########!", .T. );
        VALID If( Vrut({oRut},Rut_Pac1), (oRut:oGet:Picture := "@R ##.###.####!", oRut:Refresh(),oBrw:Refresh(), .t. ), .f. )

            Redefine SAY oNom Var Nom_Pac1 Id 4012 Of oDlgBus Update Picture "@!" FONT oFont2   COLOR RGB(0,0,128), RGB(159,233,255)

            REDEFINE BTNBMP oBtn1 ID 4007 PROMPT "VOLVER"  Resource "#8002" 2007 FONT oFont2 OF oDlgBus MESSAGE "VOLVER Y NO GRABA"  ;
                    ACTION (oDlgBus:END())


        REDEFINE XBROWSE oBrw  OF oDlgBus ALIAS "GeneC"  ID 4001;
                        HEADERS 'Folio','Fecha','Digita','Hora';
                        FIELDS GeneC->Nro_Cot,ctod(GeneC->Fec_Cot),GeneC->Cod_Dig,GeneC->Hor_Dig;
                        COLSIZES 70, 90, 60, 60;
                        PICTURES '@!','@D','@!','@!';
                        FONT oFont2;
               CELL LINES AUTOSORT NOBORDER

                                         oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
                                         oBrw:nColDividerStyle := LINESTYLE_RAISED
                                         oBrw:nRowDividerStyle := LINESTYLE_RAISED
                                             oBrw:bClrHeader := {|| { nRGB(140, 0, 0), nRGB( 231, 242, 255 ), } }
                                             oBrw:nOpacity    := 230
                                             oBrw:nHeaderHeight      := 35
                                             oBrw:nFreeze       := 2
                                             AEval( oBrw:aCols, { |o| o:nHeadStrAlign := AL_CENTER } )
                                             oDlgBus:bStart:={ || oBrw:Gotop() }

                                            oBrw:bClrStd  := { || If( Eval( oBrw:bKeyNo,,oBrw) % 2 == 0, { CLR_BLACK, RGB( 198, 255, 198 ) },;
                                             { CLR_BLACK, RGB( 232, 255, 232 ) } ) }    // Efecto Cebra
                                             oBrw:Seek("")
                                             oBrw:bClrStd             := {|| { nRGB(  0,  0,  0), nRGB(255,248,220) } }

                                             oBrw:bClrSelFocus        := {|| { nRGB(  255,  255,  255), nRGB(102, 178, 255) } }
                                             oBrw:bClrSel       := {|| { nRGB(  0,  0,255), nRGB(241,222,088) } }  // para barra de linea selecc cuando el control no tiene el foco
                                            oBrw:lAutoSort := .t.
                                            oBrw:lFooter := .f.
                                            oBrw:lHScroll := .f.
                                    oBrw:lIncrFilter      := .t.
                                    oBrw:lSeekWild        := .F.                   &&  .T. Busca Contenido, .F. Que comience con lo que digita
                                            oBrw:nColorPen := CLR_RED
                                            oBrw:bChange := {|| oBrw:Refresh() }



 
FWH 22.10 - HARBOUR - PELLES C
remtec
 
Posts: 719
Joined: Fri May 12, 2017 2:50 pm

Re: Xbrowse no Actualiza Datos

Postby karinha » Wed Jul 15, 2020 6:41 pm

Code: Select all  Expand view

#include "Fivewin.Ch"
#include "Ord.Ch"     // PARA SCOPES()

FUNCTION ACTUALIZA()

   LOCAL oFont1, oFont2 // etc
   LOCAL Rut_Pac1 := Spac( 12 )

   Abre_dbf( "GeneCoti", 3, .F. , "GeneC" ) // COMO ESTA LA APERTURA?

   SET INDEX TO GeneCoti  // NTX?

   DbSetorder( 2 ) // ESTA CORRECTO EL INDICE? SET ORDER TO 2

   cAlias := ALIAS() // "GeneC"

   ( cAlias )->( OrdScope( 0, Rut_Pac1 ) )
   ( cAlias )->( OrdScope( 1, Rut_Pac1 ) )
   ( cAlias )->( DbGotop() )

   Define Font oFont1 Name "Arial" Size 0, 25    BOLD
   Define Font oFont2 Name "Arial" Size 0, - 14    BOLD
   Gra := 0

   DEFINE DIALOG oDlgBus RESOURCE "BUSCA_COTI" STYLE nOr( WS_POPUP, WS_VISIBLE, WS_DLGFRAME ) COLORS RGB( 138, 4, 4 )

   REDEFINE SAY oSay1 ID 4004 PROMPT "COTIZACIONES REALIZADAS" OF oDlgBus FONT oFont1  COLORS RGB( 56, 76, 170 )

   REDEFINE SAY oSay3 ID 4011 PROMPT "Rut Paciente" OF oDlgBus FONT oFont2    RIGHT

   REDEFINE SAY oSay4 ID 4005 PROMPT "Nombre" OF oDlgBus FONT oFont2  RIGHT

// Este Get es el encargado de Actualizar el Xbrowse
   Redefine GET oRut VAR Rut_Pac1 ID 4008 PICTURE "@R ##.###.####!" FONT oFont2 OF oDlgBus COLOR RGB( 0, 0, 128 ), RGB( 159, 233, 255 );
      WHEN  ( oRut:oGet:Picture := "@KR #########!", .T. );
      VALID If( Vrut( { oRut },Rut_Pac1 ), ( oRut:oGet:Picture := "@R ##.###.####!", oRut:Refresh(),oBrw:Refresh(), .T. ), .F. )

   Redefine SAY oNom Var Nom_Pac1 Id 4012 Of oDlgBus Update PICTURE "@!" FONT oFont2   COLOR RGB( 0, 0, 128 ), RGB( 159, 233, 255 )

   REDEFINE BTNBMP oBtn1 ID 4007 PROMPT "VOLVER"  Resource "#8002" 2007 FONT oFont2 OF oDlgBus MESSAGE "VOLVER Y NO GRABA"  ;
      ACTION ( oDlgBus:END() )


   REDEFINE XBROWSE oBrw  OF oDlgBus ALIAS "GeneC"  ID 4001;
      HEADERS 'Folio', 'Fecha', 'Digita', 'Hora';
      FIELDS GeneC->Nro_Cot, ctod( GeneC->Fec_Cot ), GeneC->Cod_Dig, GeneC->Hor_Dig;
      COLSIZES 70, 90, 60, 60;
      PICTURES '@!', '@D', '@!', '@!';
      FONT oFont2;
      CELL LINES AUTOSORT NOBORDER

   oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
   oBrw:nColDividerStyle := LINESTYLE_RAISED
   oBrw:nRowDividerStyle := LINESTYLE_RAISED
   oBrw:bClrHeader := {|| { nRGB( 140, 0, 0 ), nRGB( 231, 242, 255 ), } }
   oBrw:nOpacity    := 230
   oBrw:nHeaderHeight      := 35
   oBrw:nFreeze       := 2
   AEval( oBrw:aCols, { |o| o:nHeadStrAlign := AL_CENTER } )
   oDlgBus:bStart := { || oBrw:Gotop() }

   oBrw:bClrStd  := { || If( Eval( oBrw:bKeyNo,,oBrw ) % 2 == 0, { CLR_BLACK, RGB( 198, 255, 198 ) }, ;
      { CLR_BLACK, RGB( 232, 255, 232 ) } ) }    // Efecto Cebra
   oBrw:Seek( "" )
   oBrw:bClrStd             := {|| { nRGB(  0,  0,  0 ), nRGB( 255,248,220 ) } }

   oBrw:bClrSelFocus        := {|| { nRGB(  255,  255,  255 ), nRGB( 102, 178, 255 ) } }
   oBrw:bClrSel       := {|| { nRGB(  0,  0,255 ), nRGB( 241,222,088 ) } }  // para barra de linea selecc cuando el control no tiene el foco
   oBrw:lAutoSort := .T.
   oBrw:lFooter := .F.
   oBrw:lHScroll := .F.
   oBrw:lIncrFilter      := .T.
   oBrw:lSeekWild        := .F.                   //  .T. Busca Contenido, .F. Que comience con lo que digita
   oBrw:nColorPen := CLR_RED
   oBrw:bChange := {|| oBrw:Refresh() }

RETURN NIL

FUNCTION cPicture_Get()  // aqui la mascara del GET. Cambie para tu ejemplo.

   IF cTipo = "J" .AND. oGet:cPicture != "@R 99.999.999/9999-99"
      cCgc := Space( 14 )
      oGet:cPicture := "@R 99.999.999/9999-99"
      oGet:oGet:Picture := "@R 99.999.999/9999-99"
      oGet:Refresh()
   ELSEIF cTipo = "F" .AND. oGet:cPicture != "@R 999.999.999-99"
      cCgc := Space( 11 )
      oGet:cPicture := "@R 999.999.999-99"
      oGet:oGet:Picture := "@R 999.999.999-99"
      oGet:Refresh()
   ENDIF

RETURN( .T. )
 


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

Re: Xbrowse no Actualiza Datos

Postby remtec » Thu Jul 16, 2020 10:25 pm

Hola Karinha

Muchas gracias por responder.

Mira, el get que tengo esta funcionando bien, incluyendo la validación del rut_pac1.

Mi problema se genera al digitar un rut_pac1, el xbrowse debiera mostarar los datos de ese rut_pac1 existentes el la Dbf "GeneC", que esta indexada por Rut_Pac, pense usar el OrdScope, para filtrar, pero esto no sucede.

Muchas gracias y muchos saludos.

Antonio
FWH 22.10 - HARBOUR - PELLES C
remtec
 
Posts: 719
Joined: Fri May 12, 2017 2:50 pm

Re: Xbrowse no Actualiza Datos

Postby karinha » Thu Jul 16, 2020 10:32 pm

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

Re: Xbrowse no Actualiza Datos

Postby FranciscoA » Sat Jul 18, 2020 5:38 pm

Hola Antonio.
Mira este ejemplo que te puede servir de guia:
Code: Select all  Expand view
#include "fivewin.ch"
#include "Ord.ch"
//------------------------------------------------//FAP
Function InfoScoped()
local oDlg, oBrw, cAlias, oFont
local oState, cState

   dbUseArea(.t.,,"Customer","CUST",.f.)
   dbSelectArea("CUST")
   index on field->State To cu temporary
   cAlias := Alias()

   (cAlias)->( OrdSetFocus("CU") )

   cState := space(len(Cust->state))

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE DIALOG oDlg SIZE 800,500 PIXEL TRUEPIXEL FONT oFont;
      TITLE "Prueba Scope"

   @ 20, 20 SAY "State" SIZE 100,20 PIXEL OF oDlg

   @ 20,120 GET oState VAR cState SIZE 100,20 PIXEL OF oDlg PICTURE "@!" ;
           VALID if( !Empty(cState), (PonerScope(oBrw,cAlias,cState,.t.),.t.), (PonerScope(oBrw,cAlias,cState,.f.),.f.) )

   @ 20,250 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUST" ;
      COLUMNS 'State','First', 'City' ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      oBrw:CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

   (cAlias)->(dbCloseArea())
return nil

//---------------------------------------
Function PonerScope(oBrw,cAlias,cState,lScope)
  if lScope
    (cAlias)->( OrdScope(TOPSCOPE,cState) )
    (cAlias)->( OrdScope(BOTTOMSCOPE,cState) )
  else
    (cAlias)->( OrdScope(TOPSCOPE,NIL) )
    (cAlias)->( OrdScope(BOTTOMSCOPE,NIL) )
  endif

  (cAlias)->( DbGotop() )
  oBrw:Refresh()
Return nil
 

Saludos.
Francisco José Alegria Pérez
Francisco J. Alegría P.
Chinandega, Nicaragua.

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

Re: Xbrowse no Actualiza Datos

Postby remtec » Sun Jul 19, 2020 9:25 pm

karinha wrote:Entonces, use INDEX ON... TEMPORARY


Hola Karinha

Muchas gracias por tu ayuda.

Saludos

Antonio
FWH 22.10 - HARBOUR - PELLES C
remtec
 
Posts: 719
Joined: Fri May 12, 2017 2:50 pm

Re: Xbrowse no Actualiza Datos

Postby remtec » Sun Jul 19, 2020 9:26 pm

FranciscoA wrote:Hola Antonio.
Mira este ejemplo que te puede servir de guia:
Code: Select all  Expand view
#include "fivewin.ch"
#include "Ord.ch"
//------------------------------------------------//FAP
Function InfoScoped()
local oDlg, oBrw, cAlias, oFont
local oState, cState

   dbUseArea(.t.,,"Customer","CUST",.f.)
   dbSelectArea("CUST")
   index on field->State To cu temporary
   cAlias := Alias()

   (cAlias)->( OrdSetFocus("CU") )

   cState := space(len(Cust->state))

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE DIALOG oDlg SIZE 800,500 PIXEL TRUEPIXEL FONT oFont;
      TITLE "Prueba Scope"

   @ 20, 20 SAY "State" SIZE 100,20 PIXEL OF oDlg

   @ 20,120 GET oState VAR cState SIZE 100,20 PIXEL OF oDlg PICTURE "@!" ;
           VALID if( !Empty(cState), (PonerScope(oBrw,cAlias,cState,.t.),.t.), (PonerScope(oBrw,cAlias,cState,.f.),.f.) )

   @ 20,250 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUST" ;
      COLUMNS 'State','First', 'City' ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      oBrw:CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

   (cAlias)->(dbCloseArea())
return nil

//---------------------------------------
Function PonerScope(oBrw,cAlias,cState,lScope)
  if lScope
    (cAlias)->( OrdScope(TOPSCOPE,cState) )
    (cAlias)->( OrdScope(BOTTOMSCOPE,cState) )
  else
    (cAlias)->( OrdScope(TOPSCOPE,NIL) )
    (cAlias)->( OrdScope(BOTTOMSCOPE,NIL) )
  endif

  (cAlias)->( DbGotop() )
  oBrw:Refresh()
Return nil
 

Saludos.
Francisco José Alegria Pérez


Hola Francisco

Como estas amigo?

Muchas gracias por responder y tu ayuda.

Aplique tu codigo y ya esta funcionando.

Muchas gracias y muchos saludos.

Antonio
FWH 22.10 - HARBOUR - PELLES C
remtec
 
Posts: 719
Joined: Fri May 12, 2017 2:50 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 43 guests