stringwhere="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) ";
stringwhere="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(!string.IsNullOrWhiteSpace(dmodel.OrderNo))
...
...
@@ -1296,11 +1296,11 @@ GROUP BY od.GoodsId,o.OrderId
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))
{
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
//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,
stringsql=$@" 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(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
...
...
@@ -1336,7 +1336,7 @@ GROUP BY b.Id order by b.Id asc";
stringwhere="where 1=1 and a.OrderStatus in(2,3,4,5,6) ";
stringwhere="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' ) ) ) ";
@@ -1373,11 +1373,11 @@ GROUP BY b.Id order by b.Id asc";
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))
{
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";
//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 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(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
...
...
@@ -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_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}