leandro wrote:Cristobal, buenas noches
Ahora estoy intentando colocar los datos que requiero mostrar dentro de los paneles, por ahora quiero colocar el resultado de una consulta en el panel 1, pero los datos del recorset no se muestran en el xbrowse (como puedes ver en la imagen la información si esta en el recorset), lo hago de la misma manera en un dialogo y funciona perfectamente.
- Code: Select all Expand view RUN
**********************************
* REPORTE DE KARDEX Y MOVIMIENTO *
**********************************
fTesDock()
FUNCTION fTesDock()
#include "fivewin.ch"
#include "report.ch"
#include "Ado.ch"
#include "vrd.ch"
#include "dtpicker.ch"
#include "xbrowse.ch"
#include "colores.ch"
#include "tgraph.ch"
Local oWChRgr1
Local cFont := "Liberation Mono" //TAHOMA //CALIBRI //SEGOE UI SYMBOL
Public oFontCtrl,oFont1
Public cPathApp := cFilePath( GetModuleFileName( GetInstance() ) )
DEFINE FONT oFont NAME cFont SIZE 0,-11
DEFINE FONT oFontB NAME cFont SIZE 0,-14 BOLD //ARIAL NARROW
DEFINE FONT oFont1 NAME cFont SIZE 0,-11 BOLD
DEFINE FONT oFontE NAME cFont SIZE 0,-14
DEFINE FONT oFont2 NAME cFont SIZE 0,-16
DEFINE FONT oFont3 NAME cFont SIZE 0,-20 //BOLD
DEFINE FONT oFont4 NAME "CALIBRI" SIZE 0,-16
DEFINE FONT oFontCtrl NAME cFont SIZE 0, -9 BOLD
DEFINE FONT oFontS NAME "FIXEDSYS" SIZE 0,-12
DEFINE WINDOW oWChRgr1 MDICHILD TITLE "Reporte Inventario Gráfico" ICON "#8001" OF oWnd
oDock1 := TDockPnel():New( oWChRgr1 )
WITH OBJECT oDock1
:SetHeightCaption( 40 )
:SetCoors( { | o | 10 }, { | o | 10 }, ;
{ | o | Int( o:oWnd:nHeight / 2 ) }, ;
{ | o | Int( o:oWnd:nWidth / 2 ) - XEVal( o:nLeft, o ) } )
:SetCaption( { | o | "Entradas y Salidas Mensuales" } )
:SetColors( METRO_RED, CLR_WHITE, Rgb( 88, 88, 88 ), CLR_HGRAY )
:SetFont( oFont4 )
:SetBorderSize( 1 )
:SetImgsFiles( { { "C:\fwh1909\bitmaps\16x16\panel.bmp", ;
{ || oDock1:aBtnBmps[ 1 ]:SetImages( if( oDock1:lSelected, "..\bitmaps\16x16\panel.bmp", "\Fwh\bitmaps\16x16\check.bmp" ) ), ;
oDock1:lSelected := !oDock1:lSelected }, "ToolTip" } } )
:SetCtrlsPnel( { | o, nT, nL, nH, nW, oB | oB := fMovMeses( o, nT, nL, nH, nW ) } )
:bRClicked := { || MsgInfo( oDock1:oWnd:aControls[ 1 ]:ClassName() ) }
:Activate()
END
oDock2 := TDockPnel():New( oWChRgr1 )
WITH OBJECT oDock2
:SetHeightCaption( 40 )
:SetCoors( { | o | XEval( o:oWnd:aControls[ 1 ]:nTop, o ) }, ;
{ | o | XEval( o:oWnd:aControls[ 1 ]:nRight, o ) + 10 }, ;
{ | o | XEval( o:oWnd:aControls[ 1 ]:nBottom, o ) }, ;
{ | o | Int( o:oWnd:nWidth / 2 ) + XEval( o:nLeft, o ) - 40 } )
:SetCaption( { | o | "Kardex Por Artículo" } )
:SetColors( CLR_WHITE, METRO_AMBER, METRO_AMBER, CLR_WHITE )
:SetBorderSize( 1 )
:SetFont( oFont4 )
:Activate()
END
oDock3 := TDockPnel():New( oWChRgr1 )
WITH OBJECT oDock3
:SetHeightCaption( 40 )
:SetCoors( { | o | XEval( o:oWnd:aControls[ 2 ]:nBottom, o ) + 10 }, ;
{ | o | 10 }, ;
{ | o | Int( o:oWnd:nHeight / 2 ) + XEval( o:oWnd:aControls[ 2 ]:nHeight, o ) - 34 }, ;
{ | o | XEVal( o:oWnd:aControls[ 2 ]:nRight, o ) } )
:SetCaption( { | o | "Graficas Informativas" } )
:SetBorderSize( 4 )
:SetColors( CLR_WHITE, METRO_RED, Rgb( 88, 88, 88 ), CLR_WHITE )
:SetFont( oFont4 )
:SetImgsFiles( { { "C:\fwh1909\bitmaps\16x16\min.bmp", ;
{ || oDock1:aBtnBmps[ 1 ]:SetImages( if( oDock1:lSelected, "\Fwh\bitmaps\16x16\panel.bmp", "\Fwh\bitmaps\16x16\check.bmp" ) ), ;
oDock1:lSelected := !oDock1:lSelected }, "ToolTip" } } )
:Activate()
END
ACTIVATE WINDOW oWChRgr1 MAXIMIZED
Return nil
**********************************
*MOVIMIENTO DE ARTICULOS POR MESES
**********************************
function fMovMeses(oP, nT, nL, nH, nW)
Local cQry
Local oBrwMs
Local nWidth := 0
TEXT INTO cQry
SELECT mes,SUM(entradas) AS entradas,SUM(salidas) AS salidas,nombre FROM (
SELECT MONTH(MOV.o_fechas) AS mes,SUM(MOV.o_cansal) AS salidas,SUM(MOV.o_canent) AS entradas,"Leandro" AS nombre
FROM tbl_movi MOV WHERE MOV.o_articu='CORP012' GROUP BY MONTH(MOV.o_fechas)
UNION
SELECT MONTH(FAC.mm_fechas) AS mes,SUM(FAC.mm_cansal) AS salidas,SUM(FAC.mm_canent) AS entradas,"Arevalo" AS nombre
FROM tbl_mofa FAC WHERE FAC.mm_articu='CORP012' GROUP BY MONTH(FAC.mm_fechas)
) MOV GROUP BY mes
ENDTEXT
Define Font oFont Name "Calibri" Size 0,-13 BOLD
Define Font oFont1 Name "Calibri" Size 0,-13
Define Font oFont2 Name "Calibri" Size 0,-20 BOLD
//CREAMOS UNA CONEXION PARA EL REPORTE
vCnd := "DSN=dlyma;Uid="+oLamcla:cUsuario+";Pwd="+oLamcla:cPassword+";"
oCnMes := FW_OpenAdoConnection( vCnd )
//Activamos DB
vQry := "USE "+oLamcla:cEmpDBda
TRY
oCnMes:Execute(vQry)
CATCH oError
FW_ShowAdoError(oCnMes)
END
oRsMes := FW_OPENRECORDSET(oCnMes,cQry,adLockOptimistic,adOpenKeyset)
oBrwMs := TXBrowse():New( oP )
oBrwMs:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrwMs:nRowDividerStyle := LINESTYLE_LIGHTGRAY
oBrwMs:nColDividerStyle := LINESTYLE_LIGHTGRAY
oBrwMs:nHeaderLines := 1
oBrwMs:lColDividerComplete := .t.
oBrwMs:lRecordSelector := .t.
oBrwMs:l2007 := .f.
oBrwMs:oFont := oFont1
oBrwMs:bClrRowFocus := { || { CLR_BLACK, RGB( 185, 220, 255 ) } }
oBrwMs:bClrStd := { || { Rgb( 88, 88, 88 ), CLR_WHITE } }
oBrwMs:nColorPen := CLR_HGRAY
oBrwMs:bClrHeader := { || { CLR_BLACK, CLR_WHITE, CLR_HGRAY } }
oBrwMs:lFullGrid := .T.
oBrwMs:lRecordSelector := .F.
oBrwMs:lHScroll := .F.
oBrwMs:lVScroll := .F.
oBrwMs:lFitGridHeight := .T.
oBrwMs:nHeaderHeight := 32
oBrwMs:nRowHeight := 27
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "mes" ):Value , "99" ) ) }
oCol:cHeader = "Mes"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "entradas" ):Value , "999,999" ) ) }
oCol:cHeader = "Entradas"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "salidas" ):Value , "999,999" ) ) }
oCol:cHeader = "Salidas"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "entradas" ):Value - oRsMes:Fields( "salidas" ):Value , "999,999" ) ) }
oCol:cHeader = "Saldo"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), cValtoChar( oRsMes:Fields( "nombre" ):Value ) ) }
oCol:cHeader = "Nombre"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oBrwMs:SetADO( oRsMes )
oBrwMs:CreateFromCode()
Return oBrwMs
Leandro, TDockPnel, no interfiere en ningún caso con el contenido de los controles que se sitúan en su interior como cualquier otro contenedor.
Dicho esto, el problema debe estar en la definición del XBrowse
Prueba algo asi y vamos viendo donde puede estar el problema
- Code: Select all Expand view RUN
**********************************
*MOVIMIENTO DE ARTICULOS POR MESES
**********************************
function fMovMeses(oP, nT, nL, nH, nW)
Local cQry
Local oBrwMs
Local nWidth := 0
TEXT INTO cQry
SELECT mes,SUM(entradas) AS entradas,SUM(salidas) AS salidas,nombre FROM (
SELECT MONTH(MOV.o_fechas) AS mes,SUM(MOV.o_cansal) AS salidas,SUM(MOV.o_canent) AS entradas,"Leandro" AS nombre
FROM tbl_movi MOV WHERE MOV.o_articu='CORP012' GROUP BY MONTH(MOV.o_fechas)
UNION
SELECT MONTH(FAC.mm_fechas) AS mes,SUM(FAC.mm_cansal) AS salidas,SUM(FAC.mm_canent) AS entradas,"Arevalo" AS nombre
FROM tbl_mofa FAC WHERE FAC.mm_articu='CORP012' GROUP BY MONTH(FAC.mm_fechas)
) MOV GROUP BY mes
ENDTEXT
Define Font oFont Name "Calibri" Size 0,-13 BOLD
Define Font oFont1 Name "Calibri" Size 0,-13
Define Font oFont2 Name "Calibri" Size 0,-20 BOLD
//CREAMOS UNA CONEXION PARA EL REPORTE
vCnd := "DSN=dlyma;Uid="+oLamcla:cUsuario+";Pwd="+oLamcla:cPassword+";"
oCnMes := FW_OpenAdoConnection( vCnd )
//Activamos DB
vQry := "USE "+oLamcla:cEmpDBda
TRY
oCnMes:Execute(vQry)
CATCH oError
FW_ShowAdoError(oCnMes)
END
oRsMes := FW_OPENRECORDSET(oCnMes,cQry,adLockOptimistic,adOpenKeyset)
oBrwMs := TXBrowse():New( oP )
oBrwMs:nTop := nT
oBrwMs:nLeft := nL
oBrwMs:nHeight := nH
oBrwMs:nWidth := nW
//oBrwMs:lAutoCols := .T.
// oBrwMs:nDataType := DATATYPE_ADO
oBrwMs:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrwMs:nRowDividerStyle := LINESTYLE_LIGHTGRAY
oBrwMs:nColDividerStyle := LINESTYLE_LIGHTGRAY
oBrwMs:nHeaderLines := 1
oBrwMs:lColDividerComplete := .t.
oBrwMs:lRecordSelector := .t.
oBrwMs:l2007 := .f.
oBrwMs:oFont := oFont1
oBrwMs:bClrRowFocus := { || { CLR_BLACK, RGB( 185, 220, 255 ) } }
oBrwMs:bClrStd := { || { Rgb( 88, 88, 88 ), CLR_WHITE } }
oBrwMs:nColorPen := CLR_HGRAY
oBrwMs:bClrHeader := { || { CLR_BLACK, CLR_WHITE, CLR_HGRAY } }
oBrwMs:lFullGrid := .T.
oBrwMs:lRecordSelector := .F.
oBrwMs:lHScroll := .F.
oBrwMs:lVScroll := .F.
oBrwMs:lFitGridHeight := .T.
oBrwMs:nHeaderHeight := 32
oBrwMs:nRowHeight := 27
oBrwMs:SetADO( oRsMes, .T., .T. )
oBrwMs:CreateFromCode()
/*
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "mes" ):Value , "99" ) ) }
oCol:cHeader = "Mes"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "entradas" ):Value , "999,999" ) ) }
oCol:cHeader = "Entradas"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "salidas" ):Value , "999,999" ) ) }
oCol:cHeader = "Salidas"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), Transform( oRsMes:Fields( "entradas" ):Value - oRsMes:Fields( "salidas" ):Value , "999,999" ) ) }
oCol:cHeader = "Saldo"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oCol = oBrwMs:AddCol()
oCol:bStrData = { || If( oRsMes:Eof, Space( nWidth ), cValtoChar( oRsMes:Fields( "nombre" ):Value ) ) }
oCol:cHeader = "Nombre"
oCol:nWidth = 80
oCol:nHeadStrAlign = AL_LEFT
oCol:nDataStrAlign = AL_LEFT
oCol:oHeaderFont = oFont
oBrwMs:SetADO( oRsMes )
oBrwMs:CreateFromCode()
*/
Return oBrwMs