丽晶erp店铺销售排行-区域销售排行查询脚本-测试版本3.1.44

(图1)

(图2)

运行测试版本3.1.44其他版本自行测试,自行结合此脚本实现其他功能

--渠道区域
SELECT 
b.[Sort],
sum(a.WholeSalePrice * d.[Quantity]) as jhj,
sum(d.[DiscountPrice] * d.[Quantity])-sum(a.WholeSalePrice * d.[Quantity]) as jhjml,
sum(a.DpPrice2 * d.[Quantity]) as pfj,
sum(d.[DiscountPrice] * d.[Quantity])-sum(a.DpPrice2 * d.[Quantity]) as pfjml,
sum(d.[Quantity]) AS sl,
sum(d.[DiscountPrice] * d.[Quantity]) as pay 
FROM [Goods] a,[Customer] b,[CheckL] c,[CheckLGoods] d
where 
a.Goods_no = d.Goods_No and b.[Customer_ID]=c.[Customer_ID] AND c.[CheckID]=d.[CheckID] AND 
CONVERT (varchar,c.[CheckDate],120) between '2022-05-08 00:00:00' and '2022-05-07 00:00:00'
GROUP by b.[Sort]
union select b.[Sort],0,0,0,0,0,0 from [Customer] b,[CheckL] c where b.Customer_ID=c.Customer_ID and
CONVERT (varchar,c.[CheckDate],120) between '2022-05-08 00:00:00' and '2022-05-07 00:00:00'
order by pay desc;


--店铺销售
select A.* 
from (SELECT [Customer].[Abbrev] as name,[CheckL].[Customer_ID] as qdbh,[Customer].[Sort],sum([Goods].WholeSalePrice * [CheckLGoods].[Quantity]) as jhj,
sum([CheckLGoods].[DiscountPrice] * [CheckLGoods].[Quantity])-sum([Goods].WholeSalePrice * [CheckLGoods].[Quantity]) as jhjml,
sum([Goods].DpPrice2 * [CheckLGoods].[Quantity]) as pfj,
sum([CheckLGoods].[DiscountPrice] * [CheckLGoods].[Quantity])-sum([Goods].DpPrice2 * [CheckLGoods].[Quantity]) as pfjml,
sum([CheckLGoods].[Quantity]) AS sl,
sum([CheckLGoods].[DiscountPrice] * [CheckLGoods].[Quantity]) as pay FROM [Goods],[Customer],[CheckL],[CheckLGoods] 
where [Goods].Goods_no = [CheckLGoods].Goods_No and [Customer].[Customer_ID]=[CheckL].[Customer_ID] AND [CheckL].[CheckID]=[CheckLGoods].[CheckID] AND 
CONVERT (varchar,[CheckL].[CheckDate],120) between '2022-04-28 00:00:00' and 
'2022-04-28 00:00:00' GROUP BY [CheckL].[Customer_ID],[Customer].[Sort],[Customer].[Abbrev] 
union 
select Customer_Na,Customer_ID,Sort,0,0,0,0,0,0 
from Customer 
where Sort!='虚拟店铺' and DealInPattern!='' and ShutOut=0 and 
Customer_ID not in(select Customer_ID from CheckL where CheckDate between '2022-04-28 00:00:00' and '2022-04-28 00:00:00') ) A 
ORDER BY A.pay DESC

--今日会员消费
SELECT sum([CheckLGoods].[DiscountPrice] * [CheckLGoods].[Quantity]) as zxfpay FROM [KMD].[dbo].[CheckL],[KMD].[dbo].[CheckLGoods] where [CheckL].[CheckID]=[CheckLGoods].[CheckID] and DateDiff(dd,CheckDate,getdate())<=0 AND VIP_Card is not null and VIP_Card!=''


1、本站目前拥有近 1000+ 精品收费资源,现在加入VIP会员即可全部下载。
2、本资源部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
SEA模板网 » 丽晶erp店铺销售排行-区域销售排行查询脚本-测试版本3.1.44

发表评论

加入本站VIP会员订阅计划,海量资源免费查看

目前为止共有 3654 位优秀的VIP会员加入! 立刻加入VIP会员