代码
ALTER proc [dbo].[P_CheckCode]
(
@ret int output,
@nId int,
@tag nvarchar(50),
@cCode nvarchar(50),
@nHotelId int
)
as
begin
if Upper(@tag)='B_AREA'
begin
if exists(select 1 from B_Area where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Address'
begin
if exists(select 1 from B_Address where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Authorizer'
begin
if exists(select 1 from B_Authorizer where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Certificate'
begin
if exists(select 1 from B_Certificate where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_City'
begin
if exists(select 1 from B_City where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Consume'
begin
if exists(select 1 from B_Consume where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_ConsumeKind'
begin
if exists(select 1 from B_ConsumeKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Country'
begin
if exists(select 1 from B_Country where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Direction'
begin
if exists(select 1 from B_Direction where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Floor'
begin
if exists(select 1 from B_Floor where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_GuestKind'
begin
if exists(select 1 from B_GuestKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_HabitKind'
begin
if exists(select 1 from B_HabitKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_JobKind'
begin
if exists(select 1 from B_JobKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_LimitNet'
begin
if exists(select 1 from B_LimitNet where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_LimitPhone'
begin
if exists(select 1 from B_LimitPhone where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_LimitVod'
begin
if exists(select 1 from B_LimitVod where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_MtRoom'
begin
if exists(select 1 from B_MtRoom where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_MtRoomKind'
begin
if exists(select 1 from B_MtRoomKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Package'
begin
if exists(select 1 from B_Package where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_PayType'
begin
if exists(select 1 from B_PayType where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Province'
begin
if exists(select 1 from B_Province where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Property'
begin
if exists(select 1 from B_Property where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Remark'
begin
if exists(select 1 from B_Remark where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_RentKind'
begin
if exists(select 1 from B_RentKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_ReserveSource'
begin
if exists(select 1 from B_ReserveSource where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_ReserveSourceType'
begin
if exists(select 1 from B_ReserveSourceType where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Role'
begin
if exists(select 1 from B_Role where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Room'
begin
if exists(select 1 from B_Room where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_RoomKind'
begin
if exists(select 1 from B_RoomKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Salesman'
begin
if exists(select 1 from B_Salesman where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_SellPeriod'
begin
if exists(select 1 from B_SellPeriod where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Service'
begin
if exists(select 1 from B_Service where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_ServiceKind'
begin
if exists(select 1 from B_ServiceKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Town'
begin
if exists(select 1 from B_Town where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Traffic'
begin
if exists(select 1 from B_Traffic where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_TransferCode'
begin
if exists(select 1 from B_TransferCode where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Unit'
begin
if exists(select 1 from B_Unit where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_User'
begin
if exists(select 1 from B_User where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_WelcomeMsg'
begin
if exists(select 1 from B_WelcomeMsg where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='A_RoomState'
begin
if exists(select 1 from A_RoomState where cCode=@cCode and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_MarkCode'
begin
if exists(select 1 from B_MarkCode where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='C_VirtualGuest'
begin
if exists(select 1 from C_VirtualGuest where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_CompanyKind'
begin
if exists(select 1 from B_CompanyKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_FinanceKind'
begin
if exists(select 1 from B_FinanceKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Department'
begin
if exists(select 1 from B_Department where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
end
(
@ret int output,
@nId int,
@tag nvarchar(50),
@cCode nvarchar(50),
@nHotelId int
)
as
begin
if Upper(@tag)='B_AREA'
begin
if exists(select 1 from B_Area where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Address'
begin
if exists(select 1 from B_Address where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Authorizer'
begin
if exists(select 1 from B_Authorizer where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Certificate'
begin
if exists(select 1 from B_Certificate where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_City'
begin
if exists(select 1 from B_City where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Consume'
begin
if exists(select 1 from B_Consume where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_ConsumeKind'
begin
if exists(select 1 from B_ConsumeKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Country'
begin
if exists(select 1 from B_Country where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Direction'
begin
if exists(select 1 from B_Direction where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Floor'
begin
if exists(select 1 from B_Floor where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_GuestKind'
begin
if exists(select 1 from B_GuestKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_HabitKind'
begin
if exists(select 1 from B_HabitKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_JobKind'
begin
if exists(select 1 from B_JobKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_LimitNet'
begin
if exists(select 1 from B_LimitNet where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_LimitPhone'
begin
if exists(select 1 from B_LimitPhone where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_LimitVod'
begin
if exists(select 1 from B_LimitVod where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_MtRoom'
begin
if exists(select 1 from B_MtRoom where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_MtRoomKind'
begin
if exists(select 1 from B_MtRoomKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Package'
begin
if exists(select 1 from B_Package where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_PayType'
begin
if exists(select 1 from B_PayType where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Province'
begin
if exists(select 1 from B_Province where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Property'
begin
if exists(select 1 from B_Property where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Remark'
begin
if exists(select 1 from B_Remark where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_RentKind'
begin
if exists(select 1 from B_RentKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_ReserveSource'
begin
if exists(select 1 from B_ReserveSource where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_ReserveSourceType'
begin
if exists(select 1 from B_ReserveSourceType where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Role'
begin
if exists(select 1 from B_Role where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Room'
begin
if exists(select 1 from B_Room where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_RoomKind'
begin
if exists(select 1 from B_RoomKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Salesman'
begin
if exists(select 1 from B_Salesman where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_SellPeriod'
begin
if exists(select 1 from B_SellPeriod where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Service'
begin
if exists(select 1 from B_Service where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_ServiceKind'
begin
if exists(select 1 from B_ServiceKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Town'
begin
if exists(select 1 from B_Town where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Traffic'
begin
if exists(select 1 from B_Traffic where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_TransferCode'
begin
if exists(select 1 from B_TransferCode where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Unit'
begin
if exists(select 1 from B_Unit where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_User'
begin
if exists(select 1 from B_User where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_WelcomeMsg'
begin
if exists(select 1 from B_WelcomeMsg where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='A_RoomState'
begin
if exists(select 1 from A_RoomState where cCode=@cCode and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_MarkCode'
begin
if exists(select 1 from B_MarkCode where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='C_VirtualGuest'
begin
if exists(select 1 from C_VirtualGuest where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_CompanyKind'
begin
if exists(select 1 from B_CompanyKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_FinanceKind'
begin
if exists(select 1 from B_FinanceKind where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
else if Upper(@tag)='B_Department'
begin
if exists(select 1 from B_Department where cCode=@cCode and nHotelId=@nHotelId and nId<>@nId)
set @ret=1
else
set @ret=-1
end
end
代码
ALTER proc [dbo].[P_GetAccountCtrlList]
/*********************************************
**FN:获取外部系统转账控制列表
**TIME:
**************************************************/
(
@ret int=-1 output,
@nHotelId int,
@nParentId int,
@tag int
)
as
begin
if @tag=1 --bill
begin
select A.nId,A.nConsumeKindId,nParentId=A.nBillId,bIsControl,cConsumeKindName = B.cName
from C_BillAccountControl A
left join B_ConsumeKind B on B.nId=A.nConsumeKindId
where A.nBillId=@nParentId and A.nHotelId =@nHotelId
set @ret=1
end
else if @tag=2 --guest
begin
select A.nId,A.nConsumeKindId,nParentId=A.nGuestId,bIsControl,cConsumeKindName = B.cName
from C_GuestAccountControl A
left join B_ConsumeKind B on B.nId=A.nConsumeKindId
where A.nGuestId=@nParentId and A.nHotelId =@nHotelId
set @ret=1
end
end
/*********************************************
**FN:获取外部系统转账控制列表
**TIME:
**************************************************/
(
@ret int=-1 output,
@nHotelId int,
@nParentId int,
@tag int
)
as
begin
if @tag=1 --bill
begin
select A.nId,A.nConsumeKindId,nParentId=A.nBillId,bIsControl,cConsumeKindName = B.cName
from C_BillAccountControl A
left join B_ConsumeKind B on B.nId=A.nConsumeKindId
where A.nBillId=@nParentId and A.nHotelId =@nHotelId
set @ret=1
end
else if @tag=2 --guest
begin
select A.nId,A.nConsumeKindId,nParentId=A.nGuestId,bIsControl,cConsumeKindName = B.cName
from C_GuestAccountControl A
left join B_ConsumeKind B on B.nId=A.nConsumeKindId
where A.nGuestId=@nParentId and A.nHotelId =@nHotelId
set @ret=1
end
end