// This list displays Items to the Project public ActionResult List(int ProjectID) { int siteCoID = base.siteusercompanyid; ViewBag.ProjectID = ProjectID; // ViewBag.CoItems = db.GetItemsBySiteCoID(siteCoID).ToList(); ViewBag.Divisions = new SelectList(db.GetDivisionsByProjectID(Convert.ToInt32(ProjectID)), nameof(GetDivisionsByProjectID_Result.ViewID), nameof(GetDivisionsByProjectID_Result.Division)); ViewBag.Areas = new MultiSelectList(db.GetAreasByProjectID(Convert.ToInt32(ProjectID)), nameof(GetAreasByProjectID_Result.ViewID), nameof(GetAreasByProjectID_Result.Division)); ViewBag.GroupList = db.GetGroupsBySiteCoID(siteCoID).Where(s => s.Group != null && s.Group != "").ToList(); ViewBag.ManufacturerList = db.GetManufacturersBySiteCoID(siteCoID).Where(s => s.Name != null && s.Name != "").ToList(); ViewBag.StageList = db.GetMasterStagesBySiteID(siteCoID).Where(s => s.Stage != null && s.Stage != "").ToList(); return(View()); }
public ActionResult AddItems(int ID, int ProjectID)//CorID { ViewBag.CorID = ID; ViewBag.ProjectID = ProjectID; ViewBag.Action = "Add"; ViewBag.Items = db.GetProjectInfoPartsAddBySiteCoID(siteusercompanyid).ToList(); ViewBag.Divisions = new SelectList(db.GetDivisionsByProjectID(ProjectID), nameof(GetDivisionsByProjectID_Result.ViewID), nameof(GetDivisionsByProjectID_Result.Division)); ViewBag.Areas = new MultiSelectList(db.GetAreasByProjectID(ProjectID), nameof(GetAreasByProjectID_Result.ViewID), nameof(GetAreasByProjectID_Result.Division)); return(View("ListItems")); }
// GET: Common/Items/Short - this displays Items within a Project public ActionResult Short(int?id, int IsCorItem = 0) { if (IsCorItem == 1) { return(CorItemShort(id)); } var item = db.GetProjectItemInfoByItemID(id).FirstOrDefault(); if (item == null) { return(HttpNotFound()); } var projectID = db.ProjectItems.Where(p => p.ItemID == id).Select(p => p.ProjectID).FirstOrDefault(); var masterStageID = db.ProjectStages.Where(p => p.ProjectStageID == item.StageID).Select(p => p.StageMasterID).FirstOrDefault(); ViewBag.Areas = new SelectList(db.GetAreasByProjectID(projectID).ToList(), nameof(GetAreasByProjectID_Result.ViewID), nameof(GetAreasByProjectID_Result.Division), item.AreaID); ViewBag.Divisions = new SelectList(db.GetDivisionsByProjectID(projectID).ToList(), nameof(GetDivisionsByProjectID_Result.ViewID), nameof(GetDivisionsByProjectID_Result.Division), item.DivisionID); ViewBag.CoStages = new SelectList(db.GetMasterStagesBySiteID(siteusercompanyid).ToList(), nameof(GetMasterStagesBySiteID_Result.ViewID), nameof(GetMasterStagesBySiteID_Result.Stage)); ViewBag.ProjectStages = new SelectList(db.GetProjectStagesByProjectID(projectID).ToList(), nameof(GetProjectStagesByProjectID_Result.ProjectStageID), nameof(GetProjectStagesByProjectID_Result.StageName), item.StageID); ViewBag.ProjectID = repo.GetProjectIDByItemID(id ?? 0); var priceModel = new Models.ItemModels.EditShortItem.PriceModel() { ItemID = id, Qty = item.Qty, UnitCost = item.UnitCost, UnitPrice = item.UnitPrice, Extension = item.Extension, Margin = item.Margin, Markup = item.Markup, Tax = item.Tax, Taxable = item.Taxable ?? false, Total = item.Total, ExcludePOR = item.ExcludePor ?? false, WarranteePart = item.WarranteePart ?? false, OneOffItem = item.OneOffItem ?? false }; var itemDetails = new ItemModels.ItemDetails() { ViewID = item.ViewID, Label = item.Label, ProductDescription = item.ProductDescription, SalesDescription = item.SalesDescription, AreaID = item.AreaID, Area = item.Area, DivisionID = item.DivisionID, Division = item.Division, Por_ = item.Por_, CustodyID = item.CustodyID, Custody = item.Custody, Qty = item.Qty, ProjectCostCodeID = item.ProjectCostCodeID, CostCode = item.CostCode, UnitCost = item.UnitCost, UnitPrice = item.UnitPrice, Extension = item.Extension, Margin = item.Margin, Markup = item.Markup, Tax = item.Tax, TaxRate = item.TaxRate, Taxable = item.Taxable, Total = item.Total, ExcludePor = item.ExcludePor, WarranteePart = item.WarranteePart, OneOffItem = item.OneOffItem, StageID = item.StageID, Stage = item.Stage, Hours = item.Hours, ProjectTotalHours = item.ProjectTotalHours, }; ViewBag.Item = itemDetails; var model = new Models.ItemModels.EditShortItem() { Price = priceModel }; var subLabors = db.GetSubLaborInfoByProjectItemID(id, projectID, masterStageID).ToList(); var Labors = new StageModels.StageMasterEdit(); if (subLabors != null) { foreach (var sub in subLabors) { Labors.StageSubDetails.Add(new StageModels.StageDetails() { StageMasterID = (int)masterStageID, SubStageID = sub.ViewID, SubName = sub.SubName, CostPerHour = sub.LaborCost, PricePerHour = sub.LaborPrice, Percent = sub.LaborFactor, SellPerHour = sub.SellPrice }); } } ViewBag.Labors = Labors; return(View(model)); }