Re: Crystal report y NPGSQL

From: "Agustin(dot)PHP Casiva" <casivaagustin(at)gmail(dot)com>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Crystal report y NPGSQL
Date: 2006-04-14 22:07:56
Message-ID: 646eb5870604141507n73cc9ea9h9714683afa4576bd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Esta es la clase que maneja y llama al reporte que debes diseñarlo
previamente.

/*
* Created by SharpDevelop.
* User: Beto
* Date: 28/12/2005
* Time: 08:39 a.m.
*
*/

using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using CrystalDecisions;
using CrystalDecisions.CrystalReports.Engine;
using System.ComponentModel;
using CrystalDecisions.Shared;

namespace Interface
{
/// <summary>
/// frmReporte, levanta un reporte crystal y le manda los datos
/// </summary>
public class frmReporte : System.Windows.Forms.Form
{
private CrystalDecisions.Windows.Forms.CrystalReportViewer CRV;

//Este es el constructor,

//ds es el dataset con los datos

//rep es el path completo con el nombre del reporte

public frmReporte(DataSet ds, string rep)
{
//
// The InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();
ReportDocument rpt = new ReportDocument();
rpt.Load(rep);
rpt.Database.Tables[0].SetDataSource(ds);
CRV.ReportSource = rpt;

//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
public frmReporte(DataSet ds, string rep, string fDesde, string fHasta){
InitializeComponent();
ReportDocument rpt = new ReportDocument();

ParameterFields paramFields = new ParameterFields ();
ParameterField paramField1= new ParameterField ();
ParameterField paramField2= new ParameterField ();
ParameterDiscreteValue discreteVal1 = new ParameterDiscreteValue ();
ParameterDiscreteValue discreteVal2 = new ParameterDiscreteValue ();

rpt.Load(rep);
rpt.Database.Tables[0].SetDataSource(ds);
paramField1.ParameterFieldName = "fdesde";
if (fDesde!=""){
discreteVal1.Value = fDesde;
paramField1.CurrentValues.Add(discreteVal1);
paramFields.Add(paramField1);
}

paramField2.ParameterFieldName = "fhasta";
if (fHasta != ""){
discreteVal2.Value = fHasta;
paramField2.CurrentValues.Add(discreteVal2);
paramFields.Add(paramField2);
}
CRV.ParameterFieldInfo = paramFields;
CRV.ReportSource = rpt;
}

#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The
Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent() {
this.CRV = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
this.SuspendLayout();
//
// CRV
//
this.CRV.ActiveViewIndex = -1;
this.CRV.DisplayGroupTree = false;
this.CRV.Dock = System.Windows.Forms.DockStyle.Fill;
this.CRV.Location = new System.Drawing.Point(0, 0);
this.CRV.Name = "CRV";
this.CRV.Size = new System.Drawing.Size(292, 266);
this.CRV.TabIndex = 0;
this.CRV.Load += new System.EventHandler(this.CrystalReportViewer1Load);
//
// frmReporte
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.CRV);
this.Name = "frmReporte";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Vista Previa";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ResumeLayout(false);
}
#endregion
void CrystalReportViewer1Load(object sender, System.EventArgs e)
{

}

}
}
Espero que te sirva de ayuda.
--
Agustin Casiva - Desarrollador de Sistemas

www.casivaagustin.com.ar
casivaagustin(at)gmail(dot)com

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message cristian.ssv 2006-04-15 15:47:21 Necisto crear una base de datos distribuida en postgres
Previous Message Agustin.PHP Casiva 2006-04-14 21:49:25 Re: Crystal report y NPGSQL