diff --git a/Controllers/DestinazioniController.cs b/Controllers/DestinazioniController.cs
index c9d6f8e..b7f143c 100644
--- a/Controllers/DestinazioniController.cs
+++ b/Controllers/DestinazioniController.cs
@@ -91,7 +91,7 @@ namespace SoftwayWeb.Controllers
ViewBag.dataGiro = dataG;
}
- urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
+ urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzoNonValidate";
urlBase = urlBase + "?autista=" + codAutista + "&dataGiro=" + dataGi + "&mezzo=" + codMezzo;
Uri baseAddress = new Uri(urlBase);
client = new HttpClient();
@@ -124,6 +124,103 @@ namespace SoftwayWeb.Controllers
return RedirectToAction("Error");
}
+ }
+ public IActionResult IndexValidate(string id, string? codAutista, string? nomeAutista, DateTime dataGiro, string? codMezzo, string? desMezzo, int? page = 1)
+ {
+ helper = new SessionHelper(this);
+
+ token = helper.GetStringValue("tok");
+
+ if (string.IsNullOrEmpty(token))
+ {
+ return RedirectToAction("Login", "Login");
+ }
+
+ string autista = string.Empty;
+ string dataGi = string.Empty;
+ string mezzo = string.Empty;
+ string dataGiro2 = string.Empty;
+
+ ViewBag.CodAutista = codAutista;
+ ViewBag.Autista = nomeAutista;
+ ViewBag.CodMezzo = codMezzo;
+ ViewBag.Automezzo = desMezzo;
+ ViewBag.dataGiro = dataGiro.ToString("dd/MM/yyyy");
+
+ if (!string.IsNullOrEmpty(codAutista))
+ {
+ helper.SetStringValue("codAutista", codAutista.TrimEnd());
+ helper.SetStringValue("nomeAutista", nomeAutista.TrimEnd());
+ }
+ else
+ {
+ string codAut = helper.GetStringValue("codAutista");
+ codAutista = codAut.TrimEnd();
+ ViewBag.CodAutista = codAutista;
+ string nomeAut = helper.GetStringValue("nomeAutista");
+ ViewBag.Autista = nomeAut;
+ }
+
+ if (!string.IsNullOrEmpty(codMezzo))
+ {
+ helper.SetStringValue("codMezzo", codMezzo.TrimEnd());
+ helper.SetStringValue("desMezzo", desMezzo.TrimEnd());
+ }
+ else
+ {
+ string mez = helper.GetStringValue("codMezzo").TrimEnd();
+ codMezzo = mez;
+ ViewBag.CodMezzo = codMezzo;
+ string nomeMezzo = helper.GetStringValue("desMezzo");
+ ViewBag.Automezzo = nomeMezzo;
+ }
+
+ if (dataGiro.Date != DateTime.MinValue)
+ {
+ helper.SetStringValue("dataGiro", dataGiro.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'"));
+ dataGi = dataGiro.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
+ helper.SetStringValue("dataGiro2", dataGiro.ToString("dd/MM/yyyy"));
+ }
+ else
+ {
+ dataGi = helper.GetStringValue("dataGiro");
+ string dataG = helper.GetStringValue("dataGiro2");
+ ViewBag.dataGiro = dataG;
+ }
+
+ urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
+ urlBase = urlBase + "?autista=" + codAutista + "&dataGiro=" + dataGi + "&mezzo=" + codMezzo;
+ Uri baseAddress = new Uri(urlBase);
+ client = new HttpClient();
+ client.BaseAddress = baseAddress;
+
+ List>(dato);
+ modelList = modelList.Where(x => x.serialeGiro == id).OrderBy(x => x.Seq).ThenBy(x => x.Committente).ToList();
+
+ if (page != null && page < 1)
+ {
+ page = 1;
+ }
+
+ var pageSize = 10;
+
+ var shortList = modelList.ToPagedList(page ?? 1, pageSize);
+
+ return View(shortList);
+ }
+ else
+ {
+ errMes = response.Content.ReadAsStringAsync().Result;
+ helper.SetStringValue("errMsg", errMes);
+ return RedirectToAction("Error");
+ }
+
}
public IActionResult EliminaDestinazione(string serial)
diff --git a/Controllers/GiriDaValidareController.cs b/Controllers/GiriDaValidareController.cs
index cabe568..139e559 100644
--- a/Controllers/GiriDaValidareController.cs
+++ b/Controllers/GiriDaValidareController.cs
@@ -57,19 +57,19 @@ namespace SoftwayWeb.Controllers
string _filtro= helper.GetStringValue("filterData");
- if (data == DateTime.MinValue && string.IsNullOrEmpty(_filtro))
+ if (data == DateTime.MinValue && string.IsNullOrEmpty(_filtro) && modelList.Count()>0)
{
var last = modelList.OrderByDescending(t => t.DataGiro).Take(1).First();
modelList = modelList.Where(x => x.DataGiro == last.DataGiro).ToList();
}
- if (data == DateTime.MinValue && !string.IsNullOrEmpty(_filtro))
+ if (data == DateTime.MinValue && !string.IsNullOrEmpty(_filtro) && modelList.Count() > 0)
{
DateTime dataFiltro=Convert.ToDateTime(_filtro);
ViewBag.Filtro = Convert.ToString(_filtro);
modelList = modelList.Where(x => x.DataGiro == dataFiltro).ToList();
}
- if (data != DateTime.MinValue )
+ if (data != DateTime.MinValue && modelList.Count() > 0)
{
helper.SetStringValue("filterData", Convert.ToString( data));
ViewBag.Filtro = data.ToString("dd/MM/yyyy");
diff --git a/Views/Destinazioni/Index.cshtml b/Views/Destinazioni/Index.cshtml
index 45b901e..ecefe8c 100644
--- a/Views/Destinazioni/Index.cshtml
+++ b/Views/Destinazioni/Index.cshtml
@@ -19,7 +19,7 @@
Automezzo: @ViewBag.CodMezzo - @ViewBag.Automezzo
+ Data giro: @ViewBag.dataGiro
+
+ Autista: @ViewBag.CodAutista - @ViewBag.Autista
+
+ Automezzo: @ViewBag.CodMezzo - @ViewBag.Automezzo
+
| *@ + | S. | +Committente | +Sede | +Indirizzo sede | +Ca. | +Tr. | +Co. | +Nr.Co. | +Uo | +Ci. | +Note | +Bc - Bs | ++ | + |
+ | *@
+ }
+
+ |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
+ @Html.HiddenFor(modelItem => item.ConsFatta.consFattaFlagCons)
+
+ @if (item.ConsFatta.consFattaFlagCons!=null && item.ConsFatta.consFattaFlagCons.Contains("S"))
+ {
+ |
+ }
+ else
+ {
+
+ |
+ }*@
+
+
+ @Html.DisplayFor(modelItem => item.Seq) | +@Html.DisplayFor(modelItem => item.Committente) | +@*@Html.DisplayFor(modelItem => item.CodSede) - *@@Html.DisplayFor(modelItem => item.Sede) | +@Html.DisplayFor(modelItem => item.IndirizzoSede) | + @if (item.Casse != null && item.Casse > 0) + { + int icasse = 0; + icasse = Convert.ToInt32(item.Casse); ++ @icasse + | + } + else + { ++ } + @if (item.Trasf != null && item.Trasf > 0) + { + | + @Html.DisplayFor(modelItem => item.Trasf) + | + } + else + { ++ } + @if (item.Colli != null && item.Colli > 0) + { + int icolli = 0; + icolli = Convert.ToInt32(item.Colli); + | + @icolli + | + } + else + { ++ } + @if (item.num_cons != null && item.num_cons > 0) + { + | + @Html.DisplayFor(modelItem => item.num_cons) + | + } + else + { ++ } + @if (item.Uova != null && item.Uova > 0) + { + | + @Html.DisplayFor(modelItem => item.Uova) + | + } + else + { ++ } + @if (item.Cist != null && item.Cist > 0) + { + | + @Html.DisplayFor(modelItem => item.Cist) + | + } + else + { ++ } + + | + @Html.DisplayFor(modelItem => item.Note) + | + + @if (item.ConsFatta != null && item.ConsFatta.consFattaBanCar != null && item.ConsFatta.consFattaBanSca!=null) + { + diffBancali = item.ConsFatta.consFattaBanCar.Value - item.ConsFatta.consFattaBanSca.Value; + ++ @diffBancali + | + } + else + { ++ } + @if (item.ConsFatta == null) + { + |
+ @if (!string.IsNullOrEmpty(item.Prog))
+ {
+ |
+
+ |
+ }
+ else
+ {
+ + | + } + + |