>Set hour to 24 >local i,j,TrendFunc,xlsheet,XLApp,tmpsheet,fllam,faten,fcier,taten,tsolu,unotab,dostab,tretab,cuatab,cintab,seitab,sietab >Set date dmy >SET CENTURY ON >unotab="unotab"+"FOP"+substr(sys(2015),3,10)+".dbf" >dostab="dostab"+"FOP"+substr(sys(2015),3,10)+".dbf" >tretab="tretab"+"FOP"+substr(sys(2015),3,10)+".dbf" >cuatab="cuatab"+"FOP"+substr(sys(2015),3,10)+".dbf" >cintab="cintab"+"FOP"+substr(sys(2015),3,10)+".dbf" >seitab="seitab"+"FOP"+substr(sys(2015),3,10)+".dbf" >sietab="sietab"+"FOP"+substr(sys(2015),3,10)+".dbf" >m.ini = "01/01/2000" >m.fin = "31/05/2000" >m.usuario = 0 >m.ingeniero = 0 >m.grupo = 0 >m.servicio = 0 >m.modelo = " " >m.host = 0 >Do form fecllam >select llamadas.numero as numero ,; > llamadas.fllamada as fllamada ,; > llamadas.undhard as hardware ,; > llamadas.modelo as modelo ,; > llamadas.mantenim as sernombre ,; > llamadas.host as host ,; > llamadas.piso as piso ,; > llamadas.usuario as usuario ,; > llamadas.ingeniero as ingeniero ,; > llamadas.grupo as grupo ,; > llamadas.servicio as servicio ,; > llamadas.reporta as usunombre ,; > oficina.nombre as ofinombre ,; > dispositivo.descripcion as disnombre ,; > ingeniero.nombre as ingnombre ,; > grupos_ing.nombre as grunombre ,; > sub_unidades.descripcion as mantenim ,; > " " as llaestado18 ,; > " " as llaestado18 ,; > " " as llaestado18 ,; > llamadas.fcierre as cierre ; > from llamadas, usuarios_cia, oficina, dispositivo, ingeniero, grupos_ing, sub_unidades ; > where Sys(11,Llamadas.fllamada) >= sys(11,m.ini) and; > Sys(11,Llamadas.fllamada) <= Sys(11,m.fin) and ; > llamadas.usuario = usuarios_cia.codigo and ; > llamadas.oficina = oficina.codigo and ; > llamadas.dispositivo = dispositivo.codigo and ; > llamadas.ingeniero = ingeniero.codigo and ; > llamadas.grupo = grupos_ing.codigo and ; > llamadas.servicio = sub_unidades.codigo ; >order by numero ; >group by numero ; >into table unotab > >select unotab >if empty(m.usuario) > select * from unotab into table dostab > else > select * from unotab where usuario = m.usuario into table dostab >endif >select dostab >if empty(m.modelo) > select * from dostab into table tretab > else > select * from dostab where modelo = m.modelo into table tretab >endif >select tretab >if empty(m.host) > select * from tretab into table cuatab > else > select * from tretab where host = m.host into table cuatab >endif >if empty(m.ingeniero) > select * from cuatab into table cintab > else > select * from cuatab where ingeniero = m.ingeniero into table cintab >endif >if empty(m.grupo) > select * from cintab into table seitab.dbf > else > select * from cintab where grupo = m.grupo into table seitab.dbf >endif >if empty(m.servicio) > select * from seitab into table sietab > else > select * from seitab where servicio = m.servicio into table sietab >endif >select * from sietab into cursor curtab >go bottom >x=recno() >go top >dimension arreglo(x) >SELECT * from sietab INTO ARRAY arreglo >WAIT WINDOW "Iniciando Excel " NOWAIT >if x<=1 > =messagebox("No hay información para el query requerido") >else >tmpsheet = GetObject('','excel.sheet') >XLApp = tmpsheet.application >XLApp.WorkBooks.Add() >XLSheet = XLApp.ActiveSheet >XLSheet.Cells(1,1).value = "Numero Llamada" >XLSheet.Cells(1,2).value = "Fecha Llamada" >XLSheet.Cells(1,3).value = "Host" >XLSheet.Cells(1,4).value = "Modelo" >XLSheet.Cells(1,5).value = "Serie" >XLSheet.Cells(1,6).value = "Usuario Codigo" >XLSheet.Cells(1,7).value = "Usuario Nombre" >XLSheet.Cells(1,8).value = "Oficina" >XLSheet.Cells(1,9).value = "Piso" >XLSheet.Cells(1,10).value = "Ingeniero Codigo" >XLSheet.Cells(1,11).value = "Ingeniero Nombre" >XLSheet.Cells(1,12).value = "Grupo Codigo" >XLSheet.Cells(1,13).value = "Grupo Nombre" >XLSheet.Cells(1,14).value = "Servicio Codigo" >XLSheet.Cells(1,15).value = "Servicio Nombre" >XLSheet.Cells(1,16).value = "Llamadas" >XLSheet.Cells(1,17).value = "Temporal" >* ****************************************************** >for i=1 to x > XLSheet.Cells(i+1,1).value = arreglo(i,1) > XLSheet.Cells(i+1,2).value = arreglo(i,2) > XLSheet.Cells(i+1,3).value = arreglo(i,6) > XLSheet.Cells(i+1,4).value = arreglo(i,4) > XLSheet.Cells(i+1,5).value = arreglo(i,5) > XLSheet.Cells(i+1,6).value = arreglo(i,8) > XLSheet.Cells(i+1,7).value = arreglo(i,12) > XLSheet.Cells(i+1,8).value = arreglo(i,13) > XLSheet.Cells(i+1,9).value = arreglo(i,7) > XLSheet.Cells(i+1,10).value = arreglo(i,9) > XLSheet.Cells(i+1,11).value = arreglo(i,15) > XLSheet.Cells(i+1,12).value = arreglo(i,10) > XLSheet.Cells(i+1,13).value = arreglo(i,16) > XLSheet.Cells(i+1,14).value = arreglo(i,11) > XLSheet.Cells(i+1,15).value = arreglo(i,17) > arreglo(i,18)="Cerradas" > if empty(arreglo(i,21)) > arreglo(i,18)="Abiertas" > endif > XLSheet.Cells(i+1,16).value = arreglo(i,18) > XLSheet.Cells(i+1,17).value = 1 > wait windows "Iniciando Excel. Copiados "+alltrim(str(i))+" registros de "+alltrim(str(x)) nowait >endfor >dirxls=sys(5)+curdir()+"General"+substr(sys(2015),3,10)+".xls" >*XLApp.ActiveWorkbook.SaveAs("d:\arphelp\general.xls") >XLApp.ActiveWorkbook.SaveAs(dirxls) >XLApp.Visible = .t. >endif >select unotab >use >delete file unotab >select dostab >use >delete file dostab >select tretab >use >delete file tretab >select cuatab >use >delete file cuatab >select cintab >use >delete file cintab >select seitab >use >delete file seitab >>