Пример #1
0
        // GET: Admin/Payments
        public ActionResult Index()
        {
            filter = GetFilter();

            if (!filter.Date.HasValue)
            {
                filter.Date = new DateTime(DateTime.Now.Year, 1, 1, 0, 0, 0); //DateTime.Now.AddMonths(-1);
            }
            if (!filter.DateEnd.HasValue)
            {
                filter.DateEnd = DateTime.Now;
            }

            model.Filter = filter;
            var mFilter = FilterModel.Extend <LkFilter>(filter);

            var userId     = CurrentUser.UserId;
            var userSubscr = _Repository.GetUserSubscrDefault(userId);

            if (userSubscr != null)
            {
                model.List = _Repository.GetPayments(userSubscr.Id, mFilter);
                if (model.List != null && model.List.Items != null && model.List.Items.Count() > 0)
                {
                    var summaZaPeriod = model.List.Items.Select(s => s.Amount).Sum();
                    model.SummaZaPeriod = summaZaPeriod.HasValue ? summaZaPeriod.Value : 0m;
                }
            }

            return(View(ViewName, model));
        }
Пример #2
0
        //Список продуктов категории
        public ActionResult List(Guid id)
        {
            //Шаблон
            ViewName = _Repository.GetModuleView(ControllerName, ActionName);
            if (string.IsNullOrEmpty(ViewName))
            {
                throw new Exception("Не указан шаблон представления для данного контроллера и метода");
            }

            var model = new ProductCategoryFrontModel()
            {
                LayoutInfo  = _layoutData,
                Breadcrumbs = _breadcrumb,
                PageName    = _pageName,
                User        = CurrentUser
            };

            model.Item = _Repository.GetCartCategory(id);
            if (model.Item != null)
            {
                filter = GetFilter();
                var cFilter = FilterModel.Extend <CartFilter>(filter);
                cFilter.CategoryId = id;

                model.Item.Products = _Repository.GetProducts(cFilter);

                var userId = CurrentUser.UserId;
                model.InCart = _Repository.GetCartItemsIdList(userId);
            }

            return(View(ViewName, model));
        }
Пример #3
0
        // GET: Admin/Payments
        public ActionResult Index(Guid?subscr)
        {
            if (subscr == null)
            {
                return(Redirect("/admin/subscrs"));
            }
            filter = GetFilter();
            var mFilter = FilterModel.Extend <LkFilter>(filter);

            mFilter.Status = ViewBag.Status = Request.Params["status"];
            mFilter.Type   = ViewBag.Type = Request.Params["type"];


            model.List = _cmsRepository.GetPayments((Guid)subscr, mFilter);


            if (mFilter.Date.HasValue)
            {
                ViewBag.beginDate = mFilter.Date.Value.ToString("dd.MM.yyyy");
            }

            if (mFilter.DateEnd.HasValue)
            {
                ViewBag.endDate = mFilter.DateEnd.Value.ToString("dd.MM.yyyy");
            }


            return(View(model));
        }
Пример #4
0
        //Список сделанных заказов
        public ActionResult Index()
        {
            //Шаблон
            ViewName = _Repository.GetModuleView(ControllerName, ActionName);
            if (string.IsNullOrEmpty(ViewName))
            {
                throw new Exception("Не указан шаблон представления для данного контроллера и метода");
            }

            filter = GetFilter();

            if (!filter.Date.HasValue)
            {
                filter.Date = DateTime.Now.AddYears(-1);
            }
            if (!filter.DateEnd.HasValue)
            {
                filter.DateEnd = DateTime.Now;
            }

            model.Filter = filter;

            var cFilter = FilterModel.Extend <CartFilter>(filter);

            cFilter.UserId = CurrentUser.UserId;

            model.List = _Repository.GetOrders(cFilter);

            return(View(ViewName, model));
        }
Пример #5
0
        public ActionResult Index()
        {
            filter = GetFilter();

            var userId     = CurrentUser.UserId;
            var userSubscr = _Repository.GetUserSubscrDefault(userId);

            if (userSubscr != null)
            {
                var pFilter = FilterModel.Extend <LkFilter>(filter);
                model.List = _Repository.GetSubscrDevices(userSubscr.Id, pFilter);
            }

            if (filter.Date.HasValue)
            {
                ViewBag.beginDate = filter.Date.Value.ToString("dd.MM.yyyy");
            }

            if (filter.DateEnd.HasValue)
            {
                ViewBag.endDate = filter.DateEnd.Value.ToString("dd.MM.yyyy");
            }

            return(View(ViewName, model));
        }
Пример #6
0
        //Нплаченные платежи
        public ActionResult Index()
        {
            filter = GetFilter();

            if (!filter.Date.HasValue)
            {
                filter.Date = new DateTime(DateTime.Now.Year, 1, 1, 0, 0, 0); //DateTime.Now.AddMonths(-1);
            }
            if (!filter.DateEnd.HasValue)
            {
                filter.DateEnd = DateTime.Now;
            }

            model.Filter = filter;
            var mFilter = FilterModel.Extend <LkFilter>(filter);

            if (!string.IsNullOrEmpty(mFilter.Category))
            {
                mFilter.Payed = (filter.Category == "1") ? true : false;
            }


            var userId     = CurrentUser.UserId;
            var userSubscr = _Repository.GetUserSubscrDefault(userId);

            if (userSubscr != null)
            {
                model.List = _Repository.GetInvoices(userSubscr.Id, mFilter);
            }


            return(View(ViewName, model));
        }
Пример #7
0
        /// <summary>
        /// Дебит кредит баланс
        /// </summary>
        /// <returns></returns>
        public ActionResult DebitCredit()
        {
            if (!_Repository.ModuleAllowed(ControllerName))
            {
                Response.Redirect("/page/error/451");
            }

            //Шаблон
            ViewName = _Repository.GetModuleView(ControllerName, ActionName);
            if (string.IsNullOrEmpty(ViewName))
            {
                throw new Exception("Не указан шаблон представления для данного контроллера и метода");
            }

            var filter = GetFilter();

            //if (!filter.Date.HasValue)
            //    filter.Date = new DateTime(DateTime.Now.Year, 1, 1, 0, 0, 0);
            //if (!filter.DateEnd.HasValue)
            //    filter.DateEnd = DateTime.Now;

            var model = new StatisticsFrontModel();

            ViewName = _Repository.GetModuleView(ControllerName, ActionName);

            model.Filter = filter;

            var userId     = CurrentUser.UserId;
            var userSubscr = _Repository.GetUserSubscrDefault(userId);

            if (userSubscr != null)
            {
                var pFilter = FilterModel.Extend <LkFilter>(filter);
                pFilter.Size = 10;


                var subscrBalances = _Repository.GetSubscrSaldoInfo(userId);
                model.Balance = (subscrBalances != null) ? subscrBalances.SingleOrDefault(s => s.Default == true) : null;

                model.DebitCreditData = _Repository.GetDebitCreditData(userSubscr.Id, pFilter);
                //if (model.DebitCreditData != null && model.DebitCreditData.Items != null && model.DebitCreditData.Items.Count() > 0)
                //{
                //    foreach (var balance in model.DebitCreditData.Items)
                //    {
                //        if (balance.PeriodId.HasValue)
                //        {
                //            var str = balance.PeriodId.Value.ToString();
                //            var year = str.Substring(0, 4);
                //            var month = str.Substring(4, 1) == "0" ? str.Substring(5, 1) : str.Substring(4, 2);

                //            balance.Period = new DateTime(int.Parse(year), int.Parse(month), 1, 0, 0, 0);
                //        }
                //    }
                //}
            }

            return(PartialView(ViewName, model));
        }
Пример #8
0
        // GET: Admin/Users
        public ActionResult Index()
        {
            filter       = GetFilter();
            model.Filter = GetFilterTree();
            var userFilter = FilterModel.Extend <UserFilter>(filter);

            model.List = _cmsRepository.GetSiteAdmins(userFilter);

            return(View(model));
        }
Пример #9
0
        // GET: Admin/Modules
        public ActionResult Index()
        {
            filter = GetFilter();
            var mfilter = FilterModel.Extend <ModuleFilter>(filter);

            model.List = _cmsRepository.GetModules(mfilter);

            ViewBag.SearchText = filter.SearchText;
            return(View(model));
        }
        public ActionResult Index()
        {
            model.PageName = "Категории товаров и услуг";
            filter         = GetFilter();
            model.Filter   = filter;
            var cFilter = FilterModel.Extend <CartFilter>(filter);

            model.List = _cmsRepository.GetCartCategories(cFilter);

            return(View(model));
        }
Пример #11
0
        // GET: Admin/Lk
        public ActionResult Index()
        {
            model.PageName = "Товары и услуги";
            filter         = GetFilter();
            model.Filter   = filter;
            var cFilter = FilterModel.Extend <CartFilter>(filter);

            model.List = _cmsRepository.GetProducts(cFilter);

            return(View(model));
        }
Пример #12
0
        // GET: Admin/SiteModules
        public ActionResult Index()
        {
            filter = GetFilter();
            var mfilter = FilterModel.Extend <ModuleFilter>(filter);

            model.Item         = _cmsRepository.GetSite(SiteId);
            model.Item.Modules = _cmsRepository.GetSiteModulesList(SiteId);

            ViewBag.SearchText = filter.SearchText;
            return(View(model));
        }
Пример #13
0
        // GET: Admin/Lk
        public ActionResult Index()
        {
            model.PageName = "Заказы";
            filter         = GetFilter();
            model.Filter   = filter;
            var cFilter = FilterModel.Extend <CartFilter>(filter);

            model.List = _cmsRepository.GetOrders(cFilter);

            return(View(model));
        }
Пример #14
0
        // GET: Admin/Messages
        public ActionResult Index()
        {
            filter = GetFilter();
            var mfilter = FilterModel.Extend <MessagesFilter>(filter);

            if (Request.QueryString["viewmsg"] != null)
            {
                mfilter.ViewMessages = Convert.ToBoolean(Request.QueryString["viewmsg"]);
            }
            model.List = _cmsRepository.GetMessages(mfilter);
            return(View(model));
        }
        public ActionResult Item(Guid id)
        {
            model.PageName = "Категория товаров и услуг";
            model.Item     = _cmsRepository.GetCartCategory(id);
            if (model.Item != null)
            {
                filter = GetFilter();
                var cFilter = FilterModel.Extend <CartFilter>(filter);
                cFilter.CategoryId = id;

                model.ProductsList = _cmsRepository.GetProductsList(cFilter);
                ViewBag.Image      = model.Item.Icon;
            }

            return(View("Item", model));
        }
Пример #16
0
        // GET: Admin/Events
        public ActionResult Index()
        {
            #region filter
            filter = GetFilter();
            var mfilter = FilterModel.Extend <EventFilterModel>(filter);

            var annual = false;
            if (!String.IsNullOrEmpty(Request.QueryString["annual"]))
            {
                bool.TryParse(Request.QueryString["annual"], out annual);
                mfilter.Annual = annual;
            }
            #endregion
            model.List = _cmsRepository.GetEventsList(mfilter);
            return(View(model));
        }
Пример #17
0
        public ActionResult SiteModuleTemplatesList()
        {
            filter = GetFilter();
            var tfilter = FilterModel.Extend <TemplateFilter>(filter);

            var controller = Guid.Empty;

            if (!string.IsNullOrEmpty(filter.Group) && Guid.TryParse(filter.Group, out controller))
            {
                tfilter.Controller = controller;
            }

            model.List = _cmsRepository.GetTemplates(tfilter);

            ViewBag.SearchText = filter.SearchText;
            ViewBag.Group      = filter.Group;

            return(View("Areas/admin/View/Templates/Modal/ModuleTemplates.cshtml", model));
        }
Пример #18
0
        // GET: Admin/Pages
        public ActionResult Index(string group)
        {
            filter = GetFilter();
            var mfilter = FilterModel.Extend <PageFilterModel>(filter);

            if (!String.IsNullOrEmpty(group))
            {
                mfilter.GroupId = Guid.Parse(group);
                ViewBag.Group   = group;
            }

            model.List = _cmsRepository.GetPages(mfilter);

            model.Filter = GetFilterTree();



            return(View(model));
        }
Пример #19
0
        //Новый заказ
        public ActionResult Confirm()
        {
            //Шаблон
            ViewName = _Repository.GetModuleView(ControllerName, ActionName);
            if (string.IsNullOrEmpty(ViewName))
            {
                throw new Exception("Не указан шаблон представления для данного контроллера и метода");
            }

            filter = GetFilter();
            var mFilter = FilterModel.Extend <LkFilter>(filter);

            mFilter.Payed = false;

            var userId = CurrentUser.UserId;


            return(View(ViewName, model));
        }
Пример #20
0
        // GET: Admin/Templates
        public ActionResult Index()
        {
            filter = GetFilter();
            var tfilter = FilterModel.Extend <TemplateFilter>(filter);

            var controller = Guid.Empty;

            if (!string.IsNullOrEmpty(filter.Group) && Guid.TryParse(filter.Group, out controller))
            {
                tfilter.Controller = controller;
            }

            model.List = _cmsRepository.GetTemplates(tfilter);

            model.Modules = _cmsRepository.GetModulesList();

            ViewBag.SearchText = filter.SearchText;
            ViewBag.Group      = filter.Group;

            return(View(model));
        }
Пример #21
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            //Шаблон
            ViewName = _Repository.GetModuleView(ControllerName, ActionName);
            if (string.IsNullOrEmpty(ViewName))
            {
                throw new Exception("Не указан шаблон представления для данного контроллера и метода");
            }

            filter = GetFilter();

            if (!filter.Date.HasValue)
            {
                filter.Date = new DateTime(DateTime.Now.Year, 1, 1, 0, 0, 0);
            }
            if (!filter.DateEnd.HasValue)
            {
                filter.DateEnd = DateTime.Now;
            }

            var userId     = CurrentUser.UserId;
            var userSubscr = _Repository.GetUserSubscrDefault(userId);

            if (userSubscr != null)
            {
                var pFilter = FilterModel.Extend <LkFilter>(filter);
                model.List = _Repository.GetSubscrDevices(userSubscr.Id, pFilter);

                var cons = _Repository.GetConsumptionStatistics(userSubscr.Id, pFilter);
                if (cons != null && cons.Count() > 0)
                {
                    var data = cons.Reverse();
                    model.СonsumptionDataJson = "[['Месяц','Потребление', 'Мощность']," + string.Join(",", data.Select(s => string.Format("['{0}',{1},{2}]", s.Period.Value.ToString("MMM"), s.ConsumptionAmount1.Value.ToString("0.00").Replace(",", "."), s.ConsumptionAmount2.Value.ToString("0.00").Replace(",", ".")))) + "]";
                }
            }
            model.Filter = filter;

            return(View(ViewName, model));
        }
Пример #22
0
        public ActionResult Index(Guid?subscr)
        {
            if (subscr == null)
            {
                return(Redirect("/admin/subscrs"));
            }
            filter = GetFilter();
            var mFilter = FilterModel.Extend <LkFilter>(filter);

            if (!String.IsNullOrEmpty(Request.QueryString["payed"]))
            {
                var res = bool.TryParse(Request.QueryString["payed"], out bool payed);
                if (res)
                {
                    mFilter.Payed = payed;
                }
            }
            model.List = _cmsRepository.GetInvoices((Guid)subscr, mFilter);


            if (mFilter.Date.HasValue)
            {
                ViewBag.beginDate = mFilter.Date.Value.ToString("dd.MM.yyyy");
            }

            if (mFilter.DateEnd.HasValue)
            {
                ViewBag.endDate = mFilter.DateEnd.Value.ToString("dd.MM.yyyy");
            }

            if (mFilter.Payed.HasValue)
            {
                ViewBag.payed = mFilter.Payed.Value.ToString();
            }

            return(View(model));
        }
Пример #23
0
        //Список категорий продуктов
        public ActionResult Index()
        {
            //Шаблон
            ViewName = _Repository.GetModuleView(ControllerName, ActionName);
            if (string.IsNullOrEmpty(ViewName))
            {
                throw new Exception("Не указан шаблон представления для данного контроллера и метода");
            }

            filter = GetFilter();
            var cFilter = FilterModel.Extend <CartFilter>(filter);

            var model = new ProductCategoryFrontModel()
            {
                LayoutInfo  = _layoutData,
                Breadcrumbs = _breadcrumb,
                PageName    = _pageName,
                User        = CurrentUser
            };

            model.List = _Repository.GetCartCategories(cFilter);

            return(View(ViewName, model));
        }
Пример #24
0
        //Статистика по платежам и начислениям
        public ActionResult Index()
        {
            filter = GetFilter();
            var aFilter = FilterModel.Extend <LkFilter>(filter);
            var pFilter = FilterModel.Extend <LkFilter>(filter);

            var userId     = CurrentUser.UserId;
            var userSubscr = _Repository.GetUserSubscrDefault(userId);

            if (userSubscr != null)
            {
#pragma warning disable CS1061 // 'FrontRepository' does not contain a definition for 'GetInvoices' and no extension method 'GetInvoices' accepting a first argument of type 'FrontRepository' could be found (are you missing a using directive or an assembly reference?)
                var accruals = _Repository.GetInvoices(userSubscr.Id, aFilter);
#pragma warning restore CS1061 // 'FrontRepository' does not contain a definition for 'GetInvoices' and no extension method 'GetInvoices' accepting a first argument of type 'FrontRepository' could be found (are you missing a using directive or an assembly reference?)
                if (accruals.Items != null && accruals.Items.Count() > 0)
                {
                    var data = accruals.Items
                               .GroupBy(p => p.Period)
                               .Select(p => new PaymentModel()
                    {
                        Date = DateTime.Parse($"{ p.First().Date.Year }-{p.First().Date.Month}-01"),
                        //Quantity = p.Count(),
                        PeriodId = p.First().PeriodId,
                        Amount   = p.Sum(c => c.Amount),
                    }).ToArray()
                               .Reverse();

                    filter.Date              = data.First().Date;
                    filter.DateEnd           = DateTime.Now;
                    model.InvoicesByDateJson = "[['Месяцы','рубли']," + string.Join(",", data.Where(s => s.Amount != null).Select(s => string.Format("['{0}',{1}]", s.Date.ToString("MM.yyyy"), s.Amount.Value.ToString("0.00").Replace(",", ".")))) + "]";
                }
                // model.InvoicesByDateJson = "[['Месяцы','рубли'],['декабрь',8651486.31],['январь',13223292.59],['февраль',11916139.67],['март',1501363.17],['апрель',10639269.23],['май',11251567.51],['июнь',0.00]]";


                var payments = _Repository.GetPayments(userSubscr.Id, pFilter);
                if (payments.Items != null && payments.Items.Count() > 0)
                {
                    var data = payments.Items
                               .GroupBy(p => p.Period)
                               .Select(p => new PaymentModel()
                    {
                        Date = DateTime.Parse($"{ p.First().Date.Year }-{p.First().Date.Month}-01"),
                        //Quantity = p.Count(),
                        PeriodId = p.First().PeriodId,
                        Amount   = p.Sum(c => c.Amount),
                    }).ToArray();

                    model.PaymentsByDateJson = "[['Месяцы','рубли']," + string.Join(",", data.Where(s => s.Amount != null).Select(s => string.Format("['{0}',{1}]", s.Date.ToString("MM.yyyy"), s.Amount.Value.ToString("0.00").Replace(",", ".")))) + "]";
                }
            }

            if (filter.Date.HasValue)
            {
                ViewBag.beginDate = filter.Date.Value.ToString("dd.MM.yyyy");
            }

            if (filter.DateEnd.HasValue)
            {
                ViewBag.endDate = filter.DateEnd.Value.ToString("dd.MM.yyyy");
            }


            return(View(ViewName, model));
        }
        public ActionResult Save(Guid id, CartCategoryViewModel backModel, HttpPostedFileBase upload)
        {
            ErrorMessage message = new ErrorMessage
            {
                Title = "Информация"
            };

            if (ModelState.IsValid)
            {
                backModel.Item.Id = id;

                #region Сохранение изображения
                if (upload != null && upload.ContentLength > 0)
                {
                    string allowExt = Settings.PicTypes;
                    string fileExt  = upload.FileName.Substring(upload.FileName.LastIndexOf(".")).Replace(".", "").ToLower();

                    if (allowExt.ToLower().Contains(fileExt))
                    {
                        string savePath = Settings.UserFiles + SiteId + "/cart/";
                        backModel.Item.Icon = $"{savePath}{id}.{fileExt}";

                        if (!Directory.Exists(Server.MapPath(savePath)))
                        {
                            Directory.CreateDirectory(Server.MapPath(savePath));
                        }

                        try
                        {
                            var filePath = Server.MapPath(backModel.Item.Icon);
                            if (System.IO.File.Exists(filePath))
                            {
                                System.IO.File.Delete(filePath);
                            }

                            upload.SaveAs(filePath);
                        }
#pragma warning disable CS0168 // The variable 'ex' is declared but never used
                        catch (Exception ex)
#pragma warning restore CS0168 // The variable 'ex' is declared but never used
                        {
                            //log
                        }
                    }
                }
                #endregion

                if (_cmsRepository.CheckCartCategoryExists(id))
                {
                    _cmsRepository.UpdateCartCategory(backModel.Item);
                    message.Info = "Запись обновлена";
                }
                else
                {
                    _cmsRepository.InsertCartCategory(backModel.Item);
                    message.Info = "Запись добавлена";
                }
                message.Buttons = new ErrorMessageBtnModel[]
                {
                    new ErrorMessageBtnModel {
                        Url = StartUrl + Request.Url.Query, Text = "вернуться в список"
                    },
                    new ErrorMessageBtnModel {
                        Url = $"{StartUrl}/item/{id}", Text = "ок", Action = "false"
                    }
                };
            }
            else
            {
                message.Info    = "Ошибка в заполнении формы. Поля в которых допушены ошибки - помечены цветом";
                message.Buttons = new ErrorMessageBtnModel[]
                {
                    new ErrorMessageBtnModel {
                        Url = $"{StartUrl}/item/{id}", Text = "ок", Action = "false"
                    }
                };
            }

            //----------------------------------------------

            model.PageName = "Категория товаров и услуг";
            model.Item     = _cmsRepository.GetCartCategory(id);
            if (model.Item != null)
            {
                filter = GetFilter();
                var cFilter = FilterModel.Extend <CartFilter>(filter);
                cFilter.CategoryId = id;

                model.ProductsList = _cmsRepository.GetProductsList(cFilter);
                ViewBag.Image      = model.Item.Icon;
            }

            model.ErrorInfo = message;
            return(View("Item", model));
        }
Пример #26
0
        /// <summary>
        /// Графики - ключевые показатели
        /// </summary>
        /// <returns></returns>
        public ActionResult Chart()
        {
            if (!_Repository.ModuleAllowed(ControllerName))
            {
                Response.Redirect("/page/error/451");
            }

            //Шаблон
            ViewName = _Repository.GetModuleView(ControllerName, ActionName);
            if (string.IsNullOrEmpty(ViewName))
            {
                throw new Exception("Не указан шаблон представления для данного контроллера и метода");
            }

            var filter = GetFilter();

            if (!filter.Date.HasValue)
            {
                filter.Date = new DateTime(DateTime.Now.Year, 1, 1, 0, 0, 0);
            }
            if (!filter.DateEnd.HasValue)
            {
                filter.DateEnd = DateTime.Now;
            }

            var model = new StatisticsFrontModel();

            ViewName = _Repository.GetModuleView(ControllerName, ActionName);

            model.Filter = filter;

            var userId     = CurrentUser.UserId;
            var userSubscr = _Repository.GetUserSubscrDefault(userId);

            if (userSubscr != null)
            {
                var pFilter = FilterModel.Extend <LkFilter>(filter);

                //Для двойного графика (начисления, платежи)
                var balances = _Repository.GetDebitCreditStatisticsList(userSubscr.Id, pFilter);

                if (balances != null && balances.Count() > 0)
                {
                    //foreach (var balance in balances)
                    //{
                    //    if (balance.PeriodId.HasValue)
                    //    {
                    //        var str = balance.PeriodId.Value.ToString();
                    //        var year = str.Substring(0, 4);
                    //        var month = str.Substring(4, 1) == "0" ? str.Substring(5, 1) : str.Substring(4, 2);

                    //        balance.Period = new DateTime(int.Parse(year), int.Parse(month), 1, 0, 0, 0);
                    //    }
                    //}
                    var data = balances.Reverse();
                    model.InvoicesAndPaymentsByDateJson = "[['Месяц','Начисления, ₽','Платежи, ₽']," + string.Join(",", data.Select(s => string.Format("['{0}',{1}, {2}]", s.Period.Value.ToString("MMM"), s.InvoiceAmount.Value.ToString("0.00").Replace(",", "."), s.PaymentAmount.Value.ToString("0.00").Replace(",", ".")))) + "]";

                    model.InvoicesSumByPeriod = data.Sum(i => i.InvoiceAmount) ?? 0.0m;
                    model.PaymentsSumByPeriod = data.Sum(p => p.PaymentAmount) ?? 0.0m;
                }

                #region Графики по отдельности (закоментировано)
                //Для графика (начисления)
                //var invoices = _Repository.GetInvoicesList(userSubscr.Id, pFilter);
                //if(invoices!= null && invoices.Count()>0)
                //{
                //    var data = invoices.Where(i => i.DocTypeId == 39)
                //        .GroupBy(p => p.Period)
                //        .Select(p => new InvoiceModel()
                //        {
                //            Date = new DateTime(p.First().Date.Year, p.First().Date.Month, 1, 0, 0, 0, 0),
                //            Period = p.First().Period,
                //            Amount = p.Sum(c => c.Amount),
                //        }).ToArray();

                //    model.PaymentsByDateJson = "[['Месяц','руб']," + string.Join(",", data.Where(s => s.Amount != null).Select(s => string.Format("['{0}',{1}]", s.Date.ToString("MMM"), s.Amount.Value.ToString("0.00").Replace(",", ".")))) + "]";
                //}


                //Для графика (платежи)
                //var payments = _Repository.GetPaymentsList(userSubscr.Id, pFilter);
                //if (payments != null && payments.Count() > 0)
                //{
                //    var data = payments
                //        .GroupBy(p => p.Period)
                //        .Select(p => new PaymentModel()
                //        {
                //            Date = new DateTime(p.First().Date.Year, p.First().Date.Month, 1, 0, 0, 0, 0),
                //            Period = p.First().Period,
                //            Amount = p.Sum(c => c.Amount),
                //        }).ToArray();

                //    model.InvoicesByDateJson = "[['Месяц','руб']," + string.Join(",", data.Where(s => s.Amount != null).Select(s => string.Format("['{0}',{1}]", s.Date.ToString("MMM"), s.Amount.Value.ToString("0.00").Replace(",", ".")))) + "]";
                //}

                #endregion
            }

            return(PartialView(ViewName, model));
        }