Commit a9eecf89 authored by 吴春's avatar 吴春

提交

parent 2dbe9cf8
...@@ -313,8 +313,15 @@ namespace Mall.Model.Query ...@@ -313,8 +313,15 @@ namespace Mall.Model.Query
public string CompanyName { get; set; } public string CompanyName { get; set; }
/// <summary>
/// 订单状态
/// </summary>
public int OrderStatus { get; set; }
/// <summary>
/// 订单手续费
/// </summary>
public decimal ServiceCharge { get; set; }
} }
} }
...@@ -1260,8 +1260,8 @@ GROUP BY od.GoodsId,o.OrderId ...@@ -1260,8 +1260,8 @@ GROUP BY od.GoodsId,o.OrderId
#region 粉象收益核算表 #region 粉象收益核算表
public List<OrderStatistics_Query> GetFXOrderProfitLossList(int pageIndex, int pageSize, out long count, OrderStatistics_Query dmodel) public List<OrderStatistics_Query> GetFXOrderProfitLossList(int pageIndex, int pageSize, out long count, OrderStatistics_Query dmodel)
{ {
string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) "; // string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) ";
string where = "where 1=1 and (a.OrderStatus in(2,3,4,5,6) or (a.OrderStatus=7 and a.PaymentTime is not NULL and a.CancelTime is not NULL and DATE_FORMAT(a.PaymentTime,'%Y-%m-%d' )<DATE_FORMAT(a.CancelTime,'%Y-%m-%d' ) ) ) ";
if (dmodel != null) if (dmodel != null)
{ {
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo)) if (!string.IsNullOrWhiteSpace(dmodel.OrderNo))
...@@ -1296,11 +1296,11 @@ GROUP BY od.GoodsId,o.OrderId ...@@ -1296,11 +1296,11 @@ GROUP BY od.GoodsId,o.OrderId
if (!string.IsNullOrWhiteSpace(dmodel.StartDate)) if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{ {
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) "; where += $" and DATE_FORMAT(a.PaymentTime,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
} }
if (!string.IsNullOrWhiteSpace(dmodel.EndDate)) if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{ {
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' ) "; where += $" and DATE_FORMAT(a.PaymentTime,'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' ) ";
} }
} }
...@@ -1318,7 +1318,7 @@ GROUP BY od.GoodsId,o.OrderId ...@@ -1318,7 +1318,7 @@ GROUP BY od.GoodsId,o.OrderId
//GROUP BY b.Id order by b.Id desc"; //GROUP BY b.Id order by b.Id desc";
string sql = $@" SELECT B.Id,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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 a.OrderStatus,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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(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,sum(b.FreightCostMoney) as GoodsFreight, SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight,
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney 0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney
...@@ -1336,7 +1336,7 @@ GROUP BY b.Id order by b.Id asc"; ...@@ -1336,7 +1336,7 @@ GROUP BY b.Id order by b.Id asc";
public List<OrderStatistics_Query> GetFXAllOrderProfitLossList(OrderStatistics_Query dmodel) public List<OrderStatistics_Query> GetFXAllOrderProfitLossList(OrderStatistics_Query dmodel)
{ {
string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) "; string where = "where 1=1 and (a.OrderStatus in(2,3,4,5,6) or (a.OrderStatus=7 and a.PaymentTime is not NULL and a.CancelTime is not NULL and DATE_FORMAT(a.PaymentTime,'%Y-%m-%d' )<DATE_FORMAT(a.CancelTime,'%Y-%m-%d' ) ) ) ";
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
if (dmodel != null) if (dmodel != null)
{ {
...@@ -1373,11 +1373,11 @@ GROUP BY b.Id order by b.Id asc"; ...@@ -1373,11 +1373,11 @@ GROUP BY b.Id order by b.Id asc";
if (!string.IsNullOrWhiteSpace(dmodel.StartDate)) if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{ {
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) "; where += $" and DATE_FORMAT(a.PaymentTime,'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
} }
if (!string.IsNullOrWhiteSpace(dmodel.EndDate)) if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{ {
where += $" and DATE_FORMAT(a.CreateDate,'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' ) "; where += $" and DATE_FORMAT(a.PaymentTime,'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' ) ";
} }
} }
...@@ -1395,7 +1395,7 @@ GROUP BY b.Id order by b.Id asc"; ...@@ -1395,7 +1395,7 @@ GROUP BY b.Id order by b.Id asc";
//GROUP BY b.Id "; //GROUP BY b.Id ";
string sql = $@" SELECT B.Id,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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 a.OrderStatus,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,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(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,sum(b.FreightCostMoney) as GoodsFreight, SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight,
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney 0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney
...@@ -1405,7 +1405,6 @@ LEFT JOIN rb_supplier as f on f.ID=b.SupplierId ...@@ -1405,7 +1405,6 @@ LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
LEFT JOIN rb_member_user as muser on muser.id=b.CompanyId LEFT JOIN rb_member_user as muser on muser.id=b.CompanyId
left join rb_goods_orderaftersale oa on b.ID= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5) {where} left join rb_goods_orderaftersale oa on b.ID= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5) {where}
GROUP BY b.Id order by b.Id asc "; GROUP BY b.Id order by b.Id asc ";
return Get<OrderStatistics_Query>(sql, parameters).ToList(); return Get<OrderStatistics_Query>(sql, parameters).ToList();
} }
......
...@@ -152,10 +152,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -152,10 +152,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat
foreach (var item in list) foreach (var item in list)
{ {
item.ALLCommission = item.CostMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.CouponMoney + item.RefundActual + item.YFMoney; item.ALLCommission = item.ServiceCharge + item.CostMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.CouponMoney + item.RefundActual + item.YFMoney;
item.NoPaid = item.ALLCommission; item.NoPaid = item.ALLCommission;
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0); item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.RefundActual + item.RemitFXCommission + item.CostMoney + item.GoodsFreight + item.PayMoney; item.Paid = item.ServiceCharge + item.RefundActual + item.RemitFXCommission + item.CostMoney + item.GoodsFreight + item.PayMoney;
item.GrossProfit = item.AllPrice + item.YSMoney - item.ALLCommission; item.GrossProfit = item.AllPrice + item.YSMoney - item.ALLCommission;
if (item.AllPrice == 0) if (item.AllPrice == 0)
{ {
...@@ -332,6 +332,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -332,6 +332,7 @@ 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 },
...@@ -361,10 +362,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -361,10 +362,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat
} }
foreach (var item in list) foreach (var item in list)
{ {
item.ALLCommission = item.CostMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.CouponMoney + item.RefundActual + item.YFMoney; item.ALLCommission = item.ServiceCharge + item.CostMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.CouponMoney + item.RefundActual + item.YFMoney;
item.NoPaid = item.ALLCommission; item.NoPaid = item.ALLCommission;
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0); item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.RefundActual + item.RemitFXCommission + item.CostMoney + item.GoodsFreight + item.PayMoney; item.Paid = item.ServiceCharge + item.RefundActual + item.RemitFXCommission + item.CostMoney + item.GoodsFreight + item.PayMoney;
item.GrossProfit = item.AllPrice + item.YSMoney - item.ALLCommission; item.GrossProfit = item.AllPrice + item.YSMoney - item.ALLCommission;
if (item.AllPrice == 0) if (item.AllPrice == 0)
{ {
...@@ -403,6 +404,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -403,6 +404,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
datarow.ExcelRows.Add(new ExcelColumn(value: item.AllPrice.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.AllPrice.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.YSMoney.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.YSMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: (item.AllPrice + item.YSMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: (item.AllPrice + item.YSMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.ServiceCharge.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.CostMoney.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.CostMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.GoodsFreight.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.GoodsFreight.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.FXCommission.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.FXCommission.ToString("#0.00")) { });
...@@ -464,6 +466,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -464,6 +466,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.YSMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.YSMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice + x.YSMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice + x.YSMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.ServiceCharge).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.CostMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.CostMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.GoodsFreight).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.GoodsFreight).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.FXCommission).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.FXCommission).ToString("#0.00")) { });
...@@ -558,10 +561,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -558,10 +561,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat
} }
foreach (var item in list) foreach (var item in list)
{ {
item.ALLCommission = item.CostMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.CouponMoney + item.RefundActual + item.YFMoney; item.ALLCommission = item.ServiceCharge + item.CostMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.CouponMoney + item.RefundActual + item.YFMoney;
item.NoPaid = item.ALLCommission; item.NoPaid = item.ALLCommission;
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0); item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.RefundActual + item.RemitFXCommission + item.CostMoney + item.GoodsFreight + item.PayMoney; item.Paid = item.ServiceCharge + item.RefundActual + item.RemitFXCommission + item.CostMoney + item.GoodsFreight + item.PayMoney;
item.GrossProfit = item.AllPrice + item.YSMoney - item.ALLCommission; item.GrossProfit = item.AllPrice + item.YSMoney - item.ALLCommission;
if (item.AllPrice == 0) if (item.AllPrice == 0)
{ {
...@@ -590,6 +593,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -590,6 +593,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
Final_Price = list.Sum(x => x.Final_Price),//数量 Final_Price = list.Sum(x => x.Final_Price),//数量
FreightMoney = list.Sum(x => !string.IsNullOrWhiteSpace(x.FreightMoney) ? Convert.ToDecimal(x.FreightMoney) : 0), FreightMoney = list.Sum(x => !string.IsNullOrWhiteSpace(x.FreightMoney) ? Convert.ToDecimal(x.FreightMoney) : 0),
AllPrice = list.Sum(x => x.AllPrice), AllPrice = list.Sum(x => x.AllPrice),
ServiceCharge = list.Sum(x => x.ServiceCharge),
CostMoney = list.Sum(x => x.CostMoney), CostMoney = list.Sum(x => x.CostMoney),
PackingMoney = list.Sum(x => x.PackingMoney), PackingMoney = list.Sum(x => x.PackingMoney),
GoodsFreight = list.Sum(x => x.GoodsFreight), GoodsFreight = list.Sum(x => x.GoodsFreight),
......
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