public void SendOrdersReport(OrderBindingModel model, string email)
        {
            string fileName = Directory.GetCurrentDirectory() + "\\Reports\\periodreport.pdf";
            string subject  = "Список заказов в период с " + model.Date.ToString() + " по " + model.DateTo.ToString();

            var orders = orderLogic.Read(model).ToList();

            Dictionary <int, List <PaymentViewModel> > payments = new Dictionary <int, List <PaymentViewModel> >();

            foreach (var order in orders)
            {
                var orderPayments = paymentLogic.Read(new PaymentBindingModel {
                    OrderId = order.Id
                }).ToList();

                payments.Add(order.Id, orderPayments);
            }

            SaveToPdf.CreateDoc(new OrderPaymentsInfo
            {
                FileName = fileName,
                Title    = subject,
                Orders   = orders,
                Payments = payments
            });

            SendMail(email, fileName, subject);
        }
        public IActionResult ReadOfDogovors(ReportModel model)
        {
            List <string> list = new List <string> {
                "Номер", "Номер агента", "Дата", "Сумма"
            };

            SaveToPdf.CreateDocAllDogovor(new Info
            {
                FileName = model.puth + $"ReportDogovorpdf{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.pdf",
                Colon    = list,
                Title    = $" Договорa",
                dogovors = _dogovor.Read(null),
                agents   = _agent.Read(null)
            });
            return(RedirectToAction("Report"));
        }
Beispiel #3
0
        public IActionResult ReadOfReportSpisok(ReportViewModel model)//кнопка отчет на странице клиент
        {
            string        filename = model.puth + $"ReportClientpdf{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.";
            List <string> list     = new List <string> {
                "Паспорт", "ФИО", "Номер телефона", "Email"
            };
            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.CreateDoc(new Info
            {
                FileName = filename + "pdf",
                Colon    = list,
                Title    = $" Список клиентов для Агента{Program.Agent.Name}",
                Clients  = clients
            });
            Mail.SendMail(model.SendMail, $"{filename}pdf", $"Список клиентов для Агента{Program.Agent.Name}");
            SaveToExcel.CreateDoc(new Info {
                FileName = filename + "xlsx",
                Colon    = list,
                Title    = $" Список клиентов для Агента{Program.Agent.Name}",
                Clients  = clients
            }


                                  );

            Mail.SendMail(model.SendMail, $"{filename}xlsx", $"Список клиентов для Агента{Program.Agent.Name} за {DateTime.Now}");

            return(RedirectToAction("Client"));
        }
        /// </summary>
        /// <returns></returns>

        public IActionResult ReadOfPereReport(ReportViewModel model)
        {
            List <string> list = new List <string> {
                "район-месяц", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
            };
            var FileName = model.puth + $"ReportPerepdf{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.pdf";

            SaveToPdf.CreateDocPere(new Info
            {
                FileName = FileName,
                Colon    = list,
                Title    = $" Список клиентов для Агента{Program.Agent.Name} по неархивированным заключенным договорам{DateTime.Now}",
                raion    = _raions.Read(null),
                dogovors = _dogovor.Read(new DogovorBindingModel {
                    AgentId = (int)Program.Agent.Id
                }),
                reiss = _reis.Read(null)
            });

            Mail.SendMail(model.SendMail, FileName, $"Отчет о работе Агента {Program.Agent.Id} за месяц {DateTime.Now.Month} года {DateTime.Now.Year}");
            return(RedirectToAction("Report"));
        }
Beispiel #5
0
        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 ReadOfAgent(string[] Month, ReportModel m)
        {
            if (Month.Length == 0)
            {
                TempData["ErrorLack"] = "Вы не выбрали месяц";
                return(RedirectToAction("Report"));
            }
            var           FileName = m.puth + $"ReportMonth{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.pdf";
            List <string> list     = new List <string> {
                "Номер", "Дата", "Агент", "Сумма"
            };
            DateTime date = AgentController.PeriodDate(Month[0]);

            SaveToPdf.ZpMonth(new Info
            {
                FileName  = FileName,
                Title     = $"Отчет зп за месяц {DateTime.Now.Month} года {DateTime.Now.Year}",
                Colon     = list,
                zarplatas = _zarplata.Read(null).Where(rec => rec.data.Month == date.Month).ToList()
            }, date);;
            Mail.SendMail(m.SendMail, FileName, $"Отчет за месяц {DateTime.Now.Month} года {DateTime.Now.Year}");
            return(RedirectToAction("Report"));
        }
        public IActionResult ReadOfAgent(string[] Month, ReportViewModel m)
        {
            if (Month.Length == 0)
            {
                TempData["ErrorLack"] = "Вы не выбрали месяц";
                return(RedirectToAction("Report"));
            }
            var           FileName = m.puth + $"ReportMonth{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.pdf";
            List <string> list     = new List <string> {
                "Номер", "дата", "Клиент", "Сумма"
            };
            DateTime date = AgentController.PeriodDate(Month[0]);

            SaveToPdf.ReportMonth(new Info
            {
                FileName = FileName,
                Title    = $"Отчет о работе Агента {Program.Agent.Id} за месяц {DateTime.Now.Month} года {DateTime.Now.Year}",
                Colon    = list,
                dogovors = _dogovor.Read(null),
                Clients  = _client.Read(null)
            }, date);
            Mail.SendMail(m.SendMail, FileName, $"Отчет о работе Агента {Program.Agent.Id} за месяц {DateTime.Now.Month} года {DateTime.Now.Year}");
            return(RedirectToAction("Report"));
        }
        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());
        }