DbCombo Fwh no funcina

DbCombo Fwh no funcina

Postby fsandoval » Sat Nov 12, 2005 2:48 pm

Una preunta porque el dbcombo en fwh no funciona, el ejemplo de los dbctest con clipper funciona y fwh no corre.

cuales son los cambios que hay que hacer.


saludos.
fernando sandoval ruiz
fernando sandoval ruiz
fsandoval@hotmail.com
fsandoval
 
Posts: 71
Joined: Mon Oct 10, 2005 9:24 pm
Location: aguascalientes

Postby Antonio Linares » Sat Nov 12, 2005 3:00 pm

Fernando,

Acabamos de probar samples\dbctest.prg con FW y FWH y ambos funcionan igual. El combobox se ve así:

Image
regards, saludos

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

Antonio Gracias pero el fwh4 NO

Postby fsandoval » Sat Nov 12, 2005 4:30 pm

Aqui esta el codigo que estoy utilizando prove el dbctest fw funciona pero fwh4. NO

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

Function ManArticul( nEvent, oTbM , oDb)
local oDlg
local cTBaja := "ESTA DE ALTA"
local lSave := .f.
Local NumArt :=Space(6)
Local NomArt :=Space(40)
Local GruArt :=space(45)
Local SubgArt:=space(40)
Local UniArt :=Space(30)
Local Costo :=0
Local PVenta :=0
Local Existen:=0
Local TIVA :=0
Local TIEPS :=0
Local Exento :=0
Local TCero :=0
Local Clase :=0
Local oTbGpos,oTbUni,oTbSGpos,oTbCla
Local lExento,LTCero:=.f.
Local oDbGrupos
Local oGetUni, oGetGrupos, oGetSubG, oGet

local nRecNo := oTbM:RecNo()
if nEvent == ID_AMOD
NumArt :=oTbM:xFieldGet(1 )
NomArt :=oTbM:xFieldGet( 2 )
GruArt :=oTbM:xFieldGet(3)
SubGArt:=oTbM:xFieldGet(4)
UniArt :=oTbM:xFieldGet(5)
Costo :=oTbM:xFieldGet(6)
PVenta :=oTbM:xFieldGet(7)
Existen:=oTbM:xFieldGet(8)
TIva :=oTbM:xFieldGet(9)
TIEPS :=oTbM:xFieldGet(10)
Exento :=oTbM:xFieldGet(11)
TCero :=oTbM:xFieldGet(12)
Clase :=oTbM:xFieldGet(13)
endif


if oDb:Used()

DEFINE TABLE oTbGpos NAME "grupos" DATAFIELD ;
ORDER BY 1;
OF oDb

OPEN TABLE oTbGpos
if oTbGpos:lOpened
if oTbGpos:RecCount() > 0
// oTbGpos:Read()
DbCreate( oTbGpos:cName, MyDbStruct( oTbGpos:hResult ) )
DbUseArea( .t.,"DBFCDX", oTbGpos:cName, "GRUPOS" )
DbCreateIndex("grupos","numgpo")
nFldCount := oTbGpos:FieldCount()
oTbGpos:GoTop()
ns := Seconds()
while oTbGpos:FetchRow() // Salta, hace el read pero no controla registro ni pone el eof
// @ 10, 10 SAY "Tratando registro: " + AllTrim( str( ++i ) ) // El pintado es una perdida de tiempo pero entretiene ;-)
DbAppend()
FOR n := 1 TO nFldCount
FieldPut( n, oTbGpos:xFieldGet( n ) )
NEXT
end
DbCommit()
DbGoTop()
DATABASE oDbGrupos
else
MsgAlert("La Tabla de Grupos esta vacia")
return(.t.)
endif
else
msgAlert("La Tabla de grupos no esta abirta")
return(.t.)
endif

DEFINE TABLE oTbSGpos NAME "subgrupos" DATAFIELD ;
ORDER BY 1;
OF oDb

OPEN TABLE oTbSGpos
if oTbSGpos:lOpened
if oTbSGpos:RecCount() > 0
// oTbGpos:Read()
DbCreate( oTbSGpos:cName, MyDbStruct( oTbSGpos:hResult ) )
DbUseArea( .t.,, oTbSGpos:cName,"SubGrupos" )
DbCreateIndex("subgrupos","numsubgpo")
nFldCount := oTbSGpos:FieldCount()
oTbSGpos:GoTop()
ns := Seconds()
while oTbSGpos:FetchRow() // Salta, hace el read pero no controla registro ni pone el eof
// @ 10, 10 SAY "Tratando registro: " + AllTrim( str( ++i ) ) // El pintado es una perdida de tiempo pero entretiene ;-)
DbAppend()
FOR n := 1 TO nFldCount
FieldPut( n, oTbSGpos:xFieldGet( n ) )
NEXT
end
DbCommit()
DbGoTop()
DATABASE oDbSGrupos
else
MsgAlert("La Tabla de Sub Grupos esta vacia")
return(.t.)
endif
else
msgAlert("La Tabla de Sub grupos no esta abirta")
return(.t.)
endif



DEFINE TABLE oTbUni NAME "unimedidas" DATAFIELD ;
ORDER BY 1;
OF oDb

OPEN TABLE oTbUni
if oTbUni:lOpened
if oTbUni:RecCount() > 0
// oTbGpos:Read()
DbCreate( oTbUni:cName, MyDbStruct( oTbUni:hResult ) )
DbUseArea( .t.,, oTbUni:cName ,"unidades")
DbCreateIndex("unidades","numuni")
nFldCount := oTbUni:FieldCount()
oTbUni:GoTop()
ns := Seconds()
while oTbUni:FetchRow() // Salta, hace el read pero no controla registro ni pone el eof
// @ 10, 10 SAY "Tratando registro: " + AllTrim( str( ++i ) ) // El pintado es una perdida de tiempo pero entretiene ;-)
DbAppend()
FOR n := 1 TO nFldCount
FieldPut( n, oTbUni:xFieldGet( n ) )
NEXT
end
DbCommit()
DbGoTop()
DATABASE oDbUniMed
else
MsgAlert("La Tabla de Unidades esta vacia")
return(.t.)
endif
else
msgAlert("La Tabla de Unidades no esta abirta")
return(.t.)
endif


DEFINE TABLE oTbCla NAME "clases" DATAFIELD ;
ORDER BY 1;
OF oDb

OPEN TABLE oTbCla
if oTbCla:lOpened
if oTbCla:RecCount() > 0
// oTbGpos:Read()
DbCreate( oTbCla:cName, MyDbStruct( oTbCla:hResult ) )
DbUseArea( .t.,, oTbCla:cName, "clases" )
DbCreateIndex("clases","clase")

nFldCount := oTbCla:FieldCount()
oTbCla:GoTop()
ns := Seconds()
while oTbCla:FetchRow() // Salta, hace el read pero no controla registro ni pone el eof
// @ 10, 10 SAY "Tratando registro: " + AllTrim( str( ++i ) ) // El pintado es una perdida de tiempo pero entretiene ;-)
DbAppend()
FOR n := 1 TO nFldCount
FieldPut( n, oTbCla:xFieldGet( n ) )
NEXT
end
DbCommit()
DbGoTop()
DATABASE oDbClase
else
MsgAlert("La Tabla de Clasificacion esta vacia")
return(.t.)
endif

else
msgAlert("La Tabla de Clasificaion no esta abirta")
return(.t.)
endif



else
MsgAlert("No esta en uso la base de datos de comandas")
endif

MSGINFO( GRUPOS->NOMGPO)

DEFINE DIALOG oDlg RESOURCE "DLGART" TITLE "Mantenimiento de Articulos / " + ;
if( nEvent == ID_AALT, "Altas", "Modificaciones" )


REDEFINE GET NumArt ID 101 PICTURE "@K!" WHEN nEvent==ID_AALT ;
OF oDlg

REDEFINE GET NomArt ID 102 PICTURE "@K!" OF oDlg

/*
REDEFINE BTNGET oGet VAR GruArt ID 103 RESOURCE "combo" ACTION ( SelGrupo( oGet , 200 , 200 ) , oGet:KeyDown(VK_RETURN, 1)) ;
VALID (if( oDbGrupos:Seek( GruArt ) .and. !empty( GruArt ) , ( oDbGrupos:Load(), .t.) , ;
( MsgInfo( "El Grupo " + AllTrim( GruArt ) + ;
" no existe" ), .f. ))) OF oDlg UPDATE
*/
REDEFINE BTNGET oGetSubg VAR SubGArt ID 104 RESOURCE "combo" ACTION ( SelSubGrupo( oGetSubG , 200 , 200 ) , oGetSubG:KeyDown(VK_RETURN, 1)) ;
VALID (if( oDbSGrupos:Seek( SubGArt ) .and. !empty( SUbGArt ) , ( oDbSGrupos:Load(), .t.) , ;
( MsgInfo( "El Sub Grupo " + AllTrim( SUbGArt ) + ;
" no existe" ), .f. ))) OF oDlg UPDATE

REDEFINE BTNGET oGetUni VAR UniArt ID 105 RESOURCE "combo" ACTION ( SelUnidad( oGetUni , 200 , 200 ) , oGetUni:KeyDown(VK_RETURN, 1)) ;
VALID (if( oDbUniMed:Seek( UniArt ) .and. !empty( UniArt ) , ( oDbUniMed:Load(), .t.) , ;
( MsgInfo( "La Unidad de Medida" + AllTrim( UniArt ) + ;
" no existe" ), .f. ))) OF oDlg UPDATE

REDEFINE BTNGET oGetCla VAR Clase ID 112 RESOURCE "combo" ACTION ( SelClase( oGetCla , 200 , 200 ) , oGetCla:KeyDown(VK_RETURN, 1)) ;
VALID (if( oDbClase:Seek( Clase ) .and. !empty( Clase ) , ( oDbClase:Load(), .t.) , ;
( MsgInfo( "La clase " + AllTrim( Clase ) + ;
" no existe" ), .f. ))) OF oDlg UPDATE


REDEFINE DBCOMBO oGetArt VAR GruArt ID 103 OF oDLG;
ALIAS "GRUPOS" ITEMFIELD "NUMGPO" LISTFIELD "NOMGPO"
/*
REDEFINE DBCOMBO SubGArt ID 104 OF oDLG;
ALIAS "subgrupos" ITEMFIELD "NumSubGpo" LISTFIELD "NomSubGpo"

REDEFINE DBCOMBO UniArt ID 105 OF oDLG;
ALIAS "unidades" ITEMFIELD "NumUni" LISTFIELD "NomUni"

REDEFINE DBCOMBO Clase ID 112 OF oDLG;
ALIAS "Clases" ITEMFIELD "Clase" LISTFIELD "NomCla"
*/
REDEFINE GET Costo ID 106 PICTURE "9,999.99" OF oDlg
REDEFINE GET PVenta ID 107 PICTURE "9,999.99" OF oDlg
REDEFINE GET TIva ID 108 PICTURE "99.99" OF oDlg
REDEFINE GET TIEPS ID 110 PICTURE "99.99" OF oDlg

REDEFINE RADIO oExento VAR Exento ID 109 ,111 OF oDlg WHEN TIva = 0

REDEFINE BUTTON ID 201 OF oDlg ACTION ( lSave := .t. , DbCloseAll() , oDlg:End())
REDEFINE BUTTON ID 299 OF oDlg ACTION ( lSave := .f. , DbCloseAll() , oDlg:End())

ACTIVATE DIALOG oDlg CENTER

if lSave
if Exento = 2
TCero =1
else
TCero =0
endif

if TIva >0
TCero=0
Exento=0
endif

if nEvent= ID_AALT
SqlStm="INSERT INTO articul ( NUMART , NOMBRE , NUMGPO, SUBGPO , NUMUNI , COSTO , PREVTA , TASAIVA ,TASAIEPS, EXENTO, TASACERO, CLASE , numcia ) VALUES( "
SqlStm=SqlStm+"'"+alltrim(NumArt)+"','"+alltrim(NomArt)+"','"+alltrim(GruArt)+"','"+alltrim(SubgArt)+"','"+alltrim(UniArt)+"','"+alltrim(Str(Costo))+"','"+alltrim(Str(PVenta))+"','"+alltrim(Str(TIva))+"','"+alltrim(Str(TIEPS))+"','"+alltrim(Str(Exento))+"','"+alltrim(Str(TCero))+"','"+alltrim(Clase)+"','"+ alltrim(Str(LnEmp))+"'"+")"
oTbM:ExecSql( SqlStm )
oTbM:Last():Read()
else
SqlStm="UPDATE articul SET NOMBRE="+"'"+alltrim(NomArt)+"',NUMGPO='"+alltrim( GruArt )+"', SUBGPO='"+alltrim( SubgArt)+"',NUMUNI='"+alltrim( UniArt )+"',COSTO='"+alltrim( Str(Costo))+"',PREVTA='"+alltrim( Str(PVenta))+"',TASAIVA='"+alltrim( Str(TIva))+"',TASAIEPS='"+alltrim( Str(TIEPS))+"',EXENTO='"+alltrim( Str(Exento))+"',TASACERO='"+alltrim( Str(TCero)) +"',numcia='"+alltrim( str(LnEmp))+"'"+" WHERE NUMART='"+alltrim(NumArt)+"'"
oTbM:ExecSql( SqlStm )
oTbM:Last():Read()
endif
endif


return( nil )
fernando sandoval ruiz
fsandoval@hotmail.com
fsandoval
 
Posts: 71
Joined: Mon Oct 10, 2005 9:24 pm
Location: aguascalientes

Postby Antonio Linares » Sat Nov 12, 2005 6:39 pm

Fernando,

Que versión y build de FWH estás usando ?
regards, saludos

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

Uso la FWH2.4

Postby fsandoval » Sat Nov 12, 2005 8:38 pm

Uso la fwh 2.4
fernando sandoval ruiz
fsandoval@hotmail.com
fsandoval
 
Posts: 71
Joined: Mon Oct 10, 2005 9:24 pm
Location: aguascalientes


Return to FiveWin para CA-Clipper

Who is online

Users browsing this forum: No registered users and 1 guest