Ejemplo n.º 1
0
        public List <ReportPurchase> ReportPurchase(int depid, int staffid, int supplier, int status, int valid, int isover, int type, int ret, string no, string m, string start, string end, int less, int big, float pless, float pbig)
        {
            var list = _stockoutRepository.ReportPurchase();

            if (depid != 0)
            {
                list = list.Where(p => p.depId == depid);
            }
            if (staffid != 0)
            {
                list = list.Where(p => p.staffId == staffid);
            }
            if (supplier != 0)
            {
                list = list.Where(p => p.supplierId == supplier);
            }
            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 (isover != -1)
            {
                list = list.Where(p => p.isover == isover);
            }
            if (no != "")
            {
                list = list.Where(p => p.requireNo.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.poAmount >= less);
            }
            if (big != -404)
            {
                list = list.Where(p => p.poAmount < big);
            }
            if (pless != -404)
            {
                var fless = Convert.ToDouble(pless); list = list.Where(p => p.poPrice >= fless);
            }
            if (pbig != -404)
            {
                var fbig = Convert.ToDouble(pbig); list = list.Where(p => p.poPrice < fbig);
            }
            if (type == 0)
            {
                list = list.Where(p => p.type == "普通采购");
            }
            if (type == 1)
            {
                list = list.Where(p => p.type == "申请采购");
            }
            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());
        }