protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(TabieID); if (tabieInfo != null) { labArea.Text = tabieInfo.TabieName; //判断当前餐点状态,已叫菜或者走菜就餐的就不用开启叫菜功能 if (tabieInfo.TabieState >= 3) { btnReady.Hidden = true; } Hiddenid.Text = TabieUsingID.ToString(); //绑定菜品类别 BindFoodClass(); //绑定菜品信息 BindDishInfo(); //绑定显示当前点菜信息 BindSelectDishInfo(); } else { Alert.ShowInTop("餐台信息获取失败", MessageBoxIcon.Error); PageContext.Redirect("~/Dinner/DinnerTabieManager.aspx"); } } }
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) { int ID = GetSelectedDataKeyID(Grid1); if (e.CommandName == "viewField") { PageContext.Redirect(string.Format("~/Reports/DinnerOrderEdit.aspx?id={0}", ID)); } if (e.CommandName == "stockField") { if (CheckPower("CoreCateringEdit")) { //库存冲减 StockProcess(ID); } else { Alert.Show("您没有反结算的权限!"); } } if (e.CommandName == "stockBack") { if (CheckPower("CoreCateringEdit")) { tm_TabieUsingInfo tm_tabieUsingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(ID); //反结算-更新餐台信息状态 tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(tm_tabieUsingInfo.TabieID); if (tabieInfo.TabieState == 1) { tabieInfo.TabieState = 4; tabieInfo.CurrentUsingID = tm_tabieUsingInfo.ID; Core.Container.Instance.Resolve <IServiceTabie>().Update(tabieInfo); //反结算-更新就餐开台信息状态 tm_tabieUsingInfo.OrderState = "1"; Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(tm_tabieUsingInfo); //反结算-删除结算信息 IList <ICriterion> qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("TabieUsingID", ID)); tm_TabiePayInfo payInfo = Core.Container.Instance.Resolve <IServiceTabiePayInfo>().GetEntityByFields(qryList); if (payInfo != null) { Core.Container.Instance.Resolve <IServiceTabiePayInfo>().Delete(payInfo); } Alert.Show("请返回营业管理进行反结算处理!"); //刷新 BindGrid(); } else { Alert.Show("餐台当前使用中,不能进行反结算!"); } } else { Alert.Show("您没有反结算的权限!"); } } }
/// <summary> /// 退菜单打印 /// </summary> /// <param name="listDish">退菜菜品信息</param> /// <param name="entity">开台信息</param> protected void LocalPrint(tm_TabieDishesInfo listDish, tm_TabieUsingInfo entity) { tm_Tabie tabieEntity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(entity.TabieID); StringBuilder sb = new StringBuilder(); StringBuilder count = new StringBuilder(); StringBuilder price = new StringBuilder(); sb.AppendFormat("{0}\n", tabieEntity.TabieName); sb.Append("##退菜单##\n"); sb.Append(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); sb.Append("---------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); sb.AppendFormat("{0}\n", listDish.DishesName); count.Append("\n"); price.AppendFormat("{0}{1}[退菜]\n", Math.Abs(listDish.DishesCount), listDish.UnitName); sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); sb.Append("服务员:002\n"); count.Append("打印机:吧台\n"); price.Append("\n"); LocalPrint(sb.ToString(), count.ToString(), price.ToString()); }
/// <summary> /// 清台并返回餐台列表 /// </summary> protected void CloseTabie() { tm_Tabie tabieEntity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(TabieID); tabieEntity.TabieState = 1; tabieEntity.CurrentUsingID = 0; Core.Container.Instance.Resolve <IServiceTabie>().Update(tabieEntity); //更新就餐信息菜品信息打印状态 string sql = string.Format("UPDATE tm_tabiedishesinfo SET IsPrint=1 WHERE TabieUsingID={0} and IsPrint=0 ", TabieUsingID); DbHelperMySQL.ExecuteSql(sql); //更新会员信息 bool IsVip = bool.Parse(ConfigurationManager.AppSettings["IsVip"]); if (IsVip) { IList <ICriterion> qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("VIPPhone", txtVip.Text.Trim())); tm_vipinfo vipInfo = Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntityByFields(qryList); if (vipInfo != null) { vipInfo.VIPCount -= decimal.Parse(nbxVip.Text); Core.Container.Instance.Resolve <IServiceVipInfo>().Update(vipInfo); } } //返回 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); }
private void SaveItem() { tm_Tabie entity = new tm_Tabie(); if (action == "edit") { entity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(_id);; } if (action == "add") { tm_Diningarea area = Core.Container.Instance.Resolve <IServiceDiningarea>().GetEntity(_id); entity.Diningarea_Tabie = area; } entity.TabieName = txbTabieName.Text.Trim(); entity.TabieNumber = numTabieNumber.Text; entity.SalesModel = lstSalesModel.SelectedValue; entity.Sort = Int32.Parse(numSort.Text); if (action == "edit") { Core.Container.Instance.Resolve <IServiceTabie>().Update(entity); } else { Core.Container.Instance.Resolve <IServiceTabie>().Create(entity); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(TabieID); if (tabieInfo != null) { //判断当前餐点状态,已叫菜或者走菜就餐的就不用开启叫菜功能 if (tabieInfo.TabieState >= 3) { btnReady.Hidden = true; } //绑定套餐信息 BindGroup(); //加载就餐相关信息 LoadData(); } else { Alert.ShowInTop("餐台信息获取失败", MessageBoxIcon.Error); PageContext.Redirect("~/Dinner/DinnerTabieManager.aspx"); } } }
/// <summary> /// 点菜单本地前台打印 /// </summary> /// <param name="listDish"></param> /// <param name="entity"></param> protected void LocalPrint(IList <tm_TabieDishesInfo> listDish, tm_TabieUsingInfo entity) { if (listDish != null && listDish.Count > 0) { tm_Tabie tabieEntity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(entity.TabieID); StringBuilder sb = new StringBuilder(); StringBuilder count = new StringBuilder(); StringBuilder price = new StringBuilder(); sb.AppendFormat("{0}\n", tabieEntity.TabieName); sb.Append("点菜单\n"); sb.Append(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); sb.Append("---------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); foreach (tm_TabieDishesInfo item in listDish) { //判断赠送 if (item.IsFree.Equals("0")) { //判断退菜 if (item.DishesType.Equals("1")) { sb.AppendFormat("{0}\n", item.DishesName); } //判断退菜 if (item.DishesType.Equals("2")) { sb.AppendFormat("{0}[退菜]\n", item.DishesName); } //团购菜品 if (item.DishesType.Equals("3")) { sb.AppendFormat("{0}[套餐]\n", item.DishesName); } } else { sb.AppendFormat("{0}[赠送]\n", item.DishesName); } count.AppendFormat("{0}{1}\n", item.DishesCount, item.UnitName); price.AppendFormat("{0}\n", item.Moneys); } sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); sb.Append("服务员:002\n"); count.Append("打印机:吧台\n"); price.Append("\n"); LocalPrint(sb.ToString(), count.ToString(), price.ToString()); } }
private void Bind() { tm_Tabie entity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(_id); labDiningArea.Text = entity.Diningarea_Tabie.AreaName; txbTabieName.Text = entity.TabieName; lstSalesModel.SelectedValue = entity.SalesModel; numTabieNumber.Text = entity.TabieNumber; numSort.Text = entity.Sort.ToString(); }
protected void btnClose_Click(object sender, EventArgs e) { if (_tabieid > 0) { Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Delete(_id); tm_Tabie entity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(_tabieid); entity.TabieState = 1; Core.Container.Instance.Resolve <IServiceTabie>().Update(entity); } PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //获取当前餐台信息 tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(TabieID); lblTabie.Text = tabieInfo.TabieName; TabieUsingID = tabieInfo.CurrentUsingID; //绑定其他空闲餐台信息 BindFreeTabie(); } }
/// <summary> /// 就餐人数选择返回处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void WindowSelectPeople_Close(object sender, WindowCloseEventArgs e) { string[] id = Hiddenid.Text.TrimEnd(',').Split(','); //获取餐台信息 tm_Tabie tabie = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(Int32.Parse(id[0])); if (tabie != null) { //跳转显示餐台就餐信息 PageContext.Redirect("~/Dinner/DinnerTabieUsingManager.aspx?id=" + tabie.CurrentUsingID + "&TabieId=" + tabie.ID); } }
private void LoadData() { //权限检查 tm_TabieUsingInfo tm_tabieUsingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(_id); tm_Tabie entity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(tm_tabieUsingInfo.TabieID); txbTitle.Text = entity.Diningarea_Tabie.AreaName + "区" + entity.TabieName; //绑定就餐信息 BindTabieUingInfo(); //绑定就餐点菜信息 BindTabieDishesInfo(); }
/// <summary> /// 餐台开台处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { string[] id = Hiddenid.Text.TrimEnd(',').Split(','); if (id.Length == 1 && !string.IsNullOrEmpty(id[0])) { //获取餐台信息 tm_Tabie tabie = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(Int32.Parse(id[0])); //判断是否已经开台 if (tabie.TabieState > 1) { Alert.ShowInTop("此餐台已开台!", "错误操作", MessageBoxIcon.Error); } else { //创建设置开台信息 tm_TabieUsingInfo newUsingInfo = new tm_TabieUsingInfo(); newUsingInfo.TabieID = Int32.Parse(id[0]); newUsingInfo.OrderState = "1"; //开台使用 newUsingInfo.Moneys = 0; newUsingInfo.PrePrice = 0; newUsingInfo.Discount = 0; newUsingInfo.FactPrice = 0; newUsingInfo.Population = 0; newUsingInfo.ClearTime = null; newUsingInfo.OpenTime = DateTime.Now; newUsingInfo.OrderNO = string.Format("XF{0}", newUsingInfo.OpenTime.ToString("yyyyMMddhhmmss")); Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Create(newUsingInfo); //获取当前创建的开台信息,主要是获取ID IList <ICriterion> qrylist = new List <ICriterion>(); qrylist.Add(Expression.Eq("OrderState", "1")); qrylist.Add(Expression.Eq("TabieID", tabie.ID)); tm_TabieUsingInfo CurrentUsingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntityByFields(qrylist); if (CurrentUsingInfo != null) { //开台成功,修改餐台的状态信息 tabie.TabieState = 2; //设置开台 tabie.CurrentUsingID = CurrentUsingInfo.ID; //标识当前开台信息 Core.Container.Instance.Resolve <IServiceTabie>().Update(tabie); PageContext.RegisterStartupScript(WindowSelectPeople.GetShowReference("~/Dinner/DSelectPeople.aspx?id=" + CurrentUsingInfo.ID + "&tabieid=" + tabie.ID, "就餐人数")); } else { Alert.ShowInTop("餐台开台失败!", "错误操作", MessageBoxIcon.Error); } } } if (id.Length > 1) { Alert.ShowInTop("选择了" + id.Length + "个餐台,一次只能开一个!"); } }
protected void btnSave_Click(object sender, EventArgs e) { //获取退菜菜品信息 tm_TabieDishesInfo tabieDishesInfo = Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().GetEntity(DishesID); if (tabieDishesInfo != null) { //获取开台信息 tm_TabieUsingInfo usingEnitty = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(tabieDishesInfo.TabieUsingID); tm_Tabie objTabie = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(usingEnitty.TabieID); //获取菜品信息 tm_Dishes dish = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity((int)tabieDishesInfo.DishesID); //创建退菜菜品信息 tm_TabieDishesInfo backEntity = new tm_TabieDishesInfo(); backEntity.DishesID = tabieDishesInfo.DishesID; backEntity.DishesCount = -decimal.Parse(numCount.Text); backEntity.Price = dish.SellPrice; backEntity.Moneys = backEntity.DishesCount * tabieDishesInfo.Price; backEntity.DishesType = "2"; backEntity.IsFree = "0"; backEntity.IsDiscount = dish.IsDiscount; backEntity.TabieUsingID = tabieDishesInfo.TabieUsingID; backEntity.UnitName = GetSystemEnumValue("CPDW", dish.DishesUnit.ToString()); backEntity.DishesName = dish.DishesName; backEntity.PrintID = dish.PrinterID; backEntity.IsPrint = 1; Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Create(backEntity); //更新开台总价 usingEnitty.Moneys += backEntity.Moneys; usingEnitty.FactPrice += backEntity.Moneys; Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(usingEnitty); //打印退菜单据 tm_Printer objPrinter = Core.Container.Instance.Resolve <IServicePrinter>().GetEntity(tabieDishesInfo.PrintID); bool isPrint = bool.Parse(ConfigurationManager.AppSettings["IsPrint"]); if (isPrint) { //判断是否是后厨打印单据 if (objPrinter.PrinterType.Equals("2")) { //后厨打印单据 new NetPrintHelper().Printeg(backEntity.DishesName, backEntity.DishesCount, backEntity.UnitName, (int)usingEnitty.Population, objPrinter, 3, objTabie.TabieName); } //前台打印单据 LocalPrint(backEntity, usingEnitty);//默认打印机 } } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); }
/// <summary> /// 点菜处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDishes_Click(object sender, EventArgs e) { string[] id = Hiddenid.Text.TrimEnd(',').Split(','); if (id.Length == 1 && !string.IsNullOrEmpty(id[0])) { int tabieId = Int32.Parse(id[0]); tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(tabieId); if (tabieInfo.TabieState > 1) { PageContext.Redirect("~/Dinner/DinnerOrderMealManager.aspx?id=" + tabieInfo.CurrentUsingID + "&TabieId=" + tabieId); } else { Alert.ShowInTop("还没开台!不可点菜", "错误操作", MessageBoxIcon.Error); } } }
//合台合并支付 protected void btnMontage_Click(object sender, EventArgs e) { string[] id = Hiddenid.Text.TrimEnd(',').Split(','); List <int> ids = new List <int>(); foreach (string z in id) { tm_Tabie tm_Tabie = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(Int32.Parse(z)); //判断餐台状态是否未就餐中 if (tm_Tabie.TabieState < 4) { Alert.ShowInTop("未就餐的餐台不能进行合台付款!", "错误操作", MessageBoxIcon.Error); return; } else { ids.Add(tm_Tabie.ID); } } if (ids.Count > 1) { //创建合并付款编号 string MergeNO = string.Format("XSHT{0}", DateTime.Now.ToString("yyyyMMddHHmmss")); foreach (int u in ids) { //获取餐台信息 tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(u); //获取餐台当前就餐信息 if (tabieInfo.CurrentUsingID > 0) { //更新就餐信息的合并付款编号信息 tm_TabieUsingInfo tabieUsingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(tabieInfo.CurrentUsingID); tabieUsingInfo.MergeNO = MergeNO; Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(tabieUsingInfo); } } //跳转到合并付款页面 PageContext.RegisterStartupScript(WindowPay.GetShowReference("~/Dinner/DMergePay.aspx?id=" + MergeNO, "合台付款")); } else { Alert.ShowInTop("至少选择两个未结算的餐台进行合台!", "错误操作", MessageBoxIcon.Error); } }
/// <summary> /// 清台处理(暂时不用) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { string[] id = Hiddenid.Text.TrimEnd(',').Split(','); if (id.Length >= 1 && !string.IsNullOrEmpty(id[0])) { foreach (string i in id) { tm_Tabie entity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(Int32.Parse(i)); if (entity.TabieState == 1) { continue; } if (entity.TabieState == 3) { entity.TabieState = 1; Core.Container.Instance.Resolve <IServiceTabie>().Update(entity); continue; } IList <ICriterion> qrylist = new List <ICriterion>(); qrylist.Add(Expression.Eq("TabieID", Int32.Parse(i))); qrylist.Add(Expression.Lt("OrderState", "3")); tm_TabieUsingInfo sb = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntityByFields(qrylist); if (sb == null) { Alert.ShowInTop("餐桌已上菜,不可清台", "错误操作", MessageBoxIcon.Error); return; } else { entity.TabieState = 1; sb.OrderState = "4"; sb.ClearTime = DateTime.Now; Core.Container.Instance.Resolve <IServiceTabie>().Update(entity); Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(sb); } } } BindTabieInfo(); }
protected void btnSaveClose_Click(object sender, EventArgs e) { if (action == "add") { string tabieName = txbTabieName.Text.Trim(); int sort = Int32.Parse(numSort.Text); string tabieNumber = numTabieNumber.Text; IList <ICriterion> qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("Diningarea_Tabie.ID", _id)); qryList.Add(Expression.Disjunction() .Add(Expression.Eq("TabieName", tabieName)) .Add(Expression.Eq("TabieNumber", tabieNumber)) .Add(Expression.Eq("Sort", sort)) ); tm_Tabie entity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntityByFields(qryList); if (entity != null) { Alert.ShowInTop("餐区[ " + labDiningArea.Text + " ]已存在餐台名为[ " + entity.TabieName + " ]编号为[ " + entity.TabieNumber + " ]排序为[ " + entity.Sort + " ]的餐台!保存失败", MessageBoxIcon.Warning); return; } } SaveItem(); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); }
protected void btnSave_Click(object sender, EventArgs e) { //获取当前餐台信息 tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(TabieID); //获取就餐信息 tm_TabieUsingInfo tabieUsingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID); //获取转台餐台 int tabieID = int.Parse(ddlTabie.SelectedValue); tm_Tabie tabieChangeInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(tabieID); //更新就餐信息 tabieUsingInfo.TabieID = tabieID; Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(tabieUsingInfo); //更新转台餐台信息 tabieChangeInfo.CurrentUsingID = TabieUsingID; tabieChangeInfo.TabieState = tabieInfo.TabieState; Core.Container.Instance.Resolve <IServiceTabie>().Update(tabieChangeInfo); //更新原餐台信息 tabieInfo.CurrentUsingID = 0; tabieInfo.TabieState = 1; Core.Container.Instance.Resolve <IServiceTabie>().Update(tabieInfo); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); }
/// <summary> /// 加载就餐相关信息 /// </summary> private void LoadData() { //权限检查 CheckPowerWithButton("CoreCateringView", btnNew); tm_TabieUsingInfo Usingentity = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID); //绑定开台时间 dltStart.Text = Usingentity.OpenTime.ToString(); //绑定团购信息 ddlGroup.SelectedValue = Usingentity.GroupMoneys.ToString(); tbGroup.Text = Usingentity.GroupCardNO; tbxPeople.Text = Usingentity.Population.ToString(); tbxVipID.Text = Usingentity.VipID; tm_Tabie entity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(TabieID); groupTabie.Title = string.Format("{0}区{1}【消费单号:{2}】", entity.Diningarea_Tabie.AreaName, entity.TabieName, Usingentity.OrderNO); btnPay.OnClientClick = WindowPay.GetShowReference("~/Dinner/DPay.aspx?id=" + TabieUsingID + "&TabieId=" + TabieID, "付款"); Grid1.PageSize = ConfigHelper.PageSize; ddlGridPageSize.SelectedValue = ConfigHelper.PageSize.ToString(); //绑定就餐点餐信息 BindTabieDishesInfo(); }
/// <summary> /// 结算留存单打印 /// </summary> protected void LocalPrint() { tm_TabieUsingInfo tabieUsingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID); tm_Tabie tabieEntity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(tabieUsingInfo.TabieID); IList <ICriterion> qrylist = new List <ICriterion>(); qrylist.Add(Expression.Eq("TabieUsingID", tabieUsingInfo.ID)); tm_TabiePayInfo PayEntity = Core.Container.Instance.Resolve <IServiceTabiePayInfo>().GetEntityByFields(qrylist); StringBuilder sb = new StringBuilder(); StringBuilder count = new StringBuilder(); StringBuilder price = new StringBuilder(); sb.Append("农投良品生活馆\n"); sb.Append("结算单\n"); sb.AppendFormat("桌 位:{0}\n", tabieEntity.TabieName); sb.AppendFormat("账单编号:{0}\n", tabieUsingInfo.OrderNO); sb.AppendFormat("营业日期:{0}\n", DateTime.Now.ToShortDateString()); sb.AppendFormat("开台时间:{0}\n", tabieUsingInfo.OpenTime.ToString("yyyy-MM-dd HH:mm:ss")); sb.AppendFormat("结账时间:{0}\n", DateTime.Parse(dltCloseTabie.Text).ToString("yyyy-MM-dd HH:mm:ss")); sb.AppendFormat("客 数:{0}\n", tabieUsingInfo.Population); sb.AppendFormat("收款机号 \n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.AppendFormat("收银员:{0} \n", User.Identity.Name); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); sb.Append("---------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); sb.Append("菜品名称\n"); count.Append("数量 \n"); price.Append("金额 \n"); sb.Append("---------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); //获取点菜信息 string sql = string.Format("SELECT DishesName,sum(DishesCount) as DishesCount,SUM(Moneys) as Moneys,UnitName,IsFree,DishesType FROM tm_tabiedishesinfo WHERE TabieUsingID={0} GROUP BY DishesName,UnitName,IsFree,DishesType ORDER BY DishesName " , tabieUsingInfo.ID); DataSet ds = DbHelperMySQL.Query(sql); if (ds.Tables[0] != null) { foreach (DataRow row in ds.Tables[0].Rows) { //判断赠送 if (!row["IsFree"].ToString().Equals("1")) { //判断退菜 if (row["DishesType"].ToString().Equals("1")) { sb.AppendFormat("{0}\n", row["DishesName"].ToString()); } if (row["DishesType"].ToString().Equals("2")) { sb.AppendFormat("{0}[退菜]\n", row["DishesName"].ToString()); } //团购菜品 if (row["DishesType"].ToString().Equals("3")) { sb.AppendFormat("{0}[套餐]\n", row["DishesName"].ToString()); } } else { sb.AppendFormat("{0}[赠送]\n", row["DishesName"].ToString()); } count.AppendFormat("{0}{1}\n", row["DishesCount"].ToString(), row["UnitName"].ToString()); price.AppendFormat("{0}\n", row["Moneys"].ToString()); } } sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); sb.Append("消费合计:\n"); count.Append("\n"); price.AppendFormat("{0}\n", tabieUsingInfo.Moneys); sb.Append("赠送金额:\n"); count.Append("\n"); price.AppendFormat("{0}\n", tabieUsingInfo.PrePrice); sb.Append("抹零金额:\n"); count.Append("\n"); price.AppendFormat("{0}\n", tabieUsingInfo.Erasing); sb.Append("应付金额:\n"); count.Append("\n"); price.AppendFormat("{0}\n", tabieUsingInfo.FactPrice); sb.AppendFormat("折扣[{0}折]\n", tabieUsingInfo.DisPoint); count.Append("\n"); price.AppendFormat("{0}\n", tabieUsingInfo.Discount); sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); //买单支付 if (rblPayType.SelectedValue == "1") { if (!string.IsNullOrEmpty(PayEntity.PayWayCash)) { sb.Append("现金支付:\n"); count.Append("\n"); price.AppendFormat("{0}\n", PayEntity.CashMoneys); } if (!string.IsNullOrEmpty(PayEntity.PayWayCredit)) { sb.Append("刷卡支付:\n"); count.Append("\n"); price.AppendFormat("{0}\n", PayEntity.CreditMoneys); } if (!string.IsNullOrEmpty(PayEntity.PayWayVipcard)) { sb.Append("会员卡支付:\n"); count.Append("\n"); price.AppendFormat("{0}\n", PayEntity.VipcardMoneys); //获取会员卡信息和余额 IList <ICriterion> qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("VIPPhone", tabieUsingInfo.VipID)); tm_vipinfo vipInfo = Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntityByFields(qryList); if (vipInfo != null) { sb.AppendFormat("会员卡:{0}\n", tabieUsingInfo.VipID); count.AppendFormat("余额:{0}\n", vipInfo.VIPCount); price.AppendFormat("\n"); } } if (!string.IsNullOrEmpty(PayEntity.PayWayOnline)) { sb.Append("微信支付:\n"); count.Append("\n"); price.AppendFormat("{0}\n", PayEntity.OnlineMoneys); } if (!string.IsNullOrEmpty(PayEntity.PayWayZFB)) { sb.Append("支付宝支付:\n"); count.Append("\n"); price.AppendFormat("{0}\n", PayEntity.ZFBMoneys); } sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); } //美团 if (!string.IsNullOrEmpty(tabieUsingInfo.GroupCardNO)) { sb.AppendFormat("美团【{0}】:\n", tabieUsingInfo.GroupName); count.AppendFormat("{0}\n", tabieUsingInfo.GroupCardNO); price.Append("\n"); sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); } //免单 if (rblPayType.SelectedValue == "2") { sb.Append("免单:\n"); price.AppendFormat("{0}\n", tabieUsingInfo.FreeReason); count.Append("\n"); sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); } //挂账 if (rblPayType.SelectedValue == "3") { sb.Append("挂账:\n"); count.AppendFormat("{0}\n", tabieUsingInfo.Charge); price.Append("\n"); sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); } sb.Append("地址:渝北区冉家坝龙山路301号\n"); count.Append(" \n"); price.Append("\n"); sb.Append("电话:02367364577\n"); count.Append(" \n"); price.Append("\n"); sb.Append("欢迎光临\n"); count.Append("\n"); price.Append("\n"); LocalPrint(sb.ToString(), count.ToString(), price.ToString()); }
/// <summary> /// 走菜处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOut_Click(object sender, EventArgs e) { string[] id = Hiddenid.Text.TrimEnd(',').Split(','); if (id.Length == 1 && !string.IsNullOrEmpty(id[0])) { tm_Tabie tabie = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(Int32.Parse(id[0])); //判断是否已经开台 if (tabie.TabieState > 1) { bool isPrint = bool.Parse(ConfigurationManager.AppSettings["IsPrint"]); string sql = string.Empty; //获取餐点信息和就餐信息 tm_TabieUsingInfo usingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(tabie.CurrentUsingID); tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(usingInfo.TabieID); List <ICriterion> qrylist = new List <ICriterion>(); //获取没有打印的菜品信息 qrylist = new List <ICriterion>(); qrylist.Add(Expression.Eq("TabieUsingID", usingInfo.ID)); qrylist.Add(Expression.Eq("IsPrint", 0)); IList <tm_TabieDishesInfo> listDish = Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Query(qrylist); //获取打印机列表信息 IList <ICriterion> qrylistPrint = new List <ICriterion>(); qrylistPrint = new List <ICriterion>(); qrylistPrint.Add(Expression.Eq("PrinterType", "2")); IList <tm_Printer> listPrinter = Core.Container.Instance.Resolve <IServicePrinter>().GetAllByKeys(qrylistPrint); //判断餐台是否是叫菜状态 if (tabieInfo.TabieState == 3) { if (isPrint) { //后厨打印菜品(叫菜) new NetPrintHelper().Printeg("就餐走菜!!!!!", listPrinter[0], (int)usingInfo.Population, tabieInfo.TabieName, 4); } } //前台打印点菜单 if (isPrint) { LocalPrint(listDish, usingInfo);//默认打印机 } //打印美团单(开台状态下第一次打印,如果已经叫菜或走菜不再打印) if (tabieInfo.TabieState < 3 && !string.IsNullOrEmpty(usingInfo.GroupName)) { new NetPrintHelper().Printeg(usingInfo.GroupName, listPrinter[0], (int)usingInfo.Population, tabieInfo.TabieName, 1); new NetPrintHelper().Printeg(usingInfo.GroupName, listPrinter[0], (int)usingInfo.Population, tabieInfo.TabieName, 1); } foreach (tm_Printer item in listPrinter) { //获取对应打印机下的菜品 sql = string.Format("SELECT DishesName,sum(DishesCount) as DishesCount,UnitName FROM tm_tabiedishesinfo WHERE TabieUsingID={0} and IsPrint=0 and PrintID={1} GROUP BY DishesName,UnitName " , usingInfo.ID, item.ID); DataSet ds = DbHelperSQL.Query(sql); if (isPrint) { if (ds.Tables[0] != null) { foreach (DataRow row in ds.Tables[0].Rows) { //后厨打印菜品(叫菜) new NetPrintHelper().Printeg(row["DishesName"].ToString(), decimal.Parse(row["DishesCount"].ToString()) , row["UnitName"].ToString(), (int)usingInfo.Population, item, 1 , tabieInfo.TabieName); new NetPrintHelper().Printeg(row["DishesName"].ToString(), decimal.Parse(row["DishesCount"].ToString()) , row["UnitName"].ToString(), (int)usingInfo.Population, item, 9 , tabieInfo.TabieName); } } } } //更新就餐信息菜品信息打印状态 sql = string.Format("UPDATE tm_tabiedishesinfo SET IsPrint=1 WHERE TabieUsingID={0} and IsPrint=0 ", usingInfo.ID); DbHelperSQL.ExecuteSql(sql); //更新餐台状态为走菜就餐状态 tabieInfo.TabieState = 4; Core.Container.Instance.Resolve <IServiceTabie>().Update(tabieInfo); } else { Alert.ShowInTop("未开台,不可走菜!", "错误操作", MessageBoxIcon.Error); } } if (id.Length > 1) { Alert.ShowInTop("选择了" + id.Length + "个餐台,一次只能执行一个!", MessageBoxIcon.Information); } }
//获取单位 public string GetTabieName(string id) { tm_Tabie supplierInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(int.Parse(id)); return(supplierInfo != null ? supplierInfo.TabieName : ""); }
public string GetTabieName(string tabieID) { tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(int.Parse(tabieID)); return(tabieInfo != null ? tabieInfo.TabieName : ""); }
/// <summary> /// 走菜处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnGo_Click(object sender, EventArgs e) { bool isPrint = bool.Parse(ConfigurationManager.AppSettings["IsPrint"]); string sql = string.Empty; //获取餐点信息和就餐信息 tm_TabieUsingInfo usingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID); tm_Tabie tabieInfo = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(usingInfo.TabieID); List <ICriterion> qrylist = new List <ICriterion>(); //获取没有打印的菜品信息 qrylist = new List <ICriterion>(); qrylist.Add(Expression.Eq("TabieUsingID", usingInfo.ID)); qrylist.Add(Expression.Eq("IsPrint", 0)); IList <tm_TabieDishesInfo> listDish = Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Query(qrylist); //获取打印机列表信息 IList <ICriterion> qrylistPrint = new List <ICriterion>(); qrylistPrint = new List <ICriterion>(); qrylistPrint.Add(Expression.Eq("PrinterType", "2")); IList <tm_Printer> listPrinter = Core.Container.Instance.Resolve <IServicePrinter>().GetAllByKeys(qrylistPrint); //判断餐台是否是叫菜状态 if (tabieInfo.TabieState == 3) { if (isPrint) { //后厨打印菜品(叫菜) new NetPrintHelper().Printeg("餐台走菜!!!!!", listPrinter[0], (int)usingInfo.Population, tabieInfo.TabieName, 4); } } //前台打印点菜单 if (isPrint) { LocalPrint(listDish, usingInfo);//默认打印机 } //打印美团单(开台状态下第一次打印,如果已经叫菜或走菜不再打印) if (tabieInfo.TabieState < 3 && !string.IsNullOrEmpty(usingInfo.GroupName)) { new NetPrintHelper().Printeg(usingInfo.GroupName, listPrinter[0], (int)usingInfo.Population, tabieInfo.TabieName, 1); new NetPrintHelper().Printeg(usingInfo.GroupName, listPrinter[0], (int)usingInfo.Population, tabieInfo.TabieName, 1); } //后厨打印 foreach (tm_Printer item in listPrinter) { //获取对应打印机下的菜品 sql = string.Format("SELECT DishesName,sum(DishesCount) as DishesCount,UnitName FROM tm_tabiedishesinfo WHERE TabieUsingID={0} and IsPrint=0 and PrintID={1} GROUP BY DishesName,UnitName " , usingInfo.ID, item.ID); DataSet ds = DbHelperSQL.Query(sql); if (isPrint) { if (ds.Tables[0] != null) { foreach (DataRow row in ds.Tables[0].Rows) { //后厨打印菜品(叫菜) new NetPrintHelper().Printeg(row["DishesName"].ToString(), decimal.Parse(row["DishesCount"].ToString()) , row["UnitName"].ToString(), (int)usingInfo.Population, item, 1 , tabieInfo.TabieName); new NetPrintHelper().Printeg(row["DishesName"].ToString(), decimal.Parse(row["DishesCount"].ToString()) , row["UnitName"].ToString(), (int)usingInfo.Population, item, 9 , tabieInfo.TabieName); } } } } //更新就餐信息菜品信息打印状态 sql = string.Format("UPDATE tm_tabiedishesinfo SET IsPrint=1 WHERE TabieUsingID={0} and IsPrint=0 ", usingInfo.ID); DbHelperSQL.ExecuteSql(sql); //更新餐台状态为走菜就餐状态 tabieInfo.TabieState = 4; Core.Container.Instance.Resolve <IServiceTabie>().Update(tabieInfo); PageContext.Redirect("~/Dinner/DinnerTabieManager.aspx"); }
/// <summary> /// 客户预打单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPrint_Click(object sender, EventArgs e) { tm_TabieUsingInfo tabieUsingInfo = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID); tm_Tabie tabieEntity = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(tabieUsingInfo.TabieID); StringBuilder sb = new StringBuilder(); StringBuilder count = new StringBuilder(); StringBuilder price = new StringBuilder(); sb.Append("农投良品生活馆\n"); sb.Append("顾客联\n"); sb.AppendFormat("桌 位:{0}\n", tabieEntity.TabieName); sb.AppendFormat("账单编号:{0}\n", tabieUsingInfo.OrderNO); sb.AppendFormat("营业日期:{0}\n", DateTime.Now.ToShortDateString()); sb.AppendFormat("开台时间:{0}\n", tabieUsingInfo.OpenTime.ToString("yyyy-MM-dd hh:mm:ss")); sb.AppendFormat("结账时间:{0}\n", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); sb.AppendFormat("客 数:{0}\n", tabieUsingInfo.Population); sb.AppendFormat("收款机号 \n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.Append("\n"); count.AppendFormat("收银员:{0} \n", User.Identity.Name); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); price.Append("\n"); sb.Append("---------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); sb.Append("菜品名称\n"); count.Append("数量 \n"); price.Append("金额 \n"); sb.Append("---------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); //获取点菜信息 string sql = string.Format("SELECT DishesName,sum(DishesCount) as DishesCount,SUM(Moneys) as Moneys,UnitName,IsFree,DishesType FROM tm_tabiedishesinfo WHERE TabieUsingID={0} GROUP BY DishesName,UnitName,IsFree,DishesType ORDER BY DishesName " , tabieUsingInfo.ID); DataSet ds = DbHelperSQL.Query(sql); if (ds.Tables[0] != null) { foreach (DataRow row in ds.Tables[0].Rows) { //判断赠送 if (!row["IsFree"].ToString().Equals("1")) { //判断退菜 if (row["DishesType"].ToString().Equals("1")) { sb.AppendFormat("{0}\n", row["DishesName"].ToString()); } if (row["DishesType"].ToString().Equals("2")) { sb.AppendFormat("{0}[退菜]\n", row["DishesName"].ToString()); } //团购菜品 if (row["DishesType"].ToString().Equals("3")) { sb.AppendFormat("{0}[套餐]\n", row["DishesName"].ToString()); } } else { sb.AppendFormat("{0}[赠送]\n", row["DishesName"].ToString()); } count.AppendFormat("{0}{1}\n", row["DishesCount"].ToString(), row["UnitName"].ToString()); price.AppendFormat("{0}\n", row["Moneys"].ToString()); } } sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); sb.Append("消费合计:\n"); count.Append("\n"); price.AppendFormat("{0}\n", tabieUsingInfo.Moneys); sb.Append("赠送金额:\n"); count.Append("\n"); price.AppendFormat("{0}\n", tabieUsingInfo.PrePrice); sb.Append("应付金额:\n"); count.Append("\n"); price.AppendFormat("{0}\n", tabieUsingInfo.FactPrice); sb.Append("-----------------------------------------------------------------------------\n"); count.Append("\n"); price.Append("\n"); sb.Append("地址:渝北区冉家坝龙山路301号\n"); count.Append("\n"); price.Append("\n"); sb.Append("电话:02367364577\n"); count.Append(" \n"); price.Append("\n"); sb.Append("欢迎光临\n"); count.Append("\n"); price.Append("\n"); LocalPrint(sb.ToString(), count.ToString(), price.ToString()); }