Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Added reports for vendor in their portal #431

support8d18b15749ae
diff --git a/src/Business/Grand.Business.Common/Services/Security/PermissionProvider.cs b/src/Business/Grand.Business.Common/Services/Security/PermissionProvider.cs
index 65f6a0525..43e91ceaf 100644
--- a/src/Business/Grand.Business.Common/Services/Security/PermissionProvider.cs
+++ b/src/Business/Grand.Business.Common/Services/Security/PermissionProvider.cs
@@ -203,7 +203,8 @@ namespace Grand.Business.Common.Services.Security
StandardPermission.ManageOrders,
StandardPermission.ManageVendorReviews,
StandardPermission.ManageShipments,
- StandardPermission.ManageMerchandiseReturns
+ StandardPermission.ManageMerchandiseReturns,
+ StandardPermission.ManageReports
}
},
new DefaultPermission
diff --git a/src/Business/Grand.Business.Core/Interfaces/System/Reports/ICustomerReportService.cs b/src/Business/Grand.Business.Core/Interfaces/System/Reports/ICustomerReportService.cs
index d3b88cbb0..71a719e6c 100644
--- a/src/Business/Grand.Business.Core/Interfaces/System/Reports/ICustomerReportService.cs
+++ b/src/Business/Grand.Business.Core/Interfaces/System/Reports/ICustomerReportService.cs
@@ -14,6 +14,7 @@ namespace Grand.Business.Core.Interfaces.System.Reports
/// Get best customers
/// </summary>
/// <param name="storeId">Store ident</param>
+ /// <param name="vendorId">Vendor ident</param>
/// <param name="createdFromUtc">Order created date from (UTC); null to load all records</param>
/// <param name="createdToUtc">Order created date to (UTC); null to load all records</param>
/// <param name="os">Order status; null to load all records</param>
@@ -23,8 +24,8 @@ namespace Grand.Business.Core.Interfaces.System.Reports
/// <param name="pageIndex">Page index</param>
/// <param name="pageSize">Page size</param>
/// <returns>Report</returns>
- IPagedList<BestCustomerReportLine> GetBestCustomersReport(string storeId, DateTime? createdFromUtc,
- DateTime? createdToUtc, int? os, PaymentStatus? ps, ShippingStatus? ss, int orderBy,
+ IPagedList<BestCustomerReportLine> GetBestCustomersReport(string storeId = "", string vendorId = "", DateTime? createdFromUtc = null,
+ DateTime? createdToUtc = null, int? os = null, PaymentStatus? ps = null, ShippingStatus? ss = null, int orderBy = 0,
int pageIndex = 0, int pageSize = 214748364);
/// Gets a report of customers registered in the last days
diff --git a/src/Business/Grand.Business.Core/Interfaces/System/Reports/IOrderReportService.cs b/src/Business/Grand.Business.Core/Interfaces/System/Reports/IOrderReportService.cs
index 357aa334b..6310b179d 100644
--- a/src/Business/Grand.Business.Core/Interfaces/System/Reports/IOrderReportService.cs
+++ b/src/Business/Grand.Business.Core/Interfaces/System/Reports/IOrderReportService.cs
@@ -15,13 +15,15 @@ namespace Grand.Business.Core.Interfaces.System.Reports
/// Get "order by country" report
/// </summary>
/// <param name="storeId">Store identifier; "" to load all records</param>
+ /// <param name="vendorId">Vendor identifier; "" to load all records</param>
/// <param name="os">Order status</param>
/// <param name="ps">Payment status</param>
/// <param name="ss">Shipping status</param>
/// <param name="startTimeUtc">Start date</param>
/// <param name="endTimeUtc">End date</param>
/// <returns>Result</returns>
- Task<IList<OrderByCountryReportLine>> GetCountryReport(string storeId = "", int? os = null,
+ Task<IList<OrderByCountryReportLine>> GetCountryReport(string storeId = "",
+ string vendorId = "", int? os = null,
PaymentStatus? ps = null, ShippingStatus? ss = null,
DateTime? startTimeUtc = null, DateTime? endTimeUtc = null);
diff --git a/src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationUpdateResourceString.cs b/src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationUpdateResourceString.cs
index 8a5c1d024..9ca37c54e 100644
--- a/src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationUpdateResourceString.cs
+++ b/src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationUpdateResourceString.cs
@@ -7,7 +7,7 @@ namespace Grand.Business.System.Services.Migrations._2._2
{
public int Priority => 0;
public DbVersion Version => new(2, 2);
- public Guid Identity => new("FA844964-DB84-457C-B517-E0EF521AE44B");
+ public Guid Identity => new("97287FAC-ECF6-462E-9ED0-586C26151A4F");
public string Name => "Update resource string for english language 2.2";
/// <summary>
diff --git a/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs b/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs
index 18d639cf0..6f4e99543 100644
--- a/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs
+++ b/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs
@@ -52,6 +52,7 @@ namespace Grand.Business.System.Services.Reports
/// Get best customers
/// </summary>
/// <param name="storeId">Store ident</param>
+ /// <param name="vendorId">Vendor ident</param>
/// <param name="createdFromUtc">Order created date from (UTC); null to load all records</param>
/// <param name="createdToUtc">Order created date to (UTC); null to load all records</param>
/// <param name="os">Order status; null to load all records</param>
@@ -61,8 +62,8 @@ namespace Grand.Business.System.Services.Reports
/// <param name="pageIndex">Page index</param>
/// <param name="pageSize">Page size</param>
/// <returns>Report</returns>
- public virtual IPagedList<BestCustomerReportLine> GetBestCustomersReport(string storeId, DateTime? createdFromUtc,
- DateTime? createdToUtc, int? os, PaymentStatus? ps, ShippingStatus? ss, int orderBy,
+ public virtual IPagedList<BestCustomerReportLine> GetBestCustomersReport(string storeId = "", string vendorId = "", DateTime? createdFromUtc = null,
+ DateTime? createdToUtc = null, int? os = null, PaymentStatus? ps = null, ShippingStatus? ss = null, int orderBy = 0,
int pageIndex = 0, int pageSize = 214748364)
{
@@ -83,37 +84,57 @@ namespace Grand.Business.System.Services.Reports
if (!string.IsNullOrEmpty(storeId))
query = query.Where(o => o.StoreId == storeId);
- var query2 = from co in query
- group co by co.CustomerId into g
- select new
- {
- CustomerId = g.Key,
- OrderTotal = g.Sum(x => x.OrderTotal / x.CurrencyRate),
- OrderCount = g.Count()
- };
- switch (orderBy)
+ if (string.IsNullOrEmpty(vendorId))
{
- case 1:
+ var query2 = from co in query
+ group co by co.CustomerId into g
+ select new
{
- query2 = query2.OrderByDescending(x => x.OrderTotal);
- }
- break;
- case 2:
- {
- query2 = query2.OrderByDescending(x => x.OrderCount);
- }
- break;
- default:
- throw new ArgumentException("Wrong orderBy parameter", "orderBy");
+ CustomerId = g.Key,
+ OrderTotal = g.Sum(x => x.OrderTotal / x.CurrencyRate),
+ OrderCount = g.Count()
+ };
+ query2 = orderBy switch {
+ 1 => query2.OrderByDescending(x => x.OrderTotal),
+ 2 => query2.OrderByDescending(x => x.OrderCount),
+ _ => throw new ArgumentException("Wrong orderBy parameter", "orderBy")
+ };
+
+ var tmp = new PagedList<dynamic>(query2, pageIndex, pageSize);
+ return new PagedList<BestCustomerReportLine>(tmp.Select(x => new BestCustomerReportLine {
+ CustomerId = x.CustomerId,
+ OrderTotal = x.OrderTotal,
+ OrderCount = x.OrderCount
+ }), tmp.PageIndex, tmp.PageSize, tmp.TotalCount);
}
-
- var tmp = new PagedList<dynamic>(query2, pageIndex, pageSize);
- return new PagedList<BestCustomerReportLine>(tmp.Select(x => new BestCustomerReportLine {
+
+ var vendorQuery = from p in query
+ from item in p.OrderItems
+ select new { VendorId = item.VendorId, CustomerId = p.CustomerId, OrderCode = p.Code, Quantity = item.Quantity, PriceInclTax = item.PriceInclTax, Rate = p.Rate };
+
+ vendorQuery = vendorQuery.Where(x => x.VendorId == vendorId);
+
+ var vendorQueryGroup = from co in vendorQuery
+ group co by co.CustomerId into g
+ select new
+ {
+ CustomerId = g.Key,
+ OrderTotal = g.Sum(x => x.PriceInclTax / x.Rate),
+ OrderCount = g.Count()
+ };
+ vendorQueryGroup = orderBy switch {
+ 1 => vendorQueryGroup.OrderByDescending(x => x.OrderTotal),
+ 2 => vendorQueryGroup.OrderByDescending(x => x.OrderCount),
+ _ => throw new ArgumentException("Wrong orderBy parameter", "orderBy")
+ };
+
+ var vendorReport = new PagedList<dynamic>(vendorQueryGroup, pageIndex, pageSize);
+ return new PagedList<BestCustomerReportLine>(vendorReport.Select(x => new BestCustomerReportLine {
CustomerId = x.CustomerId,
OrderTotal = x.OrderTotal,
OrderCount = x.OrderCount
- }),
- tmp.PageIndex, tmp.PageSize, tmp.TotalCount);
+ }), vendorReport.PageIndex, vendorReport.PageSize, vendorReport.TotalCount);
+
}
/// <summary>
diff --git a/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs b/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
index 9330f9891..159aca7b0 100644
--- a/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
+++ b/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
@@ -53,13 +53,14 @@ namespace Grand.Business.System.Services.Reports
/// Get "order by country" report
/// </summary>
/// <param name="storeId">Store identifier</param>
+ /// <param name="vendorId">Vendor identifier</param>
/// <param name="os">Order status</param>
/// <param name="ps">Payment status</param>
/// <param name="ss">Shipping status</param>
/// <param name="startTimeUtc">Start date</param>
/// <param name="endTimeUtc">End date</param>
/// <returns>Result</returns>
- public virtual async Task<IList<OrderByCountryReportLine>> GetCountryReport(string storeId, int? os,
+ public virtual async Task<IList<OrderByCountryReportLine>> GetCountryReport(string storeId, string vendorId, int? os,
PaymentStatus? ps, ShippingStatus? ss, DateTime? startTimeUtc, DateTime? endTimeUtc)
{
var query = from p in _orderRepository.Table
@@ -79,23 +80,57 @@ namespace Grand.Business.System.Services.Reports
if (endTimeUtc.HasValue)
query = query.Where(o => endTimeUtc.Value >= o.CreatedOnUtc);
- var report = (from oq in query
- group oq by oq.BillingAddress.CountryId into result
- select new
- {
- CountryId = result.Key,
- TotalOrders = result.Count(),
- SumOrders = result.Sum(o => o.OrderTotal / o.CurrencyRate)
- }
- )
- .OrderByDescending(x => x.SumOrders)
- .Select(r => new OrderByCountryReportLine {
- CountryId = r.CountryId,
- TotalOrders = r.TotalOrders,
- SumOrders = r.SumOrders
- });
-
- return await Task.FromResult(report.ToList());
+ if (!string.IsNullOrEmpty(vendorId))
+ {
+ query = query
+ .Where(o => o.OrderItems
+ .Any(orderItem => orderItem.VendorId == vendorId));
+ }
+
+ if (string.IsNullOrEmpty(vendorId))
+ {
+ var report = (from oq in query
+ group oq by oq.BillingAddress.CountryId
+ into result
+ select new {
+ CountryId = result.Key,
+ TotalOrders = result.Count(),
+ SumOrders = result.Sum(o => o.OrderTotal / o.CurrencyRate)
+ }
+ )
+ .OrderByDescending(x => x.SumOrders)
+ .Select(r => new OrderByCountryReportLine {
+ CountryId = r.CountryId,
+ TotalOrders = r.TotalOrders,
+ SumOrders = r.SumOrders
+ });
+
+ return await Task.FromResult(report.ToList());
+ }
+
+ var vendorQuery = from p in query
+ from item in p.OrderItems
+ select new { VendorId = item.VendorId, OrderCode = p.Code, CountryId = p.BillingAddress.CountryId, Quantity = item.Quantity, PriceInclTax = item.PriceInclTax, Rate = p.Rate };
+
+ vendorQuery = vendorQuery.Where(x => x.VendorId == vendorId);
+
+ var vendorReport = (from oq in vendorQuery
+ group oq by oq.CountryId
+ into result
+ select new {
+ CountryId = result.Key,
+ TotalOrders = result.Count(),
+ SumOrders = result.Sum(y => y.PriceInclTax / y.Rate)
+ }
+ )
+ .OrderByDescending(x => x.SumOrders)
+ .Select(r => new OrderByCountryReportLine {
+ CountryId = r.CountryId,
+ TotalOrders = r.TotalOrders,
+ SumOrders = r.SumOrders
+ });
+ return await Task.FromResult(vendorReport.ToList());
+
}
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs
index 38c97be76..553733013 100644
--- a/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs
@@ -111,8 +111,16 @@ namespace Grand.Web.Admin.Services
PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;
- var items = _customerReportService.GetBestCustomersReport(model.StoreId, startDateValue, endDateValue,
- orderStatus, paymentStatus, shippingStatus, 2, pageIndex - 1, pageSize);
+ var items = _customerReportService.GetBestCustomersReport(
+ storeId: model.StoreId,
+ createdFromUtc: startDateValue,
+ createdToUtc: endDateValue,
+ os: orderStatus,
+ ps: paymentStatus,
+ ss: shippingStatus,
+ orderBy: 2,
+ pageIndex: pageIndex - 1,
+ pageSize: pageSize);
var report = new List<BestCustomerReportLineModel>();
foreach (var x in items)
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/Statistics.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/Statistics.cshtml
new file mode 100644
index 000000000..eea790d64
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Home/Statistics.cshtml
@@ -0,0 +1,55 @@
+@{
+ //page title
+ ViewBag.Title = Loc["Vendor.Dashboard.Statistics"];
+}
+
+<div class="page-bar" style="height:43px;">
+ <div class="page-toolbar">
+ <div id="dashboard-report-range" class="pull-right btn btn-sm">
+ <i class="icon-calendar"></i>&nbsp;
+ <span class="thin uppercase">@DateTime.Now.ToLocalTime().ToString(CultureInfo.InvariantCulture)</span>&nbsp;
+ </div>
+ </div>
+</div>
+<div class="content-header">
+ <h3 class="page-title">
+ <i class="icon-bulb"></i>
+ @Loc["Vendor.Dashboard"]
+ <small>@Loc["Vendor.Dashboard.Statistics"]</small>
+ </h3>
+</div>
+
+<div class="content">
+ <vc:vendor-widget widget-zone="vendor_dashboard_statistics_before" />
+ <div class="row">
+ <div class="col-md-12">
+ <div class="row">
+ <div class="col-md-6">
+ <div class="x_panel">
+ <div class="x_title">
+ <div class="caption level-caption">
+ <span class="caption-subject font-dark bold uppercase">@Loc["Vendor.Reports.BestSellers.ByQuantity"]</span>
+ </div>
+ </div>
+ <div class="x_content">
+ <vc:vendor-bestsellers-brief-report-by-quantity></vc:vendor-bestsellers-brief-report-by-quantity>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-6">
+ <div class="x_panel">
+ <div class="x_title">
+ <div class="caption level-caption">
+ <span class="caption-subject font-dark bold uppercase">@Loc["Vendor.Reports.BestSellers.ByAmount"]</span>
+ </div>
+ </div>
+ <div class="x_content">
+ <vc:vendor-bestsellers-brief-report-by-amount></vc:vendor-bestsellers-brief-report-by-amount>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <vc:vendor-widget widget-zone="vendor_dashboard_statistics_after" />
+</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/BestsellersReport.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/BestsellersReport.cshtml
new file mode 100644
index 000000000..fc553895d
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/BestsellersReport.cshtml
@@ -0,0 +1,159 @@
+@model BestsellersReportModel
+@inject AdminAreaSettings adminAreaSettings
+@{
+ //page title
+ ViewBag.Title = Loc["Vendor.Reports.Bestsellers"];
+}
+
+<div class="row">
+ <div class="col-md-12">
+ <div class="x_panel light form-fit popup-window">
+ <div class="x_title">
+ <div class="caption level-caption">
+ <i class="fa fa-list-alt"></i>
+ @Loc["Vendor.Reports.Bestsellers"]
+ </div>
+
+ </div>
+ <div class="x_content form">
+ <vc:vendor-widget widget-zone="vendor_bestsellers_report" additional-data="Model" />
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="x_content">
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="main-header col-12 px-0">
+ <div class="row align-items-end">
+ <div class="col-md-4 col-sm-12 col-12">
+ <div class="form-actions">
+ <div class="btn-group">
+ <button class="btn btn-success filter-submit" id="search-salesreport">
+ <i class="fa fa-search"></i> @Loc["Vendor.Reports.Bestsellers.RunReport"]
+ </button>
+ <button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
+ <i class="fa fa-filter"></i>&nbsp; @Loc["Vendor.Common.Filters"]
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="collapse" id="filterCollapse">
+ <div class="drop-filters-container w-100">
+ <div class="form-group">
+ <admin-label asp-for="StartDate" class="col-sm-3 control-label" />
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="StartDate" />
+ </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="EndDate" class="col-sm-3 control-label" />
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="EndDate" />
+ </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="PaymentStatusId" class="col-sm-3 control-label" />
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses" />
+ </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="BillingCountryId" class="col-sm-3 control-label" />
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="BillingCountryId" asp-items="Model.AvailableCountries" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="x_content">
+ <div id="salesreport-grid"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+<script>
+ $(document).ready(function () {
+ $("#salesreport-grid").kendoGrid({
+ dataSource: {
+ transport: {
+ read: {
+ url: "@Html.Raw(Url.Action("BestsellersReportList", "Reports", new { area = Constants.AreaVendor }))",
+ type: "POST",
+ dataType: "json",
+ data: additionalData
+ }
+ },
+ schema: {
+ data: "Data",
+ total: "Total",
+ errors: "Errors"
+ },
+ error: function(e) {
+ display_kendoui_grid_error(e);
+ // Cancel the changes
+ this.cancelChanges();
+ },
+ pageSize: @(adminAreaSettings.DefaultGridPageSize),
+ serverPaging: true,
+ serverFiltering: true,
+ serverSorting: true
+ },
+ pageable: {
+ refresh: true,
+ pageSizes: [@(adminAreaSettings.GridPageSizes)]
+ },
+ editable: {
+ confirmation: false,
+ mode: "inline"
+ },
+ scrollable: false,
+ columns: [{
+ field: "ProductName",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.Name"]",
+ template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { area = Constants.AreaVendor })/#=ProductId#">#=kendo.htmlEncode(ProductName)#</a>'
+ }, {
+ field: "TotalQuantity",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.TotalQuantity"]"
+ },{
+ field: "TotalAmount",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.TotalAmount"]"
+ }]
+ });
+ });
+</script>
+<script>
+
+ $(document).ready(function () {
+
+ $('#search-salesreport').click(function () {
+ var grid = $('#salesreport-grid').data('kendoGrid');
+ grid.dataSource.page(1); //new search. Set page size to 1
+ //grid.dataSource.read(); we already loaded the grid above using "page" function
+ return false;
+ });
+
+ });
+
+ function additionalData() {
+ var data = {
+ StartDate: $('#@Html.IdFor(model => model.StartDate)').val(),
+ EndDate: $('#@Html.IdFor(model => model.EndDate)').val(),
+ StoreId: $('#StoreId').val(),
+ PaymentStatusId: $('#PaymentStatusId').val(),
+ BillingCountryId: $('#BillingCountryId').val(),
+ VendorId: $('#VendorId').val()
+ };
+ addAntiForgeryToken(data);
+ return data;
+ }
+
+</script>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/CountryReport.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/CountryReport.cshtml
new file mode 100644
index 000000000..26c67ec1d
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/CountryReport.cshtml
@@ -0,0 +1,148 @@
+@model CountryReportModel
+@{
+ //page title
+ ViewBag.Title = Loc["Vendor.Reports.Country"];
+}
+
+
+
+<div class="row">
+ <div class="col-md-12">
+ <div class="x_panel light form-fit popup-window">
+ <div class="x_title">
+ <div class="caption level-caption">
+ <i class="fa fa-list-alt"></i>
+ @Loc["Vendor.Reports.Country"]
+ </div>
+
+ </div>
+ <div class="x_content form">
+ <vc:vendor-widget widget-zone="vendor_country_report" additional-data="Model" />
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="x_content">
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="main-header col-12 px-0">
+ <div class="row align-items-end">
+ <div class="col-md-4 col-ms-12 col-12">
+ <div class="form-group mb-0">
+ <admin-label asp-for="StartDate" class="control-label" />
+ <admin-input asp-for="StartDate" />
+ </div>
+ </div>
+ <div class="col-md-4 col-ms-12 col-12">
+ <div class="form-group mb-0">
+ <admin-label asp-for="EndDate" class="control-label" />
+ <admin-input asp-for="EndDate" />
+ </div>
+ </div>
+ <div class="col-md-4 col-sm-12 col-12">
+ <div class="form-actions">
+ <div class="btn-group">
+ <button class="btn btn-success filter-submit" id="search-countryreport">
+ <i class="fa fa-search"></i> @Loc["Vendor.Reports.Country.RunReport"]
+ </button>
+ <button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
+ <i class="fa fa-filter"></i>&nbsp; @Loc["Vendor.Common.Filters"]
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="collapse" id="filterCollapse">
+ <div class="drop-filters-container w-100">
+ <div class="form-group">
+ <admin-label asp-for="PaymentStatusId" class="control-label col-md-3 col-sm-3" />
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="x_content">
+ <div id="countryreport-grid"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+
+ <script>
+ $(document).ready(function () {
+ $("#countryreport-grid").kendoGrid({
+ dataSource: {
+ transport: {
+ read: {
+ url: "@Html.Raw(Url.Action("CountryReportList", "Reports", new { area = Constants.AreaVendor }))",
+ type: "POST",
+ dataType: "json",
+ data: additionalData
+ }
+ },
+ schema: {
+ data: "Data",
+ total: "Total",
+ errors: "Errors"
+ },
+ error: function(e) {
+ display_kendoui_grid_error(e);
+ // Cancel the changes
+ this.cancelChanges();
+ },
+ serverPaging: true,
+ serverFiltering: true,
+ serverSorting: true
+ },
+ pageable: {
+ refresh: true,
+ numeric: false,
+ previousNext: false,
+ info: false
+ },
+ scrollable: false,
+ columns: [{
+ field: "CountryName",
+ title: "@Loc["Vendor.Reports.Country.Fields.CountryName"]"
+ }, {
+ field: "TotalOrders",
+ title: "@Loc["Vendor.Reports.Country.Fields.TotalOrders"]"
+ },{
+ field: "SumOrders",
+ title: "@Loc["Vendor.Reports.Country.Fields.SumOrders"]"
+ }]
+ });
+ });
+ </script>
+
+ <script>
+
+ $(document).ready(function () {
+
+ $('#search-countryreport').click(function () {
+ var grid = $('#countryreport-grid').data('kendoGrid');
+ grid.dataSource.read();
+ return false;
+ });
+
+ });
+
+ function additionalData() {
+ var data = {
+ StartDate: $('#@Html.IdFor(model => model.StartDate)').val(),
+ EndDate: $('#@Html.IdFor(model => model.EndDate)').val(),
+ OrderStatusId: $('#OrderStatusId').val(),
+ PaymentStatusId: $('#PaymentStatusId').val()
+ };
+ addAntiForgeryToken(data);
+ return data;
+ }
+
+ </script>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/Customer.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/Customer.cshtml
new file mode 100644
index 000000000..a328da70b
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/Customer.cshtml
@@ -0,0 +1,150 @@
+@inject AdminAreaSettings adminAreaSettings
+
+@model CustomerReportsModel
+@{
+ //page title
+ ViewBag.Title = Loc["Vendor.Reports.Customer"];
+}
+
+
+
+<div class="row">
+ <div class="col-md-12">
+ <div class="x_panel light form-fit popup-window">
+ <div class="x_title">
+ <div class="caption level-caption">
+ <i class="fa fa-list-alt"></i>
+ @Loc["Vendor.Reports.Customer"]
+ </div>
+
+ </div>
+ <div class="x_content form">
+ <vc:vendor-widget widget-zone="vendor_customer_report" additional-data="Model" />
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="x_content">
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="main-header col-12 px-0">
+ <div class="row align-items-end">
+ <div class="col-md-4 col-ms-12 col-12">
+ <div class="form-group mb-0">
+ <admin-label asp-for="StartDate" class="control-label" />
+ <admin-input asp-for="StartDate" />
+ </div>
+ </div>
+ <div class="col-md-4 col-ms-12 col-12">
+ <div class="form-group mb-0">
+ <admin-label asp-for="EndDate" class="control-label" />
+ <admin-input asp-for="EndDate" />
+ </div>
+ </div>
+ <div class="col-md-4 col-sm-12 col-12">
+ <div class="form-actions">
+ <div class="btn-group">
+ <button class="btn btn-success filter-submit" id="search-customerreport">
+ <i class="fa fa-search"></i> @Loc["Vendor.Reports.Customer.RunReport"]
+ </button>
+ <button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
+ <i class="fa fa-filter"></i>&nbsp; @Loc["Vendor.Common.Filters"]
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="collapse" id="filterCollapse">
+ <div class="drop-filters-container w-100">
+ <div class="form-group">
+ <admin-label asp-for="PaymentStatusId" class="control-label col-md-3 col-sm-3" />
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="x_content">
+ <div id="bestsellers-byamount-grid"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+<script>
+ $(document).ready(function () {
+ $("#bestsellers-byamount-grid").kendoGrid({
+ dataSource: {
+ transport: {
+ read: {
+ url: "@Html.Raw(Url.Action("ReportBestCustomersByOrderTotalList", "Reports", new { area = Constants.AreaVendor }))",
+ type: "POST",
+ dataType: "json",
+ data: additionalData
+ }
+ },
+ schema: {
+ data: "Data",
+ total: "Total",
+ errors: "Errors"
+ },
+ error: function (e) {
+ display_kendoui_grid_error(e);
+ // Cancel the changes
+ this.cancelChanges();
+ },
+ pageSize: @(adminAreaSettings.DefaultGridPageSize),
+ serverPaging: true,
+ serverFiltering: true,
+ serverSorting: true
+ },
+ pageable: {
+ refresh: true,
+ pageSizes: [@(adminAreaSettings.GridPageSizes)]
+ },
+ editable: {
+ confirmation: false,
+ mode: "inline"
+ },
+ scrollable: false,
+ columns: [{
+ field: "CustomerName",
+ title: "@Loc["Vendor.Reports.Customer.BestBy.Fields.Customer"]",
+ }, {
+ field: "OrderTotal",
+ title: "@Loc["Vendor.Reports.Customer.BestBy.Fields.OrderTotal"]"
+ }, {
+ field: "OrderCount",
+ title: "@Loc["Vendor.Reports.Customer.BestBy.Fields.OrderCount"]"
+ }]
+ });
+ });
+</script>
+ <script>
+
+ $(document).ready(function () {
+
+ $('#search-customerreport').click(function () {
+ var grid = $('#bestsellers-byamount-grid').data('kendoGrid');
+ grid.dataSource.read();
+ return false;
+ });
+
+ });
+
+ function additionalData() {
+ var data = {
+ StartDate: $('#@Html.IdFor(model => model.StartDate)').val(),
+ EndDate: $('#@Html.IdFor(model => model.EndDate)').val(),
+ PaymentStatusId: $('#PaymentStatusId').val()
+ };
+ addAntiForgeryToken(data);
+ return data;
+ }
+
+ </script>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/LowStockReport.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/LowStockReport.cshtml
new file mode 100644
index 000000000..721e542f4
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/LowStockReport.cshtml
@@ -0,0 +1,88 @@
+@inject AdminAreaSettings adminAreaSettings
+@{
+ //page title
+ ViewBag.Title = Loc["Vendor.Reports.LowStockReport"];
+}
+
+<div class="row">
+ <div class="col-md-12">
+ <div class="x_panel light form-fit">
+ <div class="x_title">
+ <div class="caption level-caption">
+ <i class="fa fa-cubes"></i>
+ @Loc["Vendor.Reports.LowStockReport"]
+ </div>
+ </div>
+ <div class="x_content form">
+ <div class="form-horizontal">
+ <div class="x_content">
+ <div id="products-grid"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+<script>
+ $(document).ready(function() {
+ $("#products-grid").kendoGrid({
+ dataSource: {
+ transport: {
+ read: {
+ url: "@Html.Raw(Url.Action("LowStockReportList", "Reports", new { area = Constants.AreaVendor }))",
+ type: "POST",
+ dataType: "json",
+ data: addAntiForgeryToken
+ }
+ },
+ schema: {
+ data: "Data",
+ total: "Total",
+ errors: "Errors"
+ },
+ error: function(e) {
+ display_kendoui_grid_error(e);
+ // Cancel the changes
+ this.cancelChanges();
+ },
+ pageSize: @(adminAreaSettings.DefaultGridPageSize),
+ serverPaging: true,
+ serverFiltering: true,
+ serverSorting: true
+ },
+ pageable: {
+ refresh: true,
+ pageSizes: [@(adminAreaSettings.GridPageSizes)]
+ },
+ editable: {
+ confirmation: false,
+ mode: "inline"
+ },
+ scrollable: false,
+ columns: [
+ {
+ field: "Name",
+ title: "@Loc["Vendor.Reports.LowStockReport.Fields.Name"]",
+ width: 300,
+ //if not a grouped product, then display
+ template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { area = Constants.AreaVendor })/#=Id#">#:Name# # if(Attributes !== null) {# <br /><i> #=Attributes# </i> #} #</a>',
+ }, {
+ field: "ManageInventoryMethod",
+ title: "@Loc["Vendor.Reports.LowStockReport.Fields.ManageInventoryMethod"]",
+ width: 150
+ }, {
+ field: "StockQuantity",
+ title: "@Loc["Vendor.Reports.LowStockReport.Fields.StockQuantity"]",
+ width: 100
+ }, {
+ field: "Published",
+ title: "@Loc["Vendor.Reports.LowStockReport.Fields.Published"]",
+ width: 100,
+ headerAttributes: { style: "text-align:center" },
+ attributes: { style: "text-align:center" },
+ template: '# if(Published) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
+ }
+ ]
+ });
+ });
+</script>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/NeverSoldReport.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/NeverSoldReport.cshtml
new file mode 100644
index 000000000..48b58a90a
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Reports/NeverSoldReport.cshtml
@@ -0,0 +1,125 @@
+@model NeverSoldReportModel
+@inject AdminAreaSettings adminAreaSettings
+@{
+ //page title
+ ViewBag.Title = Loc["Admin.Reports.NeverSold"];
+}
+
+<div class="row">
+ <div class="col-md-12">
+ <div class="x_panel light form-fit">
+ <div class="x_title">
+ <div class="caption level-caption">
+ <i class="fa fa-list-alt"></i>
+ @Loc["Vendor.Reports.NeverSold"]
+ </div>
+ </div>
+ <div class="x_content form">
+ <vc:vendor-widget widget-zone="vendor_never_sold_report" additional-data="Model" />
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="x_content">
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="row align-items-end mb-3">
+ <div class="col-md-3 col-sm-12 col-12">
+ <div class="form-group mb-0">
+ <admin-label asp-for="StartDate" class="d-flex flex-column align-items-start mw-100 px-0 text-left" />
+ <admin-input asp-for="StartDate" class="w-100" />
+ </div>
+ </div>
+ <div class="col-md-3 col-sm-12 col-12">
+ <div class="form-group mb-0">
+ <admin-label asp-for="EndDate" class="d-flex flex-column align-items-start mw-100 px-0 text-left" />
+ <admin-input asp-for="EndDate" class="w-100" />
+ </div>
+ </div>
+ <div class="col-md-5 col-sm-12 col-12 mt-md-0 mt-3">
+ <div class="form-actions">
+ <button class="btn btn-success filter-submit" id="search-neversoldreport">
+ <i class="fa fa-search"></i> @Loc["Vendor.Reports.NeverSold.RunReport"]
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="x_content">
+ <div id="neversoldreport-grid"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+
+<script>
+ $(document).ready(function () {
+ $("#neversoldreport-grid").kendoGrid({
+ dataSource: {
+ transport: {
+ read: {
+ url: "@Html.Raw(Url.Action("NeverSoldReportList", "Reports", new { area = Constants.AreaVendor }))",
+ type: "POST",
+ dataType: "json",
+ data: additionalData
+ }
+ },
+ schema: {
+ data: "Data",
+ total: "Total",
+ errors: "Errors"
+ },
+ error: function(e) {
+ display_kendoui_grid_error(e);
+ // Cancel the changes
+ this.cancelChanges();
+ },
+ pageSize: @(adminAreaSettings.DefaultGridPageSize),
+ serverPaging: true,
+ serverFiltering: true,
+ serverSorting: true
+ },
+ pageable: {
+ refresh: true,
+ pageSizes: [@(adminAreaSettings.GridPageSizes)]
+ },
+ editable: {
+ confirmation: false,
+ mode: "inline"
+ },
+ scrollable: false,
+ columns: [{
+ field: "ProductName",
+ title: "@Loc["Vendor.Reports.NeverSold.Fields.Name"]",
+ template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { area = Constants.AreaVendor })/#=ProductId#">#=kendo.htmlEncode(ProductName)#</a>'
+ }]
+ });
+ });
+</script>
+<script>
+
+ $(document).ready(function () {
+
+ $('#search-neversoldreport').click(function () {
+ var grid = $('#neversoldreport-grid').data('kendoGrid');
+ grid.dataSource.page(1); //new search. Set page size to 1
+ //grid.dataSource.read(); we already loaded the grid above using "page" function
+ return false;
+ });
+
+ });
+
+ function additionalData() {
+ var data = {
+ StartDate: $('#@Html.IdFor(model => model.StartDate)').val(),
+ EndDate: $('#@Html.IdFor(model => model.EndDate)').val()
+ };
+ addAntiForgeryToken(data);
+ return data;
+ }
+
+</script>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByAmount/Default.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByAmount/Default.cshtml
new file mode 100644
index 000000000..68db6f188
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByAmount/Default.cshtml
@@ -0,0 +1,53 @@
+@{
+ var gridPageSize = 5;
+}
+<div id="bestsellers-byamount-grid"></div>
+<script>
+ $(document).ready(function () {
+ $("#bestsellers-byamount-grid").kendoGrid({
+ dataSource: {
+ transport: {
+ read: {
+ url: "@Html.Raw(Url.Action("BestsellersBriefReportByAmountList", "Reports", new { area = Constants.AreaVendor }))",
+ type: "POST",
+ dataType: "json",
+ data: addAntiForgeryToken
+ }
+ },
+ schema: {
+ data: "Data",
+ total: "Total",
+ errors: "Errors"
+ },
+ error: function(e) {
+ display_kendoui_grid_error(e);
+ // Cancel the changes
+ this.cancelChanges();
+ },
+ pageSize: @(gridPageSize),
+ serverPaging: true,
+ serverFiltering: true,
+ serverSorting: true
+ },
+ pageable: {
+ refresh: true
+ },
+ editable: {
+ confirmation: false,
+ mode: "inline"
+ },
+ scrollable: false,
+ columns: [{
+ field: "ProductName",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.Name"]",
+ template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { area = Constants.AreaVendor })/#=ProductId#">#=ProductName#</a>',
+ }, {
+ field: "TotalQuantity",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.TotalQuantity"]"
+ }, {
+ field: "TotalAmount",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.TotalAmount"]"
+ }]
+ });
+ });
+</script>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByQuantity/Default.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByQuantity/Default.cshtml
new file mode 100644
index 000000000..8324d381e
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Components/VendorBestsellersBriefReportByQuantity/Default.cshtml
@@ -0,0 +1,54 @@
+@{
+ var gridPageSize = 5;
+}
+<div id="bestsellers-byquantity-grid"></div>
+
+<script>
+ $(document).ready(function () {
+ $("#bestsellers-byquantity-grid").kendoGrid({
+ dataSource: {
+ transport: {
+ read: {
+ url: "@Html.Raw(Url.Action("BestsellersBriefReportByQuantityList", "Reports", new { area = Constants.AreaVendor }))",
+ type: "POST",
+ dataType: "json",
+ data: addAntiForgeryToken
+ }
+ },
+ schema: {
+ data: "Data",
+ total: "Total",
+ errors: "Errors"
+ },
+ error: function(e) {
+ display_kendoui_grid_error(e);
+ // Cancel the changes
+ this.cancelChanges();
+ },
+ pageSize: @(gridPageSize),
+ serverPaging: true,
+ serverFiltering: true,
+ serverSorting: true
+ },
+ pageable: {
+ refresh: true
+ },
+ editable: {
+ confirmation: false,
+ mode: "inline"
+ },
+ scrollable: false,
+ columns: [{
+ field: "ProductName",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.Name"]",
+ template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { area = Constants.AreaVendor })/#=ProductId#">#=ProductName#</a>',
+ }, {
+ field: "TotalQuantity",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.TotalQuantity"]"
+ }, {
+ field: "TotalAmount",
+ title: "@Loc["Vendor.Reports.Bestsellers.Fields.TotalAmount"]"
+ }]
+ });
+ });
+</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/Edit.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/Edit.cshtml
index 50fc0ceb0..670e06936 100644
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/Edit.cshtml
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/Edit.cshtml
@@ -27,7 +27,7 @@
<span id="vendorreview-delete" class="btn red">
<i class="fa fa-trash-o"></i> @Loc["Vendor.Common.Delete"]
</span>
- <vc:admin-widget widget-zone="vendor_review_details_buttons" additional-data="Model"/>
+ <vc:vendor-widget widget-zone="vendor_review_details_buttons" additional-data="Model"/>
</div>
</div>
</div>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/List.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/List.cshtml
index 3172e0c17..55a2f6413 100644
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/List.cshtml
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorReview/List.cshtml
@@ -17,7 +17,7 @@
<div class="actions btn-group btn-group-devided">
<button type="button" id="approve-selected" class="k-button"><span class="k-icon k-i-check-outline"></span>&nbsp;@Loc["Vendor.VendorReviews.ApproveSelected"]</button>
<button type="button" id="disapprove-selected" class="k-button"><span class="k-icon k-i-close-outline"></span>&nbsp;@Loc["Vendor.VendorReviews.DisapproveSelected"]</button>
- <vc:admin-widget widget-zone="vendor_review_list_buttons" additional-data="Model" />
+ <vc:vendor-widget widget-zone="vendor_review_list_buttons" additional-data="Model" />
</div>
</div>
<div class="x_content form">
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/_ViewImports.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/_ViewImports.cshtml
index 61dc60b85..c151346c8 100644
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/_ViewImports.cshtml
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/_ViewImports.cshtml
@@ -29,4 +29,5 @@
@using Grand.Web.Vendor.Models.Shipment;
@using Grand.Web.Vendor.Models.MerchandiseReturn;
@using Grand.Web.Vendor.Models.VendorReview;
+@using Grand.Web.Vendor.Models.Report;
@inject Grand.Web.Common.Localization.LocService Loc
diff --git a/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByAmount.cs b/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByAmount.cs
new file mode 100644
index 000000000..6cea90ddc
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByAmount.cs
@@ -0,0 +1,14 @@
+using Grand.Web.Common.Components;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Grand.Web.Vendor.Components
+{
+ public class VendorBestsellersBriefReportByAmountViewComponent : BaseVendorViewComponent
+ {
+
+ public IViewComponentResult Invoke()
+ {
+ return View();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByQuantity.cs b/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByQuantity.cs
new file mode 100644
index 000000000..d1fc9d528
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Components/VendorBestsellersBriefReportByQuantity.cs
@@ -0,0 +1,13 @@
+using Grand.Web.Common.Components;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Grand.Web.Vendor.Components
+{
+ public class VendorBestsellersBriefReportByQuantityViewComponent : BaseVendorViewComponent
+ {
+ public IViewComponentResult Invoke()
+ {
+ return View();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs b/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs
index d4564dcdc..c5bd69aaa 100644
--- a/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs
+++ b/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs
@@ -36,7 +36,12 @@ namespace Grand.Web.Vendor.Controllers
{
return View();
}
-
+
+ public IActionResult Statistics()
+ {
+ return View();
+ }
+
public IActionResult AccessDenied(string pageUrl)
{
_ = _logger.Information(
diff --git a/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs b/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs
new file mode 100644
index 000000000..2984fdfa0
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs
@@ -0,0 +1,366 @@
+using Grand.Business.Core.Interfaces.Catalog.Prices;
+using Grand.Business.Core.Interfaces.Catalog.Products;
+using Grand.Business.Core.Interfaces.Checkout.Orders;
+using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Common.Directory;
+using Grand.Business.Core.Interfaces.Common.Localization;
+using Grand.Business.Core.Utilities.Common.Security;
+using Grand.Business.Core.Interfaces.Customers;
+using Grand.Business.Core.Interfaces.System.Reports;
+using Grand.Domain.Payments;
+using Grand.Infrastructure;
+using Grand.Web.Common.DataSource;
+using Grand.Web.Common.Extensions;
+using Grand.Web.Common.Security.Authorization;
+using Grand.Web.Vendor.Models.Report;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Rendering;
+
+namespace Grand.Web.Vendor.Controllers
+{
+ [PermissionAuthorize(PermissionSystemName.Reports)]
+ public class ReportsController : BaseVendorController
+ {
+ private readonly ICustomerService _customerService;
+ private readonly IOrderReportService _orderReportService;
+ private readonly IProductsReportService _productsReportService;
+ private readonly ICustomerReportService _customerReportService;
+ private readonly IWorkContext _workContext;
+ private readonly IPriceFormatter _priceFormatter;
+ private readonly IProductService _productService;
+ private readonly IProductAttributeFormatter _productAttributeFormatter;
+ private readonly IStockQuantityService _stockQuantityService;
+ private readonly ITranslationService _translationService;
+ private readonly ICountryService _countryService;
+ private readonly IDateTimeService _dateTimeService;
+ private readonly IOrderStatusService _orderStatusService;
+ private readonly ICurrencyService _currencyService;
+
+ public ReportsController(IOrderReportService orderReportService,
+ IProductsReportService productsReportService,
+ ICustomerReportService customerReportService,
+ IWorkContext workContext,
+ IPriceFormatter priceFormatter,
+ IProductService productService,
+ IProductAttributeFormatter productAttributeFormatter,
+ IStockQuantityService stockQuantityService,
+ ITranslationService translationService,
+ ICountryService countryService,
+ IDateTimeService dateTimeService,
+ IOrderStatusService orderStatusService,
+ ICurrencyService currencyService,
+ ICustomerService customerService)
+ {
+ _orderReportService = orderReportService;
+ _productsReportService = productsReportService;
+ _customerReportService = customerReportService;
+ _workContext = workContext;
+ _priceFormatter = priceFormatter;
+ _productService = productService;
+ _productAttributeFormatter = productAttributeFormatter;
+ _stockQuantityService = stockQuantityService;
+ _translationService = translationService;
+ _countryService = countryService;
+ _dateTimeService = dateTimeService;
+ _orderStatusService = orderStatusService;
+ _currencyService = currencyService;
+ _customerService = customerService;
+ }
+
+ [NonAction]
+ private async Task<DataSourceResult> GetBestsellersBriefReportModel(int pageIndex,
+ int pageSize, int orderBy)
+ {
+ var items = await _orderReportService.BestSellersReport(
+ vendorId: _workContext.CurrentVendor.Id,
+ orderBy: orderBy,
+ pageIndex: pageIndex,
+ pageSize: pageSize,
+ showHidden: true);
+ var result = new List<BestsellersReportLineModel>();
+ foreach (var x in items)
+ {
+ var m = new BestsellersReportLineModel {
+ ProductId = x.ProductId,
+ TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, await _currencyService.GetPrimaryStoreCurrency()),
+ TotalQuantity = x.TotalQuantity
+ };
+ var product = await _productService.GetProductById(x.ProductId);
+ if (product != null)
+ m.ProductName = product.Name;
+ result.Add(m);
+ }
+
+ var gridModel = new DataSourceResult {
+ Data = result,
+ Total = items.TotalCount
+ };
+ return gridModel;
+ }
+
+ [HttpPost]
+ public async Task<IActionResult> BestsellersBriefReportByQuantityList(DataSourceRequest command)
+ {
+ var gridModel = await GetBestsellersBriefReportModel(command.Page - 1,
+ command.PageSize, 1);
+
+ return Json(gridModel);
+ }
+
+ [HttpPost]
+ public async Task<IActionResult> BestsellersBriefReportByAmountList(DataSourceRequest command)
+ {
+ var gridModel = await GetBestsellersBriefReportModel(command.Page - 1,
+ command.PageSize, 2);
+
+ return Json(gridModel);
+ }
+
+ public async Task<IActionResult> BestsellersReport()
+ {
+ var model = new BestsellersReportModel {
+ //payment statuses
+ AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(HttpContext, false).ToList()
+ };
+ model.AvailablePaymentStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });
+
+ //billing countries
+ foreach (var c in await _countryService.GetAllCountriesForBilling(showHidden: true))
+ {
+ model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id });
+ }
+ model.AvailableCountries.Insert(0, new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });
+
+ return View(model);
+ }
+
+ [HttpPost]
+ public async Task<IActionResult> BestsellersReportList(DataSourceRequest command, BestsellersReportModel model)
+ {
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
+
+ var items = await _orderReportService.BestSellersReport(
+ createdFromUtc: startDateValue,
+ createdToUtc: endDateValue,
+ ps: paymentStatus,
+ billingCountryId: model.BillingCountryId,
+ orderBy: 2,
+ vendorId: _workContext.CurrentVendor.Id,
+ pageIndex: command.Page - 1,
+ pageSize: command.PageSize,
+ showHidden: true,
+ storeId: model.StoreId);
+
+ var result = new List<BestsellersReportLineModel>();
+ foreach (var x in items)
+ {
+ var m = new BestsellersReportLineModel {
+ ProductId = x.ProductId,
+ TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, await _currencyService.GetPrimaryStoreCurrency()),
+ TotalQuantity = x.TotalQuantity
+ };
+ var product = await _productService.GetProductById(x.ProductId);
+ if (product != null)
+ m.ProductName = product.Name;
+ if (_workContext.CurrentVendor != null)
+ {
+ if (product?.VendorId == _workContext.CurrentVendor.Id)
+ result.Add(m);
+ }
+ else
+ result.Add(m);
+ }
+ var gridModel = new DataSourceResult {
+ Data = result,
+ Total = items.TotalCount
+ };
+
+ return Json(gridModel);
+ }
+
+ public IActionResult NeverSoldReport()
+ {
+ var model = new NeverSoldReportModel();
+ return View(model);
+ }
+
+ [HttpPost]
+ public async Task<IActionResult> NeverSoldReportList(DataSourceRequest command, NeverSoldReportModel model)
+ {
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+
+
+ var items = await _orderReportService.ProductsNeverSold("", _workContext.CurrentVendor.Id,
+ startDateValue, endDateValue,
+ command.Page - 1, command.PageSize, true);
+ var gridModel = new DataSourceResult {
+ Data = items.Select(x =>
+ new NeverSoldReportLineModel {
+ ProductId = x.Id,
+ ProductName = x.Name
+ }),
+ Total = items.TotalCount
+ };
+
+ return Json(gridModel);
+ }
+
+ public IActionResult CountryReport()
+ {
+ var model = new CountryReportModel {
+ //payment statuses
+ AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(HttpContext, false).ToList()
+ };
+
+ model.AvailablePaymentStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });
+
+ return View(model);
+ }
+
+ [HttpPost]
+ public async Task<IActionResult> CountryReportList(CountryReportModel model)
+ {
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
+
+ var items = await _orderReportService.GetCountryReport(
+ vendorId: _workContext.CurrentVendor.Id,
+ ps: paymentStatus,
+ startTimeUtc: startDateValue,
+ endTimeUtc: endDateValue);
+ var result = new List<CountryReportLineModel>();
+ foreach (var x in items)
+ {
+ var country = await _countryService.GetCountryById(!string.IsNullOrEmpty(x.CountryId) ? x.CountryId : "");
+ var m = new CountryReportLineModel {
+ CountryName = country != null ? country.Name : "Unknown",
+ SumOrders = _priceFormatter.FormatPrice(x.SumOrders, await _currencyService.GetPrimaryStoreCurrency()),
+ TotalOrders = x.TotalOrders
+ };
+ result.Add(m);
+ }
+ var gridModel = new DataSourceResult {
+ Data = result,
+ Total = items.Count
+ };
+
+ return Json(gridModel);
+ }
+
+ #region Low stock reports
+
+ public IActionResult LowStockReport()
+ {
+ return View();
+ }
+
+ [HttpPost]
+ public async Task<IActionResult> LowStockReportList(DataSourceRequest command)
+ {
+ var lowStockProducts = await _productsReportService.LowStockProducts(vendorId: _workContext.CurrentVendor.Id);
+
+ var models = new List<LowStockProductModel>();
+ //products
+ foreach (var product in lowStockProducts.products)
+ {
+ var lowStockModel = new LowStockProductModel {
+ Id = product.Id,
+ Name = product.Name,
+ ManageInventoryMethod = product.ManageInventoryMethodId.GetTranslationEnum(_translationService, _workContext.WorkingLanguage.Id),
+ StockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true),
+ Published = product.Published
+ };
+ models.Add(lowStockModel);
+ }
+ //combinations
+ foreach (var combination in lowStockProducts.combinations)
+ {
+ var product = await _productService.GetProductById(combination.ProductId);
+ var lowStockModel = new LowStockProductModel {
+ Id = product.Id,
+ Name = product.Name,
+ Attributes = await _productAttributeFormatter.FormatAttributes(product, combination.Attributes, _workContext.CurrentCustomer, "<br />", true, true, true, false),
+ ManageInventoryMethod = product.ManageInventoryMethodId.GetTranslationEnum(_translationService, _workContext.WorkingLanguage.Id),
+ StockQuantity = combination.StockQuantity,
+ Published = product.Published
+ };
+ models.Add(lowStockModel);
+ }
+ var gridModel = new DataSourceResult {
+ Data = models.PagedForCommand(command),
+ Total = models.Count
+ };
+
+ return Json(gridModel);
+ }
+
+ #endregion
+
+ #region Customer Reports
+
+ public async Task<IActionResult> Customer()
+ {
+ var model = new CustomerReportsModel();
+ var status = await _orderStatusService.GetAll();
+
+ model.AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();
+ model.AvailablePaymentStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Vendor.Common.All"), Value = "" });
+
+ return View(model);
+ }
+
+ [HttpPost]
+ public async Task<IActionResult> ReportBestCustomersByOrderTotalList(DataSourceRequest command, BestCustomersReportModel model)
+ {
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
+
+ var items = _customerReportService.GetBestCustomersReport("", _workContext.CurrentVendor.Id,startDateValue, endDateValue,
+ null, paymentStatus, null, 2, command.Page - 1, command.PageSize);
+
+ var report = new List<BestCustomerReportLineModel>();
+ foreach (var x in items)
+ {
+ var m = new BestCustomerReportLineModel {
+ CustomerId = x.CustomerId,
+ OrderTotal = _priceFormatter.FormatPrice(x.OrderTotal, await _currencyService.GetPrimaryStoreCurrency()),
+ OrderCount = x.OrderCount
+ };
+ var customer = await _customerService.GetCustomerById(x.CustomerId);
+ if (customer != null)
+ {
+ m.CustomerName = !string.IsNullOrEmpty(customer.Email) ? customer.Email : _translationService.GetResource("Vendor.Customers.Guest");
+ }
+ report.Add(m);
+ }
+ var gridModel = new DataSourceResult {
+ Data = report,
+ Total = items.TotalCount
+ };
+
+ return Json(gridModel);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/BestCustomerReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/BestCustomerReportLineModel.cs
new file mode 100644
index 000000000..54720cb5d
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/BestCustomerReportLineModel.cs
@@ -0,0 +1,18 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class BestCustomerReportLineModel : BaseModel
+ {
+ public string CustomerId { get; set; }
+ [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.Customer")]
+ public string CustomerName { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.OrderTotal")]
+ public string OrderTotal { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customers.BestBy.Fields.OrderCount")]
+ public double OrderCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/BestCustomersReportModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/BestCustomersReportModel.cs
new file mode 100644
index 000000000..0728c5f5a
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/BestCustomersReportModel.cs
@@ -0,0 +1,28 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using System.ComponentModel.DataAnnotations;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class BestCustomersReportModel : BaseModel
+ {
+ public BestCustomersReportModel()
+ {
+ AvailablePaymentStatuses = new List<SelectListItem>();
+ }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.StartDate")]
+ [UIHint("DateNullable")]
+ public DateTime? StartDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.EndDate")]
+ [UIHint("DateNullable")]
+ public DateTime? EndDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.PaymentStatus")]
+ public int PaymentStatusId { get; set; }
+
+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportLineModel.cs
new file mode 100644
index 000000000..e6b57a2bc
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportLineModel.cs
@@ -0,0 +1,18 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class BestsellersReportLineModel : BaseModel
+ {
+ public string ProductId { get; set; }
+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.Name")]
+ public string ProductName { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.TotalAmount")]
+ public string TotalAmount { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Fields.TotalQuantity")]
+ public double TotalQuantity { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportModel.cs
new file mode 100644
index 000000000..88dc482aa
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/BestsellersReportModel.cs
@@ -0,0 +1,35 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using System.ComponentModel.DataAnnotations;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class BestsellersReportModel : BaseModel
+ {
+ public BestsellersReportModel()
+ {
+ AvailablePaymentStatuses = new List<SelectListItem>();
+ AvailableCountries = new List<SelectListItem>();
+ }
+
+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.Store")]
+ public string StoreId { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.StartDate")]
+ [UIHint("DateNullable")]
+ public DateTime? StartDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.EndDate")]
+ [UIHint("DateNullable")]
+ public DateTime? EndDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.PaymentStatus")]
+ public int PaymentStatusId { get; set; }
+ [GrandResourceDisplayName("Vendor.Reports.Bestsellers.BillingCountry")]
+ public string BillingCountryId { get; set; }
+
+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; }
+ public IList<SelectListItem> AvailableCountries { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/CountryReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/CountryReportLineModel.cs
new file mode 100644
index 000000000..7047d9313
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/CountryReportLineModel.cs
@@ -0,0 +1,17 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class CountryReportLineModel : BaseModel
+ {
+ [GrandResourceDisplayName("Vendor.Reports.Country.Fields.CountryName")]
+ public string CountryName { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Country.Fields.TotalOrders")]
+ public int TotalOrders { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Country.Fields.SumOrders")]
+ public string SumOrders { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/CountryReportModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/CountryReportModel.cs
new file mode 100644
index 000000000..9a973f2e1
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/CountryReportModel.cs
@@ -0,0 +1,27 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using System.ComponentModel.DataAnnotations;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class CountryReportModel : BaseModel
+ {
+ public CountryReportModel()
+ {
+ AvailablePaymentStatuses = new List<SelectListItem>();
+ }
+
+ [GrandResourceDisplayName("Vendor.Reports.Country.StartDate")]
+ [UIHint("DateNullable")]
+ public DateTime? StartDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Country.EndDate")]
+ [UIHint("DateNullable")]
+ public DateTime? EndDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Country.PaymentStatus")]
+ public int PaymentStatusId { get; set; }
+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/CustomerReportsModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/CustomerReportsModel.cs
new file mode 100644
index 000000000..c9ad7ee76
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/CustomerReportsModel.cs
@@ -0,0 +1,28 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using System.ComponentModel.DataAnnotations;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class CustomerReportsModel : BaseModel
+ {
+ public CustomerReportsModel()
+ {
+ AvailablePaymentStatuses = new List<SelectListItem>();
+ }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.StartDate")]
+ [UIHint("DateNullable")]
+ public DateTime? StartDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.EndDate")]
+ [UIHint("DateNullable")]
+ public DateTime? EndDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customer.BestBy.PaymentStatus")]
+ public int PaymentStatusId { get; set; }
+
+ public IList<SelectListItem> AvailablePaymentStatuses { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/LowStockProductModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/LowStockProductModel.cs
new file mode 100644
index 000000000..cc15ba250
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/LowStockProductModel.cs
@@ -0,0 +1,22 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class LowStockProductModel : BaseEntityModel
+ {
+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Name")]
+ public string Name { get; set; }
+
+ public string Attributes { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.ManageInventoryMethod")]
+ public string ManageInventoryMethod { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.StockQuantity")]
+ public int StockQuantity { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Catalog.Products.Fields.Published")]
+ public bool Published { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportLineModel.cs
new file mode 100644
index 000000000..fb27de842
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportLineModel.cs
@@ -0,0 +1,13 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class NeverSoldReportLineModel : BaseModel
+ {
+ public string ProductId { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.NeverSold.Fields.Name")]
+ public string ProductName { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportModel.cs
new file mode 100644
index 000000000..bd33a68b1
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/NeverSoldReportModel.cs
@@ -0,0 +1,17 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+using System.ComponentModel.DataAnnotations;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class NeverSoldReportModel : BaseModel
+ {
+ [GrandResourceDisplayName("Vendor.Reports.NeverSold.StartDate")]
+ [UIHint("DateNullable")]
+ public DateTime? StartDate { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.NeverSold.EndDate")]
+ [UIHint("DateNullable")]
+ public DateTime? EndDate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/OrderAverageReportLineSummaryModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/OrderAverageReportLineSummaryModel.cs
new file mode 100644
index 000000000..43fd03189
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/OrderAverageReportLineSummaryModel.cs
@@ -0,0 +1,23 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class OrderAverageReportLineSummaryModel : BaseModel
+ {
+ [GrandResourceDisplayName("Vendor.Reports.Average.SumTodayOrders")]
+ public string SumTodayOrders { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Average.SumThisWeekOrders")]
+ public string SumThisWeekOrders { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Average.SumThisMonthOrders")]
+ public string SumThisMonthOrders { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Average.SumThisYearOrders")]
+ public string SumThisYearOrders { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Average.SumAllTimeOrders")]
+ public string SumAllTimeOrders { get; set; }
+ }
+}
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/OrderIncompleteReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/OrderIncompleteReportLineModel.cs
new file mode 100644
index 000000000..68bf8b952
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/OrderIncompleteReportLineModel.cs
@@ -0,0 +1,20 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class OrderIncompleteReportLineModel : BaseModel
+ {
+ [GrandResourceDisplayName("Vendor.Reports.Incomplete.Item")]
+ public string Item { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Incomplete.Total")]
+ public string Total { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Incomplete.Count")]
+ public int Count { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Incomplete.View")]
+ public string ViewLink { get; set; }
+ }
+}
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/OrderPeriodReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/OrderPeriodReportLineModel.cs
new file mode 100644
index 000000000..bd0789ceb
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/OrderPeriodReportLineModel.cs
@@ -0,0 +1,19 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class OrderPeriodReportLineModel : BaseModel
+ {
+ [GrandResourceDisplayName("Vendor.Reports.Period.Name")]
+ public string Period { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Period.Count")]
+ public int Count { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Period.Amount")]
+ public double Amount { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Models/Report/RegisteredCustomerReportLineModel.cs b/src/Web/Grand.Web.Vendor/Models/Report/RegisteredCustomerReportLineModel.cs
new file mode 100644
index 000000000..c093e5799
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Models/Report/RegisteredCustomerReportLineModel.cs
@@ -0,0 +1,14 @@
+using Grand.Infrastructure.ModelBinding;
+using Grand.Infrastructure.Models;
+
+namespace Grand.Web.Vendor.Models.Report
+{
+ public class RegisteredCustomerReportLineModel : BaseModel
+ {
+ [GrandResourceDisplayName("Vendor.Reports.Customers.RegisteredCustomers.Fields.Period")]
+ public string Period { get; set; }
+
+ [GrandResourceDisplayName("Vendor.Reports.Customers.RegisteredCustomers.Fields.Customers")]
+ public int Customers { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Startup/StartupApplication.cs b/src/Web/Grand.Web.Vendor/Startup/StartupApplication.cs
index e8a504c39..2e2cec587 100644
--- a/src/Web/Grand.Web.Vendor/Startup/StartupApplication.cs
+++ b/src/Web/Grand.Web.Vendor/Startup/StartupApplication.cs
@@ -29,7 +29,6 @@ namespace Grand.Web.Vendor.Startup
services.AddScoped<IShipmentViewModelService, ShipmentViewModelService>();
services.AddScoped<IMerchandiseReturnViewModelService, MerchandiseReturnViewModelService>();
services.AddScoped<IVendorReviewViewModelService, VendorReviewViewModelService>();
-
}
public void Configure(IApplicationBuilder application, IWebHostEnvironment webHostEnvironment)
{
diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
index f9e37ade5..860723ef0 100644
--- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
+++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
@@ -17217,9 +17217,13 @@
<Resource Name="Vendor.Dashboard.ReportLatestOrder" Area="Vendor">
<Value>Latest orders</Value>
</Resource>
+ <Resource Name="Vendor.Dashboard.Statistics" Area="Vendor">
+ <Value>Statistics</Value>
+ </Resource>
<Resource Name="Vendor.Dashboard.Summary" Area="Vendor">
<Value>Summary</Value>
</Resource>
+
<Resource Name="Vendor.Header.Community" Area="Vendor">
<Value>Community</Value>
</Resource>
@@ -17791,6 +17795,120 @@
<Resource Name="Vendor.Description" Area="Front">
<Value>Description</Value>
</Resource>
+ <Resource Name="Vendor.Reports.Bestsellers" Area="Vendor">
+ <Value>Bestsellers</Value>
+ </Resource>
+ <Resource Name="vendor.reports.bestsellers.byamount" Area="Vendor">
+ <Value>Bestsellers by amount</Value>
+ </Resource>
+ <Resource Name="vendor.reports.bestsellers.byquantity" Area="Vendor">
+ <Value>Bestsellers by quantity</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.BillingCountry" Area="Vendor">
+ <Value>Billing country</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.EndDate" Area="Vendor">
+ <Value>End date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.Fields.Name" Area="Vendor">
+ <Value>Product name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.Fields.TotalAmount" Area="Vendor">
+ <Value>Total amount</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.Fields.TotalQuantity" Area="Vendor">
+ <Value>Total quantity</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.PaymentStatus" Area="Vendor">
+ <Value>Payment status</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.StartDate" Area="Vendor">
+ <Value>Start date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.RunReport" Area="Vendor">
+ <Value>Run report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country" Area="Vendor">
+ <Value>Country report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.EndDate" Area="Vendor">
+ <Value>End date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.Fields.CountryName" Area="Vendor">
+ <Value>Country name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.Fields.SumOrders" Area="Vendor">
+ <Value>Sum orders</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.Fields.TotalOrders" Area="Vendor">
+ <Value>Total orders</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.PaymentStatus" Area="Vendor">
+ <Value>Payment status</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.RunReport" Area="Vendor">
+ <Value>Run report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.StartDate" Area="Vendor">
+ <Value>Start date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer" Area="Vendor">
+ <Value>Customer report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.EndDate" Area="Vendor">
+ <Value>End date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.Fields.Customer" Area="Vendor">
+ <Value>Customer name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.Fields.OrderCount" Area="Vendor">
+ <Value>Order count</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.Fields.OrderTotal" Area="Vendor">
+ <Value>Order total</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.PaymentStatus" Area="Vendor">
+ <Value>Payment status</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.RunReport" Area="Vendor">
+ <Value>Run report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.StartDate" Area="Vendor">
+ <Value>Start date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport" Area="Vendor">
+ <Value>Low stock report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport.Fields.Name" Area="Vendor">
+ <Value>Product name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport.Fields.ManageInventoryMethod" Area="Vendor">
+ <Value>Manage inventory method</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport.Fields.Published" Area="Vendor">
+ <Value>Published</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport.Fields.StockQuantity" Area="Vendor">
+ <Value>Stock quantity</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold" Area="Vendor">
+ <Value>Products never purchased report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold" Area="Vendor">
+ <Value>Products never purchased report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold.EndDate" Area="Vendor">
+ <Value>End date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold.Fields.Name" Area="Vendor">
+ <Value>Product name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold.RunReport" Area="Vendor">
+ <Value>Run report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold.StartDate" Area="Vendor">
+ <Value>Start date</Value>
+ </Resource>
<Resource Name="Vendor.Reviews" Area="Front">
<Value>Reviews</Value>
</Resource>
diff --git a/src/Web/Grand.Web/App_Data/Resources/Upgrade/en_220.xml b/src/Web/Grand.Web/App_Data/Resources/Upgrade/en_220.xml
index 5874c9ca5..79e6084d9 100644
--- a/src/Web/Grand.Web/App_Data/Resources/Upgrade/en_220.xml
+++ b/src/Web/Grand.Web/App_Data/Resources/Upgrade/en_220.xml
@@ -1315,6 +1315,9 @@
<Resource Name="Vendor.Dashboard.ReportLatestOrder" Area="Vendor">
<Value>Latest orders</Value>
</Resource>
+ <Resource Name="Vendor.Dashboard.Statistics" Area="Vendor">
+ <Value>Statistics</Value>
+ </Resource>
<Resource Name="Vendor.Dashboard.Summary" Area="Vendor">
<Value>Summary</Value>
</Resource>
@@ -1912,4 +1915,118 @@
<Resource Name="Vendor.Catalog.Products.Permissions" Area="Vendor">
<Value>You can't edit this product, because it is not yours.</Value>
</Resource>
+ <Resource Name="Vendor.Reports.Bestsellers" Area="Vendor">
+ <Value>Bestsellers</Value>
+ </Resource>
+ <Resource Name="vendor.reports.bestsellers.byamount" Area="Vendor">
+ <Value>Bestsellers by amount</Value>
+ </Resource>
+ <Resource Name="vendor.reports.bestsellers.byquantity" Area="Vendor">
+ <Value>Bestsellers by quantity</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.BillingCountry" Area="Vendor">
+ <Value>Billing country</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.EndDate" Area="Vendor">
+ <Value>End date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.Fields.Name" Area="Vendor">
+ <Value>Product name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.Fields.TotalAmount" Area="Vendor">
+ <Value>Total amount</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.Fields.TotalQuantity" Area="Vendor">
+ <Value>Total quantity</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.PaymentStatus" Area="Vendor">
+ <Value>Payment status</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.StartDate" Area="Vendor">
+ <Value>Start date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Bestsellers.RunReport" Area="Vendor">
+ <Value>Run report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country" Area="Vendor">
+ <Value>Country report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.EndDate" Area="Vendor">
+ <Value>End date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.Fields.CountryName" Area="Vendor">
+ <Value>Country name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.Fields.SumOrders" Area="Vendor">
+ <Value>Sum orders</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.Fields.TotalOrders" Area="Vendor">
+ <Value>Total orders</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.PaymentStatus" Area="Vendor">
+ <Value>Payment status</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.RunReport" Area="Vendor">
+ <Value>Run report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Country.StartDate" Area="Vendor">
+ <Value>Start date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer" Area="Vendor">
+ <Value>Customer report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.EndDate" Area="Vendor">
+ <Value>End date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.Fields.Customer" Area="Vendor">
+ <Value>Customer name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.Fields.OrderCount" Area="Vendor">
+ <Value>Order count</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.Fields.OrderTotal" Area="Vendor">
+ <Value>Order total</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.PaymentStatus" Area="Vendor">
+ <Value>Payment status</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.RunReport" Area="Vendor">
+ <Value>Run report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.Customer.BestBy.StartDate" Area="Vendor">
+ <Value>Start date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport" Area="Vendor">
+ <Value>Low stock report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport.Fields.Name" Area="Vendor">
+ <Value>Product name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport.Fields.ManageInventoryMethod" Area="Vendor">
+ <Value>Manage inventory method</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport.Fields.Published" Area="Vendor">
+ <Value>Published</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.LowStockReport.Fields.StockQuantity" Area="Vendor">
+ <Value>Stock quantity</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold" Area="Vendor">
+ <Value>Products never purchased report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold" Area="Vendor">
+ <Value>Products never purchased report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold.EndDate" Area="Vendor">
+ <Value>End date</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold.Fields.Name" Area="Vendor">
+ <Value>Product name</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold.RunReport" Area="Vendor">
+ <Value>Run report</Value>
+ </Resource>
+ <Resource Name="Vendor.Reports.NeverSold.StartDate" Area="Vendor">
+ <Value>Start date</Value>
+ </Resource>
</Language>
\ No newline at end of file