@@ -124,10 +124,14 @@ where {where} group by oc.OrderId,oc.UserId,oc.Grade,oc.Type order by oc.Grade a
{
where+=$@" and oc.{nameof(RB_Goods_OrderCommission.OrderId)} in({dmodel.OrderIds})";
}
if(!string.IsNullOrEmpty(dmodel.OrderDetailIds))
{
where+=$@" and oc.{nameof(RB_Goods_OrderCommission.OrderDetailId)} in({dmodel.OrderDetailIds})";
}
stringsql=$@"SELECT oc.OrderId,oc.UserId,oc.Grade,oc.Type,oc.CommissionState,SUM(oc.Commission) as Commission,oc.CommissionType FROM All_Commission oc
stringsql=$@"SELECT oc.OrderId,oc.OrderDetailId,oc.UserId,oc.Grade,oc.Type,oc.CommissionState,SUM(oc.Commission) as Commission,oc.CommissionType FROM All_Commission oc
left join rb_goods_orderaftersale oa on oc.OrderDetailId= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5)
where {where} group by oc.OrderId,oc.UserId,oc.Grade,oc.Type,oc.CommissionType order by oc.Grade asc";
where {where} group by oc.OrderDetailId,oc.UserId,oc.Grade,oc.Type,oc.CommissionType order by oc.Grade asc";
@@ -1287,27 +1287,27 @@ GROUP BY od.GoodsId,o.OrderId
}
}
// 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,
//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,
//0 as OtherPrice,e.FXCommission,f.RemitFXCommission,0 as Paid
//0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,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 FXCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from rb_goods_ordercommission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as FXCommission,OrderDetailId from All_Commission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from All_Commission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
//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 desc";
stringsql=$@" 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,
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,
0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,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 FXCommission,OrderDetailId from All_Commission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from All_Commission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
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 desc";
...
...
@@ -1359,29 +1359,29 @@ 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,
//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,
//0 as OtherPrice,e.FXCommission,f.RemitFXCommission,0 as Paid
//0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,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 FXCommission,OrderDetailId from rb_goods_ordercommission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from rb_goods_ordercommission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as FXCommission,OrderDetailId from All_Commission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
//LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from All_Commission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
//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 ";
stringsql=$@" 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,
stringsql=$@" 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,
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,
0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,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 FXCommission,OrderDetailId from All_Commission GROUP BY OrderDetailId ) as e on b.Id=e.OrderDetailId
LEFT JOIN (SELECT SUM(Commission) as RemitFXCommission,OrderDetailId from All_Commission where IsRemit=1 GROUP BY OrderDetailId ) as f on b.Id=f.OrderDetailId
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}