第一范文网 - 专业文章范例文档资料分享平台

《HHL酒店管理系统》课程设计报告书V1.0 - 图文

来源:用户分享 时间:2025/5/16 6:57:06 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

点击“退房”后

- 29 -

退房后,108房会自动变为空房

6.5营业查询功能的实现

代码如下:

string str = @\; string str1 = @\; string str2 = @\;

private void FrmHotelExpense_Load(object sender, EventArgs e) {

using (SqlConnection con = myCon.getCon()) {

con.Open();

StringBuilder sql = new StringBuilder();

sql.Append(\房号,R_money as 房价,R_type as 房间类型,R_status as 房间状态,R_intime as 入住时间,R_daoqitime as 退房时间,R_notes as 备注from Room\);

- 30 -

SqlDataAdapter dapt = new SqlDataAdapter(sql.ToString(), con); ds = new DataSet(); dapt.Fill(ds, \);

}

dataGridView1.DataSource = ds.Tables[0];

}

private void butri_Click(object sender, EventArgs e) {

if (textBox1.Text == \) {

MessageBox.Show(\日期不能为空\); }

//日报表查询

else if (Regex.IsMatch(textBox1.Text.Trim(), str)) {

DataSet ds = new DataSet();

using (SqlConnection con = myCon.getCon()) {

con.Open();

DataSet dst = new DataSet();

string sql = string.Format(\R_ID as 房号,R_money as 房价,R_type as 房间类型,R_status as 房间状态,R_intime as 入住时间,R_daoqitime as 退房时间,R_notes as 备注from Room where R_daoqitime='{0}'\, this.textBox1.Text); SqlDataAdapter dapt = new SqlDataAdapter(sql, con); dapt.Fill(dst, \);

dataGridView1.DataSource = dst.Tables[0]; float sun = 0;

for (int i = 0; i < dataGridView1.RowCount; i++) {

if (!dataGridView1.Rows[i].IsNewRow)

sun = sun + float.Parse(dataGridView1[1, i].Value.ToString()); }

label1.Text = \按日报表查询,总额为:\ + sun.ToString() + \元\;

con.Close();

- 31 -

} }

//月报表查询

else if (Regex.IsMatch(textBox1.Text.Trim(), str1)) {

DataSet ds = new DataSet();

using (SqlConnection con = myCon.getCon()) {

con.Open();

DataSet dst = new DataSet();

string time = this.textBox1.Text.Trim(); string year = time.Substring(0, 4); string month = time.Substring(5, 2);

string sql = \R_ID as 房号,R_money as 房价,R_type as 房间类型,R_status as 房间状态,R_intime as 入住时间,R_daoqitime as 退房时间,R_notes as 备注from Room where year(R_daoqitime)='\ + year + \ + month + \;

SqlDataAdapter dapt = new SqlDataAdapter(sql, con); dapt.Fill(dst, \);

dataGridView1.DataSource = dst.Tables[0];

float sun = 0;

for (int i = 0; i < dataGridView1.RowCount; i++) {

if (!dataGridView1.Rows[i].IsNewRow)

sun = sun + float.Parse(dataGridView1[1, i].Value.ToString()); }

label1.Text = \按月报表查询,总额为:\ + sun.ToString() + \元\;

con.Close(); } }

//年报表查询

else if (Regex.IsMatch(textBox1.Text.Trim(), str2)) {

ds = new DataSet();

using (SqlConnection con = myCon.getCon()) {

con.Open();

DataSet dst = new DataSet();

- 32 -

《HHL酒店管理系统》课程设计报告书V1.0 - 图文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c3hqtu1wbhp4i6jo0x0ha_8.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top