by jpcavagnaro » Sun Sep 11, 2022 12:03 pm
Gracias por responder, este es el código:
xOrdenadoPor =""
xcampobusca = "Nombre"
cSQL := "SELECT top(25) * FROM clientes "
oRS1cli := CargaRecordSet( cSQL, CadenaCon )
DEFINE FONT oFont NAME "Arial narrow" SIZE 0, - 12
DEFINE FONT oFont1 NAME "Arial narrow " SIZE 6, 18
DEFINE WINDOW oWndChild MDICHILD OF oWnd FROM 0,0 TO 24,79TITLE "Actualización de Clientes "
DEFINE DIALOG odlg RESOURCE "pan_actu" ;
OF oWndChild
REDEFINE GET obusco var xbusco ID 171 PICTURE "@!" OF oDlg ;
ON CHANGE ( ::assign(), oRS1Cli:=buscosql( oBrow, xbusco, oRS1Cli ) )
REDEFINE LISTBOX oBrow FIELDS ;
iif (oRS1Cli:Fields( "activo" ):Value="S",aHbitMaps[1],aHbitMaps[2]),; // str( oRS1Cli:Fields( "Id" ):Value, 0 ), ; str( oRS1Cli:Fields( "Id" ):Value, 0 ), ;
str( oRS1Cli:Fields( "numero" ):Value, 0 ), ;
str( oRS1Cli:Fields( "documento" ):Value, 0 ), ;
str( oRS1Cli:Fields( "vendedor" ):Value, 0 ), ;
oRS1Cli:Fields( "Nombre" ):Value, ;
oRS1Cli:Fields( "Apodo" ):Value, ;
oRS1Cli:Fields( "Domic" ):Value, ;
oRS1Cli:Fields( "copo" ):Value, ;
oRS1Cli:Fields( "loca" ):Value, ;
oRS1Cli:Fields( "tele" ):Value ;
HEADERS "Act.", "Nro.","Documento", ; // ,"Reg."
"Vend", "Nombre","Apodo", ;
"Direccion" , ;
"C.Postal", ;
"Localidad", ;
( "Telofono" ), ;
( "Zona" ) ; // "zona",;
ID 181 of odlg ;
font ofont1
oBrow:bLogicLen = { || oRS1Cli:RecordCount }
oBrow:bGoTop = { || oRS1Cli:MoveFirst() }
oBrow:bGoBottom = { || oRS1Cli:MoveLast() }
oBrow:bSkip = { | nSkip | Skipper( oRs1Cli, nSkip ) }
oBrow:lcellstyle := .f.
oBrow:nlinestyle := 2
oBrow:nclrpane := { || iif( ( oRS1Cli:AbsolutePosition / 2 ) - INT( oRS1Cli:AbsolutePosition / 2 ) > 0, RGB( 193, 221, 255 ), RGB( 221, 245, 255 ) ) }
oBrow:GoTop()
oBrow:aActions = { "ID","numero", "", "", "Nombre", "Domicilio" }
oBrow:aActions[ 1 ] = { || iif (xcampobusca = "activo",(xcampobusca := "activo",xOrdenadoPor:= "activo desc"),(xcampobusca := "activo",xOrdenadoPor:= " activo ")), oRS1Cli:=buscosql( oBrow, "", obusco, oRS1Cli ) }
oBrow:aActions[ 2 ] = { || iif (xcampobusca = "numero",(xcampobusca := "numero",xOrdenadoPor:= "numero desc"),(xcampobusca := "numero",xOrdenadoPor:= "numero ")), oRS1Cli:=buscosql( oBrow, "", obusco, oRS1Cli ) }
oBrow:aActions[ 3 ] = { || xcampobusca := "documento",xOrdenadoPor:="documento", oRS1Cli:=buscosql( oBrow, "", obusco, oRS1Cli ) }
oBrow:aActions[ 4 ] = { || xcampobusca := "vendedor",xOrdenadoPor:="vendedor", oRS1Cli:=buscosql( oBrow, "", obusco, oRS1Cli ) }
oBrow:aActions[ 5 ] = { || xcampobusca := "Nombre",xOrdenadoPor:="Nombre", oRS1Cli:=buscosql( oBrow, "", obusco, oRS1Cli ) }
oBrow:aActions[ 6 ] = { || xcampobusca := "apodo" ,xOrdenadoPor:="apodo" , oRS1Cli:=buscosql( oBrow, "", obusco, oRS1Cli ) }
REDEFINE BTNBMP 2007 prompt HB_UTF8CHR( 57609 ) + " Agregar " font oSegoe ID 170 OF oDlg ACTION EditClient( oBrow, oCon, oRs1cli, oRS1Cli:AbsolutePosition, .t. ) //editclient( oLbx, .t. )
REDEFINE BTNBMP 2007 prompt HB_UTF8CHR( 57604 ) + " Editar " font oSegoe ID 180 OF oDlg ACTION EditClient( oBrow, oCon, oRs1cli, oRS1Cli:AbsolutePosition, .f. ) // editclient( oLbx, .f. )
REDEFINE BTNBMP 2007 prompt HB_UTF8CHR( 57607 ) + " Borrar " font oSegoe ID 260 OF oDlg ACTION borrasql( odlg, oRS1cli )
REDEFINE BTNBMP 2007 prompt HB_UTF8CHR( 58102 ) + " Imprimir " font oSegoe ID 210 OF oDlg ACTION lisclie( xcampo ) //generoxls() //
REDEFINE BTNBMP 2007 prompt HB_UTF8CHR( 57615 ) + " Volver " font oSegoe ID 240 OF oDlg ACTION (oWndChild:End(),oRS1cli:Close()) //on init buscosql(oBrow, "")
ACTIVATE DIALOG oDlg nowait ON INIT odlg:Move( 0, 0 )
oWndChild:nWidth := odlg:nWidth + 7
oWndChild:nHeight := odlg:nHeight + 32
ACTIVATE WINDOW oWndChild ON INIT (oRS1Cli:=buscosql( obrow, xbusco, oRS1Cli ) ,oWnd:paint() )
Jorge
Saludos.