Пример #1
0
        /// <summary>
        /// 添加消费
        /// </summary>
        private void Tjxf()
        {
            //TabPage tab = this.tab.SelectedTab;
            //ListView lv = tab.Controls[0] as ListView;
            TabItem  tabItem = this.tabMain.SelectedTab;
            ListView lv      = tabItem.AttachedControl.Controls[0] as ListView;

            if (lv.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "请选择一个餐台", "提示");
                return;
            }
            Tables table = lv.SelectedItems[0].Tag as Tables;

            if (lv.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "请选择一个餐台", "提示");
                return;
            }
            else
            {
                if (table.TState == "0")
                {
                    MessageBox.Show(this, "该餐台尚未使用!", "提示");
                }
                else if (table.TState == "3")
                {
                    MessageBox.Show(this, "该餐台已停用!", "提示");
                }
                else if (table.TState == "2")
                {
                    MessageBox.Show(this, "该餐台已预定,尚未使用!", "提示");
                }
                else
                {
                    FrmAddConsumer frm = new FrmAddConsumer();
                    frm.Zd = CMS.BLL.ConsumerBillBLL.SelectCBID(table.TID);
                    frm.Ct = table.TName;
                    frm.ShowDialog();
                }
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {//确定添加
            String ZDID = null;

            if (this.txtsum.Text == "")
            {
                MessageBox.Show(this, "请输入顾客人数!", "提示");
                return;
            }
            //添加账单并且添加消费
            if (this.txtsum.Text != "" && this.cbbool.Checked == true)
            {
                String cbid = CMS.BLL.ConsumerBillBLL.SelectCBID();
                //判断月份
                String mm  = cbid.Substring(6, 2);
                String tmm = DateTime.Now.ToString("MM");
                if (mm == tmm)
                {//在同一月份分
                    String lsh = cbid.Substring(10, 4);
                    int    id  = int.Parse(lsh) + 1;
                    lsh  = id.ToString().PadLeft(4, '0');
                    ZDID = "ZD" + DateTime.Now.ToString("yyyyMMdd") + lsh;
                }
                else
                {//不在同一月份
                    ZDID = "ZD" + DateTime.Now.ToString("yyyyMMdd") + "0000";
                }

                //判断是否是会员与折扣率
                String vipid = "";
                String CBD   = "";
                if (this.txtvipid.Text == "")
                {
                    vipid = "-1";
                    CBD   = "1";
                }
                else
                {//判断会员是否存在 如果存在获取折扣率
                    vipid = this.txtvipid.Text;
                    if (CMS.BLL.VipsBLL.SelectID(vipid) == true)
                    {
                        CBD = CMS.BLL.VipsBLL.SelectCBD(vipid);
                    }
                    else
                    {
                        MessageBox.Show(this, "会员不存在,请核对后输入!", "提示");
                        return;
                    }
                }
                if (this.txtsum.Text == "0")
                {
                    MessageBox.Show(this, "请输入正确的顾客人数!", "提示");
                    return;
                }
                //增加账单
                Boolean b = CMS.BLL.ConsumerBillBLL.InsertALL(ZDID, table.TID, this.txtsum.Text, vipid, CBD, DateTime.Now.ToString(), admin.UserID, "0", "0");
                if (true == b)
                {
                    //MessageBox.Show(this, "开单成功!", "提示");
                    //将餐桌改为占用
                    Boolean boo = CMS.BLL.TablesBLL.UPdate(table.TID, "1");
                    if (boo == true)
                    {//完成显示添加消费 关闭当前窗体
                        FrmAddConsumer frm = new FrmAddConsumer();
                        frm.Zd = ZDID;
                        frm.Ct = table.TName;
                        frm.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(this, "出现错误,请重新开单!", "提示");
                    }
                }
                else
                {
                    MessageBox.Show(this, "出现错误,请重新开单!", "提示");
                }
            }
            else
            {
                String cbid = CMS.BLL.ConsumerBillBLL.SelectCBID();
                //判断月份
                String mm  = cbid.Substring(6, 2);
                String tmm = DateTime.Now.ToString("MM");
                if (mm == tmm)
                {//在同一月份分
                    String lsh = cbid.Substring(10, 4);
                    int    id  = int.Parse(lsh) + 1;
                    lsh  = id.ToString().PadLeft(4, '0');
                    ZDID = "ZD" + DateTime.Now.ToString("yyyyMMdd") + lsh;
                }
                else
                {//不在同一月份
                    ZDID = "ZD" + DateTime.Now.ToString("yyyyMMdd") + "0000";
                }

                //判断是否是会员与折扣率
                String vipid = "";
                String CBD   = "";
                if (this.txtvipid.Text == "")
                {
                    vipid = "-1";
                    CBD   = "1";
                }
                else
                {//判断会员是否存在 如果存在获取折扣率
                    vipid = this.txtvipid.Text;
                    if (CMS.BLL.VipsBLL.SelectID(vipid) == true)
                    {
                        CBD = CMS.BLL.VipsBLL.SelectCBD(vipid);
                    }
                    else
                    {
                        MessageBox.Show(this, "会员不存在,请核对后输入!", "提示");
                        return;
                    }
                }
                if (this.txtsum.Text == "0")
                {
                    MessageBox.Show(this, "请输入正确的顾客人数!", "提示");
                    return;
                }
                //增加账单
                Boolean b = CMS.BLL.ConsumerBillBLL.InsertALL(ZDID, table.TID, this.txtsum.Text, vipid, CBD, DateTime.Now.ToString(), admin.UserID, "0", "0");
                if (true == b)
                {
                    //MessageBox.Show(this, "开单成功!", "提示");
                    //将餐桌改为占用
                    Boolean boo = CMS.BLL.TablesBLL.UPdate(table.TID, "1");
                    if (boo == true)
                    {//完成显示添加消费 关闭当前窗体
                        MessageBox.Show("开单成功!");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(this, "出现错误,请重新开单!", "提示");
                    }
                }
                else
                {
                    MessageBox.Show(this, "出现错误,请重新开单!", "提示");
                }
            }
        }