Hola busco hacer eso de arriba.
Al excel que va a mostrar los resultados desde xbrowse, se le puede poner encabezados, subtitulos o fecha de exp. que no estuvieron definidas cuando arme el xbrowse?
function main()
DEFINE DIALOG oDlg SIZE 800,500 PIXEL
@ 0,0 XBROWSE oBrw OF oDlg ;
DATASOURCE "DATA" ;
COLUMNS "material", "descrip", "mes01","mes02","mes03","mes04", "mes05","mes06","mes07","mes08","mes09", "mes10", "mes11", "mes12";
HEADERS "Material", "Descripcion","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"
oBrw:CreateFromCode()
oDlg:oClient := oBrw
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT (DlgMenu1(oDlg,oBrw))
data->(dbCloseArea())
return nil
Function DlgMenu1(oDlg,oBrw)
local oMenu, oBar
MENU oMenu 2007
MENUITEM "&Excel" ACTION ( CargaEx(oBrw) )
MENUITEM "&Salir" ACTION oDlg:End()
ENDMENU
oDlg:SetMenu(oMenu)
return nil
static function cargaex(obrw)
oExcel:=oBrw:toexcel()
oExcel:Rows(1):Insert()
nLin:=1
return nil
static function cargaex(obrw)
oExcel:=oBrw:toexcel()
//oExcel:Rows(1):Insert()
nLin:=1
oExcel:Columns("F:L"):delete(-4159)
return Nil
oExcel:= TOleAuto():New( "Excel.Application" )
oExcel:WorkBooks:Add()
oExcel:Visible := .T.
oSheet:=oExcel:ActiveSheet()
nFilM :=2
oRs:movefirst()
Do While !oRs:Eof()
cDesMat:= oRs:Fields("descrip"):Value()
oSheet:Cells( nFilM, 1 ):Value := cDesMat
nFilm++
Do While !oRs:Eof() .and. cDesMat=oRs:Fields("descrip"):Value()
nMes:=oRs:Fields("mes"):Value()
Do While !oRs:Eof() .and. cDesMat=oRs:Fields("descrip"):Value() .and. nMes=oRs:Fields("mes"):Value()
cMovi:=oRs:Fields("movim"):Value()
nSumPesI:=0
Do While !oRs:Eof() .and. cDesMat=oRs:Fields("descrip"):Value() .and. nMes=oRs:Fields("mes"):Value() ;
.and. cMovi=oRs:Fields("movim"):Value()
nSumPesI+=oRs:Fields("pnet"):Value()
oRs:movenext()
EndDo
do case
case cMovi='A'
oSheet:Cells( nFilM, 2 ):NumberFormat := "##.##0,00"
oSheet:Cells( nFilM, 2 ):Value := nSumPesI
case cMovi='I'
oSheet:Cells( (nFilM+1), (nMes+1) ):NumberFormat := "##.##0,00"
oSheet:Cells( (nFilM+1), (nMes+1) ):Value := nSumPesI
case cMovi='S'
oSheet:Cells( (nFilM+2), (nMes+1) ):NumberFormat := "##.##0,00"
oSheet:Cells( (nFilM+2), (nMes+1) ):Value := -1*nSumPesI
endcase
EndDo
EndDo
nFilM+=4
EndDo
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 38 guests