Beispiel #1
0
        public ActionResult Edit(long id)
        {
            GetDefaultData();
            var order = salesServices.GetModelById(id);

            if (order == null)
            {
                ViewBag.message = string.Format("Not fount delivery bill with id {0}", id);
                RedirectToAction("Index");
            }
            ViewBag.Islook = "look";
            return(View(order));
        }
Beispiel #2
0
        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));
            }
        }