diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportClientLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportClientLogic.cs index b8ff00d..58a2bd3 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportClientLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportClientLogic.cs @@ -132,13 +132,10 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic { var document = _saveToWord.CreateDoc(new WordInfoClient { Title = "Список оплат", - ListPaymeant = _paymeantstorage.GetFillteredList(new PaymeantSearchModel { - ClientID = model.ClientID, - DateFrom = model.DateFrom, - DateTo = model.DateTo, - }), + DateFrom = model.DateFrom, DateTo = model.DateTo, + Products = GetProducts(model) }); return document; } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToWordClient.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToWordClient.cs index 110fe5d..f111e34 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToWordClient.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/AbstractSaveToWordClient.cs @@ -32,23 +32,69 @@ namespace ElectronicsShopBusinessLogic.OfficePackage JustificationType = WordJustificationType.Both } }); - - foreach (var pre in info.ListPaymeant) - { - CreateParagraph(new WordParagraph - { - Texts = new List<(string, WordTextProperties)> - { ($"Номер заказа: {pre.OrderID.ToString()}; Номер оплаты: {pre.ID.ToString()}; Статус оплаты: {pre.PayOption.ToString()}", - new WordTextProperties { Size = "24", Bold=false})}, - TextProperties = new WordTextProperties - { - Size = "24", - JustificationType = WordJustificationType.Both - } - }); + List PaymentsID = new List(); + foreach (var pr in info.Products) + { + int id = pr.PaymentID; + if (PaymentsID.Contains(id) == false) + { + PaymentsID.Add(id); + } } - var document = SaveWord(info); + foreach (int id in PaymentsID) + { + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> { ($"Номер оплаты: {id}", new WordTextProperties { Bold = true, Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Center + } + }); + + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> { ("Номер товара Товар Цена Количество Статья затрат", new WordTextProperties { Bold = false, Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Both + } + }); + + double sum = 0; + foreach (var products in info.Products) + { + if (products.PaymentID == id) + { + sum += products.Price * products.count; + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> { ($"{products.ID.ToString()} {products.ProductName.ToString()} " + + $"{ (products.Price * products.count).ToString()} {products.count.ToString()} " + + $"{products.CostItemName.ToString()}", new WordTextProperties { Bold = false, Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Both + } + }); + } + } + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> { ($"Итого: {sum}\t", new WordTextProperties { Bold = false, Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Both + } + }); + } + + var document = SaveWord(info); return document; } diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/WordInfoClient.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/WordInfoClient.cs index 1de2b2b..5fbaaf0 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/WordInfoClient.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/OfficePackage/HelperModels/WordInfoClient.cs @@ -11,6 +11,6 @@ namespace ElectronicsShopBusinessLogic.OfficePackage.HelperModels public DateTime DateTo { get; set; } - public List ListPaymeant { get; set; } = new(); + public List? Products { get; set; } = new(); } } diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs index 99afa38..b49000a 100644 --- a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs +++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs @@ -12,7 +12,7 @@ namespace ElectronicsShopDataBaseImplement optionsBuilder) { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=WIN-4HUIDGH3G02\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=WIN-S7AOPVO8GAA\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/ElectronicsShop/ElectronicsShopRestAPI/Report b/ElectronicsShop/ElectronicsShopRestAPI/Report index 9e361af..45a2ab8 100644 Binary files a/ElectronicsShop/ElectronicsShopRestAPI/Report and b/ElectronicsShop/ElectronicsShopRestAPI/Report differ diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearch.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearch.cshtml index baedfb1..d3840f5 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearch.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearch.cshtml @@ -26,9 +26,9 @@
Экспорт отчета в .xlsx + asp-route-DateTo="@Model.Item2" style="background-color:#335a95;">Экспорт отчета в .docx Экспорт отчета в .docx + asp-route-DateTo="@Model.Item2" style="background-color:#04713A;">Экспорт отчета в .xlsx отправить на Email отчет в .pdf