📄 tsjz.cs
字号:
//
// label17
//
this.label17.Location = new System.Drawing.Point(200, 99);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(72, 23);
this.label17.TabIndex = 150;
this.label17.Text = "住宿天数:";
//
// label15
//
this.label15.Location = new System.Drawing.Point(8, 99);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(72, 23);
this.label15.TabIndex = 153;
this.label15.Text = "住宿日期:";
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(80, 144);
this.textBox10.Name = "textBox10";
this.textBox10.ReadOnly = true;
this.textBox10.TabIndex = 152;
this.textBox10.Text = "";
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(80, 120);
this.textBox8.Name = "textBox8";
this.textBox8.ReadOnly = true;
this.textBox8.TabIndex = 157;
this.textBox8.Text = "";
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(272, 120);
this.textBox9.Name = "textBox9";
this.textBox9.ReadOnly = true;
this.textBox9.TabIndex = 155;
this.textBox9.Text = "";
//
// label9
//
this.label9.Location = new System.Drawing.Point(8, 123);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(72, 23);
this.label9.TabIndex = 156;
this.label9.Text = "应收宿费:";
//
// label4
//
this.label4.Location = new System.Drawing.Point(200, 123);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 23);
this.label4.TabIndex = 154;
this.label4.Text = "预收宿费:";
//
// label10
//
this.label10.Location = new System.Drawing.Point(8, 147);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(72, 23);
this.label10.TabIndex = 161;
this.label10.Text = "增补宿费:";
//
// label12
//
this.label12.Location = new System.Drawing.Point(200, 147);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(72, 23);
this.label12.TabIndex = 160;
this.label12.Text = "退还宿费:";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(80, 96);
this.textBox6.Name = "textBox6";
this.textBox6.ReadOnly = true;
this.textBox6.TabIndex = 159;
this.textBox6.Text = "";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(272, 144);
this.textBox11.Name = "textBox11";
this.textBox11.ReadOnly = true;
this.textBox11.TabIndex = 158;
this.textBox11.Text = "";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(80, 168);
this.textBox12.Name = "textBox12";
this.textBox12.ReadOnly = true;
this.textBox12.TabIndex = 163;
this.textBox12.Text = "";
//
// textBox13
//
this.textBox13.Location = new System.Drawing.Point(272, 168);
this.textBox13.Name = "textBox13";
this.textBox13.ReadOnly = true;
this.textBox13.TabIndex = 162;
this.textBox13.Text = "";
//
// label18
//
this.label18.Location = new System.Drawing.Point(200, 171);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(72, 23);
this.label18.TabIndex = 165;
this.label18.Text = "证件号码:";
//
// label19
//
this.label19.Location = new System.Drawing.Point(8, 171);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(72, 23);
this.label19.TabIndex = 164;
this.label19.Text = "证件名称:";
//
// label20
//
this.label20.Location = new System.Drawing.Point(200, 196);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(72, 23);
this.label20.TabIndex = 169;
this.label20.Text = "详细地址:";
//
// textBox15
//
this.textBox15.Location = new System.Drawing.Point(272, 192);
this.textBox15.Name = "textBox15";
this.textBox15.ReadOnly = true;
this.textBox15.TabIndex = 168;
this.textBox15.Text = "";
//
// textBox14
//
this.textBox14.Location = new System.Drawing.Point(80, 192);
this.textBox14.Name = "textBox14";
this.textBox14.ReadOnly = true;
this.textBox14.TabIndex = 166;
this.textBox14.Text = "";
//
// label13
//
this.label13.Location = new System.Drawing.Point(8, 196);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(72, 23);
this.label13.TabIndex = 167;
this.label13.Text = "联系电话:";
//
// textBox16
//
this.textBox16.Location = new System.Drawing.Point(80, 216);
this.textBox16.Name = "textBox16";
this.textBox16.Size = new System.Drawing.Size(296, 21);
this.textBox16.TabIndex = 170;
this.textBox16.Text = "";
//
// label16
//
this.label16.Location = new System.Drawing.Point(8, 219);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(72, 23);
this.label16.TabIndex = 171;
this.label16.Text = "备 注:";
//
// textBox17
//
this.textBox17.Location = new System.Drawing.Point(272, 252);
this.textBox17.Name = "textBox17";
this.textBox17.ReadOnly = true;
this.textBox17.TabIndex = 172;
this.textBox17.Text = "";
//
// label11
//
this.label11.Location = new System.Drawing.Point(200, 256);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(72, 16);
this.label11.TabIndex = 173;
this.label11.Text = "退房日期:";
//
// tsjz
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(480, 283);
this.Name = "tsjz";
this.Text = "退宿结帐";
this.Load += new System.EventHandler(this.tsjz_Load);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
} #endregion
string opername;//传递操作员姓名
DataConn dc=new DataConn ();
private void rebind()
{
string str=dc.connstr ;
SqlConnection conn=new SqlConnection (str);
string sql="select 凭证号码 from tabdjb where 是否结帐='0'";
SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
DataSet dataset=new DataSet ();
adapter.Fill (dataset,"tabdjb");
this.comboBox1 .DisplayMember="凭证号码";
this.comboBox1 .DataSource =dataset.Tables ["tabdjb"];
conn.Dispose ();
adapter.Dispose ();
dataset.Dispose ();
}
private void tsjz_Load(object sender, System.EventArgs e)
{
this.AcceptButton =this.button2 ;
this.label2 .Text =this.opername ;
this.textBox17.Text =System.DateTime .Today.Date.ToShortDateString();
this.rebind ();
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.textBox1 .Text ="T"+this.comboBox1 .Text ;
string str=dc.connstr ;
SqlConnection conn=new SqlConnection (str);
string sql="select * from tabdjb where 凭证号码='"+this.comboBox1 .Text +"'";
SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
DataSet dataset=new DataSet ();
adapter.Fill (dataset,"tabdjb");
this.textBox2 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.姓名"));
this.textBox3 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.房间号"));
this.textBox4 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.客房类型"));
this.textBox5 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.房间价格"));
this.textBox6 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.住宿日期"));
this.textBox9 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.预付金额"));
this.textBox12 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.证件名称"));
this.textBox13 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.证件号码"));
this.textBox14 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.联系电话"));
this.textBox15 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.详细地址"));
// this.textBox6.Text =this.textBox6.Text .Substring(0,9);
//释放所有绑定
this.textBox2 .DataBindings .Clear ();
this.textBox3 .DataBindings .Clear ();
this.textBox4 .DataBindings .Clear ();
this.textBox5 .DataBindings .Clear ();
this.textBox6 .DataBindings .Clear ();
this.textBox12 .DataBindings .Clear ();
this.textBox13 .DataBindings .Clear ();
this.textBox9 .DataBindings .Clear ();
this.textBox14 .DataBindings .Clear ();
this.textBox15 .DataBindings .Clear ();
this.textBox6.Text =this.textBox6 .Text .Substring (0,9);
//判断实际住宿天数。
int count=1;
string str1=this.textBox6.Text;
while((System.DateTime.Equals(Convert.ToDateTime (this.textBox17 .Text ),Convert.ToDateTime (str1)))==false)
{
str1=(Convert.ToDateTime(str1).AddDays(1)).ToString();
count++;
}
this.textBox7.Text =count.ToString ();
//计算实际应付金额。
this.textBox8.Text =(count*Convert.ToInt32(this.textBox5.Text)).ToString ();
//结算
if(Convert.ToInt32(this.textBox8.Text)>=Convert.ToInt32(this.textBox9.Text ))
{
this.textBox10.Text =Convert.ToString((Convert.ToInt32(this.textBox8.Text)-Convert.ToInt32(this.textBox9.Text )));
this.textBox11.Text ="0";
}
else
{
this.textBox11.Text =Convert.ToString((Convert.ToInt32(this.textBox9.Text)-Convert.ToInt32(this.textBox8.Text )));
this.textBox10.Text ="0";
}
conn.Dispose ();
adapter.Dispose ();
dataset.Dispose ();
}
private void button2_Click(object sender, System.EventArgs e)
{
string str=dc.connstr ;
SqlConnection conn=new SqlConnection (str);
string sql="insert into tabtfd values(";
sql=sql+"'"+this.textBox1 .Text +"',";
sql=sql+"'"+this.textBox2 .Text +"',";
sql=sql+"'"+this.textBox12 .Text +"',";
sql=sql+"'"+this.textBox13 .Text +"',";
sql=sql+"'"+this.textBox15 .Text +"',";
sql=sql+"'"+this.textBox3 .Text +"',";
sql=sql+"'"+this.textBox4 .Text +"',";
sql=sql+""+this.textBox5 .Text +",";
sql=sql+"'"+this.textBox6 .Text +"',";
sql=sql+""+this.textBox7 .Text +",";
sql=sql+""+this.textBox8 .Text +",";
sql=sql+""+this.textBox9 .Text +",";
sql=sql+""+this.textBox10 .Text +",";
sql=sql+""+this.textBox11 .Text +",";
sql=sql+"'"+this.textBox17 .Text +"',";
sql=sql+"'"+this.textBox14 .Text +"',";
sql=sql+"'"+this.opername+"',";
sql=sql+"'"+this.textBox16 .Text +"')";
SqlCommand cmd=new SqlCommand (sql,conn);
string sql1="update tabkfinfo set 房态='空闲' where 房间号='"+this.textBox3.Text +"'";
string sql2="update tabdjb set 是否结帐='1'where 房间号='"+this.textBox3.Text +"'";
SqlCommand cmd1=new SqlCommand (sql1,conn);
SqlCommand cmd2=new SqlCommand (sql2,conn);
conn.Open ();
cmd.ExecuteNonQuery ();
MessageBox.Show ("您已成功结帐,欢迎再次光临!","恭喜",MessageBoxButtons.OK ,MessageBoxIcon.Information);
cmd1.ExecuteNonQuery ();//修改房态
cmd2.ExecuteNonQuery ();
this.rebind ();
conn.Close();
cmd1.Dispose ();
cmd2.Dispose ();
cmd.Dispose ();
}
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -