📄 cliniccharge.cs
字号:
this.label3.Name = "label3";
this.label3.TabIndex = 6;
this.label3.Text = "开始时间";
//
// label2
//
this.label2.Location = new System.Drawing.Point(288, 32);
this.label2.Name = "label2";
this.label2.TabIndex = 5;
this.label2.Text = "姓名";
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 32);
this.label1.Name = "label1";
this.label1.TabIndex = 4;
this.label1.Text = "编号";
//
// txt4
//
this.txt4.Location = new System.Drawing.Point(400, 56);
this.txt4.Name = "txt4";
this.txt4.TabIndex = 3;
this.txt4.Text = "";
//
// txt3
//
this.txt3.Location = new System.Drawing.Point(120, 64);
this.txt3.Name = "txt3";
this.txt3.TabIndex = 2;
this.txt3.Text = "";
//
// txt2
//
this.txt2.Location = new System.Drawing.Point(400, 24);
this.txt2.Name = "txt2";
this.txt2.TabIndex = 1;
this.txt2.Text = "";
//
// txt1
//
this.txt1.Location = new System.Drawing.Point(120, 32);
this.txt1.Name = "txt1";
this.txt1.TabIndex = 0;
this.txt1.Text = "";
//
// da1
//
this.da1.SelectCommand = this.sqlSelectCommand1;
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("发药员", "发药员")})});
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.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.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=BRIGHT;packet size=4096;user id=sa;data source=BRIGHT;persist secu" +
"rity info=False;initial catalog=hospitalms";
//
// da2
//
this.da2.SelectCommand = this.sqlSelectCommand2;
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("划价编号", "划价编号")})});
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT DISTINCT a.编号, a.药品编号, b.名称, a.单价, a.数量, a.金额, a.划价编号 FROM 门诊划价明细 a INNER " +
"JOIN v收费项目及药品 b ON a.药品编号 = b.编号";
this.sqlSelectCommand2.Connection = this.sqlConnection1;
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(688, 544);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 20;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// ClinicCharge
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(840, 584);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnCash);
this.Controls.Add(this.txt7);
this.Controls.Add(this.txt6);
this.Controls.Add(this.txt5);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.dataGrid2);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.groupBox1);
this.Name = "ClinicCharge";
this.Text = "ClinicCharge";
this.Load += new System.EventHandler(this.ClinicCharge_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataView2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet21)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void ClinicCharge_Load(object sender, System.EventArgs e)
{
try
{
dataSet21.EnforceConstraints=false;//去掉约束
da1.Fill(dataSet21);
da2.Fill(dataSet21);
dataView2.RowFilter="划价编号='"+dataGrid1[0,2].ToString().Trim()+"'";
dataGrid1.CurrentCellChanged+=new EventHandler(dataGrid1_CurrentCellChanged);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void dataGrid1_CurrentCellChanged(object sender, System.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)
{
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;
if(txt6.Text.Trim()!="")
{
money=Convert.ToDecimal(txt6.Text)-Convert.ToDecimal(txt5.Text);
txt7.Text=money.ToString();
}
else
{
txt7.Text="";
}
}
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=hospitalms;";
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);
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
txt6.Text="";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -