⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 financialreport.cs

📁 财务管理系统采用C#语言和SQL Server数据库 适合于一般小公司的使用
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;

namespace 财务管理系统
{
	/// <summary>
	/// BalanceSheet 的摘要说明。
	/// </summary>
	public class FinancialReport : System.Windows.Forms.Form
	{
		private CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.NumericUpDown numericUpDown1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button btnSummary;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		
		public FinancialReport()
		{
			//
			// 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()
		{
			this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.btnSummary = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
			this.groupBox1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
			this.SuspendLayout();
			// 
			// crystalReportViewer1
			// 
			this.crystalReportViewer1.ActiveViewIndex = -1;
			this.crystalReportViewer1.DisplayGroupTree = false;
			this.crystalReportViewer1.Location = new System.Drawing.Point(0, 48);
			this.crystalReportViewer1.Name = "crystalReportViewer1";
			this.crystalReportViewer1.ReportSource = null;
			this.crystalReportViewer1.Size = new System.Drawing.Size(664, 440);
			this.crystalReportViewer1.TabIndex = 0;
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.btnSummary);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.numericUpDown1);
			this.groupBox1.Location = new System.Drawing.Point(8, 0);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(648, 48);
			this.groupBox1.TabIndex = 1;
			this.groupBox1.TabStop = false;
			// 
			// btnSummary
			// 
			this.btnSummary.Location = new System.Drawing.Point(416, 15);
			this.btnSummary.Name = "btnSummary";
			this.btnSummary.Size = new System.Drawing.Size(120, 23);
			this.btnSummary.TabIndex = 2;
			this.btnSummary.Text = "显示报表";
			this.btnSummary.Click += new System.EventHandler(this.btnSummary_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(88, 19);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(152, 16);
			this.label1.TabIndex = 1;
			this.label1.Text = "选择要统计的会计期间";
			// 
			// numericUpDown1
			// 
			this.numericUpDown1.Location = new System.Drawing.Point(256, 16);
			this.numericUpDown1.Minimum = new System.Decimal(new int[] {
																		   1,
																		   0,
																		   0,
																		   0});
			this.numericUpDown1.Name = "numericUpDown1";
			this.numericUpDown1.TabIndex = 0;
			this.numericUpDown1.Value = new System.Decimal(new int[] {
																		 1,
																		 0,
																		 0,
																		 0});
			// 
			// FinancialReport
			// 
			this.AcceptButton = this.btnSummary;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(664, 493);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.crystalReportViewer1);
			this.Name = "FinancialReport";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "资产负债表";
			this.Load += new System.EventHandler(this.FinancialReport_Load);
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		
		

		//------------读入系统参数中的当前会计期间-----------
		private void FinancialReport_Load(object sender, System.EventArgs e)
		{
			string conStr="workstation id=localhost;Integrated Security=SSPI;Database=caiwubook;";
			SqlConnection cn=new SqlConnection(conStr);
			cn.Open();
			//读入当前会计期间
			SqlCommand cmd=cn.CreateCommand();
			cmd.CommandText="select 取值 from 系统参数表 where 编号='3'";
			this.numericUpDown1.Value=Convert.ToDecimal(cmd.ExecuteScalar());
		}

		//----------显示所选择的会计期间的报表--------------
		private void btnSummary_Click(object sender, System.EventArgs e)
		{			
			string conStr="workstation id=localhost;Integrated Security=SSPI;Database=caiwubook;";
			SqlConnection cn=new SqlConnection(conStr);
			cn.Open();

			//调用储存过程,计算当前会计期间的资产负债表
			SqlCommand cmd=cn.CreateCommand();
			int index=Convert.ToInt32(this.numericUpDown1.Value);
			cmd.CommandText="exec sf_计算资产负债表 "+index.ToString();
			cmd.ExecuteNonQuery();
			//显示资产负债报表
			string sql="select * from 资产负债表 where 会计期间='"+index.ToString()+"'";
			SqlDataAdapter da=new SqlDataAdapter(sql,cn);
			DataSet ds=new DataSet();
			da.Fill(ds);
			CrystalReport1 rpt=new CrystalReport1();
			//连接报表数据源
			rpt.SetDataSource(ds.Tables[0]);
			crystalReportViewer1.ReportSource=rpt;
		}

		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -