// GET: /JobOrderHeader/Create public ActionResult Create(int id)//DocumentTypeId { RecipeHeaderViewModel p = new RecipeHeaderViewModel(); p.DocDate = DateTime.Now; p.DueDate = DateTime.Now; p.CreatedDate = DateTime.Now; p.DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; p.SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; p.DocTypeId = id; p.ProcessId = _ProcessService.Find(ProcessConstants.Dyeing).ProcessId; p.PersonProcessId = _ProcessService.Find(ProcessConstants.Sales).ProcessId; PrepareViewBag(id); LastValues LastValues = _RecipeHeaderService.GetLastValues(p.DocTypeId); if (LastValues != null) { if (LastValues.JobWorkerId != null) { p.JobWorkerId = (int)LastValues.JobWorkerId; } if (LastValues.GodownId != null) { p.GodownId = (int)LastValues.GodownId; } if (LastValues.OrderById != null) { p.OrderById = (int)LastValues.OrderById; } if (LastValues.TestingQty != null) { p.TestingQty = LastValues.TestingQty; } } p.DueDate = DateTime.Now; p.DocNo = _documentTypeService.FGetNewDocNo("DocNo", ConfigurationManager.AppSettings["DataBaseSchema"] + ".JobOrderHeaders", p.DocTypeId, p.DocDate, p.DivisionId, p.SiteId); ViewBag.Mode = "Add"; ViewBag.Name = _documentTypeService.Find(id).DocumentTypeName; ViewBag.id = id; return(View(p)); }