Buenas tardes amigos del foro
estoy iniciandome con xbrowse tree
lo hago directamente con la base de datos y necesito cargarlo de acuerdo a una fecha la misma que puede ir variando y voy refrescando el Browse pero cuando cambio la fecha y mando a buscar y refrescar me crea dos columnas con el tritulo item las mismas que estan repetidas , la primera imagen es como sale al iniciar el browse y la segunda como cambia al mandar buscar.
http://img829.imageshack.us/i/imagen1a.png/
http://img843.imageshack.us/i/imagen2u.png/
adjunto el codigo
FUNCTION consulta_cheques1(oWnd)
local oDlg, oBrw, oCol,oBmp,oChild
local nFor,ocol1,ocol2,oBtn,calias,oFont,oFont1
local aGrad := {{ 0.50, CLR_RED, CLR_YELLOW }, { 0.50, CLR_YELLOW, CLR_RED }}
local oBar,ntotal
local cfecini := date()
ntotal := 0.00
set century on
SET EPOCH TO 1960
SET DATE FORMAT TO 'YYYY/MM/DD'
DEFINE FONT oFont NAME "Arial" SIZE 0, -11 BOLD // ITALIC
DEFINE FONT oFont1 NAME "Arial" SIZE 0, -14 BOLD ITALIC
DEFINE WINDOW oChild TITLE "Consulta de Cheques Posfechados" MDICHILD ;
FROM 0,0 TO 850,1250; //690,1025
COLOR "N/W" PIXEL ;
border none nominimize nomaximize //prevent resizing nominimize
DEFINE DIALOG oDlg RESOURCE "d_consulta_cheques1" of oChild
REDEFINE DTPICKER cfecini ID 101 OF oDlg
dbselectarea("tbancos")
dbsetorder("ibancos")
DBGOTOP()
dbselectarea("tcheque")
dbsetorder("icheque")
DBGOTOP()
set relation to tcheque->tccodban into tbancos
*FASTEDIT := .T.
oBrw = TXBrowse():New( oDlg )
REDEFINE XBROWSE oBrw ID 500 OF oDlg LINES CELL FOOTERS
*oBrw:SetTree( nil, { "open", "close", "go" })
oBrw:SetTree( BuildTree(cfecini), { "open", "close", "go" })
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 1 ] HEADER "Fecha"+CRLF+"Emision"
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 2 ] HEADER "Fecha"+CRLF+"Cobro"
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 3 ] PICTURE "99,999.99" HEADER "Valor" //+CRLF+"Cheque"
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 4 ] HEADER "Estado"
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 5 ] HEADER "Fecha"+CRLF+"Deposito"
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
oBrw:aCols[ 1 ]:cHeader = "Código & Nombres"
oBrw:aCols[ 3 ]:cFooter = "Total :"
* oBrw:MakeTotals(oCol)
oBrw:Valor:nTotal := nTotal
oDlg:oClient = oBrw
* // Create ButtonBar
* BtnBar( oBrw ) // Commn ButtonBar for all sample Browses
DEFINE BUTTONBAR oBar SIZE 40, 40 OF oChild _3D 2007
DEFINE BUTTON OF oChild:oBar GROUP NOBORDER;
TOOLTIP "Salir" ;
ACTION (oDlg:end(),oChild:End()) FILENAME "\FWH\imagenes\quit.bmp";
MESSAGE "Salir del Sistema"
DEFINE BUTTON OF oChild:oBar GROUP NOBORDER;
TOOLTIP "Buscar" ;
ACTION (oBrw:SetTree( nil, { "open", "close", "go" }),oBrw:SetTree( BuildTree(cfecini,oBrw), { "open", "close", "go" }),oBrw:refresh(.T.),oBrw:SetFocus()) FILENAME "\FWH\imagenes\buscar.bmp";
MESSAGE "Salir del Sistema"
* ACTION (BuildTree(cfecini,oBrw),oBrw:SetTree( nil, { "open", "close", "go" }),oBrw:refresh(.T.),oBrw:SetFocus()) FILENAME "\FWH\imagenes\buscar.bmp";
ACTIVATE DIALOG oDlg nowait CENTERED ON INIT (Odlg:move(0,0));
VALID (!( GeTKeyState(27)))
ACTIVATE WINDOW oChild ;
ON INIT (oChild:paint(),oChild:setsize( oDlg:nwidth, oDlg:nheight)) ;
VALID ( oChild := Nil, .t.)
return nil
static function BuildTree(cfecini,oBrw)
local oTree, cState,dfecha_vence
local condi1,condi2
memvar musuario
dfecha_vence := cfecini
*cstate := space(5)
dbselectarea("tcheque")
ordSetfocus("icheque1")
dbgotop()
DBSETFILTER( {||tcheque->tcfechafin == dfecha_vence },"tcheque->tcfechafin == dfecha_vence ")
dbgotop()
*if eof()
* MsgAlert("No existe inforemacion para esta fecha",musuario)
* return nil // oTree
*endif
*condi1 := dfecha_vence
*condi2 := dfecha_vence
*tcheque->(OrdScope(0,condi1))
*tcheque->(OrdScope(1,condi2))
*browse()
*?? oBrw
*oBrw:SetTree( nil, { "open", "close", "go" })
if !eof()
TREE oTree
while ! Eof()
if Empty( cState )
_TreeItem( tcheque->cl_cod+" "+tcheque->cl_razon):Cargo := { Space( 10 ), Space( 10 ),0.00,space(12),space(10) }
TREE
cState = tcheque->cl_cod
else
if cState != tcheque->cl_cod
ENDTREE
cState = tcheque->cl_cod
_TreeItem( tcheque->cl_cod+" "+tcheque->cl_razon ):Cargo := { Space( 10 ), Space( 10 ),0.00,space(12),space(10) }
TREE
endif
endif
if tcheque->cl_cod == cState
_TreeItem( tbancos->tbdesc ):Cargo := { tcheque->tcfechaini , tcheque->tcfechafin,tcheque->tcvalor,if(tcheque->tcdeposita=.T.,"Depositado","Pendiente"),tcheque->tcfecdepos }
endif
SKIP
enddo
ENDTREE
ENDTREE
gO TOP
else
TREE oTree
if Empty( cState )
_TreeItem( cstate ):cargo:= { Space( 10 ), Space( 10 ),0.00,space(12),space(10) }
TREE
endif
_TreeItem( cstate ):cargo:= { Space( 10 ), Space( 10 ),0.00,space(12),space(10) }
* ENDTREE
ENDTREE
endif
*oBrw:refresh()
*
*tcheque->(OrdScope(0,nil))
*tcheque->(OrdScope(1,nil))
cstate := space(5)
dbsetfilter()
return oTree
Voy a seguir intentando si alguien sabe donde me equivoco por favor deme una ayudita..
Saludos