Пример #1
0
        public ActionResult Pdf(string id)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user     = _systemService.GetUserAndRole(0, userName);

            if (user == null)
            {
                return(RedirectToAction("Index", "Login"));
            }

            if (user.StockOutR == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var item = new XStockReturnParent();

            if (!string.IsNullOrEmpty(id))
            {
                item = _service.XStockReturnParent(id);
            }
            else
            {
                item.Srv = _service.SRVLastest("");
            }

            var model = new XReturnPdfViewModel
            {
                From        = item.From,
                To          = item.To,
                ProjectCode = item.ProjectCode,
                ProjectName = item.ProjectName,
                Srv         = item.Srv,
                Date        = item.Date,
                UserLogin   = user
            };

            if (string.IsNullOrEmpty(id))
            {
                return(View(model));
            }
            var temp = _service.XStockReturns(id);

            model.StockReturns  = temp;
            model.TotalQuantity = temp.Sum(x => x.Quantity);
            return(View(model));
        }
Пример #2
0
        public ActionResult Pdf(string id)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user = _systemService.GetUserAndRole(0, userName);
            if (user == null)
            {
                return RedirectToAction("Index", "Login");
            }

            if (user.StockOutR == 0)
            {
                return RedirectToAction("Index", "Home");
            }

            var item = new XStockReturnParent();
            if (!string.IsNullOrEmpty(id))
            {
                item = _service.XStockReturnParent(id);
            }
            else
            {
                item.Srv = _service.SRVLastest("");
            }

            var model = new XReturnPdfViewModel
            {
                From = item.From,
                To = item.To,
                ProjectCode = item.ProjectCode,
                ProjectName = item.ProjectName,
                Srv = item.Srv,
                Date = item.Date,
                UserLogin = user
            };

            if (string.IsNullOrEmpty(id)) return View(model);
            var temp = _service.XStockReturns(id);
            model.StockReturns = temp;

            return View(model);
        }