Michele: aggiunto dettaglio consegna fatta (controller + view)

This commit is contained in:
michele 2024-07-26 12:25:27 +02:00
parent 7156ac7991
commit 63c7f162b8
4 changed files with 78 additions and 1946 deletions

View File

@ -23,37 +23,39 @@ namespace SoftwayWeb.Controllers
apiUrl = key;
}
public IActionResult Index(string id/*, string? codAutista, DateTime dataGiro, string? codMezzo*/)
public IActionResult Index(string id, string? codAutista, DateTime dataGiro, string? codMezzo)
{
//helper = new SessionHelper(this);
//token = helper.GetStringValue("tok");
//urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
////dataGiro = dataGiro.ToUniversalTime();
////urlBase = urlBase + "autista=" + giro.CodAutista + "datGiro=" + giro.DataGiro;
//urlBase = urlBase + "?autista=" + codAutista.Trim() + "&dataGiro=2023-05-30T00%3A00%3A00.000Z" + "&mezzo=" + codMezzo /*+ dataGiro*/;
//Uri baseAddress = new Uri(urlBase);
//client = new HttpClient();
//client.BaseAddress = baseAddress;
helper = new SessionHelper(this);
token = helper.GetStringValue("tok");
urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
var dataGiroFormattata = dataGiro.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
urlBase = urlBase + "?autista=" + codAutista + "&dataGiro="+ dataGiroFormattata + "&mezzo=" + codMezzo;
Uri baseAddress = new Uri(urlBase);
client = new HttpClient();
client.BaseAddress = baseAddress;
//List<Destinazioni_Out.ConsegnaFatta> modelList = new List<Destinazioni_Out.ConsegnaFatta>();
//HttpResponseMessage response = client.GetAsync(baseAddress).Result;
List<Destinazioni_Out> modelList = new List<Destinazioni_Out>();
Destinazioni_Out model = new Destinazioni_Out();
Destinazioni_Out.ConsegnaFatta modelCons = new Destinazioni_Out.ConsegnaFatta();
//if (response.IsSuccessStatusCode)
//{
// string dato = response.Content.ReadAsStringAsync().Result;
// modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out.ConsegnaFatta>>(dato);
// modelList = modelList.Where(x => x.consFattaSerial == id).ToList();
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
// var shortList = modelList.ToPagedList();
// return View(modelList/*shortList*/);
//}
//else
//{
// errMes = response.Content.ReadAsStringAsync().Result;
// helper.SetStringValue("errMsg", errMes);
// return RedirectToAction("Error");
//}
return View();
if (response.IsSuccessStatusCode)
{
string dato = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out>>(dato);
model = modelList.Where(x => x.Brserial == id).First();
modelCons = model.ConsFatta;
return View(modelCons);
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
}
}
}

View File

@ -71,7 +71,7 @@ namespace SoftwayWeb.Models
public string? consFattaMezzo { get; set; }
[Display(Name = "Autista")]
public string? consFattaAut { get; set; }
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 5)")]
[Display(Name = "Importo"), System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 5)")]
public decimal? consFattaImpor { get; set; }
[Display(Name = "Note 1")]
public string? consFattaNotImp { get; set; }

File diff suppressed because it is too large Load Diff

View File

@ -41,13 +41,14 @@
<th>Uo</th>
<th>Ci.</th>
<th>Note</th>
<th>Bc - Bs</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody class="table-border-bottom-0">
@foreach (var item in Model) {
int diffBancali = 0;
string cl = string.Empty;
@if (item.ConsFatta != null)
{
@ -171,6 +172,21 @@
<td style="font-size:12px;">
@Html.DisplayFor(modelItem => item.Note)
</td>
@if (item.ConsFatta != null)
{
diffBancali = item.ConsFatta.consFattaBanCar.Value - item.ConsFatta.consFattaBanSca.Value;
<td>
<a href="@Url.ActionLink("Index","Consegne", new{id = item.Brserial,
codAutista = item.CodAutista,
dataGiro = item.DataCarico,
codMezzo = item.CodAutomezzo})" class="links">@diffBancali</a>
</td>
}
else
{
<td>&nbsp;</td>
}
@if (item.ConsFatta == null)
{
<td>