Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            //Khởi tạo built mà mở ReportView lên để khởi tạo;
            //Truyền dữ liệu theo cấu trúc như demo
            if (chooseTable != null && chooseTable.Table.TableStatus == true)
            {
                string voucher = textBox3.Text;
                string IDKH    = textBox2.Text;
                if (CustomerController.getController().checkExist(IDKH))
                {
                    chooseTable.endBill(IDKH);
                }
                else
                {
                    chooseTable.endBill("");
                }

                if (voucher != "")
                {
                    String[] listVoucher = voucher.Trim().Split(',');
                    foreach (var item in listVoucher)
                    {
                        Voucher v = VoucherController.getController().checkExist(item);
                        if (v != null && v.Status != true)
                        {
                            chooseTable.addVoucher(v);
                        }
                    }
                }
                chooseTable.makeBill();
                List <BillReport> list = new List <BillReport>();
                int i = 0;
                chooseTable.ListFood.ForEach(item =>
                {
                    BillReport br = new BillReport();
                    br.FoodName   = item.FoodName;
                    br.Price      = item.Price;
                    br.Count      = chooseTable.ListBill_Info[i].FoodCount;
                    i++;
                    list.Add(br);
                });
                new ReportView(list, chooseTable.bill).ShowDialog(this);
                chooseTable.clearTable();
                Discount      = 0;
                textBox5.Text = "0";
                textBox2.Text = "";
                textBox3.Text = "";
            }
        }