Aggiunta preliminare display/edit clienti

This commit is contained in:
Samuele Locatelli
2023-01-31 19:24:54 +01:00
parent 73f96f4341
commit 54c15ec2eb
10 changed files with 378 additions and 250 deletions
+95
View File
@@ -0,0 +1,95 @@
@if (CurrRecord == null)
{
<alert class="alert alert-primary p-3 my-0 w-100 text-center">
Nessun record selezionato
</alert>
}
else
{
<div class="card mb-2">
<div class="card-header @cssEdit d-flex justify-content-between">
<div class="input-group input-group-sm">
<select class="form-select" @bind="@CurrRecord.idxCli" disabled="@(ReadOnly)" style="width: 10rem;">
@foreach (var item in ListSelCli)
{
<option value="@item.value">@item.label</option>
}
</select>
</div>
<div>
@if(ReadOnly)
{
<button class="btn btn-primary btn-sm" @onclick="toggleEdit"><i class="fa-solid fa-pen"></i></button>
}
else
{
<button class="btn btn-warning btn-sm" @onclick="toggleEdit"><i class="fa-solid fa-xmark"></i></button>
}
</div>
</div>
<div class="card-body">
<div class="row g-1">
<div class="col-md-4">
<label class="form-label small text-secondary">Anno</label>
<input type="number" class="form-control" disabled="@(ReadOnly)" @bind-value="@CurrRecord.anno">
<label class="form-label small text-secondary">Tipo</label>
<select class="form-select" @bind="@CurrRecord.tipo" disabled="@(ReadOnly)">
@foreach (var item in ListSelTipo)
{
<option value="@item.value">@item.label</option>
}
</select>
</div>
<div class="col-md-4">
<label class="form-label small text-secondary">Numero</label>
<input type="number" class="form-control" disabled="@(ReadOnly)" @bind-value="@CurrRecord.num">
<label class="form-label small text-secondary">Ritenuta</label>
<input type="number" step="0.01" class="form-control" disabled="@(ReadOnly)" @bind-value="@CurrRecord.ritenuta">
</div>
<div class="col-md-4">
<label class="form-label small text-secondary">Data</label>
<input type="date" class="form-control" disabled="@(ReadOnly)" @bind-value="@CurrRecord.emesso">
</div>
</div>
</div>
<div class="card-footer d-flex justify-content-between py-1">
<div class="">
netto: <b>@($"{CurrRecord.netto:C2}")</b>
</div>
<div class="">
iva: <b>@($"{CurrRecord.iva:C2}")</b>
</div>
<div class="">
importo: <b>@($"{CurrRecord.importo:C2}")</b>
</div>
</div>
</div>
<div class="card mb-2">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div>
Righe Documento
</div>
<div>
btn
</div>
</div>
<div class="card-body">
Form compilazione
<i>dett righe</i>
</div>
</div>
@*<div class="card mb-2">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div>
Materiali / servizi
</div>
<div>
btn
</div>
</div>
<div class="card-body">
Form compilazione
<i>dett righe</i>
</div>
</div>*@
}
@@ -0,0 +1,60 @@
using Microsoft.AspNetCore.Components;
using SHERPA.AD.Data;
using SHERPA.Data.DbModels;
namespace SHERPA.AD.Components
{
public partial class AccDocDetail
{
#region Public Properties
[Parameter]
public vDocsExplModel? CurrRecord { get; set; } = null;
#endregion Public Properties
#region Protected Properties
protected string cssEdit
{
get => ReadOnly ? "bg-default text-dark" : "bg-primary text-light";
}
protected List<vSelCliModel> ListSelCli { get; set; } = new List<vSelCliModel>();
protected List<vSelGruppiModel> ListSelGruppi { get; set; } = new List<vSelGruppiModel>();
protected List<vSelTipoModel> ListSelTipo { get; set; } = new List<vSelTipoModel>();
[Inject]
protected SADDataService SDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
ListSelCli = await SDService.VSelCliGetAll();
ListSelGruppi = await SDService.VSelGruppiGetAll();
ListSelTipo = await SDService.VSelTipoGetAll();
}
#endregion Protected Methods
#region Private Fields
private bool ReadOnly = true;
#endregion Private Fields
#region Private Methods
private void toggleEdit()
{
ReadOnly = !ReadOnly;
}
#endregion Private Methods
}
}
+3 -22
View File
@@ -1,23 +1,4 @@
@if (CurrRecord != null)
{
<div class="row">
<div class="col-12">
<div class="card mb-5">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div>
Nuovo Documento
</div>
<div>
</div>
</div>
<div class="card-body">
Form compilazione
</div>
</div>
</div>
</div>
}
@if (IsLoading)
@if (IsLoading)
{
<LoadingData></LoadingData>
}
@@ -118,8 +99,8 @@ else
}
@if (SelRecord != null)
{
<div>
<i>dett righe</i>
<div style="min-width: 36rem;">
<AccDocDetail CurrRecord="@SelRecord"></AccDocDetail>
</div>
}
</div>
@@ -204,8 +204,6 @@ namespace SHERPA.AD.Components
#region Private Properties
private vDocsExplModel? CurrRecord { get; set; } = null;
private vDocsExplModel? SelRecord { get; set; } = null;
#endregion Private Properties
+54 -43
View File
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components;
using SHERPA.Data.DbModels;
using SHERPA.AD.Data;
using SHERPA.Data.DbModels;
namespace SHERPA.AD.Components
{
@@ -87,6 +87,11 @@ namespace SHERPA.AD.Components
protected SelectDocExp CurrFilter { get; set; } = new SelectDocExp();
protected bool hasFilter
{
get => (!CurrFilter.Equals(new SelectDocExp()));
}
protected List<vSelCliModel> ListSelCli { get; set; } = new List<vSelCliModel>();
protected List<vSelGruppiModel> ListSelGruppi { get; set; } = new List<vSelGruppiModel>();
@@ -110,6 +115,12 @@ namespace SHERPA.AD.Components
ListSelTipo = await SDService.VSelTipoGetAll();
}
protected void ResetAll()
{
CurrFilter = new SelectDocExp();
ReportUpdate();
}
protected void ResetCli()
{
SelCli = 0;
@@ -136,13 +147,51 @@ namespace SHERPA.AD.Components
SelTipo = "*";
}
protected void ResetAll()
#endregion Protected Methods
#region Private Properties
private string cssBtnResCli
{
CurrFilter = new SelectDocExp();
ReportUpdate();
get => SelCli == 0 ? "btn btn-secondary" : "btn btn-primary";
}
#endregion Protected Methods
private string cssBtnResGrp
{
get => SelGruppo == "0" ? "btn btn-secondary" : "btn btn-primary";
}
private string cssBtnResSearch
{
get => SearchVal == "" ? "btn btn-secondary" : "btn btn-primary";
}
private string cssBtnResTipo
{
get => SelTipo == "*" ? "btn btn-secondary" : "btn btn-primary";
}
private string cssLblCli
{
get => SelCli == 0 ? "" : "bg-primary text-light";
}
private string cssLblGrp
{
get => SelGruppo == "0" ? "" : "bg-primary text-light";
}
private string cssLblSearch
{
get => SearchVal == "" ? "" : "bg-primary text-light";
}
private string cssLblTipo
{
get => SelTipo == "*" ? "" : "bg-primary text-light";
}
#endregion Private Properties
#region Private Methods
@@ -152,43 +201,5 @@ namespace SHERPA.AD.Components
}
#endregion Private Methods
private string cssBtnResGrp
{
get => SelGruppo == "0" ? "btn btn-secondary" : "btn btn-primary";
}
private string cssLblGrp
{
get => SelGruppo == "0" ? "" : "bg-primary text-light";
}
private string cssBtnResCli
{
get => SelCli == 0 ? "btn btn-secondary" : "btn btn-primary";
}
private string cssLblTipo
{
get => SelTipo == "*" ? "" : "bg-primary text-light";
}
private string cssBtnResTipo
{
get => SelTipo == "*" ? "btn btn-secondary" : "btn btn-primary";
}
private string cssLblCli
{
get => SelCli == 0 ? "" : "bg-primary text-light";
}
private string cssBtnResSearch
{
get => SearchVal == "" ? "btn btn-secondary" : "btn btn-primary";
}
private string cssLblSearch
{
get => SearchVal == "" ? "" : "bg-primary text-light";
}
protected bool hasFilter
{
get => (!CurrFilter.Equals(new SelectDocExp()));
}
}
}
+20 -39
View File
@@ -1,19 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using SHERPA.AD;
using SHERPA.AD.Shared;
using SHERPA.Data.DbModels;
using SHERPA.AD.Data;
namespace SHERPA.AD.Pages
@@ -22,29 +6,12 @@ namespace SHERPA.AD.Pages
{
#region Protected Properties
protected SelectDocExp SelFilter { get; set; } = new SelectDocExp();
#endregion Protected Properties
#region Protected Methods
protected void SetNumRec(int newNum)
{
numRecord = newNum;
}
protected void SetCurrPage(int newNum)
{
currPage = newNum;
}
protected void SetCount(int newNum)
{
totalCount = newNum;
}
protected override void OnInitialized()
{
numRecord = 10;
@@ -53,7 +20,26 @@ namespace SHERPA.AD.Pages
SelFilter.IdxCli = 0;
SelFilter.OnlySync = false;
}
protected void SetCount(int newNum)
{
totalCount = newNum;
}
protected void SetCurrPage(int newNum)
{
currPage = newNum;
}
protected void SetFilter(SelectDocExp NewFilter)
{
SelFilter = NewFilter;
}
protected void SetNumRec(int newNum)
{
numRecord = newNum;
}
#endregion Protected Methods
@@ -64,11 +50,6 @@ namespace SHERPA.AD.Pages
private int numRecord { get; set; } = 10;
private int totalCount { get; set; } = 0;
protected void SetFilter(SelectDocExp NewFilter)
{
SelFilter = NewFilter;
}
#endregion Private Properties
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>1.0.2301.3117</Version>
<Version>1.0.2301.3119</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>60fcdaab-6c1e-4bec-9d88-f7727ef1c12c</UserSecretsId>
<ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
<Version>1.0.2301.3117</Version>
<Version>1.0.2301.3118</Version>
</PropertyGroup>
<ItemGroup>
+105 -105
View File
@@ -215,6 +215,7 @@ namespace SHERPA.Data.Controllers
}
return dbResult;
}
/// <summary>
/// Ricerca Customer da idx
/// </summary>
@@ -227,7 +228,7 @@ namespace SHERPA.Data.Controllers
{
dbResult = dbCtx
.DbSetCustomers
.Where(x => (x.IdxCli== idxCli))
.Where(x => (x.IdxCli == idxCli))
.FirstOrDefault();
}
return dbResult;
@@ -415,6 +416,109 @@ namespace SHERPA.Data.Controllers
return done;
}
/// <summary>
/// Elenco VAT / CIva
/// </summary>
/// <param name="searchVal"></param>
/// <returns></returns>
public List<VatModel> VATGetAll(string searchVal)
{
List<VatModel> dbResult = new List<VatModel>();
using (SHERPAFattContext dbCtx = new SHERPAFattContext(_configuration))
{
dbResult = dbCtx
.DbSetVat
.Where(x => (x.Descrizione.Contains(searchVal) || string.IsNullOrEmpty(searchVal)))
.OrderBy(x => x.Descrizione)
.ToList();
}
return dbResult;
}
/// <summary>
/// Ricerca VAT / CIva da idx
/// </summary>
/// <param name="idxVat"></param>
/// <returns></returns>
public VatModel? VATGetByKey(int idxVat)
{
VatModel? dbResult = new VatModel();
using (SHERPAFattContext dbCtx = new SHERPAFattContext(_configuration))
{
dbResult = dbCtx
.DbSetVat
.Where(x => (x.IdxVat == idxVat))
.FirstOrDefault();
}
return dbResult;
}
/// <summary>
/// Elenco VAT / CIva che richiedono sync tramite stored
/// </summary>
/// <param name="tipoDoc">Tipo doc, * = tutti</param>
/// <param name="anno">Anno doc, 0=tutti</param>
/// <param name="notUpl">Indica se solo non caricati (1 = NON caricati)</param>
/// <returns></returns>
public List<VatModel> VATToSync(string tipoDoc, int anno, bool notUpl)
{
List<VatModel> dbResult = new List<VatModel>();
using (SHERPAFattContext dbCtx = new SHERPAFattContext(_configuration))
{
SqlParameter Tipo = new SqlParameter("@tipo", tipoDoc);
SqlParameter Anno = new SqlParameter("@anno", anno);
SqlParameter NotUpl = new SqlParameter("@notUpl", notUpl);
dbResult = dbCtx
.DbSetVat
.FromSqlRaw("EXEC stp_VAT_getByAnno @tipo,@anno,@notUpl", Tipo, Anno, NotUpl)
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiorna un record VAT / CIva
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool VATUpdate(VatModel updItem)
{
bool done = false;
using (SHERPAFattContext dbCtx = new SHERPAFattContext(_configuration))
{
try
{
var currData = dbCtx
.DbSetVat
.Where(x => x.IdxVat == updItem.IdxVat)
.FirstOrDefault();
if (currData != null)
{
currData.Iva = updItem.Iva;
currData.Descrizione = updItem.Descrizione;
currData.Enabled = updItem.Enabled;
currData.SplitPay = updItem.SplitPay;
currData.id_ext = updItem.id_ext;
dbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
dbCtx
.DbSetVat
.Add(updItem);
}
dbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in VATUpdate{Environment.NewLine}{exc}");
}
}
return done;
}
/// <summary>
/// Elenco AccoDoc (Accounting Document) filtrati
/// </summary>
@@ -490,110 +594,6 @@ namespace SHERPA.Data.Controllers
return dbResult;
}
/// <summary>
/// Elenco VAT / CIva
/// </summary>
/// <param name="searchVal"></param>
/// <returns></returns>
public List<VatModel> VATGetAll(string searchVal)
{
List<VatModel> dbResult = new List<VatModel>();
using (SHERPAFattContext dbCtx = new SHERPAFattContext(_configuration))
{
dbResult = dbCtx
.DbSetVat
.Where(x => (x.Descrizione.Contains(searchVal) || string.IsNullOrEmpty(searchVal)))
.OrderBy(x => x.Descrizione)
.ToList();
}
return dbResult;
}
/// <summary>
/// Ricerca VAT / CIva da idx
/// </summary>
/// <param name="idxVat"></param>
/// <returns></returns>
public VatModel? VATGetByKey(int idxVat)
{
VatModel? dbResult = new VatModel();
using (SHERPAFattContext dbCtx = new SHERPAFattContext(_configuration))
{
dbResult = dbCtx
.DbSetVat
.Where(x => (x.IdxVat == idxVat))
.FirstOrDefault();
}
return dbResult;
}
/// <summary>
/// Elenco VAT / CIva che richiedono sync tramite stored
/// </summary>
/// <param name="tipoDoc">Tipo doc, * = tutti</param>
/// <param name="anno">Anno doc, 0=tutti</param>
/// <param name="notUpl">Indica se solo non caricati (1 = NON caricati)</param>
/// <returns></returns>
public List<VatModel> VATToSync(string tipoDoc, int anno, bool notUpl)
{
List<VatModel> dbResult = new List<VatModel>();
using (SHERPAFattContext dbCtx = new SHERPAFattContext(_configuration))
{
SqlParameter Tipo = new SqlParameter("@tipo", tipoDoc);
SqlParameter Anno = new SqlParameter("@anno", anno);
SqlParameter NotUpl = new SqlParameter("@notUpl", notUpl);
dbResult = dbCtx
.DbSetVat
.FromSqlRaw("EXEC stp_VAT_getByAnno @tipo,@anno,@notUpl", Tipo, Anno, NotUpl)
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiorna un record VAT / CIva
/// </summary>
/// <param name="updItem"></param>
/// <returns></returns>
public bool VATUpdate(VatModel updItem)
{
bool done = false;
using (SHERPAFattContext dbCtx = new SHERPAFattContext(_configuration))
{
try
{
var currData = dbCtx
.DbSetVat
.Where(x => x.IdxVat == updItem.IdxVat)
.FirstOrDefault();
if (currData != null)
{
currData.Iva = updItem.Iva;
currData.Descrizione = updItem.Descrizione;
currData.Enabled= updItem.Enabled;
currData.SplitPay= updItem.SplitPay;
currData.id_ext = updItem.id_ext;
dbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
dbCtx
.DbSetVat
.Add(updItem);
}
dbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in VATUpdate{Environment.NewLine}{exc}");
}
}
return done;
}
#endregion Public Methods
#region Private Fields
+39 -37
View File
@@ -1,77 +1,79 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
// <auto-generated>
// This code was generated by a tool.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SHERPA {
public partial class DocArchive {
namespace SHERPA
{
public partial class DocArchive
{
/// <summary>
/// Controllo mod_searchParam.
/// mod_searchParam control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::SHERPA.WebUserControls.mod_searchParam mod_searchParam;
/// <summary>
/// Controllo divTopFooter.
/// divTopFooter control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divTopFooter;
/// <summary>
/// Controllo mod_billAdvFunHor.
/// mod_billAdvFunHor control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::SHERPA.WebUserControls.mod_billAdvFunHor mod_billAdvFunHor;
/// <summary>
/// Controllo divElenco.
/// divElenco control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divElenco;
/// <summary>
/// Controllo mod_DocsArchive.
/// mod_DocsArchive control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::SHERPA.WebUserControl.mod_DocsArchive mod_DocsArchive;
/// <summary>
/// Controllo divDetail.
/// divDetail control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divDetail;
/// <summary>
/// Controllo mod_DocsDetail.
/// mod_DocsDetail control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::SHERPA.WebUserControl.mod_DocsDetail mod_DocsDetail;
}