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 BillInfoManage_AddNewBill : System.Web.UI.Page
{
LSBLL.SystemMange TempSys = new LSBLL.SystemMange();
LSModel.BillInfo bif = new LSModel.BillInfo();
LSBLL.kaidan kaidan = new LSBLL.kaidan();
LSBLL.ReserveInfo rinfo = new LSBLL.ReserveInfo();
Maticsoft.BLL.ReserveRestInfo restinfo = new Maticsoft.BLL.ReserveRestInfo();
Maticsoft.BLL.ReserveConsumerInfo restconsumerinfo = new Maticsoft.BLL.ReserveConsumerInfo();
string ReserveID = "";
protected void Page_Load(object sender, EventArgs e)
{
try//如果是预定转开单就获取预定号
{
ReserveID = Request["ReserveID"];//获取预定号
}
catch { ReserveID = ""; }
//if (!Page.IsPostBack)
//{
//
Bind_RestaurantInfo();
//
Bind_setReserve();
//
try
//
{
//
for (int i = 0; i < TreeView1.Nodes.Count; i++)//用循环是实现了多个餐台
//
{
//
for (int j = 0; j < TreeView1.Nodes[i].ChildNodes.Count; j++)
//
{
//
if (TreeView1.Nodes[i].ChildNodes[j].Value.Equals(Request["RestID"]))
//
{
//
TreeView1.Nodes[i].ChildNodes[j].Checked = true;
//
}
//
}
//
}
//
}
//
catch { }
//}
}
////设置预定信息
//protected void Bind_setReserve()
//{
//
if (ReserveID != "" && ReserveID != null)//如果预定信息不等于空就可以进行设置数据绑定到界面
//
{
//
//查询预定信息主表
//
DataTable dtTemp = rinfo.selct_terms_yd(ReserveID);
//
TextBox1.Text = dtTemp.Rows[0]["ManCount"].ToString();//绑定预定人数
//
//判断是否有预定餐台,循环选择预定的节点
//
dtTemp = WebLog.DTConvert(restinfo.GetList("ReserveID = '"+ReserveID+"'"));
//
for (int i = 0; i < dtTemp.Rows.Count; i++)//循环记录
//
{
//
for (int j = 0; j < TreeView1.Nodes.Count; j++)//记录界面的一级菜单
//
{
//
for (int q = 0; q < TreeView1.Nodes[j].ChildNodes.Count; q++)//循环记录的二级菜单
//
{
//
if (dtTemp.Rows[i]["RestTableID"].ToString().Equals(TreeView1.Nodes[j].ChildNodes[q].Value))
//
{
//
TreeView1.Nodes[j].ChildNodes[q].Checked = true;
//
}
//
}
//
}
//
}
//
//选择菜品,加入预定的菜品
//
dtTemp = WebLog.DTConvert(restconsumerinfo.GetList("ReserveID = '"+ReserveID+"'"));//查询出预定菜品的信息
//
string TempStrLable = "";//储存拼接字符串
//
for (int i = 0; i < dtTemp.Rows.Count; i++)
//
{
//
TempStrLable += "," + dtTemp.Rows[i]["ConsumerItemID"].ToString() + "("
//
+ dtTemp.Rows[i]["CountNum"].ToString() + ")" + "["
//
+ dtTemp.Rows[i]["SDNum"].ToString() + "]";
//
}
//
Label1.Value = TempStrLable;
//
}
//}
//protected void Bind_RestaurantInfo()//绑定餐厅信息下拉列表框(预定规格)
//{
//
DataTable dtTemp = TempSys.Select_RestaurantInfo();
//
if (dtTemp != null)
//
{
//
for (int i = 0; i < dtTemp.Rows.Count; i++)
//
{
//
TreeNode tn = new TreeNode(dtTemp.Rows[i]["Rname"].ToString(),
//
dtTemp.Rows[i]["RowID"].ToString());
//
TreeView1.Nodes.Add(tn);
//
TreeView1.Nodes[i].NavigateUrl = "#";
//
DataTable dtTemp1 = TempSys.Select_YYRestTableInfo("0", dtTemp.Rows[i]["RowID"].ToString());
//
if (dtTemp1 != null)
//
{
//
if (ReserveID == "")
//
{
//
DataView dv = new DataView(dtTemp1);
//
dv.RowFilter = "RestTableSite = 0";
//
dtTemp1 = dv.ToTable();
//
}
//
else
//
{
//
DataView dv = new DataView(dtTemp1);
//
dv.RowFilter = "RestTableSite = 0 or RestTableSite = 1";
//
dtTemp1 = dv.ToTable();
//
}
//
for (int j = 0; j < dtTemp1.Rows.Count; j++)
//
{
//
TreeNode tn1 = new TreeNode(dtTemp1.Rows[j]["RestID"].ToString(),
//
dtTemp1.Rows[j]["RestID"].ToString());
//
TreeView1.Nodes[i].ChildNodes.Add(tn1);
//
TreeView1.Nodes[i].ChildNodes[j].NavigateUrl = "#";
//
}
//
}
//
}
//
TreeView1.CollapseAll();
//
}
//
else
//
{
//
LSBLL.WriteLog.writeLog("绑定预定规格出现错误", "查询出来为的数据集null",
//
"CashierPages/ReserveManage.aspx的数据绑定里面。");
//
WebLog.PageError("CashierPages/ReserveManage.aspx预定规格查询出来的数据集为null",
//
"ReserveManage.aspx");
//
}
//}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)//开单
{
GetFormValues();
DateTime dtTemp = DateTime.Now;
bif.OpenBillTime = dtTemp;
bif.MainBillID = dtTemp.ToString("YYYYMMddhhmmss");//设置主账单号
Hashtable hs = new Hashtable();
int temphsi = 0;
int TempI = 0;//累加计算子账单号
string[] RestTableID = TextBox3.Text.Split(',');
for (int i = 0; i < RestTableID.Length; i++)//用循环是实现了多个餐台
{
if (RestTableID[i] != "")
{
bif.RestTableID = RestTableID[i];//设置餐台号
bif.BillID = bif.MainBillID + TempI.ToString();//设置账单号
if (ReserveID != "" && ReserveID != null)
{
if (rinfo.updateReserveInfoSite(ReserveID, 2) > 0)//预定转开单 改变预定状态
{
if (kaidan.CreatNewBill(bif) == 0)
{
hs.Add(temphsi, bif.RestTableID);//开单不成功的餐台记录下来
temphsi++;
}
}
}
else
{
if (kaidan.CreatNewBill(bif) == 0)
{
hs.Add(temphsi, bif.RestTableID);//开单不成功的餐台记录下来
temphsi++;
}
}
TempI++;
}
}
if (hs != null)
{
if (hs.Count > 0)
{
string tempStr = "开单失败:";
for (int i = 0; i < hs.Count; i++)
{
tempStr += (hs[i] + ",");
}
tempStr += "开单失败!";
WebLog.PageError(tempStr, "BillList.aspx");
}
else
{
WebLog.PageRight("开单成功!", "BillList.aspx");
}
}
else {
WebLog.PageRight("开单成功!", "BillList.aspx");
}
}
protected void GetFormValues()
{
//bif.BillID = DateTime.Now.ToString("YYYYMMddhhmmss");
bif.HavePay = 0;
bif.LosePay = 0;
//bif.MainBillID = "";
bif.ManCount = Convert.ToInt32(TextBox1.Text);
bif.OpenBillSite = 1;
//bif.OpenBillTime = DateTime.Now;
bif.Operator = Config._WorkID;
bif.PricePay = 0;
bif.RealPay = 0;
bif.Remark = TextBox2.Text;
//bif.RestTableID = 多台开单
bif.ServiceManID = Label1.Value;
}
}