Ejemplo n.º 1
0
        public async Task <IActionResult> Subagents()
        {
            var model = new CashlessBlockViewModel
            {
                Organizations = await(from c in _db.Counterparties
                                      .Include(c => c.SubagentData)
                                      where c.Type.Description == "Субагент Р" && c.SubagentData.Balance != 0
                                      select new OrganizationCashlessInfo
                {
                    Name    = c.Name,
                    Balance = -c.SubagentData.Balance
                }).ToListAsync()
            };

            return(PartialView(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Transit()
        {
            var nfi = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone();

            nfi.NumberGroupSeparator = " ";

            var model = new CashlessBlockViewModel
            {
                Organizations = await(from lg in _db.LoanGroups
                                      where lg.IsActive && lg.Description != "Дивиденты" && lg.Balance != 0
                                      select new OrganizationCashlessInfo
                {
                    Name    = lg.Description,
                    Balance = lg.Balance
                }).ToListAsync()
            };

            return(PartialView(model));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Cashless()
        {
            var model = new CashlessBlockViewModel
            {
                Organizations = await(from o in _db.Organizations
                                      join fa in _db.FinancialAccounts on o.OrganizationId equals fa.OrganizationId
                                      group new { o, fa } by o.OrganizationId
                                      into g
                                      select new OrganizationCashlessInfo
                {
                    Name    = g.FirstOrDefault().o.Description,
                    Balance = g.Sum(gr => gr.fa.Balance)
                }).ToListAsync()
            };

            var beginIndex = model.Organizations.FindIndex(o => o.Name == "ТКП");

            model.Organizations = model.Organizations.Move(beginIndex, 1, model.Organizations.Count - 1).ToList();
            beginIndex          = model.Organizations.FindIndex(o => o.Name == "ИМ");
            model.Organizations = model.Organizations.Move(beginIndex, 1, model.Organizations.Count - 1).ToList();

            return(PartialView(model));
        }