public StockReportModel Create(Product entity) { var inventory = entity.Inventories?.FirstOrDefault() ?? new WarehouseInventory() { ReservedQuantity = 0, TotalQuantity = 0 }; var model = new StockReportModel() { ProductId = entity.Id, Published = entity.Published, StockQuantity = inventory.AvailableQuantity, ReservedQuantity = inventory.ReservedQuantity, ProductName = entity.Name, HasVariants = entity.HasVariants }; if (entity.HasVariants) { model.Variants = entity.ProductVariants.Select(variant => { var variantInventory = variant.Inventories?.FirstOrDefault(); return(new StockReportModel.VariantStockReportModel() { StockQuantity = variantInventory?.AvailableQuantity ?? 0, ReservedQuantity = variantInventory?.ReservedQuantity ?? 0, AttributeText = string.Join('\n', variant.ProductVariantAttributes.Select(x => $"{x.ProductAttribute.Label}: {x.ProductAttributeValue.Label}")) }); }).ToList(); } return(model); }
public StockReportModel GetIncomingStockReport() { RestaurantStock stock = null; var path = "c:\\temp\\stockshipped.json"; if (File.Exists(path)) { using (StreamReader r = new StreamReader(path)) { string json = r.ReadToEnd(); var items = JsonConvert.DeserializeObject <RestaurantStock>(json); stock = items; } } var reportModel = new StockReportModel { ReportTitle = "Incoming Stock Being Delivered This Month", Stock = stock }; return(reportModel); }
public ActionResult StockReceiptReport() { StockReportModel objModel = new StockReportModel(); objModel.ProductDetailsList = new List <ProductDetails>(); objModel.StateList = objReportManager.GetStateList(); objModel.CategoryList = objProductManager.GetCategoryList("Y"); return(View(objModel)); }
public ActionResult StockReceiptReport() { StockReportModel objModel = new StockReportModel(); objModel.ProductDetailsList = new List <ProductDetails>(); objModel.StateList = objReportManager.GetStateList(); string LoginPartyName = (Session["LoginUser"] as User).PartyName; string LoginPartyCode = (Session["LoginUser"] as User).PartyCode; int LoginGroupId = (Session["LoginUser"] as User).GroupId; objModel.PartyName = LoginPartyName; objModel.PartyCode = LoginPartyCode; objModel.GroupId = LoginGroupId; objModel.CategoryList = objProductManager.GetCategoryList("Y"); return(View(objModel)); }
public ActionResult StockReport() { StockReportModel objModel = new StockReportModel(); objModel.ProductDetailsList = new List <ProductDetails>(); //objModel.ProductDetailsList = objReportManager.GetAllProducts(0); //var jsonSerialiser = new JavaScriptSerializer(); //if (objModel.ProductDetailsList.Count > 0) //{ // //var jsonProduct = jsonSerialiser.Serialize(objModel.ProductDetailsList); // var jsonProduct=Json(objModel.ProductDetailsList, JsonRequestBehavior.AllowGet); // jsonProduct.MaxJsonLength = int.MaxValue; // ViewBag.ProductJsonList = jsonProduct; //} //else //{ // ViewBag.ProductJsonList = ""; //} return(View(objModel)); }
public StockReportModel GetStockItemToOrder() { RestaurantStock stock = null; var path = "c:\\temp\\stockorder.json"; if (File.Exists(path)) { using (StreamReader r = new StreamReader(path)) { string json = r.ReadToEnd(); var items = JsonConvert.DeserializeObject <RestaurantStock>(json); stock = items; } } var reportModel = new StockReportModel { ReportTitle = "Items of Stock that Require Ordering", Stock = stock }; return(reportModel); }