PUBLIC SUB Form_Open()
DIM i AS Integer
DIM fila AS Integer
DIM textos AS NEW String[]
DIM numer AS Integer
tabla.Header = TRUE
ME.Center
IF coneccion.conectarbase() THEN RETURN
tabla.Clear()
tabla.Columns.Count = 12
tabla.Columns[0].Text = "codigo"
tabla.Columns[1].Text = "cedula"
tabla.Columns[2].Text = "nombre"
tabla.Columns[3].Text = "apellido"
tabla.Columns[4].Text = "direccion"
tabla.Columns[5].Text = "telefono"
tabla.Columns[6].Text = "sexo"
tabla.Columns[7].Text = "programa"
tabla.Columns[8].Text = "fecha_ingreso"
tabla.Columns[9].Text = "dias_semanas"
tabla.Columns[10].Text = "fecha_de_asistencia"
tabla.Columns[11].Text = "hora_de_asitencia"
fila = fila + 1
tabla.Refresh
END
PUBLIC SUB reporte()
'variables a usar en el reporte
DIM header AS ReportVBox
DIM cont AS ReportHBox
DIM lab AS ReportLabel
DIM body AS ReportVBox
DIM colu AS ReportHBox
DIM i, j AS Integer
DIM textos AS NEW String[]
report.Clear
'configuracion del reporte
Report.Orientation = Report.Portrait
Report.Resolution = Printer.Resolution
Report.Padding = "1 cm"
Report.Size = "A4"
Report.Spacing = "25 mm"
'estructura del encabezado del reporte
header = NEW ReportVBox(Report)
header.LineStyle = Line.Solid
header.Autoresize = TRUE
header.ForeColor = Color.Red
header.FillColor = Color.LightGray
header.FillStyle = Fill.Solid
'texto del encabezado
cont = NEW ReportHBox(header)
cont.Autoresize = TRUE
cont.Height = "0.8 cm"
cont.Expand = TRUE
lab = NEW ReportLabel(cont)
lab.Font.Size = 12
lab.Alignment = Align.Center
lab.Text = Upper("REPORTES PARA LA ASISTENCIA DE ASESORES")
textos.Add("ALDEA UNIVERSITARIO 24 DE JULIO")
textos.Add("CUC")
lab.Expand = TRUE
'estructura del cuerpo del reporte
body = NEW ReportVBox(Report)
body.LineStyle = Line.Solid
body.ForeColor = Color.Blue
body.Autoresize = TRUE
colu = NEW ReportHBox(body)
colu.Autoresize = TRUE
colu.Spacing = "1 cm"
'contenido del cuerpo del reporte
FOR i = 0 TO tabla.Columns.Count - 1
lab = NEW ReportLabel(colu)
lab.Text = tabla.Columns[i].Text
lab.Font.Bold = TRUE
lab.Autoresize = TRUE
lab.Expand = TRUE
lab.Alignment = Align.Center
NEXT
FOR i = 0 TO tabla.rows.Count - 1
colu = NEW ReportHBox(body)
colu.Autoresize = TRUE
colu.Spacing = "1 cm"
FOR j = 0 TO tabla.Columns.Count - 1
lab = NEW ReportLabel(colu)
lab.Text = tabla[i, j].Text
lab.Autoresize = TRUE
lab.Expand = TRUE
lab.Alignment = Align.Center
NEXT
NEXT
END
PUBLIC SUB Button1_Click()
reporte()
Report.Preview
END
PUBLIC SUB Button3_Click()
DIM ArchivoTemporal AS String
DIM i AS Integer
'genero la estructura del reporte
reporte()
'inicializo el archivo temporal
ArchivoTemporal = Temp
'Inicio el objeto impresion para imprimir a un archivo
Printer.File = ArchivoTemporal
Printer.Size = report.Size
Printer.Orientation = report.Orientation
report.Resolution = printer.Resolution
'inicio el Trazado hacia el objeto printer
Draw.Begin(Printer)
Report.Layout
'recorro el numero de hojas del reporte
FOR i = 1 TO Report.count
Report.Draw(i)
IF i < Report.count THEN Printer.NewPage()
NEXT
'finalizo el trazado al buffer de impresora
Draw.End
'uso el programa externo ps2pdf (de impresora a pdf) y genero el archivo en el home del usuario
EXEC ["ps2pdf", ArchivoTemporal, User.Home &/ "reporte.pdf"] WAIT
'elimino el archivo temporal
KILL ArchivoTemporal
Message.Info("Se ha generado con exito el archivo PDF")
END
PUBLIC SUB Button2_Click()
DIM ruta AS String
DIM archivo AS File
DIM i, j AS Integer
ruta = User.Home &/ "reporte.html"
OPEN ruta FOR WRITE CREATE AS #archivo
PRINT #archivo, "<html>"
PRINT #archivo, "<head><title>Reporte en HTML de Visitas</title></head>"
PRINT #archivo, "<body topmargin='0' leftmargin='0'"
PRINT #archivo, ">"
PRINT #archivo, "<table border='1' width='500' cellpadding='4' cellspacing='0'>"
PRINT #archivo, " <tr>"
PRINT #archivo, " <td colspan='6' align='center'>"
PRINT #archivo, " <h3>Listado de Visitas</h3>"
PRINT #archivo, " </td>"
PRINT #archivo, " </tr>"
PRINT #archivo, " <tr>"
PRINT #archivo, " <td width='15%' align='center'>Id</td>"
PRINT #archivo, " <td align='center'>Codigo</td>"
PRINT #archivo, " <td align='center'>Cedula</td>"
PRINT #archivo, " <td align='center'>Nombre</td>"
PRINT #archivo, " <td align='center'>Apellidos</td>"
PRINT #archivo, " <td align='center'>Visitas</td>"
PRINT #archivo, " </tr>"
FOR i = 0 TO tabla.rows.Count - 1
PRINT #archivo, " <tr>"
FOR j = 0 TO tabla.Columns.Count - 1
PRINT #archivo, " <td>" & tabla[i, j].Text & "</td>"
NEXT
PRINT #archivo, " </tr>"
NEXT
PRINT #archivo, "</table>"
PRINT #archivo, "</body>"
PRINT #archivo, "</html>"
CLOSE #archivo
Message.Info("Se ha generado con exito el archivo html")
END
PUBLIC SUB Button4_Click()
DIM i AS Integer
'genero la estructura del reporte
reporte()
printer.Setup
Printer.Size = report.Size
Printer.Orientation = report.Orientation
report.Resolution = printer.Resolution
'inicio el Trazado hacia el objeto printer
Draw.Begin(Printer)
Report.Layout
'recorro el numero de hojas del reporte
FOR i = 1 TO Report.count
Report.Draw(i)
IF i < Report.count THEN Printer.NewPage()
NEXT
'finalizo el trazado al buffer de impresora
Draw.End
END
PUBLIC SUB Button5_Click()
ME.Close
END
PUBLIC SUB tabla_Click()
END
PUBLIC SUB Button6_Click()
DIM fila AS Integer
coneccion.asisresul = coneccion.asiscon.Exec("Select *from asesores")
fila = 0
DO WHILE coneccion.asisresul.Available
tabla.Rows.Insert(fila)
tabla[fila, 0].Text = coneccion.asisresul["codigo"]
tabla[fila, 1].Text = coneccion.asisresul["cedula"]
tabla[fila, 2].Text = coneccion.asisresul["nombres"]
tabla[fila, 3].Text = coneccion.asisresul["apellidos"]
tabla[fila, 4].Text = coneccion.asisresul["direccion"]
tabla[fila, 5].Text = coneccion.asisresul["telefono"]
tabla[fila, 6].Text = coneccion.asisresul["sexo"]
tabla[fila, 7].Text = coneccion.asisresul["programa"]
tabla[fila, 8].Text = coneccion.asisresul["fecha_ingreso"]
tabla[fila, 9].Text = coneccion.asisresul["dias_semanas"]
tabla[fila, 10].Text = coneccion.asisresul["fecha_de_asistencia"]
tabla[fila, 11].Text = coneccion.asisresul["hora_de_asistencia"]
coneccion.asisresul.MoveNext()
fila = fila + 1
LOOP
tabla.Refresh
END
PUBLIC SUB Button7_Click()
tabla.Clear
END
DIM i AS Integer
DIM fila AS Integer
DIM textos AS NEW String[]
DIM numer AS Integer
tabla.Header = TRUE
ME.Center
IF coneccion.conectarbase() THEN RETURN
tabla.Clear()
tabla.Columns.Count = 12
tabla.Columns[0].Text = "codigo"
tabla.Columns[1].Text = "cedula"
tabla.Columns[2].Text = "nombre"
tabla.Columns[3].Text = "apellido"
tabla.Columns[4].Text = "direccion"
tabla.Columns[5].Text = "telefono"
tabla.Columns[6].Text = "sexo"
tabla.Columns[7].Text = "programa"
tabla.Columns[8].Text = "fecha_ingreso"
tabla.Columns[9].Text = "dias_semanas"
tabla.Columns[10].Text = "fecha_de_asistencia"
tabla.Columns[11].Text = "hora_de_asitencia"
fila = fila + 1
tabla.Refresh
END
PUBLIC SUB reporte()
'variables a usar en el reporte
DIM header AS ReportVBox
DIM cont AS ReportHBox
DIM lab AS ReportLabel
DIM body AS ReportVBox
DIM colu AS ReportHBox
DIM i, j AS Integer
DIM textos AS NEW String[]
report.Clear
'configuracion del reporte
Report.Orientation = Report.Portrait
Report.Resolution = Printer.Resolution
Report.Padding = "1 cm"
Report.Size = "A4"
Report.Spacing = "25 mm"
'estructura del encabezado del reporte
header = NEW ReportVBox(Report)
header.LineStyle = Line.Solid
header.Autoresize = TRUE
header.ForeColor = Color.Red
header.FillColor = Color.LightGray
header.FillStyle = Fill.Solid
'texto del encabezado
cont = NEW ReportHBox(header)
cont.Autoresize = TRUE
cont.Height = "0.8 cm"
cont.Expand = TRUE
lab = NEW ReportLabel(cont)
lab.Font.Size = 12
lab.Alignment = Align.Center
lab.Text = Upper("REPORTES PARA LA ASISTENCIA DE ASESORES")
textos.Add("ALDEA UNIVERSITARIO 24 DE JULIO")
textos.Add("CUC")
lab.Expand = TRUE
'estructura del cuerpo del reporte
body = NEW ReportVBox(Report)
body.LineStyle = Line.Solid
body.ForeColor = Color.Blue
body.Autoresize = TRUE
colu = NEW ReportHBox(body)
colu.Autoresize = TRUE
colu.Spacing = "1 cm"
'contenido del cuerpo del reporte
FOR i = 0 TO tabla.Columns.Count - 1
lab = NEW ReportLabel(colu)
lab.Text = tabla.Columns[i].Text
lab.Font.Bold = TRUE
lab.Autoresize = TRUE
lab.Expand = TRUE
lab.Alignment = Align.Center
NEXT
FOR i = 0 TO tabla.rows.Count - 1
colu = NEW ReportHBox(body)
colu.Autoresize = TRUE
colu.Spacing = "1 cm"
FOR j = 0 TO tabla.Columns.Count - 1
lab = NEW ReportLabel(colu)
lab.Text = tabla[i, j].Text
lab.Autoresize = TRUE
lab.Expand = TRUE
lab.Alignment = Align.Center
NEXT
NEXT
END
PUBLIC SUB Button1_Click()
reporte()
Report.Preview
END
PUBLIC SUB Button3_Click()
DIM ArchivoTemporal AS String
DIM i AS Integer
'genero la estructura del reporte
reporte()
'inicializo el archivo temporal
ArchivoTemporal = Temp
'Inicio el objeto impresion para imprimir a un archivo
Printer.File = ArchivoTemporal
Printer.Size = report.Size
Printer.Orientation = report.Orientation
report.Resolution = printer.Resolution
'inicio el Trazado hacia el objeto printer
Draw.Begin(Printer)
Report.Layout
'recorro el numero de hojas del reporte
FOR i = 1 TO Report.count
Report.Draw(i)
IF i < Report.count THEN Printer.NewPage()
NEXT
'finalizo el trazado al buffer de impresora
Draw.End
'uso el programa externo ps2pdf (de impresora a pdf) y genero el archivo en el home del usuario
EXEC ["ps2pdf", ArchivoTemporal, User.Home &/ "reporte.pdf"] WAIT
'elimino el archivo temporal
KILL ArchivoTemporal
Message.Info("Se ha generado con exito el archivo PDF")
END
PUBLIC SUB Button2_Click()
DIM ruta AS String
DIM archivo AS File
DIM i, j AS Integer
ruta = User.Home &/ "reporte.html"
OPEN ruta FOR WRITE CREATE AS #archivo
PRINT #archivo, "<html>"
PRINT #archivo, "<head><title>Reporte en HTML de Visitas</title></head>"
PRINT #archivo, "<body topmargin='0' leftmargin='0'"
PRINT #archivo, ">"
PRINT #archivo, "<table border='1' width='500' cellpadding='4' cellspacing='0'>"
PRINT #archivo, " <tr>"
PRINT #archivo, " <td colspan='6' align='center'>"
PRINT #archivo, " <h3>Listado de Visitas</h3>"
PRINT #archivo, " </td>"
PRINT #archivo, " </tr>"
PRINT #archivo, " <tr>"
PRINT #archivo, " <td width='15%' align='center'>Id</td>"
PRINT #archivo, " <td align='center'>Codigo</td>"
PRINT #archivo, " <td align='center'>Cedula</td>"
PRINT #archivo, " <td align='center'>Nombre</td>"
PRINT #archivo, " <td align='center'>Apellidos</td>"
PRINT #archivo, " <td align='center'>Visitas</td>"
PRINT #archivo, " </tr>"
FOR i = 0 TO tabla.rows.Count - 1
PRINT #archivo, " <tr>"
FOR j = 0 TO tabla.Columns.Count - 1
PRINT #archivo, " <td>" & tabla[i, j].Text & "</td>"
NEXT
PRINT #archivo, " </tr>"
NEXT
PRINT #archivo, "</table>"
PRINT #archivo, "</body>"
PRINT #archivo, "</html>"
CLOSE #archivo
Message.Info("Se ha generado con exito el archivo html")
END
PUBLIC SUB Button4_Click()
DIM i AS Integer
'genero la estructura del reporte
reporte()
printer.Setup
Printer.Size = report.Size
Printer.Orientation = report.Orientation
report.Resolution = printer.Resolution
'inicio el Trazado hacia el objeto printer
Draw.Begin(Printer)
Report.Layout
'recorro el numero de hojas del reporte
FOR i = 1 TO Report.count
Report.Draw(i)
IF i < Report.count THEN Printer.NewPage()
NEXT
'finalizo el trazado al buffer de impresora
Draw.End
END
PUBLIC SUB Button5_Click()
ME.Close
END
PUBLIC SUB tabla_Click()
END
PUBLIC SUB Button6_Click()
DIM fila AS Integer
coneccion.asisresul = coneccion.asiscon.Exec("Select *from asesores")
fila = 0
DO WHILE coneccion.asisresul.Available
tabla.Rows.Insert(fila)
tabla[fila, 0].Text = coneccion.asisresul["codigo"]
tabla[fila, 1].Text = coneccion.asisresul["cedula"]
tabla[fila, 2].Text = coneccion.asisresul["nombres"]
tabla[fila, 3].Text = coneccion.asisresul["apellidos"]
tabla[fila, 4].Text = coneccion.asisresul["direccion"]
tabla[fila, 5].Text = coneccion.asisresul["telefono"]
tabla[fila, 6].Text = coneccion.asisresul["sexo"]
tabla[fila, 7].Text = coneccion.asisresul["programa"]
tabla[fila, 8].Text = coneccion.asisresul["fecha_ingreso"]
tabla[fila, 9].Text = coneccion.asisresul["dias_semanas"]
tabla[fila, 10].Text = coneccion.asisresul["fecha_de_asistencia"]
tabla[fila, 11].Text = coneccion.asisresul["hora_de_asistencia"]
coneccion.asisresul.MoveNext()
fila = fila + 1
LOOP
tabla.Refresh
END
PUBLIC SUB Button7_Click()
tabla.Clear
END