Commit ab623311 authored by liudong1993's avatar liudong1993
parents c5f2f217 cfb7aaee
......@@ -49,6 +49,24 @@ namespace Mall.Model.Query
/// </summary>
public int Number { get; set; }
/// <summary>
/// 返佣人员id
/// </summary>
public int OneUserId { get; set; }
/// <summary>
/// 返佣人员名称
/// </summary>
public string OneUserName { get; set; }
/// <summary>
/// 返佣人员id
/// </summary>
public int TwoUserId { get; set; }
/// <summary>
/// 返佣人员名称
/// </summary>
public string TwoUserName { get; set; }
/// <summary>
/// 供应商名称
......@@ -63,6 +81,39 @@ namespace Mall.Model.Query
public int SupplierId { get; set; }
/// <summary>
/// 特一级返佣
/// </summary>
public decimal SpecialCommission { get; set; }
/// <summary>
/// 总代理返佣
/// </summary>
public decimal GeneralAgentCommission { get; set; }
/// <summary>
/// 分公司
/// </summary>
public decimal BranchCommission { get; set; }
/// <summary>
/// 分公司
/// </summary>
public string BranchName { get; set; }
/// <summary>
/// 特一级返佣
/// </summary>
public string SpecialName { get; set; }
/// <summary>
/// 总代理返佣
/// </summary>
public string GeneralAgentName { get; set; }
/// <summary>
/// 结算款
/// </summary>
......
......@@ -4743,6 +4743,9 @@ namespace Mall.Module.Product
return list;
}
#endregion
#region 商品代理
......
......@@ -860,15 +860,24 @@ as t GROUP BY t.CreateDate desc";
if (dmodel != null)
{
if (dmodel.GoodsID > 0)
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo))
{
where += $" and b.GoodsId={dmodel.GoodsID} ";
where += $" and a.OrderNo like'%{dmodel.OrderNo}%'";
}
if (dmodel.SupplierId > 0)
{
where += $" and b.SupplierId={dmodel.SupplierId} ";
}
if (dmodel.OneUserId > 0)
{
where += $" and c.OneUserId={dmodel.OneUserId} and d.TwoUserId={dmodel.OneUserId} ";
}
if (dmodel.GoodsID > 0)
{
where += $" and b.GoodsId={dmodel.GoodsID} ";
}
if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
......@@ -879,16 +888,16 @@ as t GROUP BY t.CreateDate desc";
}
}
string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice ,
SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
c.OneCommission,d.TwoCommission,0 as OtherPrice,e.ALLCommission,0 as Paid
c.OneCommission,c.OneUserId,c.OneUserName,d.TwoCommission,d.TwoUserId,d.TwoUserName,0 as OtherPrice,e.ALLCommission,0 as Paid
from rb_goods_orderdetail as b
LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId
LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
LEFT JOIN (SELECT SUM(Commission) as OneCommission,OrderId from rb_goods_ordercommission where Grade=1 and CommissionState=2 GROUP BY OrderId ) as c on a.OrderId=c.OrderId
LEFT JOIN (SELECT SUM(Commission) as TwoCommission,OrderId from rb_goods_ordercommission where Grade=2 and CommissionState=2 GROUP BY OrderId ) as d on a.OrderId=d.OrderId
LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderId from rb_goods_ordercommission GROUP BY OrderId ) as e on a.OrderId=e.OrderId {where}
LEFT JOIN (SELECT SUM(goc.Commission) as OneCommission,goc.OrderDetailId,goc.UserId as OneUserId,mu.`Name` as OneUserName from rb_goods_ordercommission as goc LEFT JOIN rb_member_user as mu on goc.UserId=mu.Id where goc.Grade=1 and goc.CommissionState=2 GROUP BY goc.OrderDetailId ) as c on b.Id=c.OrderDetailId
LEFT JOIN (SELECT SUM(goc.Commission) as TwoCommission,goc.OrderDetailId,goc.UserId as TwoUserId,mu.`Name` as TwoUserName from rb_goods_ordercommission as goc LEFT JOIN rb_member_user as mu on goc.UserId=mu.Id where goc.Grade=2 and goc.CommissionState=2 GROUP BY goc.OrderDetailId ) as d on b.Id=d.OrderDetailId
LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderId ) as e on b.Id=e.OrderDetailId {where}
GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
return GetPage<OrderStatistics_Query>(pageIndex, pageSize, out count, sql).ToList();
}
......@@ -901,15 +910,24 @@ GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
if (dmodel != null)
{
if (dmodel.GoodsID > 0)
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo))
{
where += $" and b.GoodsId={dmodel.GoodsID} ";
where += $" and a.OrderNo like'%{dmodel.OrderNo}%'";
}
if (dmodel.SupplierId > 0)
{
where += $" and b.SupplierId={dmodel.SupplierId} ";
}
if (dmodel.OneUserId > 0)
{
where += $" and c.OneUserId={dmodel.OneUserId} and d.TwoUserId={dmodel.OneUserId} ";
}
if (dmodel.GoodsID > 0)
{
where += $" and b.GoodsId={dmodel.GoodsID} ";
}
if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
......@@ -920,17 +938,30 @@ GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
}
}
string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice ,
SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
c.OneCommission,d.TwoCommission,0 as OtherPrice,e.ALLCommission,0 as Paid
c.OneCommission,c.OneUserId,c.OneUserName,d.TwoCommission,d.TwoUserId,d.TwoUserName,0 as OtherPrice,e.ALLCommission,0 as Paid
from rb_goods_orderdetail as b
LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId
LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
LEFT JOIN (SELECT SUM(Commission) as OneCommission,OrderId from rb_goods_ordercommission where Grade=1 and CommissionState=2 GROUP BY OrderId ) as c on a.OrderId=c.OrderId
LEFT JOIN (SELECT SUM(Commission) as TwoCommission,OrderId from rb_goods_ordercommission where Grade=2 and CommissionState=2 GROUP BY OrderId ) as d on a.OrderId=d.OrderId
LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderId from rb_goods_ordercommission GROUP BY OrderId ) as e on a.OrderId=e.OrderId {where}
LEFT JOIN (SELECT SUM(goc.Commission) as OneCommission,goc.OrderDetailId,goc.UserId as OneUserId,mu.`Name` as OneUserName from rb_goods_ordercommission as goc LEFT JOIN rb_member_user as mu on goc.UserId=mu.Id where goc.Grade=1 and goc.CommissionState=2 GROUP BY goc.OrderDetailId ) as c on b.Id=c.OrderDetailId
LEFT JOIN (SELECT SUM(goc.Commission) as TwoCommission,goc.OrderDetailId,goc.UserId as TwoUserId,mu.`Name` as TwoUserName from rb_goods_ordercommission as goc LEFT JOIN rb_member_user as mu on goc.UserId=mu.Id where goc.Grade=2 and goc.CommissionState=2 GROUP BY goc.OrderDetailId ) as d on b.Id=d.OrderDetailId
LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderId ) as e on b.Id=e.OrderDetailId {where}
GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
// string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
//SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice ,
//SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
//c.OneCommission,d.TwoCommission,0 as OtherPrice,e.ALLCommission,0 as Paid
//from rb_goods_orderdetail as b
//LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId
//LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
//LEFT JOIN (SELECT SUM(Commission) as OneCommission,OrderId from rb_goods_ordercommission where Grade=1 and CommissionState=2 GROUP BY OrderId ) as c on a.OrderId=c.OrderId
//LEFT JOIN (SELECT SUM(Commission) as TwoCommission,OrderId from rb_goods_ordercommission where Grade=2 and CommissionState=2 GROUP BY OrderId ) as d on a.OrderId=d.OrderId
//LEFT JOIN (SELECT SUM(Commission) as ALLCommission,OrderId from rb_goods_ordercommission GROUP BY OrderId ) as e on a.OrderId=e.OrderId {where}
//GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
return Get<OrderStatistics_Query>( sql).ToList();
}
......
......@@ -8,6 +8,7 @@ using Mall.Common.Plugin;
using Mall.Model.Extend.User;
using Mall.Model.Query;
using Mall.Module.MarketingCenter;
using Mall.Module.Product;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
......@@ -28,6 +29,8 @@ namespace Mall.WebApi.Controllers.AppletWeChat
private readonly MiniProgramModule appletWeChatModule = new MiniProgramModule();
private readonly SupplierModule supplierModule = new SupplierModule();
private readonly ProductModule productModule = new ProductModule();
#region 直播房间信息
[HttpPost]
[AllowAnonymous]
......@@ -121,7 +124,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.OneCommission + item.TwoCommission + item.OtherPrice;
item.NoPaid = item.ALLCommission - item.Paid;
item.GrossProfit = item.AllPrice - item.ALLCommission;
item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero);
item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero);
}
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list;
......@@ -161,8 +164,16 @@ namespace Mall.WebApi.Controllers.AppletWeChat
new ExcelColumn(value: "包装费摊销") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "快递费") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "商品运费摊销") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "公司返佣") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "公司") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "总代理返佣") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "总代理") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "特一级返佣") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "特一级") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "一级返佣") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "一级返佣人") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "二级返佣") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "二级返佣人") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "其他") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "合计数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "已付") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
......@@ -210,8 +221,16 @@ namespace Mall.WebApi.Controllers.AppletWeChat
datarow.ExcelRows.Add(new ExcelColumn(value: item.PackingMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.CostFreight.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.GoodsFreight.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.BranchCommission.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.BranchName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.GeneralAgentCommission.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.GeneralAgentName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.SpecialCommission.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.SpecialName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.OneCommission.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.OneUserName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.TwoCommission.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.TwoUserName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.OtherPrice.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.ALLCommission.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.Paid.ToString("#0.00")) { });
......
......@@ -54,6 +54,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public ApiResult GetPayInfo()
{
var request = RequestParm;
......@@ -107,6 +108,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public ApiResult GetRechargePayInfo()
{
var request = RequestParm;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment