private DataTable XuatHoaDon() { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT iHD.TenMonAn, iHD.DonGia, iHD.SoLuong FROM info_HOADON iHD, HOADON HD WHERE iHD.IDHoaDon = HD.ID"); return(tb); }
void loadHoaDon() { DataTable tb1 = new DataTable(); tb1 = LoadDuLieu.docDuLieu("select tenMon,donGia,soLuong from HOADON where idBan=" + x.ToString()); tb1.Columns[0].ColumnName = "Tên Món"; tb1.Columns[1].ColumnName = "Đơn Giá"; tb1.Columns[2].ColumnName = "Số Lượng"; dataThongTinHoaDon.DataSource = tb1; int n = dataThongTinHoaDon.RowCount; if (n == 0) { tbTongGia.Text = "0"; } else { tt = 0; for (int i = 0; i < n - 1; i++) { tt = tt + double.Parse(dataThongTinHoaDon.Rows[i].Cells[1].Value.ToString()) * int.Parse(dataThongTinHoaDon.Rows[i].Cells[2].Value.ToString()); } tt = tt - tt * double.Parse(comboBox1.Text) / 100; Math.Round(tt); tbTongGia.Text = tt.ToString("#,###"); } }
private void HoatDongTongDai_Load(object sender, EventArgs e) { lbname2.Text = Message2; //Đưa Dữ liệu vào cbMonAn DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TenMonAn From MONAN"); cbMonAn.DisplayMember = "TenMonAn"; cbMonAn.ValueMember = "ID"; cbMonAn.DataSource = tb; //Đưa dữ liệu vào cbChonChiNhanh DataTable tb2 = new DataTable(); tb2 = LoadDuLieu.docDuLieu("SELECT TenCN From CHI_NHANH"); cbChonChiNhanh.DisplayMember = "TenCN"; cbChonChiNhanh.ValueMember = "ID"; cbChonChiNhanh.DataSource = tb2; //Đưa dữ liệu vào cbChiNhanh2 DataTable tb3 = new DataTable(); tb3 = LoadDuLieu.docDuLieu("SELECT TenCN From CHI_NHANH"); cbChiNhanh2.DisplayMember = "TenCN"; cbChiNhanh2.ValueMember = "ID"; cbChiNhanh2.DataSource = tb3; //Đưa dữ liệu vào dataDonHang DataTable tb4 = new DataTable(); tb4 = ThemDonHang(); dataDonHang.DataSource = tb4; //Đưa dữ liệu vào dataLuu DataTable tb5 = new DataTable(); tb5 = LuuKH(); dataLuu.DataSource = tb5; }
private DataTable ThemNhanVien() { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TK.UserName,TK.PassWord,TK.TenHienThi,TK.LoaiTaiKhoan,NV.Ten,NV.CMND,NV.QueQuan,NV.NgaySinh FROM NhanVien NV, TAI_KHOAN TK WHERE NV.IDTaiKhoan = TK.ID"); dataTaiKhoan.DataSource = tb; return(tb); }
private void btNhanHoaDon_Click(object sender, EventArgs e) { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TenMonAn, DonGia, SoLuong, DiaChi FROM DONHANG_TONGDAI"); view = new DataView(tb); dataThongTinHoaDon.DataSource = view; }
private void btTimKiem_Click(object sender, EventArgs e) { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TenMonAn, DonGia FROM MONAN WHERE TenMonAn like N'" + tbTimKiem.Text + "%'"); viewTimKiem = new DataView(tb); dataDSThucDon.DataSource = viewTimKiem; }
private DataTable LuuKH() { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TenKH, SDT, DiaChi, SoLanMuaHang From KHACHHANG"); dataLuu.DataSource = tb; return(tb); }
private DataTable ThemDonHang() { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TenMonAn, SoLuong, DiaChi From DONHANG_TONGDAI"); dataDonHang.DataSource = tb; return(tb); }
private void cbDanhMuc2_SelectedIndexChanged(object sender, EventArgs e) { cbMonAn.Items.Clear(); if (cbDanhMuc2.SelectedItem == "Tôm") { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT MA.TenMonAn From MONAN MA, LOAI_MONAN L WHERE L.TenLoai = N'Tôm' and L.ID = MA.IDLoaiMonAn"); cbMonAn.DisplayMember = "TenMonAn"; cbMonAn.ValueMember = "ID"; cbMonAn.DataSource = tb; } else if (cbDanhMuc2.SelectedItem == "Cá") { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT MA.TenMonAn From MONAN MA, LOAI_MONAN L WHERE L.TenLoai = N'Cá' and L.ID = MA.IDLoaiMonAn"); cbMonAn.DisplayMember = "TenMonAn"; cbMonAn.ValueMember = "ID"; cbMonAn.DataSource = tb; } else if (cbDanhMuc2.SelectedItem == "Cua") { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT MA.TenMonAn From MONAN MA, LOAI_MONAN L WHERE L.TenLoai = N'Cua' and L.ID = MA.IDLoaiMonAn"); cbMonAn.DisplayMember = "TenMonAn"; cbMonAn.ValueMember = "ID"; cbMonAn.DataSource = tb; } else if (cbDanhMuc2.SelectedItem == "Gà") { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT MA.TenMonAn From MONAN MA, LOAI_MONAN L WHERE L.TenLoai = N'Gà' and L.ID = MA.IDLoaiMonAn"); cbMonAn.DisplayMember = "TenMonAn"; cbMonAn.ValueMember = "ID"; cbMonAn.DataSource = tb; } else if (cbDanhMuc2.SelectedItem == "Bầu") { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT MA.TenMonAn From MONAN MA, LOAI_MONAN L WHERE L.TenLoai = N'Bầu' and L.ID = MA.IDLoaiMonAn"); cbMonAn.DisplayMember = "TenMonAn"; cbMonAn.ValueMember = "ID"; cbMonAn.DataSource = tb; } else if (cbDanhMuc2.SelectedItem == "Nai") { DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT MA.TenMonAn From MONAN MA, LOAI_MONAN L WHERE L.TenLoai = N'Nai' and L.ID = MA.IDLoaiMonAn"); cbMonAn.DisplayMember = "TenMonAn"; cbMonAn.ValueMember = "ID"; cbMonAn.DataSource = tb; } }
private void GiaoDienChinh_Load(object sender, EventArgs e) { TenHienThi.Text = Message; //Đưa dữ liệu vào dataDSThucDon DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TenMonAn, DonGia, SoLuongTrongKho FROM MONAN"); dataDSThucDon.DataSource = tb; DataTable tb2 = new DataTable(); tb2 = XuatHoaDon(); dataThongTinHoaDon.DataSource = tb2; binding(); }
private void BoPhanQuanLy_Load(object sender, EventArgs e) { Ten.Text = Message3; //Đưa dữ liệu vào combobox danh mục DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TenLoai From LOAI_MONAN"); cbDanhMuc.DisplayMember = "TenLoai"; cbDanhMuc.ValueMember = "ID"; cbDanhMuc.DataSource = tb; //Đưa dữ liệu vào combobox danh mục 2 DataTable tb2 = new DataTable(); tb2 = LoadDuLieu.docDuLieu("SELECT TenLoai From LOAI_MONAN"); cbDanhMuc2.DisplayMember = "TenLoai"; cbDanhMuc2.ValueMember = "ID"; cbDanhMuc2.DataSource = tb2; //Đưa dữ liệu vào combobox chi nhánh DataTable tb3 = new DataTable(); tb3 = LoadDuLieu.docDuLieu("SELECT TenCN From CHI_NHANH"); cbChiNhanh.DisplayMember = "TenCN"; cbChiNhanh.ValueMember = "ID"; cbChiNhanh.DataSource = tb3; //Đưa dữ liệu vào datagirdview dataviewChiNhanh DataTable tb4 = new DataTable(); tb4 = LoadDuLieu.docDuLieu("SELECT TenCN, DiaChi, LienHe, SoLuongBan FROM CHI_NHANH"); dataviewChiNhanh.DataSource = tb4; //Đưa dữ liệu vào datadsMonAn DataTable tb5 = new DataTable(); tb5 = LoadDuLieu.docDuLieu("SELECT L.TenLoai, MA.TenMonAn, MA.DonGia FROM MONAN MA, LOAI_MONAN L WHERE MA.IDLoaiMonAn = L.ID"); dataDSMonAn.DataSource = tb5; }
private void GiaoDienChinh_Load(object sender, EventArgs e) { TenHienThi.Text = Message; //Đưa dữ liệu vào dataDSThucDon DataTable tb = new DataTable(); tb = LoadDuLieu.docDuLieu("SELECT TenMonAn, DonGia FROM MONAN"); viewTimKiem = new DataView(tb); dataDSThucDon.DataSource = viewTimKiem; DataTable tb1 = new DataTable(); tb1 = LoadDuLieu.docDuLieu("select tenMon,donGia,soLuong from HOADON where idBan=" + x.ToString()); tb1.Columns[0].ColumnName = "Tên Món"; tb1.Columns[1].ColumnName = "Đơn Giá"; tb1.Columns[2].ColumnName = "Số Lượng"; dataThongTinHoaDon.DataSource = tb1; /*tb2 = XuatHoaDon(); * view = new DataView(tb2); * dataThongTinHoaDon.DataSource = view; * binding(); * binding2();*/ }