vbpuntonet reporte con crystal report

11
Crear un reporte en VS2005 con Crystal Report Crea un DATASET, presionar ADD

Upload: marioafg

Post on 06-Dec-2015

9 views

Category:

Documents


3 download

DESCRIPTION

Aprende a crear reportes con Cristal Report

TRANSCRIPT

Page 1: VBpuntoNET Reporte Con Crystal Report

Crear un reporte en VS2005 con Crystal Report

Crea un DATASET, presionar ADD

Creara el DATASET

Page 2: VBpuntoNET Reporte Con Crystal Report

Seleccionar la table y arrastrarla para que realice la conexión

Adicionar CRYSTAL REPORT, presionar el botón ADD

Page 3: VBpuntoNET Reporte Con Crystal Report

Deja USING THE REPORT WIZARD/STANDARD, presiona OK

Se visualizara la pantalla del wizard, selecciona la table y pasarla a SELECTED TABLES, presionar SIGUIENTE

Page 4: VBpuntoNET Reporte Con Crystal Report

Seleccionar los campos que aparecerán en el reporte, presionar siguiente

En caso de querer agruparlo seleccionar los campos, presionar siguiente

Page 5: VBpuntoNET Reporte Con Crystal Report

En caso de querer hacer una selección de campos con formula, presionar siguiente

Seleccionar algún estilo para el reporte, presionar Finalizar

Page 6: VBpuntoNET Reporte Con Crystal Report

Por último acomodar los campos y titulo

Crear un form donde llamaremos el reporte, presionar ADD

Page 7: VBpuntoNET Reporte Con Crystal Report

Arrastramos un CRYSTALREPORTVIEWER

Seleccionamos las propiedades del CRYSTALREPORTVIEWER1 , en el REPORTSOURCE seleccionamos el reporte creado y creara un REPORTDOCUMENT

Page 8: VBpuntoNET Reporte Con Crystal Report

Dentro de la form que llama el reporte copiar el código:

Imports System.Data.SqlClientImports System.Data

Private Sub ingresos_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Cnn.open Try Dim Ds As New dsingresos Dim Da As New SqlClient.SqlDataAdapter("Select * From TABLA " & _ "where FECHA_INGRESO >= '" & CAMPO_INGRESO.DateTimePicker11.Text & "' and FECHA_INGRESO <= '" & CAMPO_INGRESO.DateTimePicker22.Text & "' order by FECHA_INGRESO", Cnn) Da.Fill(Ds, "TABLA") 'Mandar los datos al dataSet y muestralos 'se tiene que crear forzosamente esta instancia para poder pasar 'parametros... Dim Reporte As New NOMBRE_REPORTE Reporte.SetDataSource(Ds) Reporte.SummaryInfo.ReportTitle = "TITULO DE MI REPORTE " & Today Reporte.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape Me.CrystalReportViewer1.ReportSource = Reporte Catch ex As Exception MessageBox.Show(ex.ToString) End Try End Sub

El código se copia en el load de la form, este código es para enviar un rango de fechas a imprimir.

Se crea una siguiente form donde se podrán 4 DateTimePicker

Page 9: VBpuntoNET Reporte Con Crystal Report

En el botòn GENERAR REPORTE copiar el siguiente còdigo:

Imports system.DateTime

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'Se asigna al 11 y 22 para que no cambie el fomato de fechas DateTimePicker11.Text = DateTimePicker1.Text DateTimePicker22.Text = DateTimePicker2.Text 'Cambia formato de fechas para 11 y 22 DateTimePicker11.CustomFormat = "yyyyMMdd" DateTimePicker11.Format = DateTimePickerFormat.Custom DateTimePicker22.CustomFormat = "yyyyMMdd" DateTimePicker22.Format = DateTimePickerFormat.Custom My.Forms.ingresos.ShowDialog() End Sub