public ActionResult AddInvoice(Guid CustomerId, Guid?SalesOrderId) { SalesOrder salesOrder = new SalesOrder(); SalesOrderModel salesOrderModel = new SalesOrderModel(); if (SalesOrderId != null && SalesOrderId != new Guid()) { salesOrder = salesFacade.GetSalesOrderBySalesOrderId(SalesOrderId.Value); if (salesOrder != null) { List <SalesOrderDetailVM> salesDetailList = salesDetailFacade.GetAllSalesDetailsBySaleOrderId(salesOrder.SalesOrderId); salesOrderModel.SalesOrder = salesOrder; salesOrderModel.SalesOrderDetailList = salesDetailList; } } else { salesOrderModel.SalesOrder = salesOrder; salesOrderModel.SalesOrderDetailList = new List <SalesOrderDetailVM>(); } #region Viewbag List <SelectListItem> WarehouseList = new List <SelectListItem>(); WarehouseList.AddRange(wareHouseFacade.GetAll().Select(x => new SelectListItem() { Text = x.WarehouseName, Value = x.WarehouseId.ToString() }).ToList()); //ViewBag.LeadUserList = SalesList; ViewBag.WarehouseList = WarehouseList; #endregion ViewBag.CustomerId = CustomerId; return(View(salesOrderModel)); }
public ActionResult AddPWM(int?id) { ProductWarehouseMap model = new ProductWarehouseMap(); List <SelectListItem> ProductList = new List <SelectListItem>(); List <SelectListItem> WarehouseList = new List <SelectListItem>(); if (id == null) { ProductList.Add(new SelectListItem { Text = "Products", Value = "00000000-0000-0000-0000-000000000000" }); ViewBag.ProductList = ProductList; WarehouseList.Add(new SelectListItem { Text = "Warehouses", Value = "00000000-0000-0000-0000-000000000000" }); ViewBag.WarehouseList = WarehouseList; } //ViewBag.ProductList = productsFacade.GetAll().Select(x => // new SelectListItem() // { // Text = x.ProductName.ToString() + "(" + x.Category + " - " + x.SubCategory + ")", // Value = x.ProductId.ToString() // }).ToList(); //ViewBag.WarehouseList = wareHouseFacade.GetAll().Select(x => // new SelectListItem() // { // Text = x.WarehouseName.ToString(), // Value = x.WarehouseId.ToString() // }).ToList(); if (id.HasValue && id > 0) { model = pWMFacade.Get(id.Value); WareHouse wareHouse = wareHouseFacade.GetAll().Where(x => x.WarehouseId == model.WarehouseId).FirstOrDefault(); WarehouseList.Add(new SelectListItem { Text = wareHouse.WarehouseName, Value = wareHouse.WarehouseId.ToString(), Selected = true }); ViewBag.WarehouseList = WarehouseList; Product product = productsFacade.GetAll().Where(x => x.ProductId == model.ProductId).FirstOrDefault(); ProductList.Add(new SelectListItem { Text = product.ProductName, Value = product.ProductId.ToString(), Selected = true }); ViewBag.ProductList = ProductList; } return(View(model)); }
public ActionResult DashboardPartial() { DashboardViewModel dashboardViewModel = new DashboardViewModel(); dashboardViewModel.products_count = productsFacade.GetAll().Sum(x => x.Quantity); dashboardViewModel.warehouses_count = wareHouseFacade.GetAll().Count(); dashboardViewModel.users_count = userFacade.GetAll().Count(); List <Product> FinishedProduct = productsFacade.GetAll().Where(x => x.Quantity <= 5).ToList(); List <PaymentReceive> paymentReceives = paymentFacade.GetAll(); dashboardViewModel.UnpaidInvoices = paymentFacade.GetAll().Where(x => x.PaymentStatus == "UnPaid" || x.PaymentStatus == "Partially Paid").Take(5).ToList(); dashboardViewModel.UnpaidInvoiceAmount = dashboardViewModel.UnpaidInvoices.Sum(x => x.BalanceDue); dashboardViewModel.PaidInvoiceAmount = paymentReceives.Where(x => x.PaymentStatus == "Paid").ToList().Sum(x => x.PaymentAmount); dashboardViewModel.FinishedProducts = FinishedProduct; return(View(dashboardViewModel)); }