亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 生成某一時期,各個代理商的領(lǐng)貨,退貨銷售的總表.sql

?? 手機進銷存系統(tǒng)Delphi源碼,管理手機的進貨還有銷售方面的功能
?? SQL
字號:
/******************************************
功能:生成某一時期,所有的代理商的領(lǐng)貨,退貨銷售的總表
說明:@fgt參數(shù)利用模糊查找模式,
	1。當@fGT的值為空串時,
		就執(zhí)行查找所有的代理商資料
	2。當@fgt值不為空是,就直接查找相匹配的代理商資料
	3.沒有用到匹配安符,
     @flx類型,查找三種的類型,LH領(lǐng)貨,LX銷售,TH退貨,WX未退 ALL(所有類型)(存貨) 
     @sear  查詢的報表類型1.總表,2。分類型,3。詳細報表		
*********************************************/
declare @temp char(20)
declare @out  char(8000)
declare @Fdate datetime
declare @fedate datetime
declare @fgt   char(4)
declare @lx   char(3)
declare @sjxh  char(5)
declare @sear  int
declare @cross table
(
fname char(20),
fval  char(20)
)


if exists (select * from sysobjects where name='tmp')
drop  table tmp
if exists (select * from sysobjects where name='tmp2')
drop  table tmp2
if exists (select * from sysobjects where name='tmp3')
drop  table tmp3

create  table tmp
(
fna char(20),
fname char(20),
fcount int
)

create  table tmp2
(
fid char(2),
fna char(20),
fname char(20),
fcount int
)
create  table tmp3
(
fid char(2),
fna char(20),
fname char(20),
fdate datetime,
fcolor char(20),
fjbpz char(20),
fno   char(16)
)

set @fdate='2001-01-01'
set @fedate='2005-01-01'
set @fgt=''
SET @LX='ALL'
SET @SEAR=3
set @sjxh='ALL'



if  @fgt=''
	set @fgt='%GT%'
if @sjxh='ALL'
	SET @sjxh='%XH%'




--select * from tgt
--領(lǐng)貨
				if (@LX='LH') OR (@LX='ALL')
					BEGIN
						set @temp='LH'--領(lǐng)貨(定領(lǐng)貨時間)
						insert tmp
						select @temp,fgt,count(*) from tgtlh
						where tgtlh.fdate>=@fdate and tgtlh.fdate<=@fedate and  tgtlh.fgt like @fgt
						group by fgt
					END
				if (@LX='TH') OR (@LX='ALL')
					BEGIN
						set @temp='TH'--退貨(定退貨時間)
						insert tmp
						select @temp,tgtlh.fgt,count(*) from tgtth,tgtlh
						where tgtth.fgl=tgtlh.fid and tgtth.fdate>=@fdate and tgtth.fdate<=@fedate and  tgtlh.fgt like @fgt
						group by tgtlh.fgt
					END
				if (@LX='LX') OR (@LX='ALL')
					BEGIN
						set @temp='LX'--(定銷售時間)
						insert tmp
						select @temp,tgtlh.fgt,count(*) from thxc,tgtlh
						where tgtlh.fhrxx=thxc.fcode and tgtlh.fid not in(select fgl from tgtth ) and thxc.fdate>=@fdate and thxc.fdate<=@fedate and  tgtlh.fgt like @fgt
						group by tgtlh.fgt
						END

				if (@LX='WX') OR (@LX='ALL')
					BEGIN


						set @temp='WX'--(定領(lǐng)貨時間)
						insert tmp
						select @temp,tgtlh.fgt,count(*) from tgtlh
						where tgtlh.fhrxx not in(select fcode from thxc) and tgtlh.fid not in(select fgl from tgtth ) and tgtlh.fdate>=@fdate and tgtlh.fdate<=@fedate and  tgtlh.fgt like @fgt
						group by tgtlh.fgt
					END
			IF @SEAR=1
			select b.fna as fgtname,
						(
						case a.fna
							when 'LH' then '領(lǐng)貨'
							when 'TH' then '退貨'
							when 'LX' then '銷售'
							when 'WX' then '庫存'
						end
						) as flx,a.fcount
			from tmp a,tgt b
			where b.fid=ltrim(rtrim(a.fname)) 
			order by b.fid,a.fna 
				--exec  pCrossTable  tmp,'fname','fcount','sum','fna',''
--分類型報表
if @sear=2 or @sear=3
BEGIN

				if (@lx='LH') OR (@LX='ALL')
					BEGIN
						insert tmp2
						--領(lǐng)貨(設(shè)定領(lǐng)貨的時間)
						select 'LH', thrc.fsjxh,tgtlh.fgt,count(*)  as fcount from tgtlh,thrxx,thrc
						where tgtlh.fhrxx=thrxx.fid and thrc.fid=thrxx.fhrcid and  tgtlh.fdate>=@fdate and tgtlh.fdate<=@fedate and  tgtlh.fgt like @fgt AND  thrc.fsjxh like LTRIM(RTRIM(@SJXH))
						group by tgtlh.fgt,thrc.fsjxh
						order by tgtlh.fgt
					END
					--exec  pCrossTable  tmp,'fname','fcount','sum','fna',''
					--select * from tmp2
				if (@lx='LX') OR (@LX='ALL')
					BEGIN
						--銷售(設(shè)定銷售時間表)
						insert tmp2
						select 'LX', thrc.fsjxh,tgtlh.fgt,count(*) as fcount from thrc,thrxx,thxc,tgtlh
						where tgtlh.fhrxx=thrxx.fid and thrc.fid=thrxx.fhrcid and thxc.fcode=thrxx.fid and tgtlh.fid not in(select fgl from tgtth) and thxc.fdate>=@fdate and thxc.fdate<=@fedate and  tgtlh.fgt like @fgt AND  thrc.fsjxh like LTRIM(RTRIM(@SJXH))
						group by tgtlh.fgt,thrc.fsjxh
						order by tgtlh.fgt
					END
				if (@lx='TH') OR (@LX='ALL')
					BEGIN
		
						--退貨(設(shè)定退貨時間)
						insert tmp2
						select 'TH', thrc.fsjxh,tgtlh.fgt,count(*)  as fcount from tgtlh,thrxx,thrc,tgtth
						where tgtlh.fhrxx=thrxx.fid and thrc.fid=thrxx.fhrcid and tgtlh.fid =tgtth.fgl and tgtth.fdate>=@fdate and tgtth.fdate<=@fedate and  tgtlh.fgt like @fgt
						group by tgtlh.fgt,thrc.fsjxh
						order by tgtlh.fgt 
					END
				if (@lx='WX') OR (@LX='ALL')
					BEGIN


						--庫存(設(shè)定領(lǐng)貨時間)
						insert tmp2
						select 'WX', thrc.fsjxh,tgtlh.fgt,count(*) as fcount from thrc,thrxx,tgtlh
						where  tgtlh.fhrxx not in(select fcode from thxc)   and   tgtlh.fhrxx=thrxx.fid and thrc.fid=thrxx.fhrcid and  tgtlh.fid not in(select fgl from tgtth) and tgtlh.fdate>=@fdate and tgtlh.fdate<=@fedate and  tgtlh.fgt like @fgt AND  thrc.fsjxh like LTRIM(RTRIM(@SJXH))
						group by tgtlh.fgt,thrc.fsjxh
						order by tgtlh.fgt
					 END
				--select * from tmp2
			IF @SEAR=2
			select tgt.fna, 
					(
					case tmp.fna
						when 'LH' then '領(lǐng)貨'
						when 'TH' then '退貨'
						when 'LX' then '銷售'
						when 'WX' then '庫存'
					end
					) as flx,tmp.fcount as ffcount,TSJCS.FNA AS FSJCS,TSJXH.FMODEL AS FSJXH,tmp2.fcount as fsjxhcount 
			from tmp2,tmp,tgt,TSJXH,TSJCS
			where tmp2.fid=tmp.fna and tmp.fname=tmp2.fname and tgt.fid=ltrim(rtrim(tmp.fname)) and TSJXH.FID=tmp2.fna AND TSJCS.FID=TSJXH.FSJCS  
			order by tgt.fna,tmp.fna,TSJCS.FID,TSJXH.FID

--所有的詳細報表
	IF @SEAR=3
		BEGIN
				if (@lx='LH') OR (@LX='ALL')
					BEGIN
						insert tmp3
						--領(lǐng)貨(設(shè)定領(lǐng)貨的時間)
						select 'LH', thrc.fsjxh,tgtlh.fgt,tgtlh.fdate,tcolor.fid,tjbpz.fid,thrxx.fno from tgtlh,thrxx,thrc,tcolor,tjbpz
						where tgtlh.fhrxx=thrxx.fid and thrc.fid=thrxx.fhrcid and thrxx.fcolor=tcolor.fid and tjbpz.fid=thrc.fjbpz and  tgtlh.fdate>=@fdate and tgtlh.fdate<=@fedate and  tgtlh.fgt like @fgt AND  thrc.fsjxh like LTRIM(RTRIM(@SJXH))
						order by tgtlh.fgt
					END
				if (@lx='LX') OR (@LX='ALL')
					BEGIN
						--銷售(設(shè)定銷售時間表)
						insert tmp3
						select 'LX', thrc.fsjxh,tgtlh.fgt,thxc.fdate,tcolor.fid,tjbpz.fid ,thrxx.fno from thrc,thrxx,thxc,tgtlh,tcolor,tjbpz
						where tgtlh.fhrxx=thrxx.fid and thrc.fid=thrxx.fhrcid and thxc.fcode=thrxx.fid and tgtlh.fid not in(select fgl from tgtth) and  thrxx.fcolor=tcolor.fid and tjbpz.fid=thrc.fjbpz and  thxc.fdate>=@fdate and thxc.fdate<=@fedate and  tgtlh.fgt like @fgt AND   thrc.fsjxh like LTRIM(RTRIM(@SJXH))
						order by tgtlh.fgt
					END

				if (@lx='TH') OR (@LX='ALL')
					BEGIN


						--退貨(設(shè)定退貨時間)
						insert tmp3
						select 'TH', thrc.fsjxh,tgtlh.fgt,tgtth.fdate,tcolor.fid,tjbpz.fid,thrxx.fno from tgtlh,thrxx,thrc,tgtth,tcolor,tjbpz
						where tgtlh.fhrxx=thrxx.fid and thrc.fid=thrxx.fhrcid and tgtlh.fid =tgtth.fgl and  thrxx.fcolor=tcolor.fid and tjbpz.fid=thrc.fjbpz and tgtth.fdate>=@fdate and tgtth.fdate<=@fedate and  tgtlh.fgt like @fgt
						order by tgtlh.fgt 
				--select * from tmp3
					END

				if (@lx='WX') OR (@LX='ALL')
					BEGIN
						--庫存(設(shè)定領(lǐng)貨時間)
						insert tmp3
						select 'WX', thrc.fsjxh,tgtlh.fgt,tgtlh.fdate,tcolor.fid,tjbpz.fid ,thrxx.fno from thrc,thrxx,tgtlh,tcolor,tjbpz
						where    tgtlh.fhrxx not in(select fcode from thxc) and tgtlh.fhrxx=thrxx.fid and thrc.fid=thrxx.fhrcid  and tgtlh.fid not in(select fgl from tgtth) and  thrxx.fcolor=tcolor.fid and tjbpz.fid=thrc.fjbpz and  tgtlh.fdate>=@fdate and tgtlh.fdate<=@fedate and  tgtlh.fgt like @fgt AND  thrc.fsjxh like LTRIM(RTRIM(@SJXH))
						order by tgtlh.fgt
					END
			IF @SEAR=3
			   select tgt.fna, 
					(
					case tmp.fna
						when 'LH' then '領(lǐng)貨'
						when 'TH' then '退貨'
						when 'LX' then '銷售'
						when 'WX' then '庫存'
					end
					) as flx,tmp.fcount as ffcount,TSJCS.FNA AS FSJCS,TSJXH.FMODEL AS FSJXH,tmp2.fcount as fsjxhcount,tcolor.fcolor as fcolor,tjbpz.fname as fjbpz,tmp3.fno,tmp3.fdate 
			   from tmp2,tmp,tgt,tcolor,tjbpz,tmp3,TSJCS,TSJXH
			   where tmp2.fid=tmp.fna and tmp.fname=tmp2.fname and tgt.fid=ltrim(rtrim(tmp.fname)) and TSJXH.fid=tmp2.fna and tcolor.fid= tmp3.fcolor and tjbpz.fid=tmp3.fjbpz and tmp3.fid=tmp2.fid and tmp3.fname=tmp.fname and tmp3.fna=tmp2.fna  AND TSJCS.FID=TSJXH.FSJCS 
			   order by tgt.fna,tmp.fna,TSJCS.FID,TSJXH.FID
			
		END
END
/*
if exists (select * from sysobjects where name='tmp')
drop  table tmp
if exists (select * from sysobjects where name='tmp2')
drop  table tmp2
*/


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色电影在线| 国产成人无遮挡在线视频| 色猫猫国产区一区二在线视频| 国产亚洲欧洲997久久综合| 国产乱人伦偷精品视频免下载 | 成人app软件下载大全免费| 国产人伦精品一区二区| 成人做爰69片免费看网站| 中文欧美字幕免费| 色综合天天综合网天天狠天天| 亚洲天堂福利av| 欧美美女视频在线观看| 久久国产精品色婷婷| 久久久美女毛片| 成人av小说网| 亚洲国产成人va在线观看天堂| 日韩午夜激情av| 粉嫩13p一区二区三区| 日韩毛片一二三区| 欧美日本在线播放| 国内精品在线播放| 亚洲女与黑人做爰| 91精品国产日韩91久久久久久| 国产在线精品一区二区| 18成人在线视频| 3d动漫精品啪啪一区二区竹菊| 免费看欧美女人艹b| 国产欧美日韩另类一区| 欧美亚洲动漫精品| 狠狠色丁香久久婷婷综合_中| 亚洲日本在线看| 欧美一区永久视频免费观看| 成人国产电影网| 日韩avvvv在线播放| 中文字幕欧美日韩一区| 欧美日韩综合一区| 风间由美一区二区三区在线观看| 一区二区三区中文字幕在线观看| 精品久久久久久久久久久久久久久 | 日韩美女精品在线| 日韩欧美你懂的| 91视频.com| 国内不卡的二区三区中文字幕| 亚洲欧洲一区二区在线播放| 精品国产伦理网| 欧美亚洲动漫制服丝袜| 成人一区在线观看| 青青草国产精品亚洲专区无| 亚洲视频在线观看三级| 久久久久久久综合日本| 在线电影国产精品| 91香蕉国产在线观看软件| 激情文学综合网| 日本免费新一区视频| 亚洲美女屁股眼交| 欧美激情在线一区二区三区| 日韩免费一区二区| 欧美日韩高清一区二区三区| 91麻豆免费在线观看| 成人免费视频caoporn| 精品中文av资源站在线观看| 日欧美一区二区| 午夜精品在线视频一区| 一区二区三区欧美在线观看| 亚洲欧洲精品一区二区三区| 久久综合五月天婷婷伊人| 69堂成人精品免费视频| 欧美日韩一区三区| 色视频欧美一区二区三区| 国产a区久久久| 国产激情视频一区二区在线观看 | 精品国产乱子伦一区| 日韩午夜电影av| 日韩一区二区三区电影在线观看| 欧美色精品天天在线观看视频| 色8久久人人97超碰香蕉987| 成人动漫一区二区在线| www.欧美亚洲| 一本色道久久综合亚洲aⅴ蜜桃| 成人免费看片app下载| 国产成人精品www牛牛影视| 国产丶欧美丶日本不卡视频| 高清在线不卡av| 成人国产电影网| 91亚洲男人天堂| 欧美制服丝袜第一页| 欧美精品九九99久久| 日韩一区二区在线播放| 欧美一区二区在线播放| 欧美一区二区视频在线观看2020| 欧美一区二区三区电影| 精品久久免费看| 国产精品欧美一区二区三区| 综合在线观看色| 亚洲午夜免费视频| 人人精品人人爱| 黄网站免费久久| 成人免费视频一区二区| 色哟哟在线观看一区二区三区| 欧美日韩在线综合| 日韩三区在线观看| 久久久久国产免费免费| 亚洲丝袜精品丝袜在线| 亚洲一区在线观看网站| 麻豆91精品91久久久的内涵| 国产在线精品一区在线观看麻豆| 成人激情视频网站| 色婷婷综合久色| 欧美精品在线一区二区| 久久天天做天天爱综合色| 亚洲欧洲制服丝袜| 男男视频亚洲欧美| 国产99久久久国产精品潘金| 色www精品视频在线观看| 欧美一级理论性理论a| 国产精品素人视频| 亚洲国产va精品久久久不卡综合| 蜜臀av性久久久久蜜臀aⅴ| 国产精品亚洲视频| 欧洲精品一区二区| 精品蜜桃在线看| 亚洲精品高清在线观看| 久久99精品国产麻豆婷婷| 色婷婷国产精品| 2017欧美狠狠色| 午夜欧美视频在线观看| 成人免费视频视频在线观看免费 | 91久久精品一区二区二区| 91精品国产一区二区| 国产精品美女www爽爽爽| 99re这里只有精品6| 欧美日韩国产三级| 国产欧美日韩综合| 欧美人妖巨大在线| 欧美v日韩v国产v| 亚洲制服欧美中文字幕中文字幕| 精品中文字幕一区二区小辣椒| 91福利视频在线| 中文成人av在线| 日韩欧美一级二级三级| 久久99精品久久久久婷婷| 亚洲高清不卡在线观看| 亚洲女同一区二区| 亚洲国产激情av| 中文字幕av一区二区三区| 久久久久久久免费视频了| 精品国产免费一区二区三区香蕉| 欧美日韩国产乱码电影| 91久久人澡人人添人人爽欧美 | 亚洲一区二区三区四区中文字幕| 欧美国产日韩在线观看| 中日韩av电影| 成人免费在线视频观看| 中文字幕欧美一| 亚洲精品日产精品乱码不卡| 国产精品国产a级| ㊣最新国产の精品bt伙计久久| 中文字幕视频一区二区三区久| 亚洲国产精品黑人久久久| 国产精品久久精品日日| 国产精品视频九色porn| 国产精品青草综合久久久久99| 国产精品三级视频| 中文字幕一区二区视频| 亚洲欧美日韩精品久久久久| 亚洲精品成a人| 亚洲一区二区三区中文字幕在线 | 免费成人在线网站| 精品一区二区三区欧美| 国产成a人亚洲| 色综合天天做天天爱| 欧美日韩高清一区二区三区| 欧美一区二区三区性视频| 精品久久人人做人人爽| 国产精品色哟哟| 亚洲成a天堂v人片| 激情综合色播激情啊| 99久久99久久精品免费观看| 色悠悠久久综合| 日韩亚洲欧美成人一区| 国产亚洲短视频| 一区二区三区四区在线| 日本美女一区二区三区| 国产超碰在线一区| 91久久精品一区二区| 欧美videossexotv100| 亚洲欧洲成人精品av97| 日本欧美在线看| 风间由美性色一区二区三区| 欧洲精品在线观看| 久久久亚洲综合| 亚洲午夜久久久| 成人亚洲精品久久久久软件| 欧美午夜精品久久久久久孕妇| 久久先锋影音av鲁色资源| 亚洲男人的天堂在线aⅴ视频| 美女视频一区在线观看| 97精品国产97久久久久久久久久久久 | 国产大陆亚洲精品国产| 欧美色爱综合网|