📄 eatingprint.aspx.cs
字号:
//文件名:EatingPrint.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;
public partial class ConsumeManage_EatingPrint : System.Web.UI.Page
{
private ConsumeManage_EatingForm MyEatingForm;
protected void Page_Load(object sender, EventArgs e)
{//显示旅客餐费登记信息
MyEatingForm = (ConsumeManage_EatingForm)Context.Handler;
string MyTitle = Session["MyCompanyName"].ToString()+"餐费登记单";
string My餐费编号 = "餐费编号:"+MyEatingForm.MyTable.Rows[0][2].ToString();
string My入住编号 = " 入住编号:" + MyEatingForm.MyTable.Rows[0][1].ToString();
string My操作人员 ="操作人员:"+MyEatingForm.MyTable.Rows[0][8].ToString();
string My打印日期=" 打印日期:"+DateTime.Now.ToLongDateString();
string My入住房号="房号:"+MyEatingForm.My入住房号;
string My客人姓名=" 姓名:"+MyEatingForm.My客人姓名;
this.Label1.Text = MyTitle;
this.Label2.Text = My餐费编号;
this.Label3.Text = My操作人员;
TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Left;
cell.ColumnSpan = 5;
cell.Width = 600;
cell.Text =" "+My入住房号
+ "  "+ My客人姓名
+ "  "+ My入住编号
+ "  "+ My打印日期;
row.Cells.Add(cell);
this.Table1.Rows.Add(row);
TableRow row1 = new TableRow();
TableCell cell1 = new TableCell();
cell1.HorizontalAlign = HorizontalAlign.Center;
cell1.Text = "序号";
cell1.Width = 50;
row1.Cells.Add(cell1);
TableCell cell2 = new TableCell();
cell2.HorizontalAlign = HorizontalAlign.Center;
cell2.Text = "用餐时间";
cell2.Width = 150;
row1.Cells.Add(cell2);
TableCell cell3 = new TableCell();
cell3.HorizontalAlign = HorizontalAlign.Center;
cell3.Text = "类别";
cell3.Width = 100;
row1.Cells.Add(cell3);
TableCell cell4 = new TableCell();
cell4.HorizontalAlign = HorizontalAlign.Center;
cell4.Text = "金额";
cell4.Width = 100;
row1.Cells.Add(cell4);
TableCell cell5 = new TableCell();
cell5.HorizontalAlign = HorizontalAlign.Center;
cell5.Text = "说明";
cell5.Width = 200;
row1.Cells.Add(cell5);
this.Table1.Rows.Add(row1);
Double MyAmount = 0;
for (int i = 1; i <=MyEatingForm.MyTable.Rows.Count; i++)
{
string MyDate =DateTime.Parse(MyEatingForm.MyTable.Rows[i-1][3].ToString()).ToShortDateString();
string MyType = MyEatingForm.MyTable.Rows[i-1][4].ToString();
string MyPrice = MyEatingForm.MyTable.Rows[i-1][5].ToString();
MyAmount = MyAmount + Convert.ToDouble(MyPrice);
string MyComment = MyEatingForm.MyTable.Rows[i-1][6].ToString();
string MyIndex = i.ToString();
AddRow(MyIndex, MyDate, MyType, MyPrice, MyComment);
}
TableRow row2 = new TableRow();
TableCell cell6 = new TableCell();
cell6.HorizontalAlign = HorizontalAlign.Center;
cell6.ColumnSpan = 5;
cell6.Width = 600;
cell6.Text = "合计金额:"+MyAmount.ToString()+"元";
row2.Cells.Add(cell6);
this.Table1.Rows.Add(row2);
}
private void AddRow(string MyIndex, string MyDate, string MyType, string MyPrice,string MyComment)
{
TableRow row1 = new TableRow();
TableCell cell1 = new TableCell();
cell1.HorizontalAlign = HorizontalAlign.Center;
cell1.Text = MyIndex;
cell1.Width = 50;
row1.Cells.Add(cell1);
TableCell cell2 = new TableCell();
cell2.HorizontalAlign = HorizontalAlign.Center;
cell2.Text = MyDate;
cell2.Width = 150;
row1.Cells.Add(cell2);
TableCell cell3 = new TableCell();
cell3.HorizontalAlign = HorizontalAlign.Center;
cell3.Text = MyType;
cell3.Width = 100;
row1.Cells.Add(cell3);
TableCell cell4 = new TableCell();
cell4.HorizontalAlign = HorizontalAlign.Center;
cell4.Text = MyPrice;
cell4.Width = 100;
row1.Cells.Add(cell4);
TableCell cell5 = new TableCell();
cell5.HorizontalAlign = HorizontalAlign.Center;
cell5.Text = MyComment;
cell5.Width = 200;
row1.Cells.Add(cell5);
this.Table1.Rows.Add(row1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -