Michele: modifica ricerca estrazione rapportini + Template

This commit is contained in:
michele 2024-01-19 16:37:46 +01:00
parent baebbfb634
commit 84beb51404
4 changed files with 30 additions and 22 deletions

View File

@ -36,7 +36,7 @@ namespace VirtualTask.Controllers
#region INDEX
public IActionResult Index(string impianto, int? page = 1)
public IActionResult Index(string impianto, DateTime dataIni, DateTime dataFin, int? page = 1)
{
SessionHelper helper = new SessionHelper(this);
token = helper.GetStringValue("tok");
@ -75,6 +75,15 @@ namespace VirtualTask.Controllers
else
ViewData["CurrentFilter"] = null;
if (!dataFin.ToString().Substring(0, 10).Equals("01/01/0001"))
{
modelList = modelList.Where(x => x.data_rapportino.GetValueOrDefault().Date >= dataIni.Date && x.data_rapportino.GetValueOrDefault().Date <= dataFin.Date).ToList();
}
else
{
modelList = modelList.Where(x => x.data_rapportino.GetValueOrDefault().Date >= dataIni.Date).ToList();
}
if (page != null && page < 1)
{
page = 1;
@ -128,9 +137,7 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Rapportini>>(data);
ViewData["CurrentFilter"] = impianto;
if (!impianto.Equals("System.Collections.Generic.List`1[Microsoft.AspNetCore.Mvc.Rendering.SelectListItem]")/* || impianto != null*/)
if (impianto != null)
{
modelList = modelList.Where(x => x.codice_impianto.Equals(impianto)).ToList();
}
@ -148,7 +155,6 @@ namespace VirtualTask.Controllers
workbook.AddWorksheet("sheetName");
var ws = workbook.Worksheet("sheetName");
int col = 1;
//Scrivo intestazioni colonne

View File

@ -10,7 +10,6 @@
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
}
<div class="agy-project-wrapper agy-project-page-wrapper">
<div class="container">
<div class="row">
@ -20,11 +19,24 @@
<div style="float:left;width:40%;padding:0 20px;">
<th><b>Impianto:</b></th>
@Html.DropDownList("impianto", ViewBag.Rapportini, null, new { @class = "agy-form-field require" })
@* <div style="float:left;width:40%;padding:0 20px;"> *@
<th><b>Data da:</b></th>
@Html.TextBox("dataIni", null, new { type = "date", @class = "agy-form-field require" })
@* </div> *@
@* <div style="float:left;width:40%;padding:0 20px;"> *@
<th><b>Data a:</b></th>
@Html.TextBox("dataFin", null, new { type = "date", @class = "agy-form-field require" })
@* </div> *@
<div style="float:left;width:57%;"><input type="submit" value="Cerca" class="agy-btn submitForm" /></div>
</div>
<div style="float:left;width:2%;">&nbsp;</div>
<div style="float:left;width:2%;">&nbsp;</div>
<div style="float:left;width:2%;">&nbsp;</div>
</div>
}
@ -34,20 +46,10 @@
@using (Html.BeginForm("ExportDataToExcel", "Rapportini"))
{
<div style="float:left;width:40%;padding:0 20px;">
<th><b>Data da:</b></th>
@Html.TextBox("dataIni", null, new { type = "date", @class = "agy-form-field require" })
</div>
<div style="float:left;width:40%;padding:0 20px;">
<th><b>Data a:</b></th>
@Html.TextBox("dataFin", null, new { type = "date", @class = "agy-form-field require" })
</div>
@Html.Hidden("dataIni", ViewBag.Rapportini, null)
@Html.Hidden("dataFin", ViewBag.Rapportini, null)
@Html.Hidden("impianto", ViewBag.Rapportini, null)
@* @Html.Hiddenfor(x => x.codice) *@
<div style="float:left;width:40%;padding:0 20px;">
<input type="submit" value="Esporta excel" name="Esporta excel" class="agy-btn submitForm" />
</div>

View File

@ -174,7 +174,7 @@ Purchase:
</ul>
</div>
<div class="agy-search-wrapper menu-btn-wrap">
@* <div class="agy-search-wrapper menu-btn-wrap">
<ul class="display-flex">
<li><a href="javascript:void(0);" class="agy-search-btn searchBtn"><i class="fa-solid fa-magnifying-glass"></i></a></li>
<li><a href="contact.html" class="agy-btn white">Get A Quote</a></li>
@ -186,7 +186,7 @@ Purchase:
</a>
</li>
</ul>
</div>
</div> *@
</div>
</div>

View File

@ -150,7 +150,7 @@ Purchase:
<li><a href="@Url.Action("Login2", "Login")">Accedi</a></li>
</ul>
</div>
<div class="agy-search-wrapper menu-btn-wrap">
@* <div class="agy-search-wrapper menu-btn-wrap">
<ul class="display-flex">
<li><a href="javascript:void(0);" class="agy-search-btn searchBtn"><i class="fa-solid fa-magnifying-glass"></i></a></li>
<li><a href="contact.html" class="agy-btn white">Get A Quote</a></li>
@ -162,7 +162,7 @@ Purchase:
</a>
</li>
</ul>
</div>
</div> *@
</div>
</div>
</div>