Example #1
0
        public List <ReportStock> ReportStockIn(int depid, int staffid, int depotid, int status, int valid, int intype, int ret, string no, string m, string start, string end, int less, int big)
        {
            var list = _stockoutRepository.ReportStockIn();

            if (depid != 0)
            {
                list = list.Where(p => p.depId == depid);
            }
            if (staffid != 0)
            {
                list = list.Where(p => p.staffId == staffid);
            }
            if (depotid != 0)
            {
                list = list.Where(p => p.depotId == depotid);
            }
            if (status != -1)
            {
                list = list.Where(p => p.status == status);
            }
            if (valid == 1)
            {
                list = list.Where(p => p.valid == true);
            }
            if (valid == 0)
            {
                list = list.Where(p => p.valid == false);
            }
            if (no != "")
            {
                list = list.Where(p => p.stockNo.Contains(no));
            }
            if (m != "")
            {
                list = list.Where(p => p.materialName.Contains(m) || p.materialModel.Contains(m) || p.materialUnit.Contains(m) || p.materialNo.Contains(m));
            }
            if (less != -404)
            {
                list = list.Where(p => p.amount >= less);
            }
            if (big != -404)
            {
                list = list.Where(p => p.amount < big);
            }
            if (intype != -1)
            {
                list = list.Where(p => p.datatype == intype);
            }
            if (ret == 0)
            {
                list = list.Where(p => p.returnamount == 0);
            }
            if (ret == 1)
            {
                list = list.Where(p => p.returnamount > 0);
            }
            if (start != "")
            {
                var ds = Convert.ToDateTime(start);
                list = list.Where(x => DateTime.Compare(x.createDate, ds) >= 0);
            }
            if (end != "")
            {
                var de = Convert.ToDateTime(end);
                list = list.Where(x => DateTime.Compare(x.createDate, de) < 0);
            }
            return(list.ToList());
        }