예제 #1
0
        /// <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());
        }
예제 #2
0
        /// <summary>
        /// 会员号变化处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void txtVip_Blur(object sender, EventArgs e)
        {
            lblVipMoney.Text = "0";
            if (!string.IsNullOrEmpty(MergeNO))
            {
                //获取合并餐台信息
                List <ICriterion> qrylist = new List <ICriterion>();
                qrylist.Add(Expression.Eq("MergeNO", MergeNO));
                IList <tm_TabieUsingInfo> list = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Query(qrylist);

                //获取会员信息
                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)
                {
                    //获取整单交易和应付金额
                    foreach (tm_TabieUsingInfo usingInfo in list)
                    {
                        lblVipMoney.Text = vipInfo.VIPCount.ToString();
                        //更新会员信息
                        usingInfo.VipID = txtVip.Text.Trim();
                        Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(usingInfo);
                    }
                }
                else
                {
                    Alert.Show("会员号不存在!");
                }
            }
        }
예제 #3
0
        private void Bind()
        {
            tm_vipinfo entity = Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntity(_id);

            txtRemark.Text       = entity.Remark;
            lblDate.Text         = entity.RegisterDate.ToString("yyyy-MM-dd HH:mm:ss");
            txbVipPhone.Text     = entity.VIPPhone;
            txbVipPhone.Readonly = true;
            txtVipName.Text      = entity.VIPName;
        }
예제 #4
0
        protected void btnSaveClose_Click(object sender, EventArgs e)
        {
            if (action == "add")
            {
                IList <ICriterion> qryList = new List <ICriterion>();
                qryList.Add(Expression.Eq("VIPPhone", txbVipPhone.Text.Trim()));
                tm_vipinfo vipObj = Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntityByFields(qryList);

                //判断重复
                if (vipObj != null)
                {
                    Alert.Show("注册电话号码已存在!");
                    return;
                }
            }
            SaveItem();
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
예제 #5
0
        /// <summary>
        /// 会员号变化处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void txtVip_Blur(object sender, EventArgs e)
        {
            lblVipMoney.Text = "0";
            tm_TabieUsingInfo entity = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID);

            //获取会员信息
            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)
            {
                lblVipMoney.Text = vipInfo.VIPCount.ToString();
                //更新会员信息
                entity.VipID = txtVip.Text.Trim();
                Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(entity);
            }
            else
            {
                Alert.Show("会员号不存在!");
            }
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GPPayWay.Hidden       = false;
            GPvip.Hidden          = false;
            GPFreeReason.Hidden   = true;
            GPChargeReason.Hidden = true;

            tm_TabieUsingInfo entity = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID);

            if (!IsPostBack)
            {
                if (entity.ClearTime == null)
                {
                    //设置结算时间
                    dltCloseTabie.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    //更新结算时间
                    entity.ClearTime = DateTime.Parse(DateTime.Parse(dltCloseTabie.Text.Trim()).ToString("yyyy-MM-dd HH:mm:ss"));
                    Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(entity);
                }
                else
                {
                    dltCloseTabie.Text = ((DateTime)entity.ClearTime).ToString("yyyy-MM-dd HH:mm:ss");
                }
                txtVip.Text = entity.VipID;
                //获取会员余额信息
                if (!string.IsNullOrEmpty(entity.VipID))
                {
                    IList <ICriterion> qryList = new List <ICriterion>();
                    qryList.Add(Expression.Eq("VIPPhone", entity.VipID));
                    tm_vipinfo vipInfo = Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntityByFields(qryList);
                    lblVipMoney.Text = vipInfo != null?vipInfo.VIPCount.ToString() : "0";
                }
            }
            labMoneys.Text    = entity.Moneys.ToString();
            labPrePrice.Text  = entity.PrePrice.ToString();
            labFactPrice.Text = entity.FactPrice.ToString();
        }
예제 #7
0
        private void SaveItem()
        {
            tm_vipinfo vipInfo = new tm_vipinfo();

            if (action == "edit")
            {
                vipInfo = Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntity(_id);;
            }
            if (action == "add")
            {
                vipInfo.VIPPhone     = txbVipPhone.Text.Trim();
                vipInfo.RegisterDate = DateTime.Now;
            }
            vipInfo.VIPName = txtVipName.Text.Trim();
            vipInfo.Remark  = txtRemark.Text.Trim();
            if (action == "edit")
            {
                Core.Container.Instance.Resolve <IServiceVipInfo>().Update(vipInfo);
            }
            else
            {
                Core.Container.Instance.Resolve <IServiceVipInfo>().Create(vipInfo);
            }
        }
예제 #8
0
        protected string GetVipName(string VipID)
        {
            tm_vipinfo entity = Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntity(Int32.Parse(VipID));

            return(entity.VIPName);
        }
예제 #9
0
        /// <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());
        }
예제 #10
0
        protected void btnSure_Click(object sender, EventArgs e)
        {
            string Moneys = tbxMoneys.Text.Trim();      //充值金额

            if ((!string.IsNullOrEmpty(Moneys) && !Moneys.Equals("0")))
            {
                //判断是否为在线支付
                if (cblPayWay.SelectedValue.Equals("3") || cblPayWay.SelectedValue.Equals("4"))
                {
                    //判断是否已完成在线支付(前者),如果支付失败再次支付(后者)
                    if (string.IsNullOrEmpty(hfdPayType.Text) || hfdPayType.Text.Equals("1"))
                    {
                        //判断在线支付方式
                        if (cblPayWay.SelectedValue.Equals("3"))//微信
                        {
                            //指定子页面传回的值的去处并挑战至子页面
                            PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hfdPayTime.ClientID, hfdPayType.ClientID)
                                                              + Window1.GetShowReference("~/Dinner/DOnlinePay.aspx?money=" + tbxMoneys.Text.Trim() + "&pay_type=010&terminal_trace=" + _OrderNO));
                            return;
                        }
                        else//支付宝
                        {
                            //指定子页面传回的值的去处并挑战至子页面
                            PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hfdPayTime.ClientID, hfdPayType.ClientID)
                                                              + Window1.GetShowReference("~/Dinner/DOnlinePay.aspx?money=" + tbxMoneys.Text.Trim() + "&pay_type=020&terminal_trace=" + _OrderNO));
                            return;
                        }
                    }
                }
            }
            string Presentation = tbxFree.Text.Trim();  //赠送金额

            if ((!string.IsNullOrEmpty(Moneys) && !Moneys.Equals("0")) || (!string.IsNullOrEmpty(Presentation) && !Presentation.Equals("0")))
            {
                //新增会员卡充值记录
                tm_VIPPrepaid entity = new tm_VIPPrepaid();
                entity.VipID              = _id;
                entity.VIPPhone           = Int32.Parse(Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntity(_id).VIPPhone);
                entity.PrepaidDate        = DateTime.Now;
                entity.PrepaidAmount      = decimal.Parse(Moneys == "" ? "0" : Moneys);
                entity.PresentationAmount = decimal.Parse(Presentation == "" ? "0" : Presentation);
                entity.PrepaidWay         = cblPayWay.SelectedValue;
                entity.Operator           = User.Identity.Name;
                entity.OrderNO            = _OrderNO;
                Core.Container.Instance.Resolve <IServiceVIPPrepaid>().Create(entity);

                //更新会员卡金额
                tm_vipinfo _Vipinfo = Core.Container.Instance.Resolve <IServiceVipInfo>().GetEntity(_id);
                _Vipinfo.VIPCount += (entity.PrepaidAmount + entity.PresentationAmount);
                if (_Vipinfo.VIPCount > decimal.Parse((99999999.99).ToString()) || _Vipinfo.VIPCount < 0)
                {
                    Alert.ShowInTop("充值金额不能为0!");
                    return;
                }
                Core.Container.Instance.Resolve <IServiceVipInfo>().Update(_Vipinfo);


                //清空金额输入框
                tbxMoneys.Text       = String.Empty;
                tbxFree.Text         = String.Empty;
                labPayState.Text     = String.Empty;
                imgPayState.ImageUrl = String.Empty;
                Alert.ShowInTop("充值成功!");
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
        }