public IActionResult Report(ReportViewModel model, int dogovorid) { List <string> list = new List <string> { "Название", "Цена", "Откуда", "Куда", "Время выполнения", "Объем товара", "Вес товара" }; var clientsall = _client.Read(null); var clients = _client.Read(new ClientBindingModel { Id = 0 }); foreach (var client in clientsall) { var dogovorofclient = _dogovor.Read(new DogovorBindingModel { ClientId = client.Id, AgentId = (int)Program.Agent.Id }); if (dogovorofclient.Count >= 0) { clients.Add(client); } } SaveToPdf.CreateDocDogovor(new Info { FileName = model.puth + $"ReportDogovorpdf{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.pdf", Colon = list, Title = $" Договор {dogovorid}", Client = _client.Read(new ClientBindingModel { Id = Program.ClientId })[0].ClientFIO, Agent = Program.Agent.Name, dogovor = _dogovor.Read(new DogovorBindingModel { Id = dogovorid })[0], dogovor_Reis = _dogovor.ReadReis(null), raion = _raion.Read(null), reiss = _reis.Read(null) }); return(RedirectToAction("Dogovor", new { id = Program.ClientId })); }
public IActionResult Reis(int raion, ReisSpisokModel model) { ViewBag.Reiss = _reis.Read(null); var Raion = raions.Read(null); ViewBag.Raions = Raion; Raion.Insert(0, new RaionViewModel { Name = "Все", Id = 0 }); ReisSpisokModel plvm = new ReisSpisokModel { Raion = new SelectList(Raion, "Id", "Name") }; var reisView = _reis.Read(null); List <ReisViewModel> reisV = new List <ReisViewModel>() { }; ViewBag.Reiss = reisV; if (Validation(model) == true) { foreach (var i in reisView) { if ((i.Cena > Convert.ToDouble(model.Cena1)) && (i.Cena < Convert.ToDouble(model.Cena2)) && (raion != 0)) { if ((i.OfId == raion) || (i.ToId == raion) || (raion == 0)) { reisV.Add(i); } } } } else { ViewBag.Reiss = _reis.Read(null); } return(View(plvm)); }
public IActionResult Report() { var raions = _raions.Read(null); var dogovors = _dogovor.Read(null); var reiss = _reis.Read(null); var Texts = new List <string> { }; var list = new List <List <string> > { }; if (TempData["ErrorLack"] != null) { ModelState.AddModelError("", TempData["ErrorLack"].ToString()); } foreach (var raion in raions) { Texts = new List <string> { raion.Name, SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 1, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 2, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 3, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 4, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 5, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 6, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 7, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 8, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 9, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 10, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 11, 1)), SaveToPdf.Count(new Info { dogovors = _dogovor.Read(new DogovorBindingModel { AgentId = (int)Program.Agent.Id }), reiss = _reis.Read(null) }, raion, new DateTime(2020, 12, 1)) }; list.Add(Texts); } ViewBag.list = list; return(View()); }