private void refreshdata() { DAO.OpenConnection(); txtSoHDN.ReadOnly = true; txtTennhanvien.ReadOnly = true; txtTenNCC.ReadOnly = true; txtDiachi.ReadOnly = true; mskDienthoai.ReadOnly = true; txtTenbinh.ReadOnly = true; txtDongia.ReadOnly = false; txtThanhtien.ReadOnly = true; txtTongtien.ReadOnly = true; txtGiamgia.Text = "0"; txtTongtien.Text = "0"; DAO.FillCombo("SELECT MaNCC, TenNCC FROM nha_cc", cboMaNCC, "MaNCC", "MaNCC"); cboMaNCC.SelectedIndex = -1; DAO.FillCombo("SELECT MaNV, TenNV FROM nhan_vien", cboManhanvien, "MaNV", "MaNV"); cboManhanvien.SelectedIndex = -1; DAO.FillCombo("SELECT Mabinh, tenbinh FROM DM_Binh_ga ", cboMabinh, "Mabinh", "Mabinh"); cboMabinh.SelectedIndex = -1; //Hiển thị thông tin của một hóa đơn được gọi từ form tìm kiếm if (txtSoHDN.Text != "") { LoadInfoHoadon(); } LoadDataGridView(); }
private void FrmBaoCaoTop3_Load(object sender, EventArgs e) { DAO.OpenConnection(); combo_manv.Enabled = false; bt_batdau.Enabled = true; bt_thoat.Enabled = true; bt_inbaocao.Enabled = false; bt_thongke.Enabled = false; DAO.FillCombo("SELECT MaNV, TenNV FROM nhan_vien", combo_manv, "TenNV", "MaNV"); DAO.CloseConnection(); }
private void FrmBaoCaoTop3_Load(object sender, EventArgs e) { DAO.OpenConnection(); goiy(); string sql = "SELECT c.MaNV,TenNV,a.Mabinh,d.Tenbinh, sum(a.Soluong) as soluong from " + "Chi_tiet_hoa_don_ban as a join Hoa_don_ban as b on a.SoHDB = b.SoHDB join " + "Nhan_vien as c on c.MaNV = b.MaNV join DM_Binh_ga as d on " + "d.Mabinh = a.Mabinh group by tenbinh ,c.MaNV, TenNV, a.mabinh, tenbinh order by soluong ASC"; DAO.loatdata(sql, dataGridView1); DAO.FillCombo("SELECT MaNV, TenNV FROM nhan_vien", combo_manv, "TenNV", "MaNV"); DAO.CloseConnection(); }
private void BaoCaoKhachHang_Load(object sender, EventArgs e) { DAO.OpenConnection(); string sql1 = "select DISTINCT month(ngayban) as thang from hoa_don_ban order by month(ngayban) asc"; DAO.FillCombo(sql1, comboBox1, "thang", "thang"); string sql2 = "select DISTINCT year(ngayban) as nam from hoa_don_ban order by year(ngayban)"; DAO.FillCombo(sql2, comboBox2, "nam", "nam"); string sql = " select Hoa_don_ban.Makhach,Tenkhach,Diachi,Dienthoai,ngayban,chi_tiet_hoa_don_ban.mabinh ," + " chi_tiet_hoa_don_ban.soluong as so_luong,giamgia,dbo.DM_Binh_ga.dongiaban,thanhtien,tenbinh " + "from Hoa_don_ban join Khach_hang on Hoa_don_ban.MaKhach = Khach_hang.Makhach JOIN dbo.Chi_tiet_hoa_don_ban " + " ON hoa_don_ban.sohdb = chi_tiet_hoa_don_ban.sohdb JOIN " + "dbo.DM_Binh_ga ON chi_tiet_hoa_don_ban.mabinh = dm_binh_ga.mabinh"; DAO.loatdata(sql, dataGridView1); DAO.CloseConnection(); }
private void BaoCaoDanhSachHDN_Load(object sender, EventArgs e) { DAO.OpenConnection(); string sql = "select Chi_tiet_hoa_don_nhap.SoHDN,NgayNhap, nha_cc.MaNCC,TenNCC," + "Dienthoai,Mabinh,Soluong,GIAMGIA,Dongia,Thanhtien from Nha_cc join Hoa_don_nhap on " + "Nha_cc.MaNCC = Hoa_don_nhap.MaNCC join Chi_tiet_hoa_don_nhap " + "on Hoa_don_nhap.SoHDN = Chi_tiet_hoa_don_nhap.SoHDN"; DAO.loatdata(sql, datagridview_DSHDN); DAO.FillCombo("select * from nha_cc", comboBox1, "mancc", "mancc"); goiy(); // textBoxtenncc.AutoCompleteMode = AutoCompleteMode.Suggest; // textBoxtenncc.AutoCompleteSource = AutoCompleteSource.CustomSource; // AutoCompleteStringCollection DataCollection = new AutoCompleteStringCollection(); // getda (DataCollection); // textBox1.AutoCompleteCustomSource = DataCollection; DAO.CloseConnection(); }
private void BaoCaoDoanhThu_Load(object sender, EventArgs e) { DAO.OpenConnection(); string sql1 = "select distinct month(ngayban) as thang from hoa_don_ban order by month(ngayban) asc"; DAO.FillCombo(sql1, comboBox1, "thang", "thang"); string sql2 = "select distinct year(ngayban) as nam from hoa_don_ban order by year(ngayban)"; DAO.FillCombo(sql2, comboBox2, "nam", "nam"); string sql = "select sum(thanhtien) as tong_tien,DM_binh_ga.dongiaban," + "dm_binh_ga.mabinh,tenbinh,sum(chi_tiet_hoa_don_ban.soluong) as so_luong," + " ngayban" + " from chi_tiet_Hoa_don_ban join dm_binh_ga on " + "chi_tiet_hoa_don_ban.mabinh = dm_binh_ga.mabinh join hoa_don_ban on hoa_don_ban.sohdb = chi_tiet_hoa_don_ban.sohdb " + " group BY dm_binh_ga.mabinh,tenbinh,DM_binh_ga.dongiaban,ngayban"; DAO.loatdata(sql, dataGridViewdoanhthu); DAO.CloseConnection(); }
private void cmbMaHDB_DropDown_1(object sender, EventArgs e) { DAO.FillCombo("SELECT SoHDB FROM Hoa_don_ban", cmbMaHDB, "SoHDB", "SoHDB"); cmbMaHDB.SelectedIndex = -1; }