|
DataTable dt = OtherMySqlConn.dtable("select u.MakerCode,u.RealName,u.UserLevel,r.Rank,(case when ProfitType=1 then '直营' else '团队' end) as DirectFlag,k.Name,BrandId,CreditTradeAmt,CreditTradeProfit,QrCreditTradeAmt,QrCreditTradeProfit,NonQrCreditTradeAmt,NonQrCreditTradeProfit,HelpCreditTradeAmt,HelpCreditTradeProfit,NotHelpCreditTradeAmt,NotHelpCreditTradeProfit,ProfitCreditTradeAmt,ProfitCreditTradeProfit,DebitTradeAmt,DebitTradeProfit from (select UserId,ProfitType,BrandId,sum(CreditTradeAmt) as CreditTradeAmt,sum(CreditTradeProfit) as CreditTradeProfit,sum(QrCreditTradeAmt) as QrCreditTradeAmt,sum(QrCreditTradeProfit) as QrCreditTradeProfit,sum(NonQrCreditTradeAmt) as NonQrCreditTradeAmt,sum(NonQrCreditTradeProfit) as NonQrCreditTradeProfit,sum(HelpCreditTradeAmt) as HelpCreditTradeAmt,sum(HelpCreditTradeProfit) as HelpCreditTradeProfit,sum(NotHelpCreditTradeAmt) as NotHelpCreditTradeAmt,sum(NotHelpCreditTradeProfit) as NotHelpCreditTradeProfit,sum(ProfitCreditTradeAmt) as ProfitCreditTradeAmt,sum(ProfitCreditTradeProfit) as ProfitCreditTradeProfit,sum(DebitNonCapTradeAmt+DebitCapTradeAmt) as DebitTradeAmt,sum(DebitNonTradeCapProfit+DebitTradeCapProfit) as DebitTradeProfit from ProfitRewardRecord where Id>=" + StartId + " and TradeMonth='" + Month + "' GROUP BY UserId,ProfitType,BrandId) tb left join Users u on tb.UserId=u.Id LEFT JOIN KqProducts k ON k.Id=tb.BrandId left join UserRankWhite r on u.Id=r.Id and r.CreateDate<'" + DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00' and r.UpdateDate>'" + DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00' ORDER BY u.MakerCode");
|
|
DataTable dt = OtherMySqlConn.dtable("select u.MakerCode,u.RealName,u.UserLevel,r.Rank,(case when ProfitType=1 then '直营' else '团队' end) as DirectFlag,k.Name,BrandId,CreditTradeAmt,CreditTradeProfit,QrCreditTradeAmt,QrCreditTradeProfit,NonQrCreditTradeAmt,NonQrCreditTradeProfit,HelpCreditTradeAmt,HelpCreditTradeProfit,NotHelpCreditTradeAmt,NotHelpCreditTradeProfit,ProfitCreditTradeAmt,ProfitCreditTradeProfit,DebitTradeAmt,DebitTradeProfit from (select UserId,ProfitType,BrandId,sum(CreditTradeAmt) as CreditTradeAmt,sum(CreditTradeProfit) as CreditTradeProfit,sum(QrCreditTradeAmt) as QrCreditTradeAmt,sum(QrCreditTradeProfit) as QrCreditTradeProfit,sum(NonQrCreditTradeAmt) as NonQrCreditTradeAmt,sum(NonQrCreditTradeProfit) as NonQrCreditTradeProfit,sum(HelpCreditTradeAmt) as HelpCreditTradeAmt,sum(HelpCreditTradeProfit) as HelpCreditTradeProfit,sum(NotHelpCreditTradeAmt) as NotHelpCreditTradeAmt,sum(NotHelpCreditTradeProfit) as NotHelpCreditTradeProfit,sum(ProfitCreditTradeAmt) as ProfitCreditTradeAmt,sum(ProfitCreditTradeProfit) as ProfitCreditTradeProfit,sum(DebitNonCapTradeAmt+DebitCapTradeAmt) as DebitTradeAmt,sum(DebitNonTradeCapProfit+DebitTradeCapProfit) as DebitTradeProfit from ProfitRewardRecord where Id>=" + StartId + " and TradeMonth='" + Month + "' GROUP BY UserId,ProfitType,BrandId) tb left join Users u on tb.UserId=u.Id LEFT JOIN KqProducts k ON k.Id=tb.BrandId left join UserRankWhite r on u.Id=r.Id and r.CreateDate<'" + DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00' and r.UpdateDate>'" + DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00' ORDER BY u.MakerCode");
|
|
DataTable dt = OtherMySqlConn.dtable("select u.MakerCode,u.RealName,u.UserLevel,r.Rank,m.KqSnNo,m.MerchantName,(case when SubsidyType=1 then '直营' else '团队' end) as DirectFlag,k.Name,tb.BrandId,CreditTradeAmt,SubsidyProfit from (select SubsidyUserId,MerchantId,BrandId,SubsidyType,sum(CreditTradeAmt) as CreditTradeAmt,sum(SubsidyProfitRate) as SubsidyProfit from ProfitSubsidyDetail where Id>=" + StartId + " and TradeMonth='" + Month + "' GROUP BY SubsidyUserId,MerchantId,BrandId,SubsidyType) tb left join Users u on tb.SubsidyUserId=u.Id LEFT JOIN KqProducts k ON k.Id=tb.BrandId left join PosMerchantInfo m on tb.MerchantId=m.Id left join UserRankWhite r on u.Id=r.Id and r.CreateDate<'" + DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00' and r.UpdateDate>'" + DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00'");
|
|
DataTable dt = OtherMySqlConn.dtable("select u.MakerCode,u.RealName,u.UserLevel,r.Rank,m.KqSnNo,m.MerchantName,(case when SubsidyType=1 then '直营' else '团队' end) as DirectFlag,k.Name,tb.BrandId,CreditTradeAmt,SubsidyProfit from (select SubsidyUserId,MerchantId,BrandId,SubsidyType,sum(CreditTradeAmt) as CreditTradeAmt,sum(SubsidyProfitRate) as SubsidyProfit from ProfitSubsidyDetail where Id>=" + StartId + " and TradeMonth='" + Month + "' GROUP BY SubsidyUserId,MerchantId,BrandId,SubsidyType) tb left join Users u on tb.SubsidyUserId=u.Id LEFT JOIN KqProducts k ON k.Id=tb.BrandId left join PosMerchantInfo m on tb.MerchantId=m.Id left join UserRankWhite r on u.Id=r.Id and r.CreateDate<'" + DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00' and r.UpdateDate>'" + DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00'");
|