add checkbox in report client
This commit is contained in:
parent
870f48d1c0
commit
3bbee9e09b
@ -23,6 +23,7 @@ namespace ElectronicsShopContracts.ViewModels
|
|||||||
[DisplayName("Клиент")]
|
[DisplayName("Клиент")]
|
||||||
public int ClientID { get; set; }
|
public int ClientID { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Дата оплаты")]
|
||||||
public DateTime DatePaymeant { get; set; }
|
public DateTime DatePaymeant { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,15 +286,25 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
|
|
||||||
return View();
|
return View(APIClient.GetRequset<List<PaymeantViewModel>>($"api/client/getpaymeants?_clientid={APIClient.Client.ID}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Report(DateTime DateFrom, DateTime DateTo){
|
public void Report(DateTime DateFrom, DateTime DateTo, int[] ids, bool _isFixReport) {
|
||||||
if (DateTo == DateTime.MinValue || DateFrom > DateTo) {
|
|
||||||
throw new Exception("Íåêîðåêòíî óêàçàí âðåìåííîé èíòåðâàë");
|
// ïðîâåðêà òèï ôîðìèðîâàíèÿ îò÷åòà, îòïðàâëÿòü íà íóæíî ñòðàíèöó ïðåäïðîñìîòðà
|
||||||
|
// 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]
|
[HttpGet]
|
||||||
@ -307,6 +317,11 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
public IActionResult ReportSearchFix(string jsonStr) {
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
public IActionResult CreateExcelReport(string DateFrom, string DateTo) {
|
public IActionResult CreateExcelReport(string DateFrom, string DateTo) {
|
||||||
var fileMemStream = APIClient.GetRequset<byte[]>($"api/Client/CreateXlsxReport?_clientID={APIClient.Client?.ID}&DateFrom={DateFrom}&" +
|
var fileMemStream = APIClient.GetRequset<byte[]>($"api/Client/CreateXlsxReport?_clientID={APIClient.Client?.ID}&DateFrom={DateFrom}&" +
|
||||||
$"DateTo={DateTo}");
|
$"DateTo={DateTo}");
|
||||||
@ -319,7 +334,8 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult CreateWordReport(string DateFrom, string DateTo) {
|
public IActionResult CreateWordReport(string idsStr) {
|
||||||
|
/*
|
||||||
var fileMemStream = APIClient.GetRequset<byte[]>($"api/client/CreateDocxReport?_clientID={APIClient.Client?.ID}&DateFrom={DateFrom}&" +
|
var fileMemStream = APIClient.GetRequset<byte[]>($"api/client/CreateDocxReport?_clientID={APIClient.Client?.ID}&DateFrom={DateFrom}&" +
|
||||||
$"DateTo={DateTo}");
|
$"DateTo={DateTo}");
|
||||||
|
|
||||||
@ -328,6 +344,8 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return File(fileMemStream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Report.docx");
|
return File(fileMemStream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Report.docx");
|
||||||
|
*/
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@{
|
@{
|
||||||
if (Model == null) {
|
if (Model == null) {
|
||||||
<h3 class="display-4">Авторизируйтесь</h3>
|
<h3 class="display-4">Авторизируйтесь</h3>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
<table class="table">
|
<table class="table">
|
||||||
@ -32,6 +32,9 @@
|
|||||||
<th>
|
<th>
|
||||||
Статус оплаты
|
Статус оплаты
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
Дата оплаты
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -49,6 +52,9 @@
|
|||||||
<th>
|
<th>
|
||||||
@Html.DisplayFor(modelItem => item.PayOption)
|
@Html.DisplayFor(modelItem => item.PayOption)
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayFor(modelItem => item.DatePaymeant)
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
@using ElectronicsShopContracts.SearchModels
|
@using ElectronicsShopContracts.ViewModels
|
||||||
@model PaymeantSearchModel
|
@model List<PaymeantViewModel>
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Report";
|
ViewData["Title"] = "Report";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h2 class="display-4">Отчёты</h2>
|
<h1 class="display-4">Отчёты</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="text-start">
|
||||||
|
<h2 class="display-5">Отчёт за период</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div class="align-content-center row mb-3">
|
<div class="align-content-center row mb-3">
|
||||||
<div class="col-sm-auto">
|
<div class="col-sm-auto">
|
||||||
@ -22,7 +29,108 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8"></div>
|
<div class="col-8"></div>
|
||||||
<div class="col-4"><input type="submit" value="Cформировать отчет" class="btn btn-primary" /></div>
|
<div class="col-4"><input type="submit" value="Cформировать отчет" class="btn btn-sm btn-outline-danger m-2 p-2" /></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div class="text-start">
|
||||||
|
<h2 class="display-5">Выбрать оплаты в отечет</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null) {
|
||||||
|
<h3 class="display-4">Авторизируйтесь</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<div class="text-end">
|
||||||
|
<button class="btn btn-sm btn-outline-danger m-2 p-2" id="btnFix">Cформировать отчет</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Номер
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Номер заказа
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Сумма к оплате
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Статус оплаты
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Дата оплаты
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<input type="checkbox" class="form-check-input" id="Select_all" name="Select_all" /> Выбрать все
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model) {
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayFor(modelItem => item.ID)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayFor(modelItem => item.OrderID)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayFor(modelItem => item.SumPayment)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayFor(modelItem => item.PayOption)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayFor(modelItem => item.DatePaymeant)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<input type="checkbox" class="form-check-input" id="Select_rec" name="Select_rec" value="@item.ID" />
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#Select_all').on('click', function () {
|
||||||
|
let checkboxes = document.getElementsByTagName('input');
|
||||||
|
let val = null;
|
||||||
|
|
||||||
|
for (var i = 0; i < checkboxes.length; i++) {
|
||||||
|
if (checkboxes[i].type === 'checkbox') {
|
||||||
|
if (val == null) {
|
||||||
|
val = checkboxes[i].checked;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
checkboxes[i].checked = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnFix').on('click', function () {
|
||||||
|
debugger
|
||||||
|
let val = [];
|
||||||
|
$("input[name='Select_rec']:checked").each(function () {
|
||||||
|
val.push($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/Home/Report',
|
||||||
|
data: { 'ids': val, '_isFixReport': true},
|
||||||
|
success: function (result) {
|
||||||
|
$("#idsStr").val(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
@ -23,14 +23,9 @@
|
|||||||
<div class="col-sm-auto">
|
<div class="col-sm-auto">
|
||||||
<input name="DateTo" id="dateto" type="text" value="@Model.Item2.Date.ToString("d")" readonly />
|
<input name="DateTo" id="dateto" type="text" value="@Model.Item2.Date.ToString("d")" readonly />
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="text-end">
|
||||||
<div class="col-8">
|
|
||||||
<a class="btn btn-primary btn-sm" asp-action="CreateWordReport" asp-route-DateFrom="@Model.Item1"
|
|
||||||
asp-route-DateTo="@Model.Item2" style="background-color:#335a95;">Экспорт отчета в .docx</a>
|
|
||||||
<a class="btn btn-primary btn-sm" asp-action="CreateExcelReport" asp-route-DateFrom="@Model.Item1"
|
|
||||||
asp-route-DateTo="@Model.Item2" style="background-color:#04713A;">Экспорт отчета в .xlsx</a>
|
|
||||||
<a class="btn btn-primary btn-sm" asp-action="CreatePdfReport" asp-route-DateFrom="@Model.Item1"
|
<a class="btn btn-primary btn-sm" asp-action="CreatePdfReport" asp-route-DateFrom="@Model.Item1"
|
||||||
asp-route-DateTo="@Model.Item2" style="background-color:#ad0d09;">отправить на Email отчет в .pdf</a>
|
asp-route-DateTo="@Model.Item2" style="background-color:#ad0d09;">отправить на Email отчет в .pdf</a>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
@*
|
||||||
|
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||||
|
*@
|
||||||
|
@{
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user