📄 bookingcheckprint.aspx.cs
字号:
//文件名:BookingCheckPrint.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class BookingManage_BookingCheckPrint : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{//打印预订客人用餐账单
if (Session["MyCompanyName"] != null)
{
this.Label1.Text = Session["MyCompanyName"].ToString() + "预订客人用餐结账单";
}
string MyID = Request.QueryString["MyID"].ToString();
DataTable MyTable = new DataTable();
string MySQL = "SELECT * FROM [预订信息] WHERE ([预订编号]='" + MyID + "') ";
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyEateryDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.Label3.Text = "预订编号:" + MyTable.Rows[0]["预订编号"].ToString();
this.Label4.Text = "用餐日期:" + DateTime.Parse(MyTable.Rows[0]["用餐日期"].ToString()).ToShortDateString();
this.Label5.Text = "用餐人数:" + MyTable.Rows[0]["用餐人数"].ToString();
this.Label2.Text = "预订日期:" + DateTime.Parse(MyTable.Rows[0][1].ToString()).ToShortDateString();
this.Label6.Text = "餐次名称:" + MyTable.Rows[0]["餐次名称"].ToString();
double My预交订金 = Convert.ToDouble(MyTable.Rows[0]["预交订金"].ToString());
this.Label8.Text = "预交订金:" + My预交订金.ToString() + "元";
MyConnection.Close();
MySQL = "SELECT SUM(用餐金额) FROM [用餐信息] WHERE ([用餐单号] LIKE '%" + MyID + "%') ";
MyConnection.Open();
SqlCommand MyCommand = MyConnection.CreateCommand();
MyCommand.CommandText = MySQL;
double My用餐金额 = Convert.ToDouble(MyCommand.ExecuteScalar().ToString());
this.Label7.Text = "用餐金额:" + My用餐金额.ToString() + "元";
MyConnection.Close();
MySQL = "SELECT SUM(折扣金额) FROM [用餐信息] WHERE ([用餐单号] LIKE '%" + MyID + "%') ";
MyConnection.Open();
MyCommand = MyConnection.CreateCommand();
MyCommand.CommandText = MySQL;
double My折扣金额 = Convert.ToDouble(MyCommand.ExecuteScalar().ToString());
this.Label9.Text = "折扣金额:" + My折扣金额.ToString() + "元";
MyConnection.Close();
double My实收金额 = My用餐金额 - My预交订金 - My折扣金额;
this.Label10.Text = "实收金额:" + My实收金额.ToString() + "元";
MySQL = "SELECT * FROM [用餐信息] WHERE ([用餐单号] LIKE '%" + MyID + "%') ";
MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyTable = new DataTable();
MyAdatper.Fill(MyTable);
this.TextBox1.Text = MyTable.Rows[0]["宾客意见"].ToString();
MyTable = new DataTable();
MySQL = "SELECT 用餐单号,菜品名称,计量单位,计费单价,计费数量,计费金额 FROM [用餐明细] WHERE ([用餐单号] LIKE '%" + MyID + "%') ";
MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.GridView1.DataSource = MyTable;
this.GridView1.DataBind();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -