CrystalReport.cs
上传用户:ksd66jhda
上传日期:2013-04-03
资源大小:234k
文件大小:6k
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using CrystalDecisions.CrystalReports.Engine;
- namespace 进销存管理系统
- {
- /// <summary>
- /// CrystalReport 的摘要说明。
- /// </summary>
- public class CrystalReport : System.Windows.Forms.Form
- {
- private CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1;
- private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
- private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
- private System.Data.SqlClient.SqlConnection sqlConnection1;
- private 进销存管理系统.DataSet2 dataSet21;
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
- public CrystalReport()
- {
- //
- // Windows 窗体设计器支持所必需的
- //
- InitializeComponent();
- //
- // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
- //
- }
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows 窗体设计器生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CrystalReport));
- this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
- this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
- this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
- this.dataSet21 = new 进销存管理系统.DataSet2();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet21)).BeginInit();
- this.SuspendLayout();
- //
- // crystalReportViewer1
- //
- this.crystalReportViewer1.ActiveViewIndex = -1;
- this.crystalReportViewer1.DisplayGroupTree = false;
- this.crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.crystalReportViewer1.Location = new System.Drawing.Point(0, 0);
- this.crystalReportViewer1.Name = "crystalReportViewer1";
- this.crystalReportViewer1.ReportSource = null;
- this.crystalReportViewer1.Size = new System.Drawing.Size(736, 397);
- this.crystalReportViewer1.TabIndex = 0;
- //
- // sqlDataAdapter1
- //
- this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
- this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
- new System.Data.Common.DataTableMapping("Table", "进货单", new System.Data.Common.DataColumnMapping[] {
- new System.Data.Common.DataColumnMapping("供货商号", "供货商号"),
- new System.Data.Common.DataColumnMapping("货号", "货号"),
- new System.Data.Common.DataColumnMapping("进货日期", "进货日期"),
- new System.Data.Common.DataColumnMapping("业务员", "业务员"),
- new System.Data.Common.DataColumnMapping("制单人", "制单人"),
- new System.Data.Common.DataColumnMapping("进货数量", "进货数量"),
- new System.Data.Common.DataColumnMapping("进价", "进价"),
- new System.Data.Common.DataColumnMapping("税价合计", "税价合计"),
- new System.Data.Common.DataColumnMapping("税率", "税率"),
- new System.Data.Common.DataColumnMapping("不含税价", "不含税价"),
- new System.Data.Common.DataColumnMapping("税额", "税额"),
- new System.Data.Common.DataColumnMapping("名称", "名称"),
- new System.Data.Common.DataColumnMapping("品名", "品名"),
- new System.Data.Common.DataColumnMapping("仓库", "仓库"),
- new System.Data.Common.DataColumnMapping("单位", "单位")})});
- //
- // sqlSelectCommand1
- //
- this.sqlSelectCommand1.CommandText = "SELECT a.供货商号, b.货号, a.进货日期, a.业务员, a.制单人, b.进货数量, b.进价, b.税价合计, b.税率, b.不含税价, b." +
- "税额, c.名称, d.品名, b.仓库, d.单位 FROM 进货单 a INNER JOIN 进货单明细 b ON a.编号 = b.进货单号 INNER " +
- "JOIN 供货商清单 c ON a.供货商号 = c.供货商号 INNER JOIN 商品清单 d ON b.货号 = d.货号";
- this.sqlSelectCommand1.Connection = this.sqlConnection1;
- //
- // sqlConnection1
- //
- this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=jxcbook;";
- //
- // dataSet21
- //
- this.dataSet21.DataSetName = "DataSet2";
- this.dataSet21.Locale = new System.Globalization.CultureInfo("zh-CN");
- //
- // CrystalReport
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(736, 397);
- this.Controls.Add(this.crystalReportViewer1);
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.Name = "CrystalReport";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "进货单报表";
- this.Load += new System.EventHandler(this.CrystalReport_Load);
- ((System.ComponentModel.ISupportInitialize)(this.dataSet21)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- private void CrystalReport_Load(object sender, System.EventArgs e)
- {
- sqlDataAdapter1.Fill(this.dataSet21);
- CrystalReport1 rpt=new CrystalReport1();
- rpt.SetDataSource(this.dataSet21.Tables[0]);
- crystalReportViewer1.ReportSource=rpt;
- }
-
-
- }
- }