wip - sales report
This commit is contained in:
parent
40f9334e2d
commit
adad250a1e
13 changed files with 108 additions and 26 deletions
|
@ -41,7 +41,7 @@
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
@activity.Company.Name
|
||||
@activity.ReportVisitDto.Name
|
||||
</td>
|
||||
<td>
|
||||
@activity.Demo
|
||||
|
|
|
@ -33,7 +33,7 @@ public partial class Home
|
|||
[Inject] public IActivityHttpRepository ActivityRepo { get; set; }
|
||||
private Preferences _prefs = new();
|
||||
private string _workDate;
|
||||
private List<ReportActivity> Activities { get; set; }
|
||||
private List<ReportActivityDto> Activities { get; set; }
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ActivityHttpRepository : IActivityHttpRepository
|
|||
_apiConfig = configuration.Value;
|
||||
}
|
||||
|
||||
public async Task<List<ReportActivity>?> GetActivities(string activityDate)
|
||||
public async Task<List<ReportActivityDto>?> GetActivities(string activityDate)
|
||||
{
|
||||
var response = await _client
|
||||
.GetAsync($"{_apiConfig.ActivityEndpoint}/date/{activityDate}")
|
||||
|
@ -61,8 +61,8 @@ public class ActivityHttpRepository : IActivityHttpRepository
|
|||
var content = await response.Content.ReadAsStringAsync();
|
||||
//Console.WriteLine(content);
|
||||
return string.IsNullOrWhiteSpace(content)
|
||||
? new List<ReportActivity>()
|
||||
: JsonSerializer.Deserialize<List<ReportActivity>>(content, _options);
|
||||
? new List<ReportActivityDto>()
|
||||
: JsonSerializer.Deserialize<List<ReportActivityDto>>(content, _options);
|
||||
}
|
||||
public async Task<PagingResponse<ActivityDto>> GetActivityPaged(ActivityPagingParams pagingParameters)
|
||||
{
|
||||
|
|
|
@ -28,5 +28,5 @@ public interface IActivityHttpRepository
|
|||
Task<ActivityDto> GetActivity(string id);
|
||||
Task<ActivityResponseView> CreateActivity(ActivityDto model);
|
||||
Task<ActivityResponseView> AcceptOffer(string id);
|
||||
Task<List<ReportActivity>?> GetActivities(string activityDate);
|
||||
Task<List<ReportActivityDto>?> GetActivities(string activityDate);
|
||||
}
|
9
Wonky.Client/HttpRepository/IReportHttpRepository.cs
Normal file
9
Wonky.Client/HttpRepository/IReportHttpRepository.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using Wonky.Client.Pages;
|
||||
using Wonky.Entity.DTO;
|
||||
|
||||
namespace Wonky.Client.HttpRepository;
|
||||
|
||||
public interface IReportHttpRepository
|
||||
{
|
||||
Task<NgSalesReportInitDto> FetchReport(string workDate);
|
||||
}
|
38
Wonky.Client/HttpRepository/ReportHttpRepository.cs
Normal file
38
Wonky.Client/HttpRepository/ReportHttpRepository.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Wonky.Entity.Configuration;
|
||||
using Wonky.Entity.DTO;
|
||||
|
||||
namespace Wonky.Client.HttpRepository;
|
||||
|
||||
public class ReportHttpRepository :IReportHttpRepository
|
||||
{
|
||||
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
private readonly NavigationManager _navigation;
|
||||
private ILogger<SalesItemHttpRepository> _logger;
|
||||
private readonly HttpClient _client;
|
||||
private readonly ApiConfig _apiConfig;
|
||||
|
||||
public ReportHttpRepository(HttpClient client,
|
||||
ILogger<SalesItemHttpRepository> logger,
|
||||
NavigationManager navigation, IOptions<ApiConfig> configuration)
|
||||
{
|
||||
_client = client;
|
||||
_logger = logger;
|
||||
_navigation = navigation;
|
||||
_apiConfig = configuration.Value;
|
||||
}
|
||||
|
||||
public async Task<NgSalesReportInitDto> FetchReport(string workDate)
|
||||
{
|
||||
var initData = await _client
|
||||
.GetFromJsonAsync<NgSalesReportInitDto>($"{_apiConfig.ReportEndpoint}/init/{workDate}");
|
||||
return initData ?? new NgSalesReportInitDto();
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
@page "/CrmReport"
|
||||
<h3>CrmReport</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
|
@ -124,7 +124,7 @@
|
|||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
@activity.Company.Name @activity.Company.ZipCity
|
||||
@activity.ReportVisitDto.Name @activity.ReportVisitDto.ZipCity
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
|
|
|
@ -33,7 +33,7 @@ public partial class SalesReport
|
|||
private ReportDto _reportDto = new();
|
||||
private Preferences _prefs { get; set; } = new();
|
||||
private bool _formInvalid = true;
|
||||
private List<ReportActivity>? Activities { get; set; } = new();
|
||||
private List<ReportActivityDto>? Activities { get; set; } = new();
|
||||
private DateTime _workDate;
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
|
10
Wonky.Entity/DTO/NgSalesReportInitDto.cs
Normal file
10
Wonky.Entity/DTO/NgSalesReportInitDto.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using Wonky.Entity.Models;
|
||||
|
||||
namespace Wonky.Entity.DTO;
|
||||
|
||||
public class NgSalesReportInitDto
|
||||
{
|
||||
public ReportFiguresDto ReportFigures { get; set; } = new();
|
||||
public List<ReportActivityDto> Activities { get; set; } = new();
|
||||
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
namespace Wonky.Entity.Models;
|
||||
namespace Wonky.Entity.DTO;
|
||||
|
||||
public class ReportActivity
|
||||
public class ReportActivityDto
|
||||
{
|
||||
public VisitCompany Company { get; set; }
|
||||
public ReportVisitDto ReportVisitDto { get; set; } = new();
|
||||
public string SalesHeadId { get; set; } = "";
|
||||
public bool Closed { get; set; }
|
||||
public string OrderDate { get; set; } = "";
|
||||
|
@ -14,12 +14,3 @@ public class ReportActivity
|
|||
public string SalesResume { get; set; } = "";
|
||||
}
|
||||
|
||||
public class VisitCompany
|
||||
{
|
||||
public string CompanyId { get; set; } = "";
|
||||
public string Account { get; set; } = "";
|
||||
public string Name { get; set; } = "";
|
||||
public string ZipCity { get; set; } = "";
|
||||
public string Phone { get; set; } = "";
|
||||
public string VatNumber { get; set; } = "";
|
||||
}
|
29
Wonky.Entity/DTO/ReportFiguresDto.cs
Normal file
29
Wonky.Entity/DTO/ReportFiguresDto.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
namespace Wonky.Entity.DTO;
|
||||
|
||||
public class ReportFiguresDto
|
||||
{
|
||||
public int SalesDayNumber { get; set; }
|
||||
public int NewVisitCount { get; set; }
|
||||
public int NewDemoCount { get; set; }
|
||||
public int NewSaleCount { get; set; }
|
||||
public int RecallVisitCount { get; set; }
|
||||
public int RecallDemoCount { get; set; }
|
||||
public int RecallSaleCount { get; set; }
|
||||
public int SasCount { get; set; }
|
||||
public int DistanceMonth { get; set; }
|
||||
public int NewVisitCountMonth { get; set; }
|
||||
public int NewDemoCountMonth { get; set; }
|
||||
public int NewSaleCountMonth { get; set; }
|
||||
public int RecallVisitCountMonth { get; set; }
|
||||
public int RecallDemoCountMonth { get; set; }
|
||||
public int RecallSaleCountMonth { get; set; }
|
||||
public int SasCountMonth { get; set; }
|
||||
public decimal NewTurnover { get; set; }
|
||||
public decimal RecallTurnover { get; set; }
|
||||
public decimal SasTurnover { get; set; }
|
||||
public decimal TotalTurnover { get; set; }
|
||||
public decimal NewTurnoverMonth { get; set; }
|
||||
public decimal RecallTurnoverMonth { get; set; }
|
||||
public decimal SasTurnoverMonth { get; set; }
|
||||
public decimal TotalTurnoverMonth { get; set; }
|
||||
}
|
11
Wonky.Entity/DTO/ReportVisitDto.cs
Normal file
11
Wonky.Entity/DTO/ReportVisitDto.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Wonky.Entity.DTO;
|
||||
|
||||
public class ReportVisitDto
|
||||
{
|
||||
public string CompanyId { get; set; } = "";
|
||||
public string Account { get; set; } = "";
|
||||
public string Name { get; set; } = "";
|
||||
public string ZipCity { get; set; } = "";
|
||||
public string Phone { get; set; } = "";
|
||||
public string VatNumber { get; set; } = "";
|
||||
}
|
Loading…
Reference in a new issue