shzoo

---1财务接收2财务发放3票务科发放4售票组长发放5售票点返库6售票组长返库7票务科返库 Select * from TrnInv_Details where FPDM='2012041701' ---1财务接收(1笔)IN,2财务发放(2笔记录)TOUT、TIN,3票务科发放(2笔记录)TOUT、TIN,4售票组长发放TOUT\TIN ; ---5售票员返库(2笔记录)ROUT、RIN,6售票组长返库 ROUT\RIN,7票务科返库 ROUT\RIN --发给谁TrnInv_Tb, person是接收人,LUSERID是操作人员 Select * from TrnInv_Tbl where TrnNo in (Select trnno from TrnInv_Details where FPDM='2012041701' ) order by LDateTime asc ---1财务接收(1笔)IN,2财务发放(2笔记录)TIN\TOUT,3票务科发放(2笔记录)TOUT、TIN,4售票组长发放TOUT\TIN;5销售员门票返库ROUT、RIN,6售票组长返库 ROUT\RIN ,7票务科返库 ROUT\RIN Select * from TrnInv_Movements where FPDM='2012041701' order by LDateTime asc ---1财务接收(财务科)2财务发放(票务科)3票务科发放4售票组长发放{不含数量}5售票员门票返库 {含数量} Select * from TrnInv_Balance where FPDM='2012041701' ---1财务接收(财务科)2财务发放(票务科)3票务科发放(004)4售票组长发放(销售点) 返:5售票员门票返库 {含数量} 6组长返库7票务库返库--售票时UPDATE SELECT * FROM TRNINV_SUBBALANCE where FPDM='2012041701' order by LDateTime asc ---(组长将门票发给了谁)发放给销售员时insert,售票时update ;虽然返库了,但这笔发放给售票员的记录还在 select * from TERMINALTICKETNO_TRN where FPDM='2012041701' select * from TerminalTicketNo_Detail where FPDM='2012041701' ORDER BY LDATETIME DESC --前台登录后,选择发票代码后Insert进来,售票时update ---票挂在哪个售票员名下: Select TSB.TRNINV_SUBID as ID,TB.TicketOwner as 票类型, TB.FPDM as 发票代码, TT.startno as 开始号码, TT.endno as 结束号码,(TT.LastUsedNo- TT.startno) as 剩余数量, TT.LastUsedNo as 最后使用号码 from TRNINV_BALANCE TB INNER JOIN TRNINV_SUBBALANCE TSB ON TB.LOCATION=TSB.LOCATION inner join TERMINALTICKETNO_TRN tt on tt.FPdM=TB.FPDM and tt.startno=tsb.fromfphm and tt.endNo=tsb.Tofphm where TT.LUserId = N'GET' and (TT.LastUsedNo- TT.startno)>0 and TSB.LastUsedNo<>0 and TB.LOCATION<>N'财务科' and TB.LOCATION<>N'票务科' and tsb.LOCATION=N'销售点' and tt.terminalid=N'销售点' AND TB.FPDM IN (SELECT FPDM from trninv_details TD LEFT OUTER JOIN TrnInvTicketCat_TBL TT ON TD.MPZL=TT.CatCode GROUP BY FPDM, MPZL, MPXL,CATCONTROL HAVING CATCONTROL IS NULL ) and (TT.LastUsedNo- TT.startno)>0 order by TB.FPDM desc --select * from TrnInvTicketCat_TBL --税务 --SHUIWU
posted @ 2012-04-17 23:21  brian_lee  阅读(383)  评论(0编辑  收藏  举报