public static List <SearchPhieuNhapPhieuChi> LayPhieuchitheoTimkiem(SearchPhieuNhapPhieuChi Search) { List <SearchPhieuNhapPhieuChi> ListSearch = new List <SearchPhieuNhapPhieuChi>(); DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); var DSPhieuchi = (from p in model.PhieuchiNXB select p); if (Search.Maphieuchi != "") { DSPhieuchi = DSPhieuchi.Where(q => q.Maphieuchi.Trim().Equals(Search.Maphieuchi)); } if (Search.MaNXB != "") { DSPhieuchi = DSPhieuchi.Where(q => q.MaNXB.Trim().Equals(Search.MaNXB)); } if (Search.TinhTrang != "") { DSPhieuchi = DSPhieuchi.Where(q => q.TrangThai.Trim().Equals(Search.TinhTrang)); } if (Search.Ngaytu != null && Search.Ngayden != null) { if (Search.Ngaytu.ToString() != Search.Ngayden.ToString()) { DSPhieuchi = DSPhieuchi.Where(q => q.Ngay >= Search.Ngaytu && q.Ngay <= Search.Ngayden); } else { DSPhieuchi = DSPhieuchi.Where(q => q.Ngay == Search.Ngaytu); } } if (Search.tiennhaptu != 0 && Search.tiennhapden != 0) { DSPhieuchi = DSPhieuchi.Where(q => q.Tongtien >= Search.tiennhaptu && q.Tongtien <= Search.tiennhapden); } if (Search.tiennhaptu != 0 && Search.tiennhapden == 0) { DSPhieuchi = DSPhieuchi.Where(q => q.Tongtien >= Search.tiennhaptu); } if (Search.tiennhaptu == 0 && Search.tiennhapden != 0) { DSPhieuchi = DSPhieuchi.Where(q => q.Tongtien <= Search.tiennhapden); } if (Search.tiennhaptu == Search.tiennhapden && Search.tiennhaptu != 0 && Search.tiennhapden != 0) { DSPhieuchi = DSPhieuchi.Where(q => q.Tongtien == Search.tiennhaptu); } foreach (var row in DSPhieuchi) { SearchPhieuNhapPhieuChi _search = new SearchPhieuNhapPhieuChi(); _search.Ngay = row.Ngay; _search.TrangThai = row.TrangThai; _search.Tongtien = row.Tongtien; _search.Maphieuchi = row.Maphieuchi; ListSearch.Add(_search); } return(ListSearch); }
public static List <SearchPhieuNhapPhieuChi> LayPNtheoTimkiem(SearchPhieuNhapPhieuChi Search) { List <SearchPhieuNhapPhieuChi> ListSearch = new List <SearchPhieuNhapPhieuChi>(); DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); var DSPN = (from p in model.PNsach select p); if (Search.MaPN != "") { DSPN = DSPN.Where(q => q.MaPN.Trim().Equals(Search.MaPN)); } if (Search.MaNXB != "") { DSPN = DSPN.Where(q => q.MaNXB.Trim().Equals(Search.MaNXB)); } if (Search.TinhTrang != "") { DSPN = DSPN.Where(q => q.TinhTrang.Trim().Equals(Search.TinhTrang)); } if (Search.Ngaytu != null && Search.Ngayden != null) { if (Search.Ngaytu.ToString() != Search.Ngayden.ToString()) { DSPN = DSPN.Where(q => q.Ngaynhap >= Search.Ngaytu && q.Ngaynhap <= Search.Ngayden); } else { DSPN = DSPN.Where(q => q.Ngaynhap == Search.Ngaytu); } } if (Search.tiennhaptu != 0 && Search.tiennhapden != 0) { DSPN = DSPN.Where(q => q.Tongtien >= Search.tiennhaptu && q.Tongtien <= Search.tiennhapden); } if (Search.tiennhaptu != 0 && Search.tiennhapden == 0) { DSPN = DSPN.Where(q => q.Tongtien >= Search.tiennhaptu); } if (Search.tiennhaptu == 0 && Search.tiennhapden != 0) { DSPN = DSPN.Where(q => q.Tongtien <= Search.tiennhapden); } if (Search.tiennhaptu == Search.tiennhapden && Search.tiennhaptu != 0 && Search.tiennhapden != 0) { DSPN = DSPN.Where(q => q.Tongtien == Search.tiennhaptu); } foreach (var row in DSPN) { SearchPhieuNhapPhieuChi _search = new SearchPhieuNhapPhieuChi(); _search.Ngaynhap = row.Ngaynhap; _search.TinhTrang = row.TinhTrang; _search.Tongtien = row.Tongtien; _search.MaPN = row.MaPN; ListSearch.Add(_search); } return(ListSearch); }
public static List<SearchPhieuNhapPhieuChi> LayPNtheoTimkiem(SearchPhieuNhapPhieuChi Search) { List<SearchPhieuNhapPhieuChi> ListSearch = new List<SearchPhieuNhapPhieuChi>(); DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); var DSPN = (from p in model.PNsach select p); if(Search.MaPN!="") { DSPN = DSPN.Where(q => q.MaPN.Trim().Equals(Search.MaPN)); } if(Search.MaNXB!="") { DSPN = DSPN.Where(q => q.MaNXB.Trim().Equals(Search.MaNXB)); } if(Search.TinhTrang!="") { DSPN = DSPN.Where(q => q.TinhTrang.Trim().Equals(Search.TinhTrang)); } if(Search.Ngaytu!=null&&Search.Ngayden!=null) { if (Search.Ngaytu.ToString() != Search.Ngayden.ToString()) DSPN = DSPN.Where(q => q.Ngaynhap >= Search.Ngaytu && q.Ngaynhap <= Search.Ngayden); else DSPN = DSPN.Where(q => q.Ngaynhap == Search.Ngaytu); } if(Search.tiennhaptu!=0&&Search.tiennhapden!=0) { DSPN = DSPN.Where(q => q.Tongtien >= Search.tiennhaptu && q.Tongtien <= Search.tiennhapden); } if(Search.tiennhaptu!=0&&Search.tiennhapden==0) { DSPN = DSPN.Where(q => q.Tongtien >= Search.tiennhaptu); } if(Search.tiennhaptu==0&&Search.tiennhapden!=0) { DSPN = DSPN.Where(q => q.Tongtien <= Search.tiennhapden); } if(Search.tiennhaptu==Search.tiennhapden&&Search.tiennhaptu!=0&&Search.tiennhapden!=0) { DSPN = DSPN.Where(q => q.Tongtien == Search.tiennhaptu); } foreach(var row in DSPN) { SearchPhieuNhapPhieuChi _search = new SearchPhieuNhapPhieuChi(); _search.Ngaynhap = row.Ngaynhap; _search.TinhTrang = row.TinhTrang; _search.Tongtien = row.Tongtien; _search.MaPN = row.MaPN; ListSearch.Add(_search); } return ListSearch; }
public static List<SearchPhieuNhapPhieuChi> LayPhieuchitheoTimkiem(SearchPhieuNhapPhieuChi Search) { List<SearchPhieuNhapPhieuChi> ListSearch = new List<SearchPhieuNhapPhieuChi>(); DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); var DSPhieuchi = (from p in model.PhieuchiNXB select p); if(Search.Maphieuchi!="") { DSPhieuchi = DSPhieuchi.Where(q => q.Maphieuchi.Trim().Equals(Search.Maphieuchi)); } if (Search.MaNXB != "") { DSPhieuchi = DSPhieuchi.Where(q => q.MaNXB.Trim().Equals(Search.MaNXB)); } if (Search.TinhTrang != "") { DSPhieuchi = DSPhieuchi.Where(q => q.TrangThai.Trim().Equals(Search.TinhTrang)); } if (Search.Ngaytu != null && Search.Ngayden != null) { if (Search.Ngaytu.ToString() != Search.Ngayden.ToString()) DSPhieuchi = DSPhieuchi.Where(q => q.Ngay >= Search.Ngaytu && q.Ngay <= Search.Ngayden); else DSPhieuchi = DSPhieuchi.Where(q => q.Ngay == Search.Ngaytu); } if (Search.tiennhaptu != 0 && Search.tiennhapden != 0) { DSPhieuchi = DSPhieuchi.Where(q => q.Tongtien >= Search.tiennhaptu && q.Tongtien <= Search.tiennhapden); } if (Search.tiennhaptu != 0 && Search.tiennhapden == 0) { DSPhieuchi = DSPhieuchi.Where(q => q.Tongtien >= Search.tiennhaptu); } if (Search.tiennhaptu == 0 && Search.tiennhapden != 0) { DSPhieuchi = DSPhieuchi.Where(q => q.Tongtien <= Search.tiennhapden); } if (Search.tiennhaptu == Search.tiennhapden && Search.tiennhaptu != 0 && Search.tiennhapden != 0) { DSPhieuchi = DSPhieuchi.Where(q => q.Tongtien == Search.tiennhaptu); } foreach (var row in DSPhieuchi) { SearchPhieuNhapPhieuChi _search = new SearchPhieuNhapPhieuChi(); _search.Ngay = row.Ngay; _search.TrangThai = row.TrangThai; _search.Tongtien = row.Tongtien; _search.Maphieuchi = row.Maphieuchi; ListSearch.Add(_search); } return ListSearch; }