private void FrmTongQuan_Load(object sender, EventArgs e) { HDBanBUS bus = new HDBanBUS(); HDBanDTO dto = bus.DemMaHDBan(); txtDemHDB.Text = dto.MaHDBan; //Load SO HD Nhap HDNhapBUS bus1 = new HDNhapBUS(); HDNhapDTO dto1 = bus1.DemMaHDNhap(); txtDemHDN.Text = dto1.MaHDNhap; //Load TongSP Da Ban SanPhamBUS bus2 = new SanPhamBUS(); SP_CTHDBDTO dto2 = bus2.TongSoSPBan(); txtTongSPBan.Text = dto2.SLSP.ToString(); //Load TongSP Da Nhap SanPhamBUS bus3 = new SanPhamBUS(); SP_CTHDN_LSP_HDN dto3 = bus3.TongSoSPNhap(); txtTongSPDaNhap.Text = dto3.TongSL.ToString(); //Load HD huy HDBanBUS bus4 = new HDBanBUS(); HDBanDTO dto4 = bus4.DemSoHDHuy(); txtTongSPDaNhap.Text = dto4.MaHDBan.ToString(); //loadTongDoanhThu HDBanBUS bus5 = new HDBanBUS(); HDBanDTO dto5 = bus5.TongDoanhThuTrongNgay(); txtTongDT.Text = dto5.TongTien.ToString("#.##"); }
public SP_CTHDBDTO TongSPDaBan() { SP_CTHDBDTO dto = null; string truyvan = "EXEC dbo.Proc_DemSoSPDaBan "; SqlConnection con = DataProvider.TaoKetNoi(); SqlDataReader sr = DataProvider.TruyVanDuLieu(truyvan, con); while (sr.Read()) { dto = new SP_CTHDBDTO(); dto.SLSP = int.Parse(sr["SOSP"].ToString()); } sr.Close(); con.Close(); return(dto); }
public List <SP_CTHDBDTO> LOADCTHDXUAT(string ma) { List <SP_CTHDBDTO> ls = new List <SP_CTHDBDTO>(); string truyvan = "Select sp.TenSP,cthdb.* From SAN_PHAM sp ,CHI_TIET_HDBAN cthdb Where sp.MaSP = cthdb.MaSP And MaHDBan='" + ma + "'"; SqlConnection con = DataProvider.TaoKetNoi(); SqlDataReader sr = DataProvider.TruyVanDuLieu(truyvan, con); while (sr.Read()) { SP_CTHDBDTO dto = new SP_CTHDBDTO(); dto.TenSP = sr["TenSP"].ToString(); dto.SLSP = int.Parse(sr["SoLuong"].ToString()); dto.Gia = decimal.Parse(sr["DonGia"].ToString()); //dto.TongTien = decimal.Parse(sr["ThanhTien"].ToString()); ls.Add(dto); } sr.Close(); con.Close(); return(ls); }
public List <SP_CTHDBDTO> SPBanChayNhat(DateTime TimeTu, DateTime TimeDen) { List <SP_CTHDBDTO> spb = new List <SP_CTHDBDTO>(); string truyvan = "EXEC Proc_SPBanChayNhat '" + TimeTu + "','" + TimeDen + "'"; SqlConnection con = DataProvider.TaoKetNoi(); SqlDataReader sr = DataProvider.TruyVanDuLieu(truyvan, con); while (sr.Read()) { SP_CTHDBDTO dto = new SP_CTHDBDTO(); //dto.MaSP = sr["MaSP"].ToString(); dto.TenSP = sr["TenSP"].ToString(); //dto.Gia = double.Parse(sr["DonGia"].ToString()); dto.SLSP = int.Parse(sr["SLSP"].ToString()); //dto.TenLoaiSP = sr["TenLoaiSP"].ToString(); dto.TongTien = decimal.Parse(sr["TongTien"].ToString()); //dto.NgayLapHD = DateTime.Parse(sr["NgayLapHD"].ToString()); spb.Add(dto); } sr.Close(); con.Close(); return(spb); }
public List <SP_CTHDBDTO> LayDSSPDaBan(DateTime TimeTu, DateTime TimeDen) { List <SP_CTHDBDTO> spb = new List <SP_CTHDBDTO>(); string truyvan = "Select * from dbo.HienThiDSSanPhamDaBan Where NgayLapHD between '" + TimeTu + "' AND '" + TimeDen + "' "; SqlConnection con = DataProvider.TaoKetNoi(); SqlDataReader sr = DataProvider.TruyVanDuLieu(truyvan, con); while (sr.Read()) { SP_CTHDBDTO dto = new SP_CTHDBDTO(); dto.MaSP = sr["MaSP"].ToString(); dto.TenSP = sr["TenSP"].ToString(); dto.Gia = decimal.Parse(sr["DonGia"].ToString()); dto.SLSP = int.Parse(sr["SLSP"].ToString()); dto.TenLoaiSP = sr["TenLoaiSP"].ToString(); dto.TongTien = decimal.Parse(sr["TongTien"].ToString()); dto.NgayLapHD = DateTime.Parse(sr["NgayLapHD"].ToString()); spb.Add(dto); } sr.Close(); con.Close(); return(spb); }