public JsonResult GetPODetails(string pono) { var detail = _inwardFromSupplierService.GetDetailsByPoNo(pono); string msg = string.Empty; var podetail = _purchaseOrderDetailService.GetDetailByPoNo(pono); string DelDate = podetail.DelDate.ToShortDateString(); string PODate = podetail.PoDate.ToShortDateString(); string remarks = string.Empty; double count = 0; if (podetail.DelDate.Date < DateTime.Now.Date) { count = (DateTime.Now.Date - podetail.DelDate.Date).TotalDays; if (count != 1) { remarks = (int)count + " days delay"; } else { remarks = (int)count + " day delay"; } } else if (podetail.DelDate.Date > DateTime.Now.Date) { count = (podetail.DelDate.Date - DateTime.Now.Date).TotalDays; if (count != 1) { remarks = (int)count + " days earlier"; } else { remarks = (int)count + " day earlier"; } } if (detail == null) { msg = "From PO"; } else { msg = "From Inward"; } return(Json(new { DelDate, PODate, podetail.DelAt, remarks, msg }, JsonRequestBehavior.AllowGet)); }