2024-08-27 16:29:09 +04:00

151 lines
3.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using ServiceStationContracts.ViewModels
@model List<WorkViewModel>
@{
ViewData["Title"] = "Report";
}
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<div class="text-center">
<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">
<label>С:</label>
</div>
<div class="col-3">
<input name="DateFrom" id="datefrom" type="date" />
</div>
<div class="col-sm-auto">
<label>По:</label>
</div>
<div class="col-3">
<input name="DateTo" id="dateto" type="date" />
</div>
<div class="row">
<div class="col-8"></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>
<div class="text-end">
<button class="btn btn-primary btn-sm" id="SaveWord" style="background-color:#335a95;">Экспорт отчета в .docx</button>
<button class="btn btn-primary btn-sm 2" id="SaveExcel" style="background-color:#04713A;">Экспорт отчета в .xlsx</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.Date)
</th>
<th>
@Html.DisplayFor(modelItem => item.Price)
</th>
<th>
@Html.DisplayFor(modelItem => item.TaskByWorkId)
</th>
<th>
@Html.DisplayFor(modelItem => item.TaskName)
</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;
}
}
}
});
$('#SaveWord').on('click', function () {
let val = [];
$("input[name='Select_rec']:checked").each(function () {
val.push($(this).val());
});
var str = '';
for (let i = 0; i < val.length; i++) {
str += val[i] + '_'
}
location.href = '/Home/CreateWordReport?ids=' + str
});
$('#SaveExcel').on('click', function () {
debugger
let val = [];
$("input[name='Select_rec']:checked").each(function () {
val.push($(this).val());
});
var str = '';
for (let i = 0; i < val.length; i++) {
str += val[i] + '_'
}
location.href = '/Home/CreateExcelReport?ids=' + str
});
</script>