///Reports//12 public ActionResult ProcessOrder(int?id) { if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Order Order = OrderService.GetOrderById(id.Value); if (Order == null) { return(HttpNotFound()); } var orderDto = AutoMapper.Mapper.Map <ReceivePOVM>(Order); orderDto.InventoryTransactionTypeId = (int)InventoryTransactionTypeEnum.WorksOrder; var appt = Order.Appointmentses.Where(m => !m.IsCanceled) .OrderByDescending(m => m.AppointmentId) .FirstOrDefault(); if (appt != null) { var resource = _appointmentsService.GetAppointmentResourceById(appt.ResourceId.Value); if (resource != null) { orderDto.WorksResourceName = resource.Name; } } if (TempData["AutoCompleteError"] != null) { ViewBag.Warning = TempData["AutoCompleteError"].ToString(); } //get http refferer if (Request.UrlReferrer != null) { string Referrer = Request.UrlReferrer.ToString(); ViewBag.RController = "WorksOrders"; ViewBag.RAction = "Index"; if (Referrer.Contains("PickList")) { ViewBag.RController = "PickList"; ViewBag.RAction = "Index"; } } return(View(orderDto)); }