public async Task<ActionResult> Incomebill() { var budgetDataSet = new budgetDataSet(); int id_comp = db.AspNetUsers.Where(u => u.UserName == User.Identity.Name).First().id_company; var income = db.income_proj.Include(c => c.project).Include(c => c.income).Include(c => c.income.income_item).Where(c => c.id_company == id_comp); foreach (var item in income) { budgetDataSet.IncomeRow dr = budgetDataSet.Income.NewIncomeRow(); dr.proj_name = item.project.project_name; dr.id_proj = item.id_proj; dr.item = item.income.income_item.item_name; dr.sum = item.sum; dr.name = item.income.income_name; dr.date = item.date; budgetDataSet.Income.Rows.Add(dr); } ViewData["table_income"] = budgetDataSet.Income; return View(await income.ToListAsync()); }
// GET: Reports public async Task<ActionResult> Costbill() { var budgetDataSet = new budgetDataSet(); int id_comp = db.AspNetUsers.Where(u => u.UserName == User.Identity.Name).First().id_company; var cost = db.cost_proj.Include(c => c.project).Include(c => c.cost).Include(c => c.cost.cost_item).Where(c => c.id_company == id_comp); foreach (var item in cost) { budgetDataSet.CostRow cr = budgetDataSet.Cost.NewCostRow(); cr.proj_name = item.project.project_name; cr.proj_id = item.id_proj; cr.item_name = item.cost.cost_item.item_name; cr.cost_sum = item.sum; cr.cost_name = item.cost.cost_name; cr.cost_date = item.date; budgetDataSet.Cost.Rows.Add(cr); } ViewData["table_cost"] = budgetDataSet.Cost; return View(await cost.ToListAsync()); }