alter procedure Asset_sspExcuteTicket
(
@pi_Action varchar(200),
@pi_TicketMoney3 money,
@pi_CompanyNote varchar(50),
@pi_ContractCode varchar(50),
@pi_TicketType2 varchar(50),
@pi_TicketMoney money,
@pi_InfoId bigint,
@pi_TicketType3 varchar(50),
@pi_TicketMoney1 money,
@pi_TicketMoney4 money,
@pi_TicketType varchar(50),
@pi_TicketType4 varchar(50),
@pi_TicketType1 varchar(50),
@pi_TicketMoney2 money,
@pi_DateDuan1 smalldatetime,
@pi_DateDuan2 smalldatetime,
@pi_DateDuan3 smalldatetime,
@pi_DateDuan4 smalldatetime,
@pi_DateDuan5 smalldatetime,
@pi_DateDuan6 smalldatetime,
@pi_DateDuan7 smalldatetime,
@pi_DateDuan8 smalldatetime,
@pi_DateDuan9 smalldatetime,
@pi_DateDuan10 smalldatetime,
@po_Status int output,
@po_RetValue varchar(200) output
)
as
if @pi_Action='add'
begin
insert into Asset_Ticket
(
TicketMoney3,
CompanyNote,
ContractCode,
TicketType2,
TicketMoney,
TicketType3,
TicketMoney1,
TicketMoney4,
TicketType,
TicketType4,
TicketType1,
TicketMoney2,
DateDuan1,
DateDuan2,
DateDuan3,
DateDuan4,
DateDuan5,
DateDuan6,
DateDuan7,
DateDuan8,
DateDuan9,
DateDuan10
)
values
(
@pi_TicketMoney3,
@pi_CompanyNote,
@pi_ContractCode,
@pi_TicketType2,
@pi_TicketMoney,
@pi_TicketType3,
@pi_TicketMoney1,
@pi_TicketMoney4,
@pi_TicketType,
@pi_TicketType4,
@pi_TicketType1,
@pi_TicketMoney2,
cast(nullif(@pi_DateDuan1,'') as datetime),
cast(nullif(@pi_DateDuan2,'') as datetime),
cast(nullif(@pi_DateDuan3,'') as datetime),
cast(nullif(@pi_DateDuan4,'') as datetime),
cast(nullif(@pi_DateDuan5,'') as datetime),
cast(nullif(@pi_DateDuan6,'') as datetime),
cast(nullif(@pi_DateDuan7,'') as datetime),
cast(nullif(@pi_DateDuan8,'') as datetime),
cast(nullif(@pi_DateDuan9,'') as datetime),
cast(nullif(@pi_DateDuan10,'') as datetime)
)
set @po_status = 100
set @po_RetValue='增加成功'
end
if @pi_Action='modify'
begin
update Asset_Ticket set
TicketMoney3=@pi_TicketMoney3,
CompanyNote=@pi_CompanyNote,
TicketType2=@pi_TicketType2,
TicketMoney=@pi_TicketMoney,
TicketType3=@pi_TicketType3,
TicketMoney1=@pi_TicketMoney1,
TicketMoney4=@pi_TicketMoney4,
TicketType=@pi_TicketType,
TicketType4=@pi_TicketType4,
TicketType1=@pi_TicketType1,
TicketMoney2=@pi_TicketMoney2,
DateDuan1=cast(nullif(@pi_DateDuan1,'') as datetime),
DateDuan2=cast(nullif(@pi_DateDuan2,'') as datetime),
DateDuan3=cast(nullif(@pi_DateDuan3,'') as datetime),
DateDuan4=cast(nullif(@pi_DateDuan4,'') as datetime),
DateDuan5=cast(nullif(@pi_DateDuan5,'') as datetime),
DateDuan6=cast(nullif(@pi_DateDuan6,'') as datetime),
DateDuan7=cast(nullif(@pi_DateDuan7,'') as datetime),
DateDuan8=cast(nullif(@pi_DateDuan8,'') as datetime),
DateDuan9=cast(nullif(@pi_DateDuan9,'') as datetime),
DateDuan10=cast(nullif(@pi_DateDuan10,'') as datetime)
where ContractCode=@pi_ContractCode
set @po_status = 101
set @po_RetValue='修改成功'
end
if @pi_Action='delete'
begin
delete from Asset_Ticket where ContractCode=@pi_ContractCode
set @po_status = 103
set @po_RetValue='删除成功'
end
if @@error <> 0
begin
set @po_status = 900
set @po_RetValue = '数据执行失败'
end