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; 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); helper = new SessionHelper(this);
//token = helper.GetStringValue("tok"); token = helper.GetStringValue("tok");
//urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo"; urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
////dataGiro = dataGiro.ToUniversalTime(); var dataGiroFormattata = dataGiro.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
////urlBase = urlBase + "autista=" + giro.CodAutista + "datGiro=" + giro.DataGiro; urlBase = urlBase + "?autista=" + codAutista + "&dataGiro="+ dataGiroFormattata + "&mezzo=" + codMezzo;
//urlBase = urlBase + "?autista=" + codAutista.Trim() + "&dataGiro=2023-05-30T00%3A00%3A00.000Z" + "&mezzo=" + codMezzo /*+ dataGiro*/; Uri baseAddress = new Uri(urlBase);
//Uri baseAddress = new Uri(urlBase); client = new HttpClient();
//client = new HttpClient(); client.BaseAddress = baseAddress;
//client.BaseAddress = baseAddress;
//List<Destinazioni_Out.ConsegnaFatta> modelList = new List<Destinazioni_Out.ConsegnaFatta>(); List<Destinazioni_Out> modelList = new List<Destinazioni_Out>();
//HttpResponseMessage response = client.GetAsync(baseAddress).Result; Destinazioni_Out model = new Destinazioni_Out();
Destinazioni_Out.ConsegnaFatta modelCons = new Destinazioni_Out.ConsegnaFatta();
//if (response.IsSuccessStatusCode) HttpResponseMessage response = client.GetAsync(baseAddress).Result;
//{
// string dato = response.Content.ReadAsStringAsync().Result;
// modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out.ConsegnaFatta>>(dato);
// modelList = modelList.Where(x => x.consFattaSerial == id).ToList();
// var shortList = modelList.ToPagedList(); if (response.IsSuccessStatusCode)
// return View(modelList/*shortList*/); {
//} string dato = response.Content.ReadAsStringAsync().Result;
//else modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out>>(dato);
//{ model = modelList.Where(x => x.Brserial == id).First();
// errMes = response.Content.ReadAsStringAsync().Result; modelCons = model.ConsFatta;
// helper.SetStringValue("errMsg", errMes);
// return RedirectToAction("Error"); return View(modelCons);
//} }
return View(); 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; } public string? consFattaMezzo { get; set; }
[Display(Name = "Autista")] [Display(Name = "Autista")]
public string? consFattaAut { get; set; } 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; } public decimal? consFattaImpor { get; set; }
[Display(Name = "Note 1")] [Display(Name = "Note 1")]
public string? consFattaNotImp { get; set; } 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>Uo</th>
<th>Ci.</th> <th>Ci.</th>
<th>Note</th> <th>Note</th>
<th>Bc - Bs</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th> <th>&nbsp;</th>
</tr> </tr>
</thead> </thead>
<tbody class="table-border-bottom-0"> <tbody class="table-border-bottom-0">
@foreach (var item in Model) { @foreach (var item in Model) {
int diffBancali = 0;
string cl = string.Empty; string cl = string.Empty;
@if (item.ConsFatta != null) @if (item.ConsFatta != null)
{ {
@ -171,6 +172,21 @@
<td style="font-size:12px;"> <td style="font-size:12px;">
@Html.DisplayFor(modelItem => item.Note) @Html.DisplayFor(modelItem => item.Note)
</td> </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) @if (item.ConsFatta == null)
{ {
<td> <td>