...
This commit is contained in:
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Shared.DTOs;
|
using Shared.DTOs;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Runtime.ConstrainedExecution;
|
||||||
|
|
||||||
namespace Back.Controllers
|
namespace Back.Controllers
|
||||||
{
|
{
|
||||||
@@ -157,5 +158,6 @@ namespace Back.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
using Back.Data.Contracts;
|
using Back.Data.Contracts;
|
||||||
using Back.Data.Models;
|
using Back.Data.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Shared.DTOs;
|
||||||
|
|
||||||
namespace Back.Services
|
namespace Back.Services
|
||||||
{
|
{
|
||||||
@@ -38,5 +40,6 @@ namespace Back.Services
|
|||||||
{
|
{
|
||||||
return await _invoiceitemRepo.Get(w => w.InvoiceID == invoiceID && w.ID == invoiceitemID && w.invoice.CompanyID == companyID).FirstOrDefaultAsync();
|
return await _invoiceitemRepo.Get(w => w.InvoiceID == invoiceID && w.ID == invoiceitemID && w.invoice.CompanyID == companyID).FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ using Back.Data.Models;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using Shared.DTOs;
|
using Shared.DTOs;
|
||||||
|
using System.ComponentModel.Design;
|
||||||
using System.Data.SqlTypes;
|
using System.Data.SqlTypes;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -21,7 +22,7 @@ namespace Back.Services
|
|||||||
private readonly IAsyncRepository<User> _RepoUser;
|
private readonly IAsyncRepository<User> _RepoUser;
|
||||||
private readonly RepositoryBase<Company> _RepoCompany;
|
private readonly RepositoryBase<Company> _RepoCompany;
|
||||||
private readonly IAsyncRepository<PermissionPeriod> _RepoPermissionPeriod;
|
private readonly IAsyncRepository<PermissionPeriod> _RepoPermissionPeriod;
|
||||||
|
private readonly IAsyncRepository<InvoiceItem> _invoiceitemRepo;
|
||||||
private readonly IAsyncRepository<Customer> _RepoCus;
|
private readonly IAsyncRepository<Customer> _RepoCus;
|
||||||
private readonly IAsyncRepository<Invoice> _RepoInvoice;
|
private readonly IAsyncRepository<Invoice> _RepoInvoice;
|
||||||
private readonly IAsyncRepository<CODItem> _RepoCODItem;
|
private readonly IAsyncRepository<CODItem> _RepoCODItem;
|
||||||
@@ -30,8 +31,10 @@ namespace Back.Services
|
|||||||
, IAsyncRepository<User> RepoUser
|
, IAsyncRepository<User> RepoUser
|
||||||
, IAsyncRepository<PermissionPeriod> RepoPermissionPeriod
|
, IAsyncRepository<PermissionPeriod> RepoPermissionPeriod
|
||||||
, RepositoryBase<Company> repoCompany, IAsyncRepository<Customer> RepoCus
|
, RepositoryBase<Company> repoCompany, IAsyncRepository<Customer> RepoCus
|
||||||
, IAsyncRepository<Invoice> RepoInvoice, IAsyncRepository<CODItem> RepoCODItem)
|
, IAsyncRepository<Invoice> RepoInvoice, IAsyncRepository<CODItem> RepoCODItem
|
||||||
|
, IAsyncRepository<InvoiceItem> invoiceitemRepo)
|
||||||
{
|
{
|
||||||
|
_invoiceitemRepo = invoiceitemRepo;
|
||||||
_RepoCus = RepoCus;
|
_RepoCus = RepoCus;
|
||||||
_RepoInvoice = RepoInvoice;
|
_RepoInvoice = RepoInvoice;
|
||||||
_RepoCODItem = RepoCODItem;
|
_RepoCODItem = RepoCODItem;
|
||||||
@@ -291,6 +294,19 @@ namespace Back.Services
|
|||||||
if (lastcus != null)
|
if (lastcus != null)
|
||||||
request.lastActivitiesSevices.Add(lastcus);
|
request.lastActivitiesSevices.Add(lastcus);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
request.MostInvoicedProduct = await _invoiceitemRepo.Get(w => w.invoice.CompanyID == user.RolUsers.First().CompanyID
|
||||||
|
&& (w.invoice.invoiceType==InvoiceType.Sale || w.invoice.invoiceType == InvoiceType.BackFrmSale
|
||||||
|
|| w.invoice.invoiceType == InvoiceType.Repair) && !w.invoice.BillReference.HasValue)
|
||||||
|
.Include(inc=>inc.cODItem)
|
||||||
|
.GroupBy(g => g.CODID)
|
||||||
|
.Select(s => new IdNameByCount<int>{
|
||||||
|
ID= s.Key,
|
||||||
|
Title=s.Select(s=>s.sstt).First(),
|
||||||
|
count =Convert.ToInt32(s.Sum(s => s.am))
|
||||||
|
}).OrderByDescending(o => o.count)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
public async Task<User> UpdateUser(User user)
|
public async Task<User> UpdateUser(User user)
|
||||||
|
@@ -17,6 +17,7 @@ namespace Shared.DTOs
|
|||||||
public List<AlertDTO> Warning { get; set; } = new List<AlertDTO>();
|
public List<AlertDTO> Warning { get; set; } = new List<AlertDTO>();
|
||||||
public List<AlertDTO> Notifications { get; set; } = new List<AlertDTO>();
|
public List<AlertDTO> Notifications { get; set; } = new List<AlertDTO>();
|
||||||
public List<LastActivitySevice> lastActivitiesSevices { get; set; }=new List<LastActivitySevice>();
|
public List<LastActivitySevice> lastActivitiesSevices { get; set; }=new List<LastActivitySevice>();
|
||||||
|
public List<IdNameByCount<int>>? MostInvoicedProduct { get; set; }=new List<IdNameByCount<int>>();
|
||||||
}
|
}
|
||||||
public class ServiceInDashBoardDTO
|
public class ServiceInDashBoardDTO
|
||||||
{
|
{
|
||||||
|
@@ -15,4 +15,8 @@ namespace Shared.DTOs
|
|||||||
{
|
{
|
||||||
public int Tax { get; set; }
|
public int Tax { get; set; }
|
||||||
}
|
}
|
||||||
|
public class IdNameByCount<T> : IdName<T>
|
||||||
|
{
|
||||||
|
public int count { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
6
TaxPayerFull/Layout/MostInvoicedProduct.razor
Normal file
6
TaxPayerFull/Layout/MostInvoicedProduct.razor
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@using Shared.DTOs
|
||||||
|
<h3>MostInvoicedProduct</h3>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public List<IdNameByCount<int>>? model { get; set; }
|
||||||
|
}
|
Reference in New Issue
Block a user