#include "FiveWin.ch"
#include "xbrowse.ch"
//-----------------------------------------------//
// AGREGAR REGISTROS QUEDANDO AUTOMATICAMENTE SELECCIONADOS
//-----------------------------------------------//
Function MultiSeleTodo()
local oDlg, oBrw, oFont, aTabla := {}
local aGradBarSel := { { 1, RGB(252,232,171), RGB(248,195, 34) } }
local aGradRowSel := { { 1, RGB(118,145,164), RGB(241,222,088) } }
XbrNumFormat( 'A', .t. )
//USE CUSTOMER NEW ALIAS "CUST" SHARED
//COPY STRUCT TO ".\CUST2"
AADD(aTabla,{"selecc","L",1,0})
AADD(aTabla,{"codigo","N",03,0})
AADD(aTabla,{"nombre","C",30,0})
AADD(aTabla,{"import","N",10,2})
DBCREATE("CUST2",atabla)
USE CUST2 NEW ALIAS "CUST2" EXCLUSIVE
//CUST->(DBGOTO(5))
DBSELECTAREA("CUST2")
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
DEFINE DIALOG oDlg SIZE 700,400 PIXEL FONT oFont TITLE "AGREGAR ITEM Y SELECCIONARLO AUTOMATICAMENTE"
@ 20,10 XBROWSE oBrw SIZE -10,-40 PIXEL OF oDlg ;
DATASOURCE "CUST2" ;
COLUMNS "SELECC", "CODIGO", "NOMBRE", "IMPORT" FOOTERS;
CELL LINES NOBORDER AUTOSORT ON CHANGE oBrw:MakeTotals()
WITH OBJECT oBrw
//:nMarqueeStyle := MARQSTYLE_HIGHLROWMS //Multiselect
:bClrSel := {|| { nRGB( 0, 0, 0), aGradRowSel } } // para barra de linea selecc cuando el control no tiene el foco
:bClrSelFocus := { || { CLR_BLACK, aGradBarSel } } // para barra de linea selecc cuando el control tiene el foco
:aCols[ 1 ]:nEditType := EDIT_GET
:aCols[ 1 ]:SetCheck()
:aCols[ 4 ]:nFooterType := AGGR_SUM
:aCols[ 4 ]:bSumCondition := {|| cust2->selecc = .T.}
:MakeTotals()
:CreateFromCode()
END
@ 170, 10 BUTTON "Agregar Item" SIZE 60,20 PIXEL OF oDlg ;
ACTION ( AgregItem("CUST2") ,;
oBrw:SetFocus(), oBrw:Refresh(),oBrw:MakeTotals())
//oBrw:Select(1),;
//CUST->(DbSkip()) )
@ 170, 80 BUTTON "Salir" SIZE 60,20 PIXEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
Cust2->(dbclosearea())
Ferase(".\Cust2.dbf")
return nil
//-----------------------------------------------//
Function AgregItem(cAliasDest)
(cAliasDest)->(dbappend())
(cAliasDest)->( FieldPut( 1,.t. ) )
(cAliasDest)->( FieldPut( 2,(cAliasDest)->(reccount()) ) )
(cAliasDest)->( FieldPut( 3,"Nombre"+STR((cAliasDest)->(reccount())) ) )
(cAliasDest)->( FieldPut( 4,100*(cAliasDest)->(reccount())) )
Return nil