add checkbox in report client
This commit is contained in:
parent
870f48d1c0
commit
3bbee9e09b
@ -23,6 +23,7 @@ namespace ElectronicsShopContracts.ViewModels
|
||||
[DisplayName("Клиент")]
|
||||
public int ClientID { get; set; }
|
||||
|
||||
[DisplayName("Дата оплаты")]
|
||||
public DateTime DatePaymeant { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -286,16 +286,26 @@ namespace ElectronicsShopUserApp.Controllers {
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View();
|
||||
return View(APIClient.GetRequset<List<PaymeantViewModel>>($"api/client/getpaymeants?_clientid={APIClient.Client.ID}"));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Report(DateTime DateFrom, DateTime DateTo){
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ReportSearch(string _datefrom, string _dateto) {
|
||||
@ -306,6 +316,11 @@ namespace ElectronicsShopUserApp.Controllers {
|
||||
return View(tuple);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ReportSearchFix(string jsonStr) {
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult CreateExcelReport(string DateFrom, string DateTo) {
|
||||
var fileMemStream = APIClient.GetRequset<byte[]>($"api/Client/CreateXlsxReport?_clientID={APIClient.Client?.ID}&DateFrom={DateFrom}&" +
|
||||
@ -319,7 +334,8 @@ namespace ElectronicsShopUserApp.Controllers {
|
||||
}
|
||||
|
||||
[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}&" +
|
||||
$"DateTo={DateTo}");
|
||||
|
||||
@ -328,6 +344,8 @@ namespace ElectronicsShopUserApp.Controllers {
|
||||
}
|
||||
|
||||
return File(fileMemStream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Report.docx");
|
||||
*/
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
@ -32,6 +32,9 @@
|
||||
<th>
|
||||
Статус оплаты
|
||||
</th>
|
||||
<th>
|
||||
Дата оплаты
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -49,6 +52,9 @@
|
||||
<th>
|
||||
@Html.DisplayFor(modelItem => item.PayOption)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayFor(modelItem => item.DatePaymeant)
|
||||
</th>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
@ -1,11 +1,18 @@
|
||||
@using ElectronicsShopContracts.SearchModels
|
||||
@model PaymeantSearchModel
|
||||
@using ElectronicsShopContracts.ViewModels
|
||||
@model List<PaymeantViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Report";
|
||||
}
|
||||
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Отчёты</h2>
|
||||
<h1 class="display-4">Отчёты</h1>
|
||||
</div>
|
||||
|
||||
<div class="text-start">
|
||||
<h2 class="display-5">Отчёт за период</h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="align-content-center row mb-3">
|
||||
<div class="col-sm-auto">
|
||||
@ -22,7 +29,108 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<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>
|
||||
</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,12 +23,7 @@
|
||||
<div class="col-sm-auto">
|
||||
<input name="DateTo" id="dateto" type="text" value="@Model.Item2.Date.ToString("d")" readonly />
|
||||
</div>
|
||||
<div class="row">
|
||||
<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>
|
||||
<div class="text-end">
|
||||
<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>
|
||||
</div>
|
||||
|
@ -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