use OPETMIS
go
EXECUTE sp_configure 'allow updates', 1
declare @res int
select @res = charindex('SQL Server/11', @@version)
if @res = 0
begin
print ' RECONFIGURE'
RECONFIGURE WITH OVERRIDE
end
go
print 'procgetmaxid'
/*
** dbo.procgetmaxid **********/
SETUSER 'dbo'
go
create procedure procgetmaxid
@tablename varchar(60),
@maxid int output
as
begin
/*取任意表的最大单据号,@tablebname为表名,@maxid为返回的最大ID号*/
begin tran
select @maxid=fmaxid from tbes_billno where ftablename=@tablename
if @maxid=null
begin
select @maxid=fmaxid from tbes_billno where ftablename='tbes_billno'
if @maxid=null
begin
if @tablename<>'tbes_billno'
begin
insert into tbes_billno(fid,ftablename,fmaxid) values(1 ,'tbes_billno',2)
select @maxid=1
end
end
else
begin
update tbes_billno set fmaxid=fmaxid+1 where ftablename='tbes_billno'
insert into tbes_billno(fid,ftablename,fmaxid) values(@maxid ,@tablename,2)
end
select @maxid=1
end
else
update tbes_billno set fmaxid=fmaxid+1 where ftablename=@tablename
if @@error <>0
begin
rollback tran
commit tran
raiserror 900001 '取最大ID号失败'
return -1
end
else
begin
commit tran
end
end
go
SETUSER
go
UPDATE sysobjects SET userstat = 0 where id = object_id('dbo.procgetmaxid')
go
print 'procgetmaxid1'
/*
** dbo.procgetmaxid1 **********/
SETUSER 'dbo'
go
create procedure procgetmaxid1
@tablename char(60),
@maxid int output
as
begin
select @maxid=1
end
go
SETUSER
go
UPDATE sysobjects SET userstat = 0 where id = object_id('dbo.procgetmaxid1')
go
print 'sp_addstreamtrend'
/*
** dbo.sp_addstreamtrend **********/
SETUSER 'dbo'
go
create procedure sp_addstreamtrend
(@pitemid int,
@ptime datetime,
@pcheckerid int,
@pcheckposid int,
@pchecknum int )
as
/*@pitemid int, 服务项目ID
@ptime datetime, 时间
@pcheckerid int, 检票人ID
@pcheckposid int, 检票机 ID
@pchecktype int 检票类型 1入检 -1出检*/
declare @tchecktype int
declare @ttrendid int
declare @tstreamid int
declare @tdate datetime
declare @tinsum int
declare @toutsum int
begin tran
select @tdate=convert(datetime, convert(char(10),@ptime,112),2)
select @tstreamid=fstreamid,@tinsum=finsum,@toutsum=foutsum from tber_gueststream
where fitemid=@pitemid and fcheckerid=@pcheckerid and fcheckposid=@pcheckposid and fdate=@tdate
if @@rowcount=0
begin
exec procgetmaxid 'tber_gueststream',@tstreamid output
if @pchecknum<0
begin
select @toutsum=-@pchecknum,@tinsum=0
select @tchecktype=-1
end
else
begin
select @tinsum=@pchecknum,@toutsum=0
select @tchecktype=1
end
insert into tber_gueststream(fstreamid,fitemid,fcheckerid,fcheckposid,fdate,finsum,foutsum)
values(@tstreamid,@pitemid,@pcheckerid,@pcheckposid,@tdate,@tinsum,@toutsum)
end
else
begin
if @pchecknum<0
select @toutsum=@toutsum-@pchecknum
else
select @tinsum=@tinsum+@pchecknum
update tber_gueststream set finsum=@tinsum,foutsum=@toutsum where fstreamid=@tstreamid
end
exec procgetmaxid 'tber_streamtrend',@ttrendid output
insert into tber_streamtrend(ftrendid,fitemid,fcheckerid,fcheckposid,ftime,finsum,foutsum,fonline,fchecktype)
values(@ttrendid,@pitemid,@pcheckerid,@pcheckposid,@ptime,@tinsum,@toutsum,@tinsum-@toutsum,@tchecktype)
if @@error<>0
begin
rollback
return(9)
end
else
commit
go
SETUSER
go
UPDATE sysobjects SET userstat = 0 where id = object_id('dbo.sp_addstreamtrend')
go
print 'sp_addtable'
/*
** dbo.sp_addtable **********/
SETUSER 'dbo'
go
create procedure sp_addtable
@poldtablename char(20),
@pnewtablename char(20),
@pnewtableno char(20)
as
begin
/*declare @poldtablename char(20)
declare @pnewtablename char(20)
declare @pnewtableno char(20)
select @poldtablename='tber_ticketsell'
select @pnewtablename='tbeh_ticketsell'
select @pnewtableno='1202'*/
select * into #temp1 from sysz_table_fieldnote where ftablename=@poldtablename
update #temp1 set ftablename=@pnewtablename,ftable=@pnewtableno
insert into sysz_table_fieldnote(fcode,fname,fnote,fmemo,ftable,ftype,flinktable,flength,flinkfield,fnull,flocalfield,fedit,
fvisible,fexit,fsave,ftag,fviewlength,ftermfield,ftermvalue,ftablename,flinkkeyfield,fdefault,fprintlength)
select fcode,fname,fnote,fmemo,ftable,ftype,flinktable,flength,flinkfield,fnull,flocalfield,fedit,
fvisible,fexit,fsave,ftag,fviewlength,ftermfield,ftermvalue,ftablename,flinkkeyfield,fdefault,fprintlength from #temp1
drop table #temp1
end
go
SETUSER
go
UPDATE sysobjects SET userstat = 0 where id = object_id('dbo.sp_addtable')
go
print 'sp_addticketsell'
/*
** dbo.sp_addticketsell **********/
SETUSER 'dbo'
go
create procedure sp_addticketsell
@pticketid int
as
/*重处理全部销售*/
declare @ttickettypeid int /*票种*/
declare @tdate datetime /*日期*/
declare @tsaleposid int /*POS*/
declare @tsalerid int /*售票员*/
declare @tamount int /*数量*/
declare @tsumagio money /*优惠*/
declare @tmoney money /*金额*/
declare @tcommid int /*群体*/
declare @tclientid int /*客户*/
declare @tpaywayid int /*支付方式*/
select @ttickettypeid=b.ftickettypeid,@tdate=isnull(a.fdate,getdate()),@tsaleposid=a.fsaleposid,@tsalerid=a.foperator
,@tamount=b.famount,@tsumagio=fprice*famount-b.fsale,@tmoney=b.fsale,@tcommid=b.fcommtypeid,@tclientid=a.fclientid,@tpaywayid=a.fpaywayid
from tbeu_ticketbill a,tbeu_ticket b where b.fticketbillid=a.fticketbillid and b.fticketid=@pticketid
declare @tticketsaleid int
select @tdate=convert(datetime, convert(char(10),@tdate,112),2)
begin tran
select @tticketsaleid=fticketsaleid from tber_ticketsell
where ftickettypeid=@ttickettypeid
and fdate=@tdate
and fsaleposid=@tsaleposid
and fsalerid=@tsalerid
and fcommtypeid=@tcommid
and fclientid=@tclientid
/* and fpaywayid=@tpaywayid */
if @@rowcount=0
begin
exec procgetmaxid 'tber_ticketsell',@tticketsaleid output
insert into tber_ticketsell(fticketsaleid,ftickettypeid,fdate,fsaleposid,fsalerid,famount,fsumagio,fmoney,fcommtypeid,fclientid,fpaywayid)
values(@tticketsaleid,@ttickettypeid,@tdate,@tsaleposid,@tsalerid,@tamount,@tsumagio,@tmoney,@tcommid,@tclientid,@tpaywayid)
end
else
begin
update tber_ticketsell set famount=famount+@tamount,fsumagio=fsumagio+@tsumagio,fmoney=fmoney+@tmoney
where fticketsaleid=@tticketsaleid
end
if @tpaywayid=1
begin
update tber_ticketsell set fpayway1=isnull(fpayway1,0)+@tmoney
where fticketsaleid=@ttick
没有合适的资源?快使用搜索试试~ 我知道了~
delphi 5.0 +SQL server
共288个文件
pas:87个
dfm:81个
sql:63个
需积分: 0 1 下载量 183 浏览量
2023-05-08
21:03:53
上传
评论 1
收藏 497KB ZIP 举报
温馨提示
电子票务系统,特别是报表处理模块,票据打印处理模块,component 目录为控件要加载,roots为基础窗口类。print.为打印模块。
资源推荐
资源详情
资源评论
收起资源包目录
delphi 5.0 +SQL server (288个子文件)
sp_bcp.bat 11KB
wancan.bat 102B
wucan.bat 100B
loglosttk.bat 90B
daydump.bat 86B
dayend.bat 84B
CC.BAT 82B
aa.bat 77B
Project1.cfg 1KB
cta01596 27B
Global.dcu 11KB
printdlg.dcu 9KB
frmpreview.dcu 7KB
RPTROOT.dcu 7KB
ROOTFORM.dcu 4KB
temp.dfm 90KB
qrpdatesellnew.dfm 62KB
qrpaccount1.dfm 61KB
qrpDatepaper.dfm 60KB
qrpDateTick.dfm 60KB
qrpdatesellSummarynew.dfm 49KB
qrpSummarysell.dfm 48KB
qrpdatesell.dfm 45KB
qrpdailysummaryNew.dfm 43KB
qrpdailysummary.dfm 41KB
qrpdatesellSummary.dfm 41KB
qrpdatesellthird.dfm 40KB
qrp_deptsell.dfm 40KB
qrpdeptsell.dfm 36KB
qrpaccount2.dfm 34KB
qrpvipbase.dfm 21KB
frmhistoryqry.dfm 20KB
frmaccount.dfm 19KB
frmpreview.dfm 18KB
frmpreview.dfm 18KB
qrpviplist.dfm 18KB
frmonlineSell.dfm 16KB
frmCancelCard.dfm 16KB
frmstreamtrend.dfm 15KB
frmpersoninfo.dfm 13KB
frmissuecardNew.dfm 11KB
frmissuecard.dfm 11KB
frmdailyTicket.dfm 11KB
frmdailyPaper.dfm 11KB
qrpaccount.dfm 11KB
Unit3.dfm 10KB
qrphistoryqry.dfm 10KB
frmtimesell.dfm 10KB
frmcurruseqry.dfm 10KB
frmdailysellnew.dfm 9KB
frmdailysellthird.dfm 9KB
frmsellQry.dfm 9KB
frmofflineqry.dfm 8KB
frmvipbaseinfo.dfm 8KB
frmdeptsell.dfm 8KB
frmdailysell.dfm 8KB
frmsummarysell.dfm 8KB
RPTROOT.dfm 8KB
RPTROOT.dfm 8KB
frmAbolishCard.dfm 8KB
frmRecoverCard.dfm 8KB
frmIssueNew.dfm 8KB
frmdailysummary.dfm 8KB
printdlg.dfm 7KB
frmdailysummaryNew.dfm 7KB
frmIssue.dfm 7KB
printdlg.dfm 7KB
frmNewCardBump.dfm 7KB
frmtrend.dfm 7KB
Unit1.dfm 7KB
frmcompare.dfm 7KB
frmclientqry.dfm 7KB
frmdecision.dfm 6KB
frmsellorder.dfm 6KB
frmStructureAnalysis.dfm 6KB
qrpstructureanalysis.dfm 6KB
frmNewcard.dfm 6KB
frm_sellorder.dfm 5KB
qrpaccountmaster.dfm 5KB
frmperiodsell.dfm 5KB
qrpoffdetail.dfm 4KB
frm_dailyselldisplay.dfm 4KB
qrpsellorder.dfm 4KB
QRPTEST.dfm 4KB
QRPTEST.dfm 4KB
QRPdecision.dfm 4KB
qrpcurruse.dfm 4KB
qrptrend.dfm 3KB
qrpvip.dfm 3KB
frmsalerQry.dfm 3KB
frmselview.dfm 2KB
frmselectview.dfm 2KB
frmseltickettype.dfm 2KB
frmmain.dfm 935B
ROOTFORM.dfm 483B
ROOTFORM.dfm 483B
Project1.dof 2KB
Project1.dpr 199B
dumpvip 3KB
ex_sp_ticketdailysell 3KB
共 288 条
- 1
- 2
- 3
资源评论
仇伟德howareyouこんにちは!
- 粉丝: 0
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功