Ejemplo n.º 1
0
        public ActionResult CostList(int id = 0)
        {
            try
            {
                if (id != 0)
                {
                    ViewBag.msg = 1;
                }

                var    result       = _costservice.GetAll();
                double totalbalance = 0;

                foreach (var p in result.Data)
                {
                    totalbalance += p.Amount;
                }

                ViewBag.totalbalance = (totalbalance);

                ViewBag.totalbalance1 = NumberToWord.NumberToWords((int)totalbalance);
                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content("Problem is : " + result.Message));
                }
                CostListModel cost = new CostListModel();
                cost.CostLogs  = result.Data;
                cost.Employees = _employeeservice.GetAll().Data;
                return(View(cost));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
Ejemplo n.º 2
0
        public ActionResult CostList(string key1, string key2)
        {
            try
            {
                string key = "";
                if (key1 != null && key2 != null)
                {
                    if (!key1.Contains("Month") && !key2.Contains("Year"))
                    {
                        key = key1.Substring(0, 3) + "-" + key2.Substring(2);
                    }
                    else if (key1.Contains("Month"))
                    {
                        key = key2.Substring(2);
                    }
                    else if (key2.Contains("Year"))
                    {
                        key = "-" + key1.Substring(0, 3);
                    }
                }
                else if (key1.Contains("Employee Name"))
                {
                    key = " ";
                }
                else if (key2 == null)
                {
                    key = key1;
                }

                else
                {
                    key = " ";
                }
                var result = _costservice.GetAll(key);

                ViewBag.totalclient = result.Data.Count;
                double totalbalance = 0;

                foreach (var p in result.Data)
                {
                    totalbalance += p.Amount;
                }

                ViewBag.totalbalance = (totalbalance);

                ViewBag.totalbalance1 = NumberToWord.NumberToWords((int)totalbalance);

                CostListModel cost = new CostListModel();
                cost.CostLogs  = result.Data;
                cost.Employees = _employeeservice.GetAll().Data;
                return(View(cost));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }