?? crystalreport.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
namespace 進銷存管理系統(tǒng)
{
/// <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 進銷存管理系統(tǒng).DataSet2 dataSet21;
/// <summary>
/// 必需的設(shè)計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public CrystalReport()
{
//
// Windows 窗體設(shè)計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計器生成的代碼
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </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 進銷存管理系統(tǒng).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("業(yè)務(wù)員", "業(yè)務(wù)員"),
new System.Data.Common.DataColumnMapping("制單人", "制單人"),
new System.Data.Common.DataColumnMapping("進貨數(shù)量", "進貨數(shù)量"),
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.業(yè)務(wù)員, a.制單人, b.進貨數(shù)量, 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;
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -