Ejemplo n.º 1
0
        // GET: Invoices/Client/5
        public async Task <IActionResult> Client(int?id)
        {
            var data = new ClientInvoicesViewModel()
            {
                Client   = await _context.Accounts.FirstOrDefaultAsync(m => m.AccountId == id),
                Invoices = await _context.Set <ClientInvoicesPayments>()
                           .FromSql("dbo.ClientStatement @ID = {0}, @From = NULL, @To = NULL", id).ToListAsync()  // await _context.Invoices.Include(i => i.InvoiceType).Where(m => m.AccountId == id).ToListAsync()
            };

            return(View(data));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> ClientStatement()
        {
            var query           = HttpContext.Request.QueryString.Value;
            var queryDictionary = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(query);
            var request         = new DataTablesRequest <Items>(queryDictionary);

            string searchTerm = request.GlobalSearchValue,
                   _filter    = queryDictionary.FirstOrDefault(p => p.Key == "id").Value; // accountID
            int pageNum       = request.PageNumber,
                pageSize      = request.PageSize;

            var list = _context.Set <ClientInvoicesPayments>().FromSql("dbo.ClientStatement @ID={0}, @Archived=1", _filter).OrderByDescending(p => p.RowNo);

            return(Json(new
            {
                draw = request.Draw,
                recordsFiltered = await list.CountAsync(),
                recordsTotal = await list.CountAsync(),
                data = await list.Skip((pageNum - 1) * pageSize).Take(pageSize).ToListAsync()
            }));
        }