public ActionResult CalculateCost(CalculateCostViewModel model) { string message = string.Empty; message = stockCardService.CaculateCost(model); ViewBag.Message = message; return(View(model)); // return Json(message, JsonRequestBehavior.AllowGet); }
public ActionResult CalculateCost() { var model = new CalculateCostViewModel { Year = DateTime.Now.Year, FromMonth = DateTime.Now.Month - 6, ToMonth = DateTime.Now.Month, }; return(View(model)); }
public ActionResult CalculateCostOnSaleOrder(long id) { var message = string.Empty; try { var order = salesServices.GetModelById(id); var dates = order.VoucherDate.Value; var model = new CalculateCostViewModel() { FromMonth = dates.Month, ToMonth = DateTime.Now.Month, Year = dates.Year }; message = stockCardService.CaculateCost(model); var orderN = salesServices.GetById(id); var cost = orderN.T_Amount0.Value; if (cost == 0) { cost = orderN.DT81s.ToList().Sum(x => x.Amount0.Value); } return(Json(new { Error = false, Message = message + string.Format("<br/> <span class='successfuly'> <label>Cost Of Sales:</label>{0}</span>", cost), Cost = cost, }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.LogError(ex); message = string.Format("<span class='error'> {0}</span>", ex.Message); return(Json(new { Error = true, Message = message }, JsonRequestBehavior.AllowGet)); } }