builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_DiscountCoupon_Extend.Status)}=0");
builder.Append($" SELECT a.*,b.`Name` as SmallShopName FROM {TableName} as A LEFT JOIN rb_smallshops_info as b on a.SmallShopId=b.Id WHERE a.{nameof(RB_DiscountCoupon_Extend.Status)}=0");
if(query!=null)
{
if(query.TenantId>0)
{
builder.Append($" AND {nameof(RB_DiscountCoupon_Extend.TenantId)}={query.TenantId}");
builder.Append($" AND a.{nameof(RB_DiscountCoupon_Extend.TenantId)}={query.TenantId}");
}
if(query.TenantId>0)
{
builder.Append($" AND {nameof(RB_DiscountCoupon_Extend.MallBaseId)}={query.MallBaseId}");
builder.Append($" AND a.{nameof(RB_DiscountCoupon_Extend.MallBaseId)}={query.MallBaseId}");
}
if(!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND {nameof(RB_DiscountCoupon_Extend.Name)} like '%{query.Name}%'");
builder.Append($" AND a.{nameof(RB_DiscountCoupon_Extend.Name)} like '%{query.Name}%'");
}
}
builder.Append($" order by {nameof(RB_DiscountCoupon_Extend.ID)} desc");
builder.Append($" order by a.{nameof(RB_DiscountCoupon_Extend.ID)} desc");
@@ -1276,6 +1276,10 @@ GROUP BY od.GoodsId,o.OrderId
{
where+=$" and b.GoodsId={dmodel.GoodsID} ";
}
if(dmodel.CompanyId>0)
{
where+=$" and b.CompanyId={dmodel.CompanyId} ";
}
if(!string.IsNullOrWhiteSpace(dmodel.StartDate))
{
...
...
@@ -1304,10 +1308,11 @@ GROUP BY od.GoodsId,o.OrderId
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,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
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
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 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}
GROUP BY b.Id order by b.Id desc";
...
...
@@ -1375,10 +1380,11 @@ 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,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid
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
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 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}