代码
Create
(
@ret int=-1 output,
@nId int output,
@cCode nvarchar(50),
@nCallTypeId int,
@cAddress nvarchar(50),
@nHotelId int
)
AS
begin
INSERT INTO [C_AreaCode]([cCode],[nCallTypeId],[cAddress],[nHotelId])
VALUES(@cCode,@nCallTypeId,@cAddress,@nHotelId)
SET @nId = @@IDENTITY
SET @ret=1
end
代码
PROCEDURE [dbo].[P_ADDAreaCode]ALTER proc [dbo].[P_ADDCalltype]
(
@ret int=-1 output,
@nId int,
@cName nvarchar(50),
@cCode nvarchar(50),
@nBaseTimeLong int=0,
@nMinPrice money=0,
@nUnitPrice money=0,
@nUnitTime int=0,
@nFreeTimeLong int=0,
@nServicePrice money=0,
@nServiceType int=0,
@nAddPrice money=0,
@nAddType int=0,
@nHotelId int=0,
@nCallTypeKindId int,
@tag int
)
as
begin
if @tag=1
begin
if @cName<>'' and @cCode<>'' and
begin
insert into C_Calltype(cName,cCode,nBaseTimeLong,nMinPrice,nUnitPrice,nUnitTime,nFreeTimeLong,nServicePrice,nServiceType,nAddPrice,nAddType,nHotelId,nCallTypeKindId)
values(@cName,@cCode,@nBaseTimeLong,@nMinPrice,@nUnitPrice,@nUnitTime,@nFreeTimeLong,@nServicePrice,@nServiceType,@nAddPrice,@nAddType,@nHotelId,@nCallTypeKindId)
set @ret=1
end
end
else if @tag=2
begin
if @cName<>'' and @cCode<>'' and not exists (select 1 from C_Calltype where nHotelId=@nHotelId and cName=@cName and nId<>@nId) and not exists (select 1 from C_Calltype where nHotelId=@nHotelId and cCode=@cCode and nId<>@nId) and @nCallTypeKindId>0
begin
update C_Calltype
set cName=@cName,cCode=@cCode,nBaseTimeLong=@nBaseTimeLong,nMinPrice=@nMinPrice,nUnitPrice=@nUnitPrice,nUnitTime=@nUnitTime,
nFreeTimeLong=@nFreeTimeLong,nServicePrice=@nServicePrice,nServiceType=@nServiceType,nAddPrice=@nAddPrice,nAddType=@nAddType,nCallTypeKindId=@nCallTypeKindId
where nId=@nId and nHotelId=@nHotelId
set @ret=1
end
end
end
(
@ret int=-1 output,
@nId int,
@cName nvarchar(50),
@cCode nvarchar(50),
@nBaseTimeLong int=0,
@nMinPrice money=0,
@nUnitPrice money=0,
@nUnitTime int=0,
@nFreeTimeLong int=0,
@nServicePrice money=0,
@nServiceType int=0,
@nAddPrice money=0,
@nAddType int=0,
@nHotelId int=0,
@nCallTypeKindId int,
@tag int
)
as
begin
if @tag=1
begin
if @cName<>'' and @cCode<>'' and
代码
(select 1 from C_Calltype where nHotelId=@nHotelId and cName=@cName) and not exists (select 1 from C_Calltype where nHotelId=@nHotelId and cCode=@cCode) and @nCallTypeKindId>0set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER proc [dbo].[P_BackImprest]
/*************************************************
**AZ:TLM
**FN:
**TIME:
**************************************************/
(
@ret int=-1 output,
@nHotelId int,
@nId int,
@nUserId int,
@nJobTimeListId int,
@cComputer nvarchar(100),
@cRemark nvarchar(4000),
@tag int
)
as
begin
if dbo.F_GetOptionLock(@nHotelId)=1
begin
return
end
declare @cContent nvarchar(1000)
set @cContent=''
declare @nLogTypeId int
declare @nBillId int,@nPayTypeId int,@BackMoney decimal(18,2)
if @tag=1 --bill
begin
if exists(select 1 from C_BillImprest where nRecordStateId=1 and nId=@nId and nHotelId =@nHotelId)
begin
select @nBillId=nBillId,@nPayTypeId=nPayTypeId,@BackMoney=nMoney from C_BillImprest
where nId=@nId and nHotelId =@nHotelId
begin tran
exec P_LogBackImprest @ret output,@nHotelId,@nId,@nPayTypeId,@BackMoney,0,@nUserId,@nJobTimeListId,@cComputer,@cRemark,1
if @ret<>1
begin
set @ret=-1
rollback tran
return
end
update C_BillImprest set nRecordStateId=2,
dCashTime=getdate(),nCashUserId=@nUserId,cCashComputer=@cComputer,cCashRemark=@cRemark
where nId=@nId and nHotelId =@nHotelId
if @@error <>0
begin
set @ret=-1
rollback tran
return
end
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银押金整退] 退回押金: '+convert(nvarchar(50),@BackMoney)+' 元,该押金原付款方式为: '+[dbo].[F_GetPayTypeName](@nPayTypeId)+' 备注: '+@cRemark
set @nLogTypeId=[dbo].[F_GetLogTypeId_Bill]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_BillImprest',@nUserId,null,null,@nBillId,null,@nLogTypeId
-- 2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
commit tran
end
else set @ret=-1
end
else if @tag=2 --guest
begin
if exists(select 1 from C_GuestImprest where nRecordStateId=1 and nId=@nId and nHotelId =@nHotelId)
begin
declare @nGuestId int
select @nGuestId=nGuestId,@nPayTypeId=nPayTypeId,@BackMoney=nMoney from C_GuestImprest
where nId=@nId and nHotelId =@nHotelId
begin tran
exec P_LogBackImprest @ret output,@nHotelId,@nId,@nPayTypeId,@BackMoney,0,@nUserId,@nJobTimeListId,@cComputer,@cRemark,2
if @ret<>1
begin
set @ret=-1
rollback tran
return
end
update C_GuestImprest set nRecordStateId=2,
dCashTime=getdate(),nCashUserId=@nUserId,cCashComputer=@cComputer,cCashRemark=@cRemark
where nId=@nId and nHotelId =@nHotelId
if @@error <>0
begin
set @ret=-1
rollback tran
return
end
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银押金整退] 退回押金: '+convert(nvarchar(50),@BackMoney)+' 元,该押金原付款方式为: '+[dbo].[F_GetPayTypeName](@nPayTypeId)+' 备注: '+@cRemark
set @nLogTypeId=[dbo].[F_GetLogTypeId_Guest]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_GuestImprest',@nUserId,null,@nGuestId,null,null,@nLogTypeId
-- 2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
commit tran
end
else set @ret=-1
end
End
set QUOTED_IDENTIFIER ON
go
ALTER proc [dbo].[P_BackImprest]
/*************************************************
**AZ:TLM
**FN:
**TIME:
**************************************************/
(
@ret int=-1 output,
@nHotelId int,
@nId int,
@nUserId int,
@nJobTimeListId int,
@cComputer nvarchar(100),
@cRemark nvarchar(4000),
@tag int
)
as
begin
if dbo.F_GetOptionLock(@nHotelId)=1
begin
return
end
declare @cContent nvarchar(1000)
set @cContent=''
declare @nLogTypeId int
declare @nBillId int,@nPayTypeId int,@BackMoney decimal(18,2)
if @tag=1 --bill
begin
if exists(select 1 from C_BillImprest where nRecordStateId=1 and nId=@nId and nHotelId =@nHotelId)
begin
select @nBillId=nBillId,@nPayTypeId=nPayTypeId,@BackMoney=nMoney from C_BillImprest
where nId=@nId and nHotelId =@nHotelId
begin tran
exec P_LogBackImprest @ret output,@nHotelId,@nId,@nPayTypeId,@BackMoney,0,@nUserId,@nJobTimeListId,@cComputer,@cRemark,1
if @ret<>1
begin
set @ret=-1
rollback tran
return
end
update C_BillImprest set nRecordStateId=2,
dCashTime=getdate(),nCashUserId=@nUserId,cCashComputer=@cComputer,cCashRemark=@cRemark
where nId=@nId and nHotelId =@nHotelId
if @@error <>0
begin
set @ret=-1
rollback tran
return
end
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银押金整退] 退回押金: '+convert(nvarchar(50),@BackMoney)+' 元,该押金原付款方式为: '+[dbo].[F_GetPayTypeName](@nPayTypeId)+' 备注: '+@cRemark
set @nLogTypeId=[dbo].[F_GetLogTypeId_Bill]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_BillImprest',@nUserId,null,null,@nBillId,null,@nLogTypeId
-- 2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
commit tran
end
else set @ret=-1
end
else if @tag=2 --guest
begin
if exists(select 1 from C_GuestImprest where nRecordStateId=1 and nId=@nId and nHotelId =@nHotelId)
begin
declare @nGuestId int
select @nGuestId=nGuestId,@nPayTypeId=nPayTypeId,@BackMoney=nMoney from C_GuestImprest
where nId=@nId and nHotelId =@nHotelId
begin tran
exec P_LogBackImprest @ret output,@nHotelId,@nId,@nPayTypeId,@BackMoney,0,@nUserId,@nJobTimeListId,@cComputer,@cRemark,2
if @ret<>1
begin
set @ret=-1
rollback tran
return
end
update C_GuestImprest set nRecordStateId=2,
dCashTime=getdate(),nCashUserId=@nUserId,cCashComputer=@cComputer,cCashRemark=@cRemark
where nId=@nId and nHotelId =@nHotelId
if @@error <>0
begin
set @ret=-1
rollback tran
return
end
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银押金整退] 退回押金: '+convert(nvarchar(50),@BackMoney)+' 元,该押金原付款方式为: '+[dbo].[F_GetPayTypeName](@nPayTypeId)+' 备注: '+@cRemark
set @nLogTypeId=[dbo].[F_GetLogTypeId_Guest]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_GuestImprest',@nUserId,null,@nGuestId,null,null,@nLogTypeId
-- 2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
commit tran
end
else set @ret=-1
end
End
begin
insert into C_Calltype(cName,cCode,nBaseTimeLong,nMinPrice,nUnitPrice,nUnitTime,nFreeTimeLong,nServicePrice,nServiceType,nAddPrice,nAddType,nHotelId,nCallTypeKindId)
values(@cName,@cCode,@nBaseTimeLong,@nMinPrice,@nUnitPrice,@nUnitTime,@nFreeTimeLong,@nServicePrice,@nServiceType,@nAddPrice,@nAddType,@nHotelId,@nCallTypeKindId)
set @ret=1
end
end
else if @tag=2
begin
if @cName<>'' and @cCode<>'' and not exists (select 1 from C_Calltype where nHotelId=@nHotelId and cName=@cName and nId<>@nId) and not exists (select 1 from C_Calltype where nHotelId=@nHotelId and cCode=@cCode and nId<>@nId) and @nCallTypeKindId>0
begin
update C_Calltype
set cName=@cName,cCode=@cCode,nBaseTimeLong=@nBaseTimeLong,nMinPrice=@nMinPrice,nUnitPrice=@nUnitPrice,nUnitTime=@nUnitTime,
nFreeTimeLong=@nFreeTimeLong,nServicePrice=@nServicePrice,nServiceType=@nServiceType,nAddPrice=@nAddPrice,nAddType=@nAddType,nCallTypeKindId=@nCallTypeKindId
where nId=@nId and nHotelId=@nHotelId
set @ret=1
end
end
end
(
@ret int=-1 output,
@nId int output,
@cCode nvarchar(50),
@nCallTypeId int,
@cAddress nvarchar(50),
@nHotelId int
)
AS
begin
INSERT INTO [C_AreaCode]([cCode],[nCallTypeId],[cAddress],[nHotelId])
VALUES(@cCode,@nCallTypeId,@cAddress,@nHotelId)
SET @nId = @@IDENTITY
SET @ret=1
end
代码
ALTER function [dbo].[F_GetOptionLock]
(
@nHotelId int
)
returns bit
/*************************************************
**FN:
**TIME:
**************************************************/
as
begin
declare @ret bit
if exists(select 1 from A_SystemParms
where cName='OptionKey' and cType='bit' and nHotelId =@nHotelId)
begin
select @ret=cast(cValue as bit) from A_SystemParms
where cName='OptionKey' and cType='bit' and nHotelId =@nHotelId
end
if @ret is null
begin
set @ret=0
end
return @ret
end
(
@nHotelId int
)
returns bit
/*************************************************
**FN:
**TIME:
**************************************************/
as
begin
declare @ret bit
if exists(select 1 from A_SystemParms
where cName='OptionKey' and cType='bit' and nHotelId =@nHotelId)
begin
select @ret=cast(cValue as bit) from A_SystemParms
where cName='OptionKey' and cType='bit' and nHotelId =@nHotelId
end
if @ret is null
begin
set @ret=0
end
return @ret
end