From 3bbee9e09b7091afd56ac18a89d91970f8f701f6 Mon Sep 17 00:00:00 2001 From: Ilfedotov Date: Tue, 6 Aug 2024 21:21:05 +0400 Subject: [PATCH] add checkbox in report client --- .../ViewModels/PaymeantViewModel.cs | 1 + .../Controllers/HomeController.cs | 30 ++++- .../Views/Home/Index.cshtml | 8 +- .../Views/Home/Report.cshtml | 118 +++++++++++++++++- .../Views/Home/ReportSearch.cshtml | 9 +- .../Views/Home/ReportSearchFix.cshtml | 5 + 6 files changed, 152 insertions(+), 19 deletions(-) create mode 100644 ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearchFix.cshtml diff --git a/ElectronicsShop/ElectronicsShopContracts/ViewModels/PaymeantViewModel.cs b/ElectronicsShop/ElectronicsShopContracts/ViewModels/PaymeantViewModel.cs index 37c348e..6797cf4 100644 --- a/ElectronicsShop/ElectronicsShopContracts/ViewModels/PaymeantViewModel.cs +++ b/ElectronicsShop/ElectronicsShopContracts/ViewModels/PaymeantViewModel.cs @@ -23,6 +23,7 @@ namespace ElectronicsShopContracts.ViewModels [DisplayName("Клиент")] public int ClientID { get; set; } + [DisplayName("Дата оплаты")] public DateTime DatePaymeant { get; set; } } } diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs b/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs index ec144c0..eb0a944 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs @@ -286,15 +286,25 @@ namespace ElectronicsShopUserApp.Controllers { return Redirect("~/Home/Enter"); } - return View(); + return View(APIClient.GetRequset>($"api/client/getpaymeants?_clientid={APIClient.Client.ID}")); } [HttpPost] - public void Report(DateTime DateFrom, DateTime DateTo){ - if (DateTo == DateTime.MinValue || DateFrom > DateTo) { - throw new Exception(" "); + public void Report(DateTime DateFrom, DateTime DateTo, int[] ids, bool _isFixReport) { + + // , + // todo + if (_isFixReport == false) { + if (DateTo == DateTime.MinValue || DateFrom > DateTo) { + throw new Exception(" "); + } + Response.Redirect($"ReportSearch?_datefrom={DateFrom}&_dateto={DateTo + DateTime.Now.TimeOfDay}"); + } + else { + if (ids.Length == 0) { + throw new Exception(" 0"); + } } - Response.Redirect($"ReportSearch?_datefrom={DateFrom}&_dateto={DateTo + DateTime.Now.TimeOfDay}"); } [HttpGet] @@ -307,6 +317,11 @@ namespace ElectronicsShopUserApp.Controllers { } [HttpGet] + public IActionResult ReportSearchFix(string jsonStr) { + return View(); + } + + [HttpGet] public IActionResult CreateExcelReport(string DateFrom, string DateTo) { var fileMemStream = APIClient.GetRequset($"api/Client/CreateXlsxReport?_clientID={APIClient.Client?.ID}&DateFrom={DateFrom}&" + $"DateTo={DateTo}"); @@ -319,7 +334,8 @@ namespace ElectronicsShopUserApp.Controllers { } [HttpGet] - public IActionResult CreateWordReport(string DateFrom, string DateTo) { + public IActionResult CreateWordReport(string idsStr) { + /* var fileMemStream = APIClient.GetRequset($"api/client/CreateDocxReport?_clientID={APIClient.Client?.ID}&DateFrom={DateFrom}&" + $"DateTo={DateTo}"); @@ -328,6 +344,8 @@ namespace ElectronicsShopUserApp.Controllers { } return File(fileMemStream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Report.docx"); + */ + return View(); } [HttpGet] diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Index.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Index.cshtml index ff68e3e..692ad65 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Index.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Index.cshtml @@ -14,7 +14,7 @@
@{ if (Model == null) { -

Авторизируйтесь

+

Авторизируйтесь

return; } @@ -32,6 +32,9 @@ + @@ -49,6 +52,9 @@ + } diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml index 4dc297f..2df5e0c 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml @@ -1,11 +1,18 @@ -@using ElectronicsShopContracts.SearchModels -@model PaymeantSearchModel +@using ElectronicsShopContracts.ViewModels +@model List @{ ViewData["Title"] = "Report"; } + +
-

Отчёты

+

Отчёты

+ +
+

Отчёт за период

+
+
@@ -22,7 +29,108 @@
-
+
- \ No newline at end of file + + +
+

Выбрать оплаты в отечет

+
+ +
+ @{ + if (Model == null) { +

Авторизируйтесь

+ return; + } +
+ +
+ +
Статус оплаты + Дата оплаты +
@Html.DisplayFor(modelItem => item.PayOption) + @Html.DisplayFor(modelItem => item.DatePaymeant) +
+ + + + + + + + + + + + @foreach (var item in Model) { + + + + + + + + + } + +
+ Номер + + Номер заказа + + Сумма к оплате + + Статус оплаты + + Дата оплаты + + Выбрать все +
+ @Html.DisplayFor(modelItem => item.ID) + + @Html.DisplayFor(modelItem => item.OrderID) + + @Html.DisplayFor(modelItem => item.SumPayment) + + @Html.DisplayFor(modelItem => item.PayOption) + + @Html.DisplayFor(modelItem => item.DatePaymeant) + + +
+ + } +
+ + \ No newline at end of file diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearch.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearch.cshtml index d3840f5..10d1727 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearch.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearch.cshtml @@ -23,14 +23,9 @@
-
-
- Экспорт отчета в .docx - Экспорт отчета в .xlsx +
отправить на Email отчет в .pdf + asp-route-DateTo="@Model.Item2" style="background-color:#ad0d09;">отправить на Email отчет в .pdf
diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearchFix.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearchFix.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/ReportSearchFix.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +}