...
This commit is contained in:
@@ -4,6 +4,7 @@ using Back.Data.Infrastructure.Repository;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Org.BouncyCastle.Crypto.Tls;
|
||||
using Shared.DTOs;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Data.SqlTypes;
|
||||
@@ -300,8 +301,7 @@ namespace Back.Services
|
||||
dt.Add(DateTime.Now.AddDays(i).ConvertMiladiToShamsi());
|
||||
|
||||
request.MostInvoicedProduct = await _invoiceitemRepo.Get(w => w.invoice.CompanyID == user.RolUsers.First().CompanyID && !w.invoice.IsDeleted
|
||||
&& (w.invoice.invoiceType == InvoiceType.Sale || w.invoice.invoiceType == InvoiceType.BackFrmSale
|
||||
|| w.invoice.invoiceType == InvoiceType.Repair) && !w.invoice.BillReference.HasValue
|
||||
&& ((w.invoice.invoiceType == InvoiceType.Sale || w.invoice.invoiceType == InvoiceType.Repair) && !w.invoice.BillReference.HasValue || (w.invoice.invoiceType == InvoiceType.BackFrmSale))
|
||||
&& (dt.Contains(w.invoice.InvoiceDate)))
|
||||
.Include(inc => inc.cODItem)
|
||||
.GroupBy(g => g.CODID)
|
||||
@@ -314,9 +314,8 @@ namespace Back.Services
|
||||
.ToListAsync();
|
||||
|
||||
request.MostInvoicedCustomer = await _RepoInvoice.Get(w => w.CompanyID == user.RolUsers.First().CompanyID && !w.IsDeleted
|
||||
&& (w.invoiceType == InvoiceType.Sale || w.invoiceType == InvoiceType.BackFrmSale
|
||||
|| w.invoiceType == InvoiceType.Repair) && !w.BillReference.HasValue
|
||||
&& (dt.Contains(w.InvoiceDate)))
|
||||
&& ((w.invoiceType == InvoiceType.Sale || w.invoiceType == InvoiceType.Repair) && !w.BillReference.HasValue || (w.invoiceType == InvoiceType.BackFrmSale))
|
||||
&& dt.Contains(w.InvoiceDate))
|
||||
.Include(inc => inc.Customer)
|
||||
.GroupBy(g => g.CustomerID)
|
||||
.Select(s => new IdNameByCount<int>
|
||||
@@ -331,8 +330,8 @@ namespace Back.Services
|
||||
|
||||
|
||||
var sale = await _RepoInvoice.Get(w => w.CompanyID == user.RolUsers.First().CompanyID && !w.IsDeleted
|
||||
&& (w.invoiceType == InvoiceType.Sale || w.invoiceType == InvoiceType.BackFrmSale
|
||||
|| w.invoiceType == InvoiceType.Repair) && !w.BillReference.HasValue && w.InvoiceDate.StartsWith(cdate))
|
||||
&& ((w.invoiceType == InvoiceType.Sale || w.invoiceType == InvoiceType.Repair) && !w.BillReference.HasValue || (w.invoiceType == InvoiceType.BackFrmSale))
|
||||
&& w.InvoiceDate.StartsWith(cdate))
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
@@ -344,8 +343,8 @@ namespace Back.Services
|
||||
cdate = DateTime.Now.AddMonths(-1).ConvertMiladiToShamsiAndGetYearMonth();
|
||||
|
||||
var lastonthsale = await _RepoInvoice.Get(w => w.CompanyID == user.RolUsers.First().CompanyID && !w.IsDeleted
|
||||
&& (w.invoiceType == InvoiceType.Sale || w.invoiceType == InvoiceType.BackFrmSale
|
||||
|| w.invoiceType == InvoiceType.Repair) && !w.BillReference.HasValue && w.InvoiceDate.StartsWith(cdate))
|
||||
&& ((w.invoiceType == InvoiceType.Sale || w.invoiceType == InvoiceType.Repair) && !w.BillReference.HasValue || (w.invoiceType == InvoiceType.BackFrmSale))
|
||||
&& w.InvoiceDate.StartsWith(cdate))
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
@@ -363,8 +362,34 @@ namespace Back.Services
|
||||
|
||||
request.Salepercent = decimal.Parse(((part.Value / total.Value) * 100).ToString().Split('.')[0]);
|
||||
}
|
||||
// request.ForSaleChart.AddRange(new List<IdNameByCount<int>>()
|
||||
//{
|
||||
// new IdNameByCount<int>{ID=0,Title="1",count=10},
|
||||
// new IdNameByCount<int>{ID=1,Title="2",count=5},
|
||||
// new IdNameByCount<int>{ID=2,Title="3",count=12},
|
||||
// new IdNameByCount<int>{ID=3,Title="4",count=21}
|
||||
//});
|
||||
var dateTime = DateTime.Now.ConvertMiladiToShamsi();
|
||||
for (int i = 1; i <= Convert.ToInt32(dateTime.Substring(6, 2)); i++)
|
||||
{
|
||||
var sumsale = await _RepoInvoice.Get(w => w.CompanyID == user.RolUsers.First().CompanyID && !w.IsDeleted
|
||||
&& ((w.invoiceType == InvoiceType.Sale || w.invoiceType == InvoiceType.Repair) && !w.BillReference.HasValue || (w.invoiceType == InvoiceType.BackFrmSale))
|
||||
&& w.InvoiceDate == dateTime.Substring(0, 4) + dateTime.Substring(4, 2) + i.ToString("00"))
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
.Include(inc => inc.pattern)
|
||||
.Select(s => s.tbill).ToListAsync();
|
||||
|
||||
request.ForSaleChart.Add(new IdNameByCount<int>
|
||||
{
|
||||
count = sumsale.Sum(),
|
||||
ID = i - 1,
|
||||
Title = i.ToString()
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
return request;
|
||||
}
|
||||
public async Task<User> UpdateUser(User user)
|
||||
|
@@ -19,6 +19,7 @@ namespace Shared.DTOs
|
||||
public List<LastActivitySevice> lastActivitiesSevices { get; set; }=new List<LastActivitySevice>();
|
||||
public List<IdNameByCount<int>>? MostInvoicedProduct { get; set; }=new List<IdNameByCount<int>>();
|
||||
public List<IdNameByCount<int>>? MostInvoicedCustomer { get; set; } = new List<IdNameByCount<int>>();
|
||||
public List<IdNameByCount<int>> ForSaleChart { get; set; } = new List<IdNameByCount<int>>();
|
||||
public decimal? SaleInMonth { get; set; } = 0;
|
||||
public decimal? Salepercent { get; set; } = 0;
|
||||
}
|
||||
|
@@ -5,16 +5,10 @@
|
||||
private LineChart lineChart = default!;
|
||||
private LineChartOptions lineChartOptions = default!;
|
||||
private ChartData chartData = default!;
|
||||
public List<IdNameByCount<int>> items = new List<IdNameByCount<int>>();
|
||||
[Parameter] public List<IdNameByCount<int>> items { get;set; }
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
items.AddRange(new List<IdNameByCount<int>>()
|
||||
{
|
||||
new IdNameByCount<int>{ID=0,Title="1",count=10},
|
||||
new IdNameByCount<int>{ID=1,Title="2",count=5},
|
||||
new IdNameByCount<int>{ID=2,Title="3",count=12},
|
||||
new IdNameByCount<int>{ID=3,Title="4",count=21}
|
||||
});
|
||||
|
||||
|
||||
var colors = ColorBuilder.CategoricalTwelveColors;
|
||||
|
||||
|
@@ -215,10 +215,11 @@
|
||||
<div class="col-12 col-lg-8 order-2 order-md-3 order-lg-2 mb-4">
|
||||
<div class="card col-12">
|
||||
<div class="row row-bordered g-0">
|
||||
|
||||
@if (dashBoard != null)
|
||||
{
|
||||
<div class="col-md-12">
|
||||
<SaleChart />
|
||||
</div>
|
||||
<SaleChart items="dashBoard?.ForSaleChart" />
|
||||
</div>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user