2023-06-22 02:38:03 +04:00
|
|
|
@{
|
2023-06-14 22:47:30 +04:00
|
|
|
ViewBag.Title = "Report";
|
|
|
|
}
|
|
|
|
|
2023-06-22 02:38:03 +04:00
|
|
|
<body>
|
|
|
|
<h2>Отчеты</h2>
|
|
|
|
|
|
|
|
<div class="mt-3">
|
|
|
|
<h4>Word, Excel</h4>
|
|
|
|
<div class="form-group mb-2">
|
|
|
|
<label for="ProductId">Выбранные продукты</label>
|
|
|
|
<select id="ProductId" name="LunchId" class="form-control" multiple>
|
|
|
|
@foreach (var item in ViewBag.ProductList)
|
|
|
|
{
|
|
|
|
<option value="@item.Id">@item.ProductName</option>
|
|
|
|
}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<button type="button" class="btn btn-primary" id="excel-button">Сохранить в excel</button>
|
|
|
|
<button type="button" class="btn btn-primary" id="word-button">Сохранить в word</button>
|
|
|
|
</div>
|
2023-06-14 22:47:30 +04:00
|
|
|
|
2023-06-19 09:12:18 +04:00
|
|
|
<div class="row">
|
|
|
|
<h4>Pdf</h4>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
2023-06-22 02:38:03 +04:00
|
|
|
<label for="DateAfter">От</label>
|
|
|
|
<input type="date" id="DateAfter" name="DateAfter" class="form-control" />
|
2023-06-19 09:12:18 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-06-14 22:47:30 +04:00
|
|
|
|
2023-06-19 09:12:18 +04:00
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
2023-06-22 02:38:03 +04:00
|
|
|
<label for="DateBefore">До</label>
|
|
|
|
<input type="date" id="DateBefore" name="DateBefore" class="form-control" />
|
2023-06-19 09:12:18 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-06-14 22:47:30 +04:00
|
|
|
</div>
|
2023-06-19 09:12:18 +04:00
|
|
|
<div class="form-group mt-2">
|
2023-06-22 02:38:03 +04:00
|
|
|
<button type="button" id="show-button">Показать</button>
|
|
|
|
<button type="button" class="btn btn-primary" id="email-button">Отправить pdf по почте</button>
|
2023-06-14 22:47:30 +04:00
|
|
|
</div>
|
|
|
|
|
2023-06-22 02:38:03 +04:00
|
|
|
<table id="cooks-table" class="table table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Id повара</th>
|
|
|
|
<th>ФИО повара</th>
|
|
|
|
<th>Id обеда</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody></tbody>
|
|
|
|
</table>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
|
|
<script src="~/js/site.js"></script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#show-button').click(function() {
|
|
|
|
var model = {
|
|
|
|
"DateBefore": document.getElementById("DateBefore").value,
|
|
|
|
"DateAfter": document.getElementById("DateAfter").value
|
|
|
|
};
|
|
|
|
var jsonData = JSON.stringify(model);
|
|
|
|
$.ajax({
|
|
|
|
url: `/home/ReportPdf`,
|
|
|
|
type: 'POST',
|
|
|
|
dataType: 'json',
|
|
|
|
contentType: 'application/json',
|
|
|
|
data: JSON.stringify(model),
|
|
|
|
success: function(data) {
|
|
|
|
var tableBody = $('#cooks-table tbody');
|
|
|
|
tableBody.empty();
|
|
|
|
|
|
|
|
$.each(data, function(index, cook) {
|
|
|
|
var rowCook = $('<tr></tr>');
|
|
|
|
|
|
|
|
var dateCell = $('<td></td>').text(cook.cookId);
|
|
|
|
rowCook.append(dateCell);
|
|
|
|
|
|
|
|
var lunchIdCell = $('<td></td>').text(cook.fio);
|
|
|
|
rowCook.append(lunchIdCell);
|
|
|
|
|
|
|
|
tableBody.append(rowCook);
|
|
|
|
|
|
|
|
$.each(cook.lunches, function(index, lunch) {
|
|
|
|
var rowLunch = $('<tr></tr>');
|
|
|
|
var orderCell = $('<td></td>').text(lunch.id);
|
|
|
|
|
|
|
|
rowLunch.append($('<td></td>').text(""));
|
|
|
|
rowLunch.append($('<td></td>').text(""));
|
|
|
|
|
|
|
|
rowLunch.append(orderCell);
|
|
|
|
tableBody.append(rowLunch);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
error: function() {
|
|
|
|
console.log('Произошла ошибка при получении данных');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('#email-button').click(function() {
|
|
|
|
var model = {
|
|
|
|
"DateBefore": document.getElementById("DateBefore").value,
|
|
|
|
"DateAfter": document.getElementById("DateAfter").value
|
|
|
|
};
|
|
|
|
var jsonData = JSON.stringify(model);
|
|
|
|
console.log(model);
|
|
|
|
$.ajax({
|
|
|
|
url: `/home/ReportEmail`,
|
|
|
|
type: 'POST',
|
|
|
|
dataType: 'json',
|
|
|
|
contentType: 'application/json',
|
|
|
|
data: JSON.stringify(model)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|