diff --git a/TradeManage/SysManageServiceNew.asmx.cs b/TradeManage/SysManageServiceNew.asmx.cs index d184845..908b45c 100644 --- a/TradeManage/SysManageServiceNew.asmx.cs +++ b/TradeManage/SysManageServiceNew.asmx.cs @@ -752,6 +752,124 @@ left join #ls_fee5 g on a.UserId=g.UserId } #endregion + // #region 报表18 + // [WebMethod(EnableSession = true)] + // public string GetReportTable18(DateTime? InDate, int DeptId, int ShopId, int PlatId, string MoneyCode, string Sort, bool isyc) + // { + // string dd = ""; + // try + // { + // var obj = new BaseService(); + + // string tj = ""; + // string tj1 = ""; + // //if (DeptId > 0) + // //{ + // // tj += " and b.DeptId=" + DeptId + " "; + // // tj1 += " and a.DeptId=" + DeptId + " "; + // //} + // if (PlatId > 0) + // { + // tj += " and a.PlatId=" + PlatId + " "; + // tj1 += " and a.PlatId=" + PlatId + " "; + // } + + // if (ShopId > 0) + // { + // tj += " and a.ShopId=" + ShopId + " "; + // tj1 += " and a.ShopId=" + ShopId + " "; + // } + // //if (MoneyCode != "0") + // // tj += " and a.MoneyCode='" + MoneyCode + "' "; + // // string sql = @" + // //declare @moneyrate decimal(18,4) + // //select @moneyrate=MRate from JC_Money where MCode='USD' and PlatId=2 + // //select a.ShopId,a.TotalPrice,escrowFee=isnull(a.escrowFee,0),a.RMBPrice,c.yj,yf=c.yf,cb=c.cb,hwsf=c.hwsf,c.tc,c.ck,c.md,a.Ad_Fee,a.DR_BackFee,a.DR_PostFee,a.DR_SSFee,a.Other_Fee,moneyrate=isnull(c.moneyrate,@moneyrate) into #ls from DT_OrderInfo a with(nolock) + // //inner join DT_OrderXXInfo b with(nolock) on a.OrderId=b.OrderId + // //left join DT_Fees c with(nolock) on a.OrderId=c.orderid + // //where DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 " + tj + @" and a.State>0 and a.State<3 + // //select a.*,Num2=isnull(b.Num2,0) into #ls2 from ( + // //select b.ShopId,Num=COUNT(0) from HW_GoodsInfo a with(nolock) + // //inner join HW_Shop b with(nolock) on a.GoodsId=b.GoodsId + // //group by b.ShopId)a + // //left join ( + // //select a.ShopId,Num2=COUNT(distinct c.GoodsId) from DT_OrderInfo a with(nolock) + // //inner join DT_OrderGoods b with(nolock) on a.OrderId=b.OrderId + // //inner join HW_GoodsDetail c with(nolock) on b.DetailId=c.DetailId + // //where a.State>0 and a.State<3 and DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 group by a.ShopId)b on a.ShopId=b.ShopId + + // //select d.ShopName,Master=case when d.Master=d.buyer then d.Master when d.buyer is not null and d.buyer<>'' then d.Master+'-'+d.buyer else d.Master end,a.OrderNum,a.RMBMoney,a.USDMoney,AvgPrice=case when a.OrderNum>0 then cast(a.USDMoney/a.OrderNum as decimal(18,2)) else 0 end,a.InPrice,LR=cast(b.ml as decimal(18,2)),MLL=case when b.TotalPrice>0 then cast(b.ml*100/b.TotalPrice as decimal(18,2)) else 0 end,ShopTJGoods=e.Num,ShopCDGoods=e.Num2,ckfee,a.mdfee,a.adfee,bz=case when a.InPrice>0 then CAST(a.RMBMoney/a.InPrice as decimal(18,2)) else 0 end,c.GoodRate,c.ODR,c.DSRService,c.DSRGoods,h.DSRPost,c.USDUseMoney,c.USDNoMoney,c.RMBUseMoney,c.RMBNoMoney,c.Rate1,c.Rate2,f.Rate3,c.Rate4,c.PropertyViolate,c.Rate5,g.Rate6,Rate7=isnull(c.Rate7,d.dayfee),JL=cast(b.ml as decimal(18,2))+isnull(ckfee,0)+isnull(mdfee,0)-isnull(c.Rate3,0)-isnull(c.Rate7,d.dayfee),FeeDate=isnull(c.FeeDate,d.FeeDate),TXFee=isnull(c.TXFee,d.TXFee) from + // //JC_Shop d left join ( + // //select ShopId,OrderNum=COUNT(0),RMBMoney=SUM(RMBPrice),escrowFee=sum(escrowFee),USDMoney=SUM(TotalPrice),InPrice=SUM(cb),ckfee=SUM(ck),mdfee=SUM(md),adfee=SUM(Ad_Fee) from #ls + // //group by ShopId)a on d.ShopId=a.ShopId + // //left join (select ShopId,TotalPrice=sum(TotalPrice),ml=sum(isnull(TotalPrice,0)-isnull(escrowFee,0)-isnull(yj,0)-isnull(yf,0)-((isnull(cb,0)+isnull(hwsf,0))/moneyrate)-isnull(tc,0)-isnull(ck,0)-isnull(md,0)-isnull(Ad_Fee,0)) from #ls where yf>0 + // //group by ShopId)b on a.ShopId=b.ShopId + // //left join ( + // //select GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee + // //TXFee,ShopId from JC_ShopData + // //where DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 )c on a.ShopId=c.ShopId + // //left Join #ls2 e on a.ShopId=e.ShopId + // // left join (select shopid,SUM(ABS(adfee)) Rate3 from AD_FeeList where DATEDIFF(day,addate,'" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "')=0 group by shopid) f on d.ShopId=f.shopid "+ + // // " left join ( select shopid,SUM(ABS(adfee)) Rate6 from AD_FeeList where CONVERT(varchar(7), addate, 120)='"+ InDate.Value.ToString("yyyy-MM") + "' group by shopid) g on d.ShopId=g.shopid "+ + // // " left join(select b.name shopName,case when a.Spend=0 or a.ad_sale_amount=0 then 0 else cast((Spend/ad_sale_amount)*100 as decimal(12,2)) end DSRPost from ( select sid,SUM(ISNULL(ABS(spend),0)) Spend, SUM(ISNULL(ad_sales_amount,0)) ad_sale_amount from [192.168.1.187].[UpGoods].dbo.LxERP_ProductPerformance where summary_field='Asin' and RequestDate='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' group by sid) a left join [192.168.1.187].[UpGoods].dbo.LxERP_Amazon_Shop b on a.sid=b.sid) h on d.ShopName=h.shopName " + + // // + " order by " + Sort; + + + + // string sql = @" + //declare @moneyrate decimal(18,4) + //select @moneyrate=MRate from JC_Money where MCode='USD' and PlatId=2 + //select a.ShopId,a.TotalPrice,escrowFee=isnull(a.escrowFee,0),a.RMBPrice,c.yj,yf=c.yf,cb=c.cb,hwsf=c.hwsf,c.tc,c.ck,c.md,a.Ad_Fee,a.DR_BackFee,a.DR_PostFee,a.DR_SSFee,a.Other_Fee,moneyrate=isnull(c.moneyrate,@moneyrate),ISnull( c.SubsidyFee,0) SubsidyFee into #ls from DT_OrderInfo a with(nolock) + //inner join DT_OrderXXInfo b with(nolock) on a.OrderId=b.OrderId + //left join DT_Fees c with(nolock) on a.OrderId=c.orderid + //where DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 " + tj + @" and a.State>0 and a.State<3 + //select a.*,Num2=isnull(b.Num2,0) into #ls2 from ( + //select b.ShopId,Num=COUNT(0) from HW_GoodsInfo a with(nolock) + //inner join HW_Shop b with(nolock) on a.GoodsId=b.GoodsId + //group by b.ShopId)a + //left join ( + //select a.ShopId,Num2=COUNT(distinct c.GoodsId) from DT_OrderInfo a with(nolock) + //inner join DT_OrderGoods b with(nolock) on a.OrderId=b.OrderId + //inner join HW_GoodsDetail c with(nolock) on b.DetailId=c.DetailId + //where a.State>0 and a.State<3 and DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 group by a.ShopId)b on a.ShopId=b.ShopId + + //select * from ( + //select d.ShopName,Master=case when d.Master=d.buyer then d.Master when d.buyer is not null and d.buyer<>'' then d.Master+'-'+d.buyer else d.Master end,a.OrderNum,a.RMBMoney,a.USDMoney,AvgPrice=case when a.OrderNum>0 then cast(a.USDMoney/a.OrderNum as decimal(18,2)) else 0 end,a.InPrice,LR=cast(b.ml as decimal(18,2)),MLL=case when b.TotalPrice>0 then cast(b.ml*100/b.TotalPrice as decimal(18,2)) else 0 end,ShopTJGoods=e.Num,ShopCDGoods=e.Num2,ckfee,a.mdfee,a.adfee,bz=case when a.InPrice>0 then CAST(a.RMBMoney/a.InPrice as decimal(18,2)) else 0 end,a.yf,c.GoodRate,c.ODR,t3.CVR DSRService,t3.user_sessions DSRGoods,f.DSRPost,c.USDUseMoney, n1.originalTotalCurrencyAmount as USDNoMoney,c.RMBUseMoney,c.RMBNoMoney,t2.orderDefectRate Rate1,t2.validTrackingRate Rate2,Case when d.PlatType=2 then f.Rate3 else c.Rate3 end Rate3,t4.RefundRate as Rate4, ABS( ISNULL( t4.RefundAmount,0) ) as PropertyViolate,t2.cancelRate Rate5,Case when d.PlatType=2 then g.Rate6 else (select SUM(ISNULL(Rate3,0)) from JC_ShopData where ShopId=d.ShopId and DATEDIFF(MONTH,InDate,'2023-10-18')=0) end Rate6,Rate7=isnull(c.Rate7,d.dayfee),JL=cast(b.ml as decimal(18,2))+isnull(ckfee,0)-isnull(c.Rate3,0)-isnull(c.Rate7,d.dayfee),t1.financialEventGroupEndLocale as FeeDate,t1.originalTotalCurrencyAmount as TXFee from + //JC_Shop d left join ( + //select ShopId,OrderNum=COUNT(0),RMBMoney=SUM(RMBPrice),escrowFee=sum(escrowFee),USDMoney=SUM(TotalPrice),InPrice=SUM(cb),ckfee=SUM(ck),mdfee=SUM(md),adfee=SUM(Ad_Fee),yf=SUM(yf) from #ls + //group by ShopId)a on d.ShopId=a.ShopId + //left join (select ShopId,TotalPrice=sum(TotalPrice),ml=sum(isnull(TotalPrice,0)-isnull(escrowFee,0)-isnull(yj,0)-isnull(yf,0)-((isnull(cb,0)+isnull(hwsf,0))/moneyrate)-isnull(tc,0)-isnull(ck,0)-isnull(md,0)-isnull(Ad_Fee,0)+SubsidyFee ) from #ls where yf>0 + //group by ShopId)b on a.ShopId=b.ShopId + //left join ( + //select GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee + //TXFee,ShopId from JC_ShopData + //where DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 )c on a.ShopId=c.ShopId + //left Join #ls2 e on a.ShopId=e.ShopId + //left join [192.168.1.187].[UpGoods].dbo.LxERP_Amazon_Shop o on d.ShopName=o.name + //left join ( select sid, CONVERT(decimal(12,2), SUM(t.cost)) as Rate3,CONVERT(decimal(12,2), SUM(t.sales)) as ad_sales , case when CONVERT(decimal(12,2), SUM(t.sales))<=0 then '∞' else CONVERT(nvarchar(20), convert(decimal(12,2), (CONVERT(decimal(12,2), SUM(t.cost))/CONVERT(decimal(12,2), SUM(t.sales)))*100)) end DSRPost from( select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SPAdGroupReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SBCampaignReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SDAdGroupReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid) t group by sid ) f on f.sid=o.sid" + + //" \r\n left join (select sid, CONVERT(decimal(12,2), SUM(t.cost)) as Rate6 from( select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SPAdGroupReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SBCampaignReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SDAdGroupReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid) t group by sid) g on o.sid=g.sid " + + // " \r\n left join(select t.row, t.storename,t.financialEventGroupEndLocale,t.originCurrencyIcon,CAST(ISNULL( t.originalTotalCurrencyAmount,0) as decimal(12,2)) as originalTotalCurrencyAmount from ( select ROW_NUMBER() over(PARTITION BY storename ORDER BY requestDate DESC) row,storename, financialEventGroupEndLocale,originCurrencyIcon,originalTotalCurrencyAmount from [192.168.1.187].[UpGoods].dbo.LxERP_SettlementSummaryData where accountType='Standard' and processingStatus='Closed ') t where t.row=1) t1 on d.ShopName=t1.storeName left join (select storename,CONVERT(decimal(12,2), SUM(ISNULL(originalTotalCurrencyAmount,0))) originalTotalCurrencyAmount from [192.168.1.187].[UpGoods].dbo.LxERP_SettlementSummaryData where processingStatus='Open' and accountType='Standard' group by storename) n1 on d.ShopName=n1.storeName " + + // "\r\n" + + // " left join (select sid, CAST( orderDefectRate *100 as decimal(12,2)) orderDefectRate,CAST( validTrackingRate *100 as decimal(12,2)) validTrackingRate,cast(CancelRate *100 as decimal(12,2)) cancelRate from (\r\nselect ROW_NUMBER() over(PARTITION BY sid ORDER BY requestDate DESC) row,sid, orderDefectRate,validTrackingRate,CancelRate from [192.168.1.187].[UpGoods].dbo.Amazon_V2_SELLER_PERFORMANCE_REPORT where CONVERT(date, RequestDate)='" + InDate.Value.AddDays(-1).Date.ToString("yyyy-MM-dd") + "') t where t.row=1)t2 on t2.sid=o.sid \r\nleft join (select sid, user_sessions,totalOrderItems, case when user_sessions=0 or totalOrderItems=0 then 0 else convert(decimal(12,2),(totalOrderItems*1.00/user_sessions)*100 ) end as CVR from [192.168.1.187].[UpGoods].dbo.Amazon_SALES_AND_TRAFFIC_REPORT where CONVERT(date, ReportDate)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "') t3 on t3.sid=o.sid\r\nleft join [192.168.1.187].[UpGoods].dbo.AmazonStoreRefundAmountAndRate t4 on t4.sid=o.sid and Convert(date, t4.ReportDate)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "'\r\n" + // + " where d.PlatType=2 union all\r\n select d.ShopName,Master=case when d.Master=d.buyer then d.Master when d.buyer is not null and d.buyer<>'' then d.Master+'-'+d.buyer else d.Master end,a.OrderNum,a.RMBMoney,a.USDMoney,AvgPrice=case when a.OrderNum>0 then cast(a.USDMoney/a.OrderNum as decimal(18,2)) else 0 end,a.InPrice,LR=cast(b.ml as decimal(18,2)),MLL=case when b.TotalPrice>0 then cast(b.ml*100/b.TotalPrice as decimal(18,2)) else 0 end,ShopTJGoods=e.Num,ShopCDGoods=e.Num2,ckfee,a.mdfee,a.adfee,bz=case when a.InPrice>0 then CAST(a.RMBMoney/a.InPrice as decimal(18,2)) else 0 end,a.yf,c.GoodRate,c.ODR,c.DSRService,c.DSRGoods,case when ISNULL(c.DSRPost,0)=0 then '' else CONVERT(nvarchar(20),c.DSRPost) end DSRPost,c.USDUseMoney,c.USDNoMoney,c.RMBUseMoney,c.RMBNoMoney,c.Rate1,c.Rate2,c.Rate3,c.Rate4,c.PropertyViolate,c.Rate5,c.Rate6,Rate7=isnull(c.Rate7,d.dayfee),JL=cast(b.ml as decimal(18,2))+isnull(ckfee,0)-isnull(c.Rate3,0)-isnull(c.Rate7,d.dayfee),FeeDate=isnull(c.FeeDate,d.FeeDate),TXFee=isnull(c.TXFee,d.TXFee) from \r\nJC_Shop d left join (\r\nselect ShopId,OrderNum=COUNT(0),RMBMoney=SUM(RMBPrice),escrowFee=sum(escrowFee),USDMoney=SUM(TotalPrice),InPrice=SUM(cb),ckfee=SUM(ck),mdfee=SUM(md),adfee=SUM(Ad_Fee),yf=SUM(yf) from #ls\r\ngroup by ShopId)a on d.ShopId=a.ShopId\r\nleft join (select ShopId,TotalPrice=sum(TotalPrice),ml=sum(isnull(TotalPrice,0)-isnull(escrowFee,0)-isnull(yj,0)-isnull(yf,0)-((isnull(cb,0)+isnull(hwsf,0))/moneyrate)-isnull(tc,0)-isnull(ck,0)-isnull(md,0)-isnull(Ad_Fee,0)+ SubsidyFee) from #ls where yf>0\r\ngroup by ShopId)b on a.ShopId=b.ShopId\r\nleft join (\r\nselect GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee\r\nTXFee,ShopId from JC_ShopData\r\nwhere DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + "')=0 )c on a.ShopId=c.ShopId\r\nleft Join #ls2 e on a.ShopId=e.ShopId where d.PlatType!=2 " + (isyc ? " and d.Master!='东南亚专用'" : "") + "\r\n) a order by " + Sort; + + // DataTable dt = obj.GetReportData(sql); + + + + // return GetReport3(dt, 18); + // } + // catch (Exception ex) + // { + // string a = dd; + // return ""; + + // } + // } + // #endregion + + #region 报表18 [WebMethod(EnableSession = true)] public string GetReportTable18(DateTime? InDate, int DeptId, int ShopId, int PlatId, string MoneyCode, string Sort, bool isyc) @@ -779,6 +897,34 @@ left join #ls_fee5 g on a.UserId=g.UserId tj += " and a.ShopId=" + ShopId + " "; tj1 += " and a.ShopId=" + ShopId + " "; } + + string tj2 = ""; + + if (PlatId > 0) + { + tj2 += " where c.PlatType=" + PlatId + " "; + + } + + if (ShopId > 0) + { + tj2 += " where c.ShopId=" + ShopId + " "; + + } + + string tj3 = ""; + + if (PlatId > 0) + { + tj3 += " where d.PlatType=" + PlatId + " "; + + } + + if (ShopId > 0) + { + tj3 += " where d.ShopId=" + ShopId + " "; + + } //if (MoneyCode != "0") // tj += " and a.MoneyCode='" + MoneyCode + "' "; // string sql = @" @@ -816,43 +962,76 @@ left join #ls_fee5 g on a.UserId=g.UserId // + " order by " + Sort; + //string sql = @" + //declare @moneyrate decimal(18,4) + //select @moneyrate=MRate from JC_Money where MCode='USD' and PlatId=2 + //select a.ShopId,a.TotalPrice,escrowFee=isnull(a.escrowFee,0),a.RMBPrice,c.yj,yf=c.yf,cb=c.cb,hwsf=c.hwsf,c.tc,c.ck,c.md,a.Ad_Fee,a.DR_BackFee,a.DR_PostFee,a.DR_SSFee,a.Other_Fee,moneyrate=isnull(c.moneyrate,@moneyrate),ISnull( c.SubsidyFee,0) SubsidyFee into #ls from DT_OrderInfo a with(nolock) + //inner join DT_OrderXXInfo b with(nolock) on a.OrderId=b.OrderId + //left join DT_Fees c with(nolock) on a.OrderId=c.orderid + //where DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 " + tj + @" and a.State>0 and a.State<3 + //select a.*,Num2=isnull(b.Num2,0) into #ls2 from ( + //select b.ShopId,Num=COUNT(0) from HW_GoodsInfo a with(nolock) + //inner join HW_Shop b with(nolock) on a.GoodsId=b.GoodsId + //left join jc_shop c on b.ShopId=c.ShopId " + tj2 + @" + //group by b.ShopId)a + //left join ( + //select a.ShopId,Num2=COUNT(distinct c.GoodsId) from DT_OrderInfo a with(nolock) + //inner join DT_OrderGoods b with(nolock) on a.OrderId=b.OrderId + //inner join HW_GoodsDetail c with(nolock) on b.DetailId=c.DetailId + //where a.State>0 and a.State<3 and DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 group by a.ShopId)b on a.ShopId=b.ShopId + + //select * from ( + //select d.ShopName,Master=case when d.Master=d.buyer then d.Master when d.buyer is not null and d.buyer<>'' then d.Master+'-'+d.buyer else d.Master end,a.OrderNum,a.RMBMoney,a.USDMoney,AvgPrice=case when a.OrderNum>0 then cast(a.USDMoney/a.OrderNum as decimal(18,2)) else 0 end,a.InPrice,LR=cast(b.ml as decimal(18,2)),MLL=case when b.TotalPrice>0 then cast(b.ml*100/b.TotalPrice as decimal(18,2)) else 0 end,ShopTJGoods=e.Num,ShopCDGoods=e.Num2,ckfee,a.mdfee,a.adfee,bz=case when a.InPrice>0 then CAST(a.RMBMoney/a.InPrice as decimal(18,2)) else 0 end,a.yf,c.GoodRate,c.ODR,DSRService=0,DSRGoods=null,DSRPost=0,c.USDUseMoney, USDNoMoney=0,c.RMBUseMoney,c.RMBNoMoney,Rate1=null,Rate2=null,Rate4=null, PropertyViolate=0, Rate5=0,Rate6=0,Rate7=isnull(c.Rate7,d.dayfee),JL=cast(b.ml as decimal(18,2))+isnull(ckfee,0)-isnull(c.Rate3,0)-isnull(c.Rate7,d.dayfee),FeeDate=null,TXFee=0 from + //JC_Shop d left join ( + //select ShopId,OrderNum=COUNT(0),RMBMoney=SUM(RMBPrice),escrowFee=sum(escrowFee),USDMoney=SUM(TotalPrice),InPrice=SUM(cb),ckfee=SUM(ck),mdfee=SUM(md),adfee=SUM(Ad_Fee),yf=SUM(yf) from #ls + //group by ShopId)a on d.ShopId=a.ShopId + //left join (select ShopId,TotalPrice=sum(TotalPrice),ml=sum(isnull(TotalPrice,0)-isnull(escrowFee,0)-isnull(yj,0)-isnull(yf,0)-((isnull(cb,0)+isnull(hwsf,0))/moneyrate)-isnull(tc,0)-isnull(ck,0)-isnull(md,0)-isnull(Ad_Fee,0)+SubsidyFee) from #ls where yf>0 + //group by ShopId)b on a.ShopId=b.ShopId + //left join ( + //select GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee + //TXFee,ShopId from JC_ShopData + //where DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 )c on a.ShopId=c.ShopId + //left Join #ls2 e on a.ShopId=e.ShopId "+ tj3 + @" + //) a order by " + Sort; string sql = @" -declare @moneyrate decimal(18,4) -select @moneyrate=MRate from JC_Money where MCode='USD' and PlatId=2 -select a.ShopId,a.TotalPrice,escrowFee=isnull(a.escrowFee,0),a.RMBPrice,c.yj,yf=c.yf,cb=c.cb,hwsf=c.hwsf,c.tc,c.ck,c.md,a.Ad_Fee,a.DR_BackFee,a.DR_PostFee,a.DR_SSFee,a.Other_Fee,moneyrate=isnull(c.moneyrate,@moneyrate),ISnull( c.SubsidyFee,0) SubsidyFee into #ls from DT_OrderInfo a with(nolock) -inner join DT_OrderXXInfo b with(nolock) on a.OrderId=b.OrderId -left join DT_Fees c with(nolock) on a.OrderId=c.orderid -where DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 " + tj + @" and a.State>0 and a.State<3 -select a.*,Num2=isnull(b.Num2,0) into #ls2 from ( -select b.ShopId,Num=COUNT(0) from HW_GoodsInfo a with(nolock) -inner join HW_Shop b with(nolock) on a.GoodsId=b.GoodsId -group by b.ShopId)a -left join ( -select a.ShopId,Num2=COUNT(distinct c.GoodsId) from DT_OrderInfo a with(nolock) -inner join DT_OrderGoods b with(nolock) on a.OrderId=b.OrderId -inner join HW_GoodsDetail c with(nolock) on b.DetailId=c.DetailId -where a.State>0 and a.State<3 and DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 group by a.ShopId)b on a.ShopId=b.ShopId - -select * from ( -select d.ShopName,Master=case when d.Master=d.buyer then d.Master when d.buyer is not null and d.buyer<>'' then d.Master+'-'+d.buyer else d.Master end,a.OrderNum,a.RMBMoney,a.USDMoney,AvgPrice=case when a.OrderNum>0 then cast(a.USDMoney/a.OrderNum as decimal(18,2)) else 0 end,a.InPrice,LR=cast(b.ml as decimal(18,2)),MLL=case when b.TotalPrice>0 then cast(b.ml*100/b.TotalPrice as decimal(18,2)) else 0 end,ShopTJGoods=e.Num,ShopCDGoods=e.Num2,ckfee,a.mdfee,a.adfee,bz=case when a.InPrice>0 then CAST(a.RMBMoney/a.InPrice as decimal(18,2)) else 0 end,a.yf,c.GoodRate,c.ODR,t3.CVR DSRService,t3.user_sessions DSRGoods,f.DSRPost,c.USDUseMoney, n1.originalTotalCurrencyAmount as USDNoMoney,c.RMBUseMoney,c.RMBNoMoney,t2.orderDefectRate Rate1,t2.validTrackingRate Rate2,Case when d.PlatType=2 then f.Rate3 else c.Rate3 end Rate3,t4.RefundRate as Rate4, ABS( ISNULL( t4.RefundAmount,0) ) as PropertyViolate,t2.cancelRate Rate5,Case when d.PlatType=2 then g.Rate6 else (select SUM(ISNULL(Rate3,0)) from JC_ShopData where ShopId=d.ShopId and DATEDIFF(MONTH,InDate,'2023-10-18')=0) end Rate6,Rate7=isnull(c.Rate7,d.dayfee),JL=cast(b.ml as decimal(18,2))+isnull(ckfee,0)-isnull(c.Rate3,0)-isnull(c.Rate7,d.dayfee),t1.financialEventGroupEndLocale as FeeDate,t1.originalTotalCurrencyAmount as TXFee from -JC_Shop d left join ( -select ShopId,OrderNum=COUNT(0),RMBMoney=SUM(RMBPrice),escrowFee=sum(escrowFee),USDMoney=SUM(TotalPrice),InPrice=SUM(cb),ckfee=SUM(ck),mdfee=SUM(md),adfee=SUM(Ad_Fee),yf=SUM(yf) from #ls -group by ShopId)a on d.ShopId=a.ShopId -left join (select ShopId,TotalPrice=sum(TotalPrice),ml=sum(isnull(TotalPrice,0)-isnull(escrowFee,0)-isnull(yj,0)-isnull(yf,0)-((isnull(cb,0)+isnull(hwsf,0))/moneyrate)-isnull(tc,0)-isnull(ck,0)-isnull(md,0)-isnull(Ad_Fee,0)+SubsidyFee ) from #ls where yf>0 -group by ShopId)b on a.ShopId=b.ShopId -left join ( -select GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee -TXFee,ShopId from JC_ShopData -where DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 )c on a.ShopId=c.ShopId -left Join #ls2 e on a.ShopId=e.ShopId -left join [192.168.1.187].[UpGoods].dbo.LxERP_Amazon_Shop o on d.ShopName=o.name -left join ( select sid, CONVERT(decimal(12,2), SUM(t.cost)) as Rate3,CONVERT(decimal(12,2), SUM(t.sales)) as ad_sales , case when CONVERT(decimal(12,2), SUM(t.sales))<=0 then '∞' else CONVERT(nvarchar(20), convert(decimal(12,2), (CONVERT(decimal(12,2), SUM(t.cost))/CONVERT(decimal(12,2), SUM(t.sales)))*100)) end DSRPost from( select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SPAdGroupReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SBCampaignReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SDAdGroupReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid) t group by sid ) f on f.sid=o.sid" + + declare @moneyrate decimal(18,4) + select @moneyrate=MRate from JC_Money where MCode='USD' and PlatId=2 + select a.ShopId,a.TotalPrice,escrowFee=isnull(a.escrowFee,0),a.RMBPrice,c.yj,yf=c.yf,cb=c.cb,hwsf=c.hwsf,c.tc,c.ck,c.md,a.Ad_Fee,a.DR_BackFee,a.DR_PostFee,a.DR_SSFee,a.Other_Fee,moneyrate=isnull(c.moneyrate,@moneyrate),ISnull( c.SubsidyFee,0) SubsidyFee into #ls from DT_OrderInfo a with(nolock) + inner join DT_OrderXXInfo b with(nolock) on a.OrderId=b.OrderId + left join DT_Fees c with(nolock) on a.OrderId=c.orderid + where DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 " + tj + @" and a.State>0 and a.State<3 + select a.*,Num2=isnull(b.Num2,0) into #ls2 from ( + select b.ShopId,Num=COUNT(0) from HW_GoodsInfo a with(nolock) + inner join HW_Shop b with(nolock) on a.GoodsId=b.GoodsId + inner join jc_shop c on b.ShopId=c.ShopId " + tj2 + @" + group by b.ShopId)a + left join ( + select a.ShopId,Num2=COUNT(distinct c.GoodsId) from DT_OrderInfo a with(nolock) + inner join DT_OrderGoods b with(nolock) on a.OrderId=b.OrderId + inner join HW_GoodsDetail c with(nolock) on b.DetailId=c.DetailId + where a.State>0 and a.State<3 and DATEDIFF(day,a.OrderDate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 group by a.ShopId)b on a.ShopId=b.ShopId + + select * from ( + select d.ShopName,Master=case when d.Master=d.buyer then d.Master when d.buyer is not null and d.buyer<>'' then d.Master+'-'+d.buyer else d.Master end,a.OrderNum,a.RMBMoney,a.USDMoney,AvgPrice=case when a.OrderNum>0 then cast(a.USDMoney/a.OrderNum as decimal(18,2)) else 0 end,a.InPrice,LR=cast(b.ml as decimal(18,2)),MLL=case when b.TotalPrice>0 then cast(b.ml*100/b.TotalPrice as decimal(18,2)) else 0 end,ShopTJGoods=e.Num,ShopCDGoods=e.Num2,ckfee,a.mdfee,a.adfee,bz=case when a.InPrice>0 then CAST(a.RMBMoney/a.InPrice as decimal(18,2)) else 0 end,a.yf,c.GoodRate,c.ODR,t3.CVR DSRService,t3.user_sessions DSRGoods,f.DSRPost,c.USDUseMoney, n1.originalTotalCurrencyAmount as USDNoMoney,c.RMBUseMoney,c.RMBNoMoney,t2.orderDefectRate Rate1,t2.validTrackingRate Rate2,Case when d.PlatType=2 then f.Rate3 else c.Rate3 end Rate3,t4.RefundRate as Rate4, ABS( ISNULL( t4.RefundAmount,0) ) as PropertyViolate,t2.cancelRate Rate5,Case when d.PlatType=2 then g.Rate6 else (select SUM(ISNULL(Rate3,0)) from JC_ShopData where ShopId=d.ShopId and DATEDIFF(MONTH,InDate,'2023-10-18')=0) end Rate6,Rate7=isnull(c.Rate7,d.dayfee),JL=cast(b.ml as decimal(18,2))+isnull(ckfee,0)-isnull(c.Rate3,0)-isnull(c.Rate7,d.dayfee),t1.financialEventGroupEndLocale as FeeDate,t1.originalTotalCurrencyAmount as TXFee from + JC_Shop d left join ( + select ShopId,OrderNum=COUNT(0),RMBMoney=SUM(RMBPrice),escrowFee=sum(escrowFee),USDMoney=SUM(TotalPrice),InPrice=SUM(cb),ckfee=SUM(ck),mdfee=SUM(md),adfee=SUM(Ad_Fee),yf=SUM(yf) from #ls + group by ShopId)a on d.ShopId=a.ShopId + left join (select ShopId,TotalPrice=sum(TotalPrice),ml=sum(isnull(TotalPrice,0)-isnull(escrowFee,0)-isnull(yj,0)-isnull(yf,0)-((isnull(cb,0)+isnull(hwsf,0))/moneyrate)-isnull(tc,0)-isnull(ck,0)-isnull(md,0)-isnull(Ad_Fee,0)+SubsidyFee) from #ls where yf>0 + group by ShopId)b on a.ShopId=b.ShopId + left join ( + select GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee + TXFee,ShopId from JC_ShopData + where DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 )c on a.ShopId=c.ShopId + inner Join #ls2 e on a.ShopId=e.ShopId + left join [192.168.1.187].[UpGoods].dbo.LxERP_Amazon_Shop o on d.ShopName=o.name + left join ( select sid, CONVERT(decimal(12,2), SUM(t.cost)) as Rate3,CONVERT(decimal(12,2), SUM(t.sales)) as ad_sales , case when CONVERT(decimal(12,2), SUM(t.sales))<=0 then '∞' else CONVERT(nvarchar(20), convert(decimal(12,2), (CONVERT(decimal(12,2), SUM(t.cost))/CONVERT(decimal(12,2), SUM(t.sales)))*100)) end DSRPost from( select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SPAdGroupReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SBCampaignReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SDAdGroupReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid) t group by sid ) f on f.sid=o.sid" + " \r\n left join (select sid, CONVERT(decimal(12,2), SUM(t.cost)) as Rate6 from( select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SPAdGroupReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SBCampaignReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SDAdGroupReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid) t group by sid) g on o.sid=g.sid " + " \r\n left join(select t.row, t.storename,t.financialEventGroupEndLocale,t.originCurrencyIcon,CAST(ISNULL( t.originalTotalCurrencyAmount,0) as decimal(12,2)) as originalTotalCurrencyAmount from ( select ROW_NUMBER() over(PARTITION BY storename ORDER BY requestDate DESC) row,storename, financialEventGroupEndLocale,originCurrencyIcon,originalTotalCurrencyAmount from [192.168.1.187].[UpGoods].dbo.LxERP_SettlementSummaryData where accountType='Standard' and processingStatus='Closed ') t where t.row=1) t1 on d.ShopName=t1.storeName left join (select storename,CONVERT(decimal(12,2), SUM(ISNULL(originalTotalCurrencyAmount,0))) originalTotalCurrencyAmount from [192.168.1.187].[UpGoods].dbo.LxERP_SettlementSummaryData where processingStatus='Open' and accountType='Standard' group by storename) n1 on d.ShopName=n1.storeName " + "\r\n" + " left join (select sid, CAST( orderDefectRate *100 as decimal(12,2)) orderDefectRate,CAST( validTrackingRate *100 as decimal(12,2)) validTrackingRate,cast(CancelRate *100 as decimal(12,2)) cancelRate from (\r\nselect ROW_NUMBER() over(PARTITION BY sid ORDER BY requestDate DESC) row,sid, orderDefectRate,validTrackingRate,CancelRate from [192.168.1.187].[UpGoods].dbo.Amazon_V2_SELLER_PERFORMANCE_REPORT where CONVERT(date, RequestDate)='" + InDate.Value.AddDays(-1).Date.ToString("yyyy-MM-dd") + "') t where t.row=1)t2 on t2.sid=o.sid \r\nleft join (select sid, user_sessions,totalOrderItems, case when user_sessions=0 or totalOrderItems=0 then 0 else convert(decimal(12,2),(totalOrderItems*1.00/user_sessions)*100 ) end as CVR from [192.168.1.187].[UpGoods].dbo.Amazon_SALES_AND_TRAFFIC_REPORT where CONVERT(date, ReportDate)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "') t3 on t3.sid=o.sid\r\nleft join [192.168.1.187].[UpGoods].dbo.AmazonStoreRefundAmountAndRate t4 on t4.sid=o.sid and Convert(date, t4.ReportDate)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "'\r\n" - + " where d.PlatType=2 union all\r\n select d.ShopName,Master=case when d.Master=d.buyer then d.Master when d.buyer is not null and d.buyer<>'' then d.Master+'-'+d.buyer else d.Master end,a.OrderNum,a.RMBMoney,a.USDMoney,AvgPrice=case when a.OrderNum>0 then cast(a.USDMoney/a.OrderNum as decimal(18,2)) else 0 end,a.InPrice,LR=cast(b.ml as decimal(18,2)),MLL=case when b.TotalPrice>0 then cast(b.ml*100/b.TotalPrice as decimal(18,2)) else 0 end,ShopTJGoods=e.Num,ShopCDGoods=e.Num2,ckfee,a.mdfee,a.adfee,bz=case when a.InPrice>0 then CAST(a.RMBMoney/a.InPrice as decimal(18,2)) else 0 end,a.yf,c.GoodRate,c.ODR,c.DSRService,c.DSRGoods,case when ISNULL(c.DSRPost,0)=0 then '' else CONVERT(nvarchar(20),c.DSRPost) end DSRPost,c.USDUseMoney,c.USDNoMoney,c.RMBUseMoney,c.RMBNoMoney,c.Rate1,c.Rate2,c.Rate3,c.Rate4,c.PropertyViolate,c.Rate5,c.Rate6,Rate7=isnull(c.Rate7,d.dayfee),JL=cast(b.ml as decimal(18,2))+isnull(ckfee,0)-isnull(c.Rate3,0)-isnull(c.Rate7,d.dayfee),FeeDate=isnull(c.FeeDate,d.FeeDate),TXFee=isnull(c.TXFee,d.TXFee) from \r\nJC_Shop d left join (\r\nselect ShopId,OrderNum=COUNT(0),RMBMoney=SUM(RMBPrice),escrowFee=sum(escrowFee),USDMoney=SUM(TotalPrice),InPrice=SUM(cb),ckfee=SUM(ck),mdfee=SUM(md),adfee=SUM(Ad_Fee),yf=SUM(yf) from #ls\r\ngroup by ShopId)a on d.ShopId=a.ShopId\r\nleft join (select ShopId,TotalPrice=sum(TotalPrice),ml=sum(isnull(TotalPrice,0)-isnull(escrowFee,0)-isnull(yj,0)-isnull(yf,0)-((isnull(cb,0)+isnull(hwsf,0))/moneyrate)-isnull(tc,0)-isnull(ck,0)-isnull(md,0)-isnull(Ad_Fee,0)+ SubsidyFee) from #ls where yf>0\r\ngroup by ShopId)b on a.ShopId=b.ShopId\r\nleft join (\r\nselect GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee\r\nTXFee,ShopId from JC_ShopData\r\nwhere DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + "')=0 )c on a.ShopId=c.ShopId\r\nleft Join #ls2 e on a.ShopId=e.ShopId where d.PlatType!=2 " + (isyc ? " and d.Master!='东南亚专用'" : "") + "\r\n) a order by " + Sort; + + " where d.PlatType=2 union all\r\n select d.ShopName,Master=case when d.Master=d.buyer then d.Master when d.buyer is not null and d.buyer<>'' then d.Master+'-'+d.buyer else d.Master end,a.OrderNum,a.RMBMoney,a.USDMoney,AvgPrice=case when a.OrderNum>0 then cast(a.USDMoney/a.OrderNum as decimal(18,2)) else 0 end,a.InPrice,LR=cast(b.ml as decimal(18,2)),MLL=case when b.TotalPrice>0 then cast(b.ml*100/b.TotalPrice as decimal(18,2)) else 0 end,ShopTJGoods=e.Num,ShopCDGoods=e.Num2,ckfee,a.mdfee,a.adfee,bz=case when a.InPrice>0 then CAST(a.RMBMoney/a.InPrice as decimal(18,2)) else 0 end,a.yf,c.GoodRate,c.ODR,c.DSRService,c.DSRGoods,case when ISNULL(c.DSRPost,0)=0 then '' else CONVERT(nvarchar(20),c.DSRPost) end DSRPost,c.USDUseMoney,c.USDNoMoney,c.RMBUseMoney,c.RMBNoMoney,c.Rate1,c.Rate2,c.Rate3,c.Rate4,c.PropertyViolate,c.Rate5,c.Rate6,Rate7=isnull(c.Rate7,d.dayfee),JL=cast(b.ml as decimal(18,2))+isnull(ckfee,0)-isnull(c.Rate3,0)-isnull(c.Rate7,d.dayfee),FeeDate=isnull(c.FeeDate,d.FeeDate),TXFee=isnull(c.TXFee,d.TXFee) from \r\nJC_Shop d left join (\r\nselect ShopId,OrderNum=COUNT(0),RMBMoney=SUM(RMBPrice),escrowFee=sum(escrowFee),USDMoney=SUM(TotalPrice),InPrice=SUM(cb),ckfee=SUM(ck),mdfee=SUM(md),adfee=SUM(Ad_Fee),yf=SUM(yf) from #ls\r\ngroup by ShopId)a on d.ShopId=a.ShopId\r\nleft join (select ShopId,TotalPrice=sum(TotalPrice),ml=sum(isnull(TotalPrice,0)-isnull(escrowFee,0)-isnull(yj,0)-isnull(yf,0)-((isnull(cb,0)+isnull(hwsf,0))/moneyrate)-isnull(tc,0)-isnull(ck,0)-isnull(md,0)-isnull(Ad_Fee,0) + SubsidyFee) from #ls where yf>0\r\ngroup by ShopId)b on a.ShopId=b.ShopId\r\nleft join (\r\nselect GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee\r\nTXFee,ShopId from JC_ShopData\r\nwhere DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + "')=0 )c on a.ShopId=c.ShopId\r\nleft Join #ls2 e on a.ShopId=e.ShopId where d.PlatType!=2 " + (isyc ? " and d.Master!='东南亚专用'" : "") + "\r\n) a order by " + Sort; + DataTable dt = obj.GetReportData(sql); @@ -8591,5 +8770,8 @@ where a.storeid in (6,9,11) and a.OrderGoodsId=0 and a.KCNum>0 " + tj + " gr } #endregion + + + } } diff --git a/TradeManage/bin/ApiNew.pdb b/TradeManage/bin/ApiNew.pdb index 4812633..62512ed 100644 Binary files a/TradeManage/bin/ApiNew.pdb and b/TradeManage/bin/ApiNew.pdb differ diff --git a/TradeManage/bin/TradeManage.dll b/TradeManage/bin/TradeManage.dll index 831782c..878bb32 100644 Binary files a/TradeManage/bin/TradeManage.dll and b/TradeManage/bin/TradeManage.dll differ diff --git a/TradeManage/bin/TradeManage.pdb b/TradeManage/bin/TradeManage.pdb index 8813ef3..193f96e 100644 Binary files a/TradeManage/bin/TradeManage.pdb and b/TradeManage/bin/TradeManage.pdb differ diff --git a/TradeManage/bin/TradeManageNew.dll b/TradeManage/bin/TradeManageNew.dll index 72c7e5f..0b01a2d 100644 Binary files a/TradeManage/bin/TradeManageNew.dll and b/TradeManage/bin/TradeManageNew.dll differ diff --git a/TradeManage/bin/TradeManageNew.dll.config b/TradeManage/bin/TradeManageNew.dll.config index 4b0b07e..66850e4 100644 --- a/TradeManage/bin/TradeManageNew.dll.config +++ b/TradeManage/bin/TradeManageNew.dll.config @@ -63,11 +63,11 @@ - + - + diff --git a/TradeManage/bin/TradeManageNew.pdb b/TradeManage/bin/TradeManageNew.pdb index a22f513..bad2b02 100644 Binary files a/TradeManage/bin/TradeManageNew.pdb and b/TradeManage/bin/TradeManageNew.pdb differ diff --git a/TradeManage/obj/Debug/TradeManage.dll b/TradeManage/obj/Debug/TradeManage.dll index 831782c..878bb32 100644 Binary files a/TradeManage/obj/Debug/TradeManage.dll and b/TradeManage/obj/Debug/TradeManage.dll differ diff --git a/TradeManage/obj/Debug/TradeManage.pdb b/TradeManage/obj/Debug/TradeManage.pdb index 8813ef3..193f96e 100644 Binary files a/TradeManage/obj/Debug/TradeManage.pdb and b/TradeManage/obj/Debug/TradeManage.pdb differ diff --git a/TradeManageNew/HuoWuServiceNew.asmx.cs b/TradeManageNew/HuoWuServiceNew.asmx.cs index 6e021da..28836c2 100644 --- a/TradeManageNew/HuoWuServiceNew.asmx.cs +++ b/TradeManageNew/HuoWuServiceNew.asmx.cs @@ -7682,6 +7682,16 @@ namespace TradeManageNew } #endregion + + [WebMethod(EnableSession = true)] + public List GetTemuOrderFromSKU(string sku) + { + PagesNew.Login(this.Session); + var datas = DataNew.GetTemuOrderFromSKU(sku); + + return datas; + } + } } diff --git a/TradeManageNew/Huowu/HW_TemuGoodsFee.aspx b/TradeManageNew/Huowu/HW_TemuGoodsFee.aspx deleted file mode 100644 index 56f1b70..0000000 --- a/TradeManageNew/Huowu/HW_TemuGoodsFee.aspx +++ /dev/null @@ -1,693 +0,0 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_TemuGoodsFee.aspx.cs" Inherits="TradeManageNew.Huowu.HW_TemuGoodsFee" %> - - - - - - - 货物信息 - - - - - - - - - - - - - - - - - - - - - - - - -
- 货物SKU
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 最长出单周期: - - 天 - -
- 前期定价: - - $ - - 稳定定价: - - $ -
- 第一名销量: - - - - 定价: - - $ -
- 目标销量: - - - - 定价: - - $ -
- 重推店铺: - -
-
- 计划: - - - -
- 要求: - - - -
- 备注: - - - -
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- SKU: - - - - - - 分组/人员: - - - - -
- 未出单天数: - - -   - -   -  
-
-
-
- - - - - - - - - - diff --git a/TradeManageNew/Huowu/TemuOrderGoodsFee.aspx b/TradeManageNew/Huowu/TemuOrderGoodsFee.aspx new file mode 100644 index 0000000..d66484b --- /dev/null +++ b/TradeManageNew/Huowu/TemuOrderGoodsFee.aspx @@ -0,0 +1,292 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TemuOrderGoodsFee.aspx.cs" Inherits="TradeManageNew.Huowu.TemuOrderGoodsFee" %> + + + + + + + + 货物信息 + + + + + + + + + + + + + + + + + + + + + + + + +
+ Temu订单分析
+ + + + + + + + + + + + + + + + + + + +
+ SKU: + + +
+ 总数量: 已售数量: 剩余数量: 总利润: +
+
+
+
+ + + + + + + + + + diff --git a/TradeManageNew/Huowu/HW_TemuGoodsFee.aspx.cs b/TradeManageNew/Huowu/TemuOrderGoodsFee.aspx.cs similarity index 80% rename from TradeManageNew/Huowu/HW_TemuGoodsFee.aspx.cs rename to TradeManageNew/Huowu/TemuOrderGoodsFee.aspx.cs index bffe79a..777bbab 100644 --- a/TradeManageNew/Huowu/HW_TemuGoodsFee.aspx.cs +++ b/TradeManageNew/Huowu/TemuOrderGoodsFee.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace TradeManageNew.Huowu { - public partial class HW_TemuGoodsFee : System.Web.UI.Page + public partial class TemuOrderGoodsFee : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { diff --git a/TradeManageNew/Huowu/HW_TemuGoodsFee.aspx.designer.cs b/TradeManageNew/Huowu/TemuOrderGoodsFee.aspx.designer.cs similarity index 90% rename from TradeManageNew/Huowu/HW_TemuGoodsFee.aspx.designer.cs rename to TradeManageNew/Huowu/TemuOrderGoodsFee.aspx.designer.cs index 0bd02a0..d35a105 100644 --- a/TradeManageNew/Huowu/HW_TemuGoodsFee.aspx.designer.cs +++ b/TradeManageNew/Huowu/TemuOrderGoodsFee.aspx.designer.cs @@ -11,7 +11,7 @@ namespace TradeManageNew.Huowu { - public partial class HW_TemuGoodsFee + public partial class TemuOrderGoodsFee { } } diff --git a/TradeManageNew/SysManageServiceNew.asmx.cs b/TradeManageNew/SysManageServiceNew.asmx.cs index 179c880..0b50c33 100644 --- a/TradeManageNew/SysManageServiceNew.asmx.cs +++ b/TradeManageNew/SysManageServiceNew.asmx.cs @@ -3326,7 +3326,7 @@ left join ( select sid, CONVERT(decimal(12,2), SUM(t.cost)) as Rate3,CONVERT(dec select GoodRate,ODR,DSRService,DSRGoods,DSRPost,USDUseMoney,USDNoMoney,RMBUseMoney, RMBNoMoney,Rate1,Rate2,Rate3,Rate4,PropertyViolate,Rate5,Rate6,Rate7,FeeDate,TXFee TXFee,ShopId from JC_ShopData where DATEDIFF(day,indate,'" + InDate.Value.ToString("yyyy-MM-dd") + @"')=0 )c on a.ShopId=c.ShopId - inner Join #ls2 e on a.ShopId=e.ShopId + left Join #ls2 e on a.ShopId=e.ShopId left join [192.168.1.187].[UpGoods].dbo.LxERP_Amazon_Shop o on d.ShopName=o.name left join ( select sid, CONVERT(decimal(12,2), SUM(t.cost)) as Rate3,CONVERT(decimal(12,2), SUM(t.sales)) as ad_sales , case when CONVERT(decimal(12,2), SUM(t.sales))<=0 then '∞' else CONVERT(nvarchar(20), convert(decimal(12,2), (CONVERT(decimal(12,2), SUM(t.cost))/CONVERT(decimal(12,2), SUM(t.sales)))*100)) end DSRPost from( select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SPAdGroupReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SBCampaignReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost,SUM(ISNULL(sales,0))sales from [192.168.1.187].[UpGoods].dbo.LxERP_SDAdGroupReports where CONVERT(date,report_date)='" + InDate.Value.AddDays(-2).Date.ToString("yyyy-MM-dd") + "' group by sid) t group by sid ) f on f.sid=o.sid" + " \r\n left join (select sid, CONVERT(decimal(12,2), SUM(t.cost)) as Rate6 from( select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SPAdGroupReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SBCampaignReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid union all select sid, SUM( ISNULL(cost,0)) as cost from [192.168.1.187].[UpGoods].dbo.LxERP_SDAdGroupReports where CONVERT(date,report_date)<='" + InDate.Value.AddDays(-2).ToString("yyyy-MM-dd") + "' and CONVERT(date,report_date)>='" + InDate.Value.AddDays(-31).ToString("yyyy-MM-dd") + "' group by sid) t group by sid) g on o.sid=g.sid " + diff --git a/TradeManageNew/TradeManageNew.csproj b/TradeManageNew/TradeManageNew.csproj index c57f3d4..d2f9fe4 100644 --- a/TradeManageNew/TradeManageNew.csproj +++ b/TradeManageNew/TradeManageNew.csproj @@ -1415,7 +1415,6 @@ - @@ -1426,6 +1425,7 @@ + @@ -2790,13 +2790,6 @@ HW_GoodsDetailList_EN.aspx - - HW_TemuGoodsFee.aspx - ASPXCodeBehind - - - HW_TemuGoodsFee.aspx - HW_GoodsInfoForTM2_EN.aspx ASPXCodeBehind @@ -2867,6 +2860,13 @@ HW_production.aspx + + TemuOrderGoodsFee.aspx + ASPXCodeBehind + + + TemuOrderGoodsFee.aspx + TemuShopGoodPrice.aspx ASPXCodeBehind diff --git a/TradeManageNew/bin/TradeManageNew.dll b/TradeManageNew/bin/TradeManageNew.dll index 94db7c3..26ac797 100644 Binary files a/TradeManageNew/bin/TradeManageNew.dll and b/TradeManageNew/bin/TradeManageNew.dll differ diff --git a/TradeManageNew/bin/TradeManageNew.pdb b/TradeManageNew/bin/TradeManageNew.pdb index 8ccfe51..4e503ef 100644 Binary files a/TradeManageNew/bin/TradeManageNew.pdb and b/TradeManageNew/bin/TradeManageNew.pdb differ diff --git a/TradeManageNew/obj/Debug/TradeManageNew.dll b/TradeManageNew/obj/Debug/TradeManageNew.dll index 94db7c3..26ac797 100644 Binary files a/TradeManageNew/obj/Debug/TradeManageNew.dll and b/TradeManageNew/obj/Debug/TradeManageNew.dll differ diff --git a/TradeManageNew/obj/Debug/TradeManageNew.pdb b/TradeManageNew/obj/Debug/TradeManageNew.pdb index 8ccfe51..4e503ef 100644 Binary files a/TradeManageNew/obj/Debug/TradeManageNew.pdb and b/TradeManageNew/obj/Debug/TradeManageNew.pdb differ