Esempio n. 1
0
        //开单
        public static int getInsert(ConsumerBillModel cbm)
        {
            string sql = string.Format(@"insert into ConsumerBill values('{0}',{1},'{2}','{3}','{4}','{5}','{6}',{7},{8},{9})", cbm.CBID1, cbm.TableID1, cbm.CBAmount1, cbm.VipID1, cbm.CBDiscount1, cbm.CBStartDate1, cbm.CBEndDate1, cbm.AdminID1, cbm.CBSale1, cbm.CBClose1);

            //string sql = string.Format(@"insert into ConsumerBill values('{0}',{1},'{2}','{3}','{4}','{5}','{6}',{7},{8},{9})", cbm.CBID1, cbm.TableID1, cbm.CBAmount1, cbm.VipID1, cbm.CBDiscount1, cbm.CBStartDate1, cbm.CBEndDate1, cbm.CBSale1, cbm.CBClose1);
            return(DBHelper.getExecuteNonQuery(sql));
        }
Esempio n. 2
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     //选择会员
     if (dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[4].Value.ToString() == "可用")
     {
         //会员名称
         lblName.Text = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[0].Value.ToString();
         //会员级别
         lblTop.Text = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[2].Value.ToString();
         //折扣比率
         lblBL.Text = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[3].Value.ToString();
         //会员编号
         txtNo.Text = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[5].Value.ToString();
         ConsumerBillModel cbm2 = new ConsumerBillModel();
         cbm2.CBID1       = cbm.CBID1;
         cbm2.VipID1      = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[5].Value.ToString();
         cbm2.CBDiscount1 = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[3].Value.ToString();
         int result = ConsumerBillBLL.getUpdateVip(cbm2);
         if (result > 0)
         {
             this.panel1.Visible = false;
             AccountsForm1_Load(null, null);
         }
     }
     else
     {
         MessageBox.Show("会员不可用!");
     }
 }
Esempio n. 3
0
        //结账
        private void 宾客结账ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TablesModel tables = new TablesModel();

            tables.TableID1   = id;
            tables.TableName1 = name;
            //查询出当前餐桌得编号
            ConsumerBillModel cbm = new ConsumerBillModel();

            cbm.TableID1 = id;
            cbm.CBClose1 = 0;
            DataTable dt = ConsumerBillBLL.getNo(cbm);

            cbm.CBID1 = dt.Rows[0]["账单编号"].ToString();
            AccountsForm1 af = new AccountsForm1(cbm, tables);

            af.Show();
        }
Esempio n. 4
0
        //增加消费
        private void Insert_Click(object sender, EventArgs e)
        {
            TablesModel tables = new TablesModel();

            tables.TableID1   = id;
            tables.TableName1 = name;
            //查询出当前餐桌得编号
            ConsumerBillModel cbm = new ConsumerBillModel();

            cbm.TableID1 = id;
            cbm.CBClose1 = 0;
            DataTable dt = ConsumerBillBLL.getNo(cbm);

            cbm.CBID1 = dt.Rows[0]["账单编号"].ToString();
            AddForm af = new AddForm(tables, cbm);

            af.Show();
        }
Esempio n. 5
0
        private void brnOK_Click(object sender, EventArgs e)
        {
            TablesModel tables2 = new TablesModel();

            tables2.TableName1  = tables.TableName1;
            tables2.TableState1 = 1;
            int    result = RommBLL.getUpdateZT(tables2);
            string count  = txtCount.Text.Trim();

            if (result > 0)
            {
                MessageBox.Show("OK");
                if (cb.Checked)
                {
                    string            no   = "ZD" + DateTime.Now.ToString("yyyyMMddhhmm");
                    string            time = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    ConsumerBillModel cbm  = new ConsumerBillModel(no, tables.TableID1, count, "-1", "1", time, "", admin, Convert.ToDouble("0"), 0);
                    ConsumerBillBLL.getInsert(cbm);
                    AddForm af = new AddForm(tables, cbm);
                    af.Show();
                }
                else
                {
                    string            no   = "ZD" + DateTime.Now.ToString("yyyyMMddhhmm");
                    string            time = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                    ConsumerBillModel cbm  = new ConsumerBillModel(no, tables.TableID1, count, "-1", "1", time, "", admin, Convert.ToDouble("0"), 0);
                    ConsumerBillBLL.getInsert(cbm);
                }

                FunctionForm ff = new FunctionForm();
                ff.FunctionForm_Load(null, null);
                this.Close();
            }
            else
            {
                MessageBox.Show("NO");
            }
        }
Esempio n. 6
0
 //修改是否结账
 public static int getUpdateJZ(ConsumerBillModel cbm)
 {
     return(ConsumerBillDAL.getUpdateJZ(cbm));
 }
Esempio n. 7
0
 //查找未结账的编号
 public static DataTable getNo(ConsumerBillModel cbm)
 {
     return(ConsumerBillDAL.getNo(cbm));
 }
Esempio n. 8
0
 //开单
 public static int getInsert(ConsumerBillModel cbm)
 {
     return(ConsumerBillDAL.getInsert(cbm));
 }
Esempio n. 9
0
        //结账
        private void button1_Click(object sender, EventArgs e)
        {
            //读取XML文件
            //创建XML文件流
            XmlDocument doc = new XmlDocument();

            //加载xml
            doc.Load(@"setup.xml");
            //获得根节点
            XmlElement root = doc.DocumentElement;
            //获得子节点
            XmlNodeList xnl = root.ChildNodes;
            //标题
            string name = xnl[0].InnerText;

            //创建文件
            MessageBox.Show(string.Format("{0}.txt", lblNo.Text.Trim()));
            File.Create(@"" + lblNo.Text.Trim() + ".txt").Close();
            //创建文本
            string text = "---------" + name + "-----------\n";

            text += string.Format("账单编号:{0}", lblNo.Text);
            text += string.Format("\n餐桌编号:{0}", lblTableName.Text);
            text += string.Format("\n打印时间:{0}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
            text += string.Format("\n--------------------------------------");
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                text += string.Format("\n消费项目@单价@数量@应收金额@优惠额度");
                text += string.Format("\n{0}@{1}@{2}@{3}@{4}", dataGridView1.Rows[i].Cells[1].Value.ToString(), dataGridView1.Rows[i].Cells[2].Value.ToString(), dataGridView1.Rows[i].Cells[6].Value.ToString(), dataGridView1.Rows[i].Cells[7].Value.ToString(), dataGridView1.Rows[i].Cells[5].Value.ToString());
            }
            text += string.Format("\n--------------------------------------");
            text += string.Format("\n消费总额{0}", lblMoney.Text.Trim());
            text += string.Format("\n优惠总额{0}", lblYMoney.Text.Trim());
            MessageBox.Show(text);
            //创建文件流
            FileStream fs = new FileStream(@"" + lblNo.Text.Trim() + ".txt", FileMode.Open);
            //创建读取对象,调用读取方法
            StreamWriter sw = new StreamWriter(fs);

            sw.WriteLine(text);
            //关闭资源
            sw.Close();
            fs.Close();

            //修改消费金额和优惠额度
            for (int j = 0; j < dataGridView1.Rows.Count; j++)
            {
                MessageBox.Show(dataGridView1.Rows[j].Cells[5].Value.ToString());
                ConsumerDetailsModel cdm = new ConsumerDetailsModel();
                cdm.CBID1    = lblNo.Text.Trim();
                cdm.CDSale1  = Convert.ToDouble(dataGridView1.Rows[j].Cells[5].Value.ToString());
                cdm.CDMoney1 = Convert.ToDouble(dataGridView1.Rows[j].Cells[7].Value.ToString());
                ProductsModel pm = new ProductsModel();
                pm.ProductName1 = dataGridView1.Rows[j].Cells[1].Value.ToString();
                DataTable dt = ProductsBLL.getTableID(pm);
                pm.ProductID1 = Convert.ToInt32(dt.Rows[0]["ProductID"].ToString());
                ConsumerDetailsBLL.getUpdateXF(cdm, pm);
            }

            //修改餐桌状态以及
            string            endTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            string            money   = lblMoney2.Text.Trim();
            string            no      = lblNo.Text.Trim();
            ConsumerBillModel cbm     = new ConsumerBillModel();

            cbm.CBID1      = no;
            cbm.CBEndDate1 = endTime;
            cbm.CBSale1    = Convert.ToDouble(money);
            MessageBox.Show(cbm.CBSale1.ToString());
            ConsumerBillBLL.getUpdateJZ(cbm);

            //餐桌状态
            TablesModel tables = new TablesModel();

            tables.TableName1  = lblTableName.Text.Trim();
            tables.TableState1 = 0;
            int result = RommBLL.getUpdateZT(tables);

            if (result > 0)
            {
                //new FunctionForm().FunctionForm_Load(null,null);
            }
        }
Esempio n. 10
0
 public AccountsForm1(ConsumerBillModel cbm, TablesModel tables)
 {
     this.cbm    = cbm;
     this.tables = tables;
     InitializeComponent();
 }
Esempio n. 11
0
        //修改是否结账
        public static int getUpdateJZ(ConsumerBillModel cbm)
        {
            string sql = string.Format(@"update ConsumerBill set CBEndDate='{0}',CBSale={1},CBClose=1 where CBID='{2}'", cbm.CBEndDate1, cbm.CBSale1, cbm.CBID1);

            return(DBHelper.getExecuteNonQuery(sql));
        }
Esempio n. 12
0
        //修改会员和折扣
        public static int getUpdateVip(ConsumerBillModel cbm)
        {
            string sql = string.Format(@"update ConsumerBill set VipID={0},CBDiscount={1} where CBID='{2}'", cbm.VipID1, cbm.CBDiscount1, cbm.CBID1);

            return(DBHelper.getExecuteNonQuery(sql));
        }
Esempio n. 13
0
        //查找未结账的编号
        public static DataTable getNo(ConsumerBillModel cbm)
        {
            string sql = string.Format(@"select CBID '账单编号',TableID '餐桌编号',CBAmount '顾客人数',VipID '会员编号',CBDiscount '会员折扣',CBStartDate '开单时间',CBEndDate '结账时间',AdminID '收银员编号',CBSale '消费金额',CBClose '结账' from ConsumerBill where TableID ={0} and CBClose={1}", cbm.TableID1, cbm.CBClose1);

            return(DBHelper.getTable(sql));
        }
Esempio n. 14
0
 public AddForm(TablesModel tables, ConsumerBillModel cbm)
 {
     this.tables = tables;
     this.cbm    = cbm;
     InitializeComponent();
 }