Example #1
0
 private void btnTimKiem_Click(object sender, EventArgs e)
 {
     if (cboDanhMuc.Text == "Tên Đầu Bếp")
     {
         dataGridViewTimKiemDB.DataSource = DAO3.DocBang("SELECT * FROM DauBep WHERE TenDauBep LIKE N'%" + txtNhapTuKhoa.Text.Trim() + "%'");
     }
     if (cboDanhMuc.Text == "Nơi Học")
     {
         dataGridViewTimKiemDB.DataSource = DAO3.DocBang("SELECT * FROM DauBep WHERE TenNoiHoc LIKE N'%" + txtNhapTuKhoa.Text.Trim() + "%'");
     }
     if (cboDanhMuc.Text == "Món Ăn")
     {
         dataGridViewTimKiemDB.DataSource = DAO3.DocBang("SELECT MaDauBep,MaMonAn FROM DauBep_MonAn WHERE MaMonAn LIKE N'%" + txtNhapTuKhoa.Text.Trim() + "%'");
     }
 }
Example #2
0
        private void btnTimKiemMonAn_Click(object sender, EventArgs e)
        {
            string    sql;
            DataTable tblMonAn;

            if ((cboMaLoai.Text == "") && (txtTenMonAn.Text == "") && (cboMaCongDung.Text == ""))

            {
                MessageBox.Show(" Hãy nhập một điều kiện tìm kiếm!!!", "Yêu cầu ...",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }
            sql = " SELECT * FROM MonAn WHERE 1 = 1";
            if (txtTenMonAn.Text != "")
            {
                sql = sql + "AND TenMonAn Like N'%" + txtTenMonAn.Text + "%'";
            }
            if (cboMaLoai.Text != "")
            {
                sql = sql + "AND MaLoai Like N'%" + cboMaLoai.SelectedValue + "%'";
            }
            if (cboMaCongDung.Text != "")
            {
                sql = sql + "AND MaCongDung Like N'%" + cboMaCongDung.SelectedValue + "%'";
            }
            tblMonAn = DAO3.DocBang(sql);
            if (tblMonAn.Rows.Count == 0)
            {
                MessageBox.Show("Không có bản ghi thỏa mãn điều kiện!!!", "Thông báo",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            else
            {
                MessageBox.Show("Có " + tblMonAn.Rows.Count + "bản ghi thỏa mãn điều kiện!!!", "Thông báo",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            dataGridViewMonAn.DataSource = tblMonAn;
            txtMaMonAn.Text    = "";
            txtTenMonAn.Text   = "";
            txtDonGia.Text     = "";
            txtYeuCau.Text     = "";
            txtCachLam.Text    = "";
            cboMaCongDung.Text = "";
            cboMaLoai.Text     = "";
        }
Example #3
0
        private void btnIn_Click(object sender, EventArgs e)
        {
            string sql;

            sql = "select a.MaMonAn, a.TenMonAn,b.TenLoai, c.TenCongDung, a.DonGia, a.YeuCau, a.CachLam " +
                  "from MonAn AS a, Loai_Mon_An AS b, Cong_Dung AS c where a.MaLoai = b.MaLoai AND a.MaCongDung = c.MaCongDung";

            DataTable tblMA;

            tblMA = DAO3.DocBang(sql);
            dataGridView1.DataSource = tblMA;

            COMExcel.Application exApp = new COMExcel.Application();
            COMExcel.Workbook    exBook;  //Trong 1 chương trình Excel có nhiều Workbook
            COMExcel.Worksheet   exSheet; //Trong 1 Workbook có nhiều Worksheet
            COMExcel.Range       exRange;

            int hang = 0, cot = 0;

            exBook  = exApp.Workbooks.Add(COMExcel.XlWBATemplate.xlWBATWorksheet);
            exSheet = exBook.Worksheets[1];
            exRange = exSheet.Cells[1, 1];
            exRange.Range["A1:B3"].Font.Size           = 12;
            exRange.Range["A1:B3"].Font.Bold           = true;
            exRange.Range["A1:B3"].Font.ColorIndex     = 5;//Màu xanh da trời
            exRange.Range["A1:A1"].ColumnWidth         = 7;
            exRange.Range["B1:B1"].ColumnWidth         = 15;
            exRange.Range["A1:B1"].MergeCells          = true;
            exRange.Range["A1:B1"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A1:B1"].Value               = "NHÀ HÀNG LITTLE ITALY";
            exRange.Range["A2:B2"].MergeCells          = true;
            exRange.Range["A2:B2"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A2:B2"].Value               = " ĐỐNG ĐA - HÀ NỘI";
            exRange.Range["A3:B3"].MergeCells          = true;
            exRange.Range["A3:B3"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A3:B3"].Value               = "Điện thoại:  097 383 3707";
            exRange.Range["B6:H6"].Font.Size           = 20;
            exRange.Range["A6:H6"].Font.Name           = "Times new roman";
            exRange.Range["A6:H7"].Font.Bold           = true;
            exRange.Range["A6:H7"].Font.ColorIndex     = 3;
            exRange.Range["C6:F6"].MergeCells          = true;
            exRange.Range["B6:H7"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;

            exRange.Range["C6:F6"].Value               = " THÔNG TIN CÁC MÓN ĂN ";
            exRange.Range["A8:H8"].Font.Bold           = true;
            exRange.Range["A8:H8"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;

            exRange.Range["A8:A8"].ColumnWidth = 8;
            exRange.Range["B8:B8"].ColumnWidth = 24;
            exRange.Range["C8:C8"].ColumnWidth = 30;
            exRange.Range["D8:D8"].ColumnWidth = 25;
            exRange.Range["E8:E8"].ColumnWidth = 20;
            exRange.Range["F8:F8"].ColumnWidth = 26;
            exRange.Range["G8:G8"].ColumnWidth = 30;
            exRange.Range["H8:H8"].ColumnWidth = 30;
            exRange.Range["A8:A8"].Value       = "STT";
            exRange.Range["B8:B8"].Value       = "Mã món ăn";
            exRange.Range["C8:C8"].Value       = "Tên món ăn";
            exRange.Range["D8:D8"].Value       = "Loại món ăn";
            exRange.Range["E8:E8"].Value       = "Công Dụng";
            exRange.Range["F8:F8"].Value       = "Đơn giá ";
            exRange.Range["G8:G8"].Value       = "Yêu cầu ";
            exRange.Range["H8:H8"].Value       = "Cách làm ";

            exRange = exSheet.Cells[1][hang + 8];
            exRange.Range["A1:H" + (tblMA.Rows.Count + 1) + ""].Borders.Color       = Color.Black;
            exRange.Range["A2:H" + (tblMA.Rows.Count + 1) + ""].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange = exSheet.Cells[1, 1];

            for (hang = 0; hang <= tblMA.Rows.Count - 1; hang++)
            {
                exSheet.Cells[1][hang + 9] = hang + 1;
                for (cot = 0; cot < tblMA.Columns.Count; cot++)
                {
                    exSheet.Cells[cot + 2][hang + 9] = tblMA.Rows[hang][cot].ToString();
                }
            }
            exApp.Visible = true;
            exRange.Range["F1:G1"].MergeCells          = true;
            exRange.Range["D1:G1"].Font.Italic         = true;
            exRange.Range["F1:G1"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["F1:G1"].Value = "Hà Nội, Ngày " + DateTime.Now.ToShortDateString();
        }
Example #4
0
        private void btnBCTH_Click(object sender, EventArgs e)
        {
            if (cmbDK.Text.Trim() == "")
            {
                MessageBox.Show("Bạn phải chọn điều kiện!");
                cmbDK.Focus();
                return;
            }

            COMExcel.Application exApp = new COMExcel.Application();
            COMExcel.Workbook    exBook;
            COMExcel.Worksheet   exSheet;
            COMExcel.Range       exRange;
            string    sql;
            int       hang = 0, cot = 0;
            DataTable danhsach, doanhthu;

            exBook  = exApp.Workbooks.Add(COMExcel.XlWBATemplate.xlWBATWorksheet);
            exSheet = exBook.Worksheets[1];
            exRange = exSheet.Cells[1, 1];
            exRange.Range["A1:Z300"].Font.Name         = "Times new roman";
            exRange.Range["A1:B3"].Font.Size           = 10;
            exRange.Range["A1:B3"].Font.Bold           = true;
            exRange.Range["A1:B3"].Font.ColorIndex     = 5;//Màu xanh da trời
            exRange.Range["A1:A1"].ColumnWidth         = 7;
            exRange.Range["B1:B1"].ColumnWidth         = 15;
            exRange.Range["A1:B1"].MergeCells          = true;
            exRange.Range["A1:B1"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A1:B1"].Value               = "NHÀ HÀNG LITTLE ITALY";
            exRange.Range["A2:B2"].MergeCells          = true;
            exRange.Range["A2:B2"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A2:B2"].Value               = " ĐỐNG ĐA - HÀ NỘI";
            exRange.Range["A3:B3"].MergeCells          = true;
            exRange.Range["A3:B3"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A3:B3"].Value               = "Điện thoại:  097 383 3707";
            exRange.Range["A6:A6"].Font.Bold           = true;
            exRange.Range["A6:A6"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["B6:B6"].Font.Bold           = true;
            exRange.Range["B6:B6"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A7:F7"].Font.Bold           = true;
            exRange.Range["A7:F7"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["C7:C7"].Font.Bold           = true;
            exRange.Range["C7:C7"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A7:A7"].Value               = "Tháng: ";
            exRange.Range["B7:B7"].Value               = cmbThang.Text;
            exRange.Range["C7:C7"].Value               = "Quý: ";
            exRange.Range["D7:D7"].Value               = cmbQuy.Text;
            exRange.Range["E7:E7"].Value               = "Năm: ";
            exRange.Range["F7:F7"].Value               = cmbNam.Text;
            exRange.Range["B5:F5"].Font.Size           = 16;
            exRange.Range["B5:F5"].Font.Bold           = true;
            exRange.Range["B5:F5"].Font.ColorIndex     = 3;//Màu đỏ
            exRange.Range["B5:F5"].MergeCells          = true;
            exRange.Range["B5:F5"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["B5:F5"].Value               = "BÁO CÁO TỔNG TIỀN CỦA CÁC ĐẦU BẾP";
            sql = "select c.TenDauBep, SUM( a.SoLuong * b.DonGia) from ChiTietThucDon a join MonAn b on a.MaMonAn = b.MaMonAn join DauBep c on a.MaDauBep = c.MaDauBep" +
                  " where  year(Ngaydung)=" + cmbNam.Text;
            if (cmbDK.Text.Trim() == "Tháng")
            {
                sql = sql + "and month(Ngaydung) = " + cmbThang.Text + "group by c.TenDauBep";
            }
            if (cmbDK.Text.Trim() == "Quý")
            {
                switch (cmbQuy.Text)
                {
                case "1":
                    sql = sql + " AND MONTH(a.Ngaydung) <=3 and MONTH(a.Ngaydung) >=1 group by c.TenDauBep ";
                    break;

                case "2":
                    sql = sql + " AND MONTH(a.Ngaydung) <=6 and MONTH(a.Ngaydung) >=4 group by c.TenDauBep";
                    break;

                case "3":
                    sql = sql + " AND MONTH(a.Ngaydung) <=9 and MONTH(a.Ngaydung) >=7 group by c.TenDauBep";
                    break;

                case "4":
                    sql = sql + " AND MONTH(a.Ngaydung) <=12 and MONTH(a.Ngaydung) >=10 group by c.TenDauBep";
                    break;
                }
            }

            if (cmbDK.Text.Trim() == "Năm")
            {
                sql = sql + " group by c.TenDauBep";
            }


            MessageBox.Show(sql);
            danhsach = DAO3.DocBang(sql);
            exRange.Range["A9:F9"].Font.Bold           = true;
            exRange.Range["A9:F9"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["B9:B9"].ColumnWidth         = 12;
            exRange.Range["C9:C9"].ColumnWidth         = 18;
            exRange.Range["D9:D9"].ColumnWidth         = 12;
            exRange.Range["E9:E9"].ColumnWidth         = 15;
            exRange.Range["F9:F9"].ColumnWidth         = 12;
            exRange.Range["A9:A9"].Value = "STT";
            exRange.Range["B9:B9"].Value = "Tên đầu bếp";
            exRange.Range["C9:C9"].Value = "Tổng tiền";


            for (hang = 0; hang < danhsach.Rows.Count; hang++)
            {
                exSheet.Cells[1][hang + 10] = hang + 1;
                for (cot = 0; cot < danhsach.Columns.Count; cot++)
                {
                    exSheet.Cells[cot + 2][hang + 10] = danhsach.Rows[hang][cot].ToString();
                }
            }

            sql = "select  SUM( a.SoLuong * b.DonGia) from ChiTietThucDon a join MonAn b on a.MaMonAn = b.MaMonAn join DauBep c on a.MaDauBep = c.MaDauBep" +
                  " where  year(Ngaydung)=" + cmbNam.Text;
            if (cmbDK.Text.Trim() == "Tháng")
            {
                sql = sql + "and month(Ngaydung) = " + cmbThang.Text;
            }
            else if (cmbDK.Text.Trim() == "Quý")
            {
                switch (cmbQuy.Text)
                {
                case "1":
                    sql = sql + " AND MONTH(a.Ngaydung) <=3 and MONTH(a.Ngaydung) >=1 ";
                    break;

                case "2":
                    sql = sql + " AND MONTH(a.Ngaydung) <=6 and MONTH(a.Ngaydung) >=4 ";
                    break;

                case "3":
                    sql = sql + " AND MONTH(a.Ngaydung) <=9 and MONTH(a.Ngaydung) >=7 ";
                    break;

                case "4":
                    sql = sql + " AND MONTH(a.Ngaydung) <=12 and MONTH(a.Ngaydung) >=10 ";
                    break;
                }
            }

            MessageBox.Show(sql);
            doanhthu = DAO3.DocBang(sql);
            exRange  = exSheet.Cells[1][hang + 12];
            exRange.Range["C1:C1"].Font.Bold = true;
            exRange.Range["C1:C1"].Value     = "Tổng doanh thu :";
            exRange.Range["D1:D1"].Value     = doanhthu.Rows[0][0].ToString();
            exRange = exSheet.Cells[1][hang + 13];
            exRange.Range["D1:D1"].Font.Bold = true;
            exRange = exSheet.Cells[1][hang + 14];
            exRange.Range["D1:G1"].MergeCells          = true;
            exRange.Range["D1:G1"].Font.Bold           = true;
            exRange.Range["D1:G1"].Font.Italic         = true;
            exRange.Range["D1:G1"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange = exSheet.Cells[1][hang + 16];
            exRange.Range["D1:E1"].MergeCells          = true;
            exRange.Range["E1:F1"].Font.Italic         = true;
            exRange.Range["E1:F1"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["D1:E1"].Value = "Hà Nội, Ngày " + DateTime.Now.ToShortDateString();
            exSheet.Name  = "Báo cáo";
            exApp.Visible = true;
        }
Example #5
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            double dt;
            {
                string sql;
                if (cmbDK.Text.Trim() == "Tháng")
                {
                    if (cmbThang.Text.Trim() == "")
                    {
                        MessageBox.Show("Bạn cần phải nhập tháng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        cmbThang.Focus();
                        return;
                    }
                    if (cmbNam.Text.Trim() == "")
                    {
                        MessageBox.Show("Bạn cần phải nhập Năm", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        cmbNam.Focus();
                        return;
                    }
                    sql = "select sum(a.SoLuong * b.DonGia) fromChiTietThucDon a join MonAn b on a.MaMonAn = b.MaMonAn join DauBep c on a.MaDauBep = c.MaDauBep" +
                          " where  month(Ngaydung) = " + cmbThang.Text + " and year(Ngaydung)=" + cmbNam.Text + " AND TenDauBep LIKE N'%" + cmbDaubep.Text + "%'";

                    dt = Convert.ToDouble(DAO3.DocBang(sql).Rows[0][0].ToString());
                    txtTongtien.Text = dt.ToString();
                }
                if (cmbDK.Text.Trim() == "Năm")
                {
                    if (cmbNam.Text.Trim() == "")
                    {
                        MessageBox.Show("Bạn cần phải nhập Năm", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        cmbNam.Focus();
                        return;
                    }
                    sql = "select sum(a.SoLuong * b.DonGia) from ChiTietThucDon a join MonAn b on a.MaMonAn = b.MaMonAn join DauBep c on a.MaDauBep = c.MaDauBep" +
                          " where  year(Ngaydung)=" + cmbNam.Text + " AND TenDauBep LIKE N'%" + cmbDaubep.Text + "%'";

                    dt = Convert.ToDouble(DAO3.DocBang(sql).Rows[0][0].ToString());
                    txtTongtien.Text = dt.ToString();
                }
                if (cmbDK.Text.Trim() == "Quý")
                {
                    if (cmbNam.Text.Trim() == "")
                    {
                        MessageBox.Show("Nhập điều kiện năm!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    if (cmbQuy.Text.Trim() == "")
                    {
                        MessageBox.Show("Nhập điều kiện tháng!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    sql = "select sum(a.SoLuong * b.DonGia) from ChiTietThucDon a join MonAn b on a.MaMonAn = b.MaMonAn join DauBep c on a.MaDauBep = c.MaDauBep" +
                          " where year(a.Ngaydung)="
                          + cmbNam.Text + "   AND TenDauBep LIKE N'%" + cmbDaubep.Text + "%'";

                    switch (cmbQuy.Text)
                    {
                    case "1":
                    {
                        sql = sql + " AND MONTH(a.Ngaydung) <=3 and MONTH(a.Ngaydung) >=1 ";
                        dt  = Convert.ToDouble(DAO3.DocBang(sql).Rows[0][0].ToString());
                        txtTongtien.Text = dt.ToString();
                        break;
                    }

                    case "2":
                    {
                        sql = sql + " AND MONTH(a.Ngaydung) <=6 and MONTH(a.Ngaydung) >=4 ";
                        dt  = Convert.ToDouble(DAO3.DocBang(sql).Rows[0][0].ToString());
                        txtTongtien.Text = dt.ToString();
                        break;
                    }

                    case "3":
                    {
                        sql = sql + " AND MONTH(a.Ngaydung) <=9 and MONTH(a.Ngaydung) >=7 ";
                        dt  = Convert.ToDouble(DAO3.DocBang(sql).Rows[0][0].ToString());
                        txtTongtien.Text = dt.ToString();
                        break;
                    }

                    case "4":
                    {
                        sql = sql + " AND MONTH(a.Ngaydung) <=12 and MONTH(a.Ngaydung) >=10 ";
                        dt  = Convert.ToDouble(DAO3.DocBang(sql).Rows[0][0].ToString());
                        txtTongtien.Text = dt.ToString();
                        break;
                    }
                    }
                }
            }
        }
Example #6
0
        private void btnIn_Click(object sender, EventArgs e)
        {
            string sql;

            sql = "select a.SoThucDon, c.TenKhachHang, a.NgayDung, d.TenMonAn , f.TenLoai, e.TenDauBep, b.SoLuong ,b.ThanhTien,a.ThueVAT, a.GiamGia, a.TongTien " +
                  "from ThucDon a join ChiTietThucDon b on a.SoThucDon = b.SoThucDon join KhachHang c on a.MaKhachHang = c.MaKhachHang join MonAn d on b.MaMonAn= d.MaMonAn  join DauBep e on b.MaDauBep = e.MaDauBep join Loai_Mon_An f on b.MaLoai = f.MaLoai ";
            DataTable tblThucDon;

            tblThucDon = DAO3.DocBang(sql);
            dataGridViewThucDon.DataSource = tblThucDon;

            COMExcel.Application exApp = new COMExcel.Application();
            COMExcel.Workbook    exBook;  //Trong 1 chương trình Excel có nhiều Workbook
            COMExcel.Worksheet   exSheet; //Trong 1 Workbook có nhiều Worksheet
            COMExcel.Range       exRange;

            int hang = 0, cot = 0;

            exBook  = exApp.Workbooks.Add(COMExcel.XlWBATemplate.xlWBATWorksheet);
            exSheet = exBook.Worksheets[1];
            exRange = exSheet.Cells[1, 1];
            exRange.Range["A1:B3"].Font.Size           = 12;
            exRange.Range["A1:B3"].Font.Bold           = true;
            exRange.Range["A1:B3"].Font.ColorIndex     = 5;//Màu xanh da trời
            exRange.Range["A1:A1"].ColumnWidth         = 7;
            exRange.Range["B1:B1"].ColumnWidth         = 15;
            exRange.Range["A1:B1"].MergeCells          = true;
            exRange.Range["A1:B1"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A1:B1"].Value               = "NHÀ HÀNG LITTLE ITALY";
            exRange.Range["A2:B2"].MergeCells          = true;
            exRange.Range["A2:B2"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A2:B2"].Value               = " ĐỐNG ĐA - HÀ NỘI";
            exRange.Range["A3:B3"].MergeCells          = true;
            exRange.Range["A3:B3"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["A3:B3"].Value               = "Điện thoại:  097 383 3707";
            exRange.Range["B6:H6"].Font.Size           = 20;
            exRange.Range["A6:H6"].Font.Name           = "Times new roman";
            exRange.Range["A6:H7"].Font.Bold           = true;
            exRange.Range["A6:H7"].Font.ColorIndex     = 3;
            exRange.Range["C6:F6"].MergeCells          = true;
            exRange.Range["B6:H7"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;

            exRange.Range["C6:F6"].Value               = " THÔNG TIN CÁC THỰC ĐƠN ";
            exRange.Range["A8:H8"].Font.Bold           = true;
            exRange.Range["A8:H8"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;

            exRange.Range["A8:A8"].ColumnWidth = 8;
            exRange.Range["B8:B8"].ColumnWidth = 24;
            exRange.Range["C8:C8"].ColumnWidth = 30;
            exRange.Range["D8:D8"].ColumnWidth = 25;
            exRange.Range["E8:E8"].ColumnWidth = 20;
            exRange.Range["F8:F8"].ColumnWidth = 26;
            exRange.Range["G8:G8"].ColumnWidth = 30;
            exRange.Range["H8:H8"].ColumnWidth = 15;
            exRange.Range["I8:I8"].ColumnWidth = 15;
            exRange.Range["J8:J8"].ColumnWidth = 15;
            exRange.Range["K8:K8"].ColumnWidth = 15;
            exRange.Range["L8:L8"].ColumnWidth = 15;
            exRange.Range["A8:A8"].Value       = "STT";
            exRange.Range["B8:B8"].Value       = "Số thực đơn";
            exRange.Range["C8:C8"].Value       = "Khách hàng";
            exRange.Range["D8:D8"].Value       = "Ngày dùng";
            exRange.Range["E8:E8"].Value       = "Món ăn";
            exRange.Range["F8:F8"].Value       = "Loại món ăn ";
            exRange.Range["G8:G8"].Value       = "Đầu bếp ";
            exRange.Range["H8:H8"].Value       = "Số lượng ";
            exRange.Range["I8:I8"].Value       = "Thành tiền ";
            exRange.Range["J8:J8"].Value       = "Thuế VAT ";
            exRange.Range["K8:K8"].Value       = "Giảm giá ";
            exRange.Range["L8:L8"].Value       = "Tổng tiền ";

            exRange = exSheet.Cells[1][hang + 8];
            exRange.Range["A1:L" + (tblThucDon.Rows.Count + 1) + ""].Borders.Color       = Color.Black;
            exRange.Range["A2:L" + (tblThucDon.Rows.Count + 1) + ""].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange = exSheet.Cells[1, 1];

            for (hang = 0; hang <= tblThucDon.Rows.Count - 1; hang++)
            {
                exSheet.Cells[1][hang + 9] = hang + 1;
                for (cot = 0; cot < tblThucDon.Columns.Count; cot++)
                {
                    exSheet.Cells[cot + 2][hang + 9] = tblThucDon.Rows[hang][cot].ToString();
                }
            }
            exApp.Visible = true;
            exRange.Range["F1:G1"].MergeCells          = true;
            exRange.Range["D1:G1"].Font.Italic         = true;
            exRange.Range["F1:G1"].HorizontalAlignment = COMExcel.XlHAlign.xlHAlignCenter;
            exRange.Range["F1:G1"].Value = "Hà Nội, Ngày " + DateTime.Now.ToShortDateString();
        }