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

📄 cliniccharge.cs

📁 很全面的医院管理系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
			// dataView2
			// 
			this.dataView2.Table = this.dataSet21.门诊划价明细;
			// 
			// txt5
			// 
			this.txt5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "划价金额"));
			this.txt5.Location = new System.Drawing.Point(72, 496);
			this.txt5.Name = "txt5";
			this.txt5.ReadOnly = true;
			this.txt5.TabIndex = 3;
			this.txt5.Text = "";
			// 
			// txt6
			// 
			this.txt6.Location = new System.Drawing.Point(264, 496);
			this.txt6.Name = "txt6";
			this.txt6.TabIndex = 3;
			this.txt6.Text = "";
			this.txt6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt6_KeyPress);
			this.txt6.TextChanged += new System.EventHandler(this.txt6_TextChanged);
			// 
			// txt7
			// 
			this.txt7.Location = new System.Drawing.Point(432, 496);
			this.txt7.Name = "txt7";
			this.txt7.ReadOnly = true;
			this.txt7.TabIndex = 3;
			this.txt7.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(72, 480);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(100, 16);
			this.label1.TabIndex = 4;
			this.label1.Text = "合计金额";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(264, 480);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(100, 16);
			this.label2.TabIndex = 4;
			this.label2.Text = "收款";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(432, 480);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(100, 16);
			this.label3.TabIndex = 4;
			this.label3.Text = "找零";
			// 
			// btnCash
			// 
			this.btnCash.Image = ((System.Drawing.Image)(resources.GetObject("btnCash.Image")));
			this.btnCash.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnCash.Location = new System.Drawing.Point(576, 488);
			this.btnCash.Name = "btnCash";
			this.btnCash.TabIndex = 5;
			this.btnCash.Text = "收费";
			this.btnCash.Click += new System.EventHandler(this.btnCash_Click);
			// 
			// da2
			// 
			this.da2.SelectCommand = this.sqlSelectCommand1;
			this.da2.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("划价编号", "划价编号")})});
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT DISTINCT a.编号, a.药品编号, b.名称, a.单价, a.数量, a.金额, a.划价编号 FROM 门诊划价明细 a INNER " +
				"JOIN v收费项目及药品 b ON a.药品编号 = b.编号";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=localhost;packet size=4096;integrated security=SSPI;data source=\"." +
				"\";persist security info=False;initial catalog=hisbook";
			// 
			// da1
			// 
			this.da1.SelectCommand = this.sqlSelectCommand2;
			this.da1.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("发药员", "发药员")})});
			// 
			// sqlSelectCommand2
			// 
			this.sqlSelectCommand2.CommandText = "SELECT b.姓名, b.性别, a.编号, a.科室, a.挂号编号, a.医生, a.划价时间, a.划价员, a.是否收费, a.收费员, a.收费时间" +
				", a.划价金额, a.是否发药, a.发药时间, a.发药员 FROM 门诊划价 a INNER JOIN 门诊挂号 b ON a.挂号编号 = b.编号 W" +
				"HERE (a.是否收费 = \'否\')";
			this.sqlSelectCommand2.Connection = this.sqlConnection1;
			// 
			// ClinicCharge
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(720, 525);
			this.Controls.Add(this.btnCash);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.txt5);
			this.Controls.Add(this.dataGrid2);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.txt6);
			this.Controls.Add(this.txt7);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label3);
			this.Name = "ClinicCharge";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "【门诊收费】";
			this.Load += new System.EventHandler(this.ClinicCharge_Load);
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet21)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataView2)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		//---------初始化窗体,填充数据集----------
		private void ClinicCharge_Load(object sender, System.EventArgs e)
		{
			//填充数据集
			da1.Fill(dataSet21);
			da2.Fill(dataSet21);
			//显示时,首先显示第一个划价单的明细
			dataView2.RowFilter="划价编号='"+dataGrid1[0,2].ToString().Trim()+"'";
			//明细数据根据选择的划价单编号而变化
			dataGrid1.CurrentCellChanged+=new EventHandler(dataGrid1_CurrentCellChanged);
		}

		//-------------显示划价单明细----------------
		private void dataGrid1_CurrentCellChanged(object sender, EventArgs e)
		{
			txt6.Clear();
			txt7.Clear();
			int i=dataGrid1.CurrentRowIndex;
            dataView2.RowFilter="划价编号='"+dataGrid1[i,2].ToString().Trim()+"'";
		}

		//------------根据输入条件检索划价数据--------------
		private void btnSearch_Click(object sender, System.EventArgs e)
		{
			string filter="";
			if(txt1.Text.Trim()!="")
			{
				filter+="编号 like '%"+txt1.Text.Trim()+"%' AND ";
			}
			if(txt2.Text.Trim()!="")
			{
				filter+="姓名 like '%"+txt2.Text.Trim()+"%' AND ";
			}
			if(txt3.Text.Trim()!="")
			{
				filter+="划价时间>='"+txt3.Text.Trim()+"' AND ";
			}
			if(txt4.Text.Trim()!="")
			{
				filter+="划价时间<='"+txt4.Text.Trim()+"' AND ";
			}
			int length=filter.Length;
			if(length>0)
			{
				filter=filter.Substring(0,length-5);
			}
			dataView1.RowFilter=filter;
			if(dataView1.Count>0)//有确定的划价数据再显示明细
			{				
				dataView2.RowFilter="划价编号='"+dataGrid1[0,2].ToString().Trim()+"'";
			}
		}

		//-----------根据输入金额计算找零-------------
		private void txt6_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			
			//除小数点,数字和Del键之外,不相应其他键
			if(!(e.KeyChar=='.'||(e.KeyChar>='0'&&e.KeyChar<='9'))||e.KeyChar=='8')
			{
				e.Handled=true;
				
			}		
		}

		//-----------随时计算找零金额------------
		private void txt6_TextChanged(object sender, System.EventArgs e)
		{
			if(txt5.Text.Trim()=="")//无合计金额不计算
			{
				return;
			}
			decimal money=0;
			money=Convert.ToDecimal(txt6.Text)-Convert.ToDecimal(txt5.Text);
			txt7.Text=money.ToString();
		}

		//------------执行收费-----------
		private void btnCash_Click(object sender, System.EventArgs e)
		{
			if(txt7.Text=="")//检查收款金额
			{
				MessageBox.Show("未输入收款金额","提示",MessageBoxButtons.OK,MessageBoxIcon.Stop);
				return;
			}
			if(Convert.ToDecimal(txt7.Text)<0)
			{
				MessageBox.Show("收款不足支付费用","提示",MessageBoxButtons.OK,MessageBoxIcon.Stop);
				return;
			}
			//收取款项,更新数据库
			string strConn="workstation id=localhost;Integrated Security=SSPI;Database=hisbook;";
			SqlConnection cn=new SqlConnection(strConn);
			cn.Open();
			SqlCommand cmd=cn.CreateCommand();
			cmd.CommandText="update 门诊划价 set 是否收费='是',收费时间='"+System.DateTime.Now.ToString()
				+"' where 编号='"+dataGrid1[dataGrid1.CurrentRowIndex,2].ToString().Trim()+"'";
			cmd.ExecuteNonQuery();
			dataSet21.Clear();//刷新数据集
			da1.Fill(dataSet21);
			da2.Fill(dataSet21);
						
		}

		
	}
}

⌨️ 快捷键说明

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