
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
Create proc [dbo].[P_BakReserve]
/*************************************************
**************************************************/
(
@ret int output,
@nHotelId int,
@nReserveId int,
@nUserId int=-1,
@cComputer nvarchar(100)='',
@cRemark nvarchar(4000)=''
)
as
begin
if dbo.F_GetOptionLock(@nHotelId)=1
begin
return
end
declare @cContent nvarchar(1000)
set @cContent=''
declare @nLogTypeId int
begin tran
update C_Reserve set nReserveStateId=dbo.F_GetReserveStateId_ON(),
nUserId=@nUserId,cComputer=@cComputer,
cRemark=@cRemark
where nId=@nReserveId and nHotelId=@nHotelId
if @@error<>0
begin
set @ret=-1
rollback tran
return
end
update C_RoomDayState set bActivable=0
where nReserveItmRoomId in(select nId from C_ReserveItmRoom where nReserveId=@nReserveId
and nReserveStateId in(4,6)
and nHotelId=@nHotelId)
and bActivable=1
and nHotelId=@nHotelId
update C_ReserveItmRoom set nRoomId=-1,nReserveStateId=1,
nUserId=@nUserId,cComputer=@cComputer,
cRemark=@cRemark
where nReserveId=@nReserveId
and nReserveStateId in(4,6)
and nHotelId=@nHotelId
if @@error<>0
begin
set @ret=-1
rollback tran
return
end
commit tran
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[恢复订单]'
set @nLogTypeId=[dbo].[F_GetLogTypeId_Reserve]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_Reserve',@nUserId,null,null,null,@nReserveId,@nLogTypeId
--2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
end
set QUOTED_IDENTIFIER ON
go
Create proc [dbo].[P_BakReserve]
/*************************************************
**************************************************/
(
@ret int output,
@nHotelId int,
@nReserveId int,
@nUserId int=-1,
@cComputer nvarchar(100)='',
@cRemark nvarchar(4000)=''
)
as
begin
if dbo.F_GetOptionLock(@nHotelId)=1
begin
return
end
declare @cContent nvarchar(1000)
set @cContent=''
declare @nLogTypeId int
begin tran
update C_Reserve set nReserveStateId=dbo.F_GetReserveStateId_ON(),
nUserId=@nUserId,cComputer=@cComputer,
cRemark=@cRemark
where nId=@nReserveId and nHotelId=@nHotelId
if @@error<>0
begin
set @ret=-1
rollback tran
return
end
update C_RoomDayState set bActivable=0
where nReserveItmRoomId in(select nId from C_ReserveItmRoom where nReserveId=@nReserveId
and nReserveStateId in(4,6)
and nHotelId=@nHotelId)
and bActivable=1
and nHotelId=@nHotelId
update C_ReserveItmRoom set nRoomId=-1,nReserveStateId=1,
nUserId=@nUserId,cComputer=@cComputer,
cRemark=@cRemark
where nReserveId=@nReserveId
and nReserveStateId in(4,6)
and nHotelId=@nHotelId
if @@error<>0
begin
set @ret=-1
rollback tran
return
end
commit tran
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[恢复订单]'
set @nLogTypeId=[dbo].[F_GetLogTypeId_Reserve]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_Reserve',@nUserId,null,null,null,@nReserveId,@nLogTypeId
--2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
end

ALTER proc [dbo].[P_CancelBillCnmList]
/*************************************************
**************************************************/
(
@ret int=-1 output,
@nHotelId int,
@nBillCnmListId int,
@nUserId int,
@nJobTimeListId int,
@cComputer nvarchar(100),
@cRemark nvarchar(4000),
@nRemarkId int
)
as
begin
if dbo.F_GetOptionLock(@nHotelId)=1
begin
return
end
declare @nBillId int
declare @nProductTypeId int,@nConsumeKindId int,@nProductId int,@cProductName nvarchar(50),
@nCount int,@nUnitId int,@cUnitName nvarchar(50),
@nPrice decimal(18,2),@nValue decimal(18,2)
select @nBillId=nBillId,@nConsumeKindId=nConsumeKindId,@nProductTypeId=nProductTypeId,@cProductName=cProductName,
@nCount=nCount,@nUnitId=nUnitId,@cUnitName=cUnitName,@nPrice=nPrice,
@nValue=nValue
from dbo.C_BillCnmList
where nId=@nBillCnmListId and nHotelId=@nHotelId
declare @cContent nvarchar(1000)
set @cContent=''
declare @nLogTypeId int
update C_BillCnmList set nConsumeListStateId=3,
dCancelTime=getdate(),nCancelUserId=@nUserId,cCancelComputer=@cComputer,cCancelRemark=@cRemark
where nId=@nBillCnmListId and nHotelId=@nHotelId
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银入账] 删除账目: '+@cProductName+' '+convert(nvarchar(50),@nCount)+' 笔,单价: '+convert(nvarchar(50),@nPrice)+' 元,共计金额: '+convert(nvarchar(50),@nValue)+' 元,备注: '+@cRemark
set @nLogTypeId=[dbo].[F_GetLogTypeId_Bill]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'[dbo].[P_CancelBillCnmList]:43行',@nUserId,null,null,@nBillId,null,@nLogTypeId
--2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
end
/*************************************************
**************************************************/
(
@ret int=-1 output,
@nHotelId int,
@nBillCnmListId int,
@nUserId int,
@nJobTimeListId int,
@cComputer nvarchar(100),
@cRemark nvarchar(4000),
@nRemarkId int
)
as
begin
if dbo.F_GetOptionLock(@nHotelId)=1
begin
return
end
declare @nBillId int
declare @nProductTypeId int,@nConsumeKindId int,@nProductId int,@cProductName nvarchar(50),
@nCount int,@nUnitId int,@cUnitName nvarchar(50),
@nPrice decimal(18,2),@nValue decimal(18,2)
select @nBillId=nBillId,@nConsumeKindId=nConsumeKindId,@nProductTypeId=nProductTypeId,@cProductName=cProductName,
@nCount=nCount,@nUnitId=nUnitId,@cUnitName=cUnitName,@nPrice=nPrice,
@nValue=nValue
from dbo.C_BillCnmList
where nId=@nBillCnmListId and nHotelId=@nHotelId
declare @cContent nvarchar(1000)
set @cContent=''
declare @nLogTypeId int
update C_BillCnmList set nConsumeListStateId=3,
dCancelTime=getdate(),nCancelUserId=@nUserId,cCancelComputer=@cComputer,cCancelRemark=@cRemark
where nId=@nBillCnmListId and nHotelId=@nHotelId
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银入账] 删除账目: '+@cProductName+' '+convert(nvarchar(50),@nCount)+' 笔,单价: '+convert(nvarchar(50),@nPrice)+' 元,共计金额: '+convert(nvarchar(50),@nValue)+' 元,备注: '+@cRemark
set @nLogTypeId=[dbo].[F_GetLogTypeId_Bill]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'[dbo].[P_CancelBillCnmList]:43行',@nUserId,null,null,@nBillId,null,@nLogTypeId
--2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
end

ALTER proc [dbo].[P_CashingCnmList]
/*************************************************
**************************************************/
(
@ret int=-1 output,
@nHotelId int,
@nListId int=-1 output,
@nUserId int,
@nJobTimeListId int,
@cComputer nvarchar(100),
@cRemark nvarchar(4000)='',
@tag int,
@nCshGroupId int
)
as
begin
if dbo.F_GetOptionLock(@nHotelId)=1
begin
return
end
declare @nBillId int
declare @nGuestId int
declare @nProductTypeId int,@nConsumeKindId int,@nProductId int,@cProductName nvarchar(50),
@nCount int,@nUnitId int,@cUnitName nvarchar(50),
@nPrice decimal(18,2),@nValue decimal(18,2)
declare @cContent nvarchar(1000)
set @cContent=''
declare @nLogTypeId int
if @tag=1 --bill
begin
select @nBillId=nBillId,@nConsumeKindId=nConsumeKindId,@nProductTypeId=nProductTypeId,@cProductName=cProductName,
@nCount=nCount,@nUnitId=nUnitId,@cUnitName=cUnitName,@nPrice=nPrice,
@nValue=nValue
from dbo.C_BillCnmList
where nId=@nListId and nHotelId=@nHotelId
update C_BillCnmList set nConsumeListStateId=2,
dCashTime=getdate(),nCashUserId=@nUserId,cCashComputer=@cComputer,cCashRemark=@cRemark,nCshGroupId=@nCshGroupId
where nId=@nListId and nHotelId=@nHotelId
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银结账明细] '+[dbo].[F_GetConsumeKindName](@nConsumeKindId)+' 分类下的产品: '+@cProductName+' '+convert(nvarchar(50),@nCount)+@cUnitName+' ,共计金额: '+convert(nvarchar(50),@nValue)+' 元'
-- set @cContent='主单消费明细:结算 ,分类['+[dbo].[F_GetConsumeKindName](@nConsumeKindId)+'] ,产品名称:['+convert(nvarchar(50),@cProductName)+'] ,数量'+convert(nvarchar(50),@nCount)+' ,金额:'+convert(nvarchar(50),@nValue)
set @nLogTypeId=[dbo].[F_GetLogTypeId_Bill]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_BillCnmList',@nUserId,null,null,@nBillId,null,@nLogTypeId
--2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
end
else if @tag=2 --guest
begin
select @nGuestId=nGuestId,@nProductTypeId=nProductTypeId,@nConsumeKindId=nConsumeKindId,@nProductId=nProductId,
@cProductName=cProductName,@nCount=nCount,@nUnitId=nUnitId,@cUnitName=cUnitName,
@nPrice=nPrice,@nValue=nValue
from dbo.C_GuestCnmList
where nId=@nListId and nHotelId=@nHotelId
update C_GuestCnmList set nConsumeListStateId=2,
dCashTime=getdate(),nCashUserId=@nUserId,cCashComputer=@cComputer,cCashRemark=@cRemark,nCshGroupId=@nCshGroupId
where nId=@nListId and nHotelId=@nHotelId
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银结账明细] '+[dbo].[F_GetConsumeKindName](@nConsumeKindId)+' 分类下的产品: '+@cProductName+' '+convert(nvarchar(50),@nCount)+@cUnitName+' ,共计金额: '+convert(nvarchar(50),@nValue)+' 元'
-- set @cContent='客单消费明细:结算 分类:['+[dbo].[F_GetConsumeKindName](@nConsumeKindId)+'] ,产品名称:['+convert(nvarchar(50),@cProductName)+'] ,数量:'+convert(nvarchar(50),@nCount)+' ,金额:'+convert(nvarchar(50),@nValue)
set @nLogTypeId=[dbo].[F_GetLogTypeId_Guest]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_GuestCnmList',@nUserId,null,@nGuestId,null,null,@nLogTypeId
--2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
end
end
/*************************************************
**************************************************/
(
@ret int=-1 output,
@nHotelId int,
@nListId int=-1 output,
@nUserId int,
@nJobTimeListId int,
@cComputer nvarchar(100),
@cRemark nvarchar(4000)='',
@tag int,
@nCshGroupId int
)
as
begin
if dbo.F_GetOptionLock(@nHotelId)=1
begin
return
end
declare @nBillId int
declare @nGuestId int
declare @nProductTypeId int,@nConsumeKindId int,@nProductId int,@cProductName nvarchar(50),
@nCount int,@nUnitId int,@cUnitName nvarchar(50),
@nPrice decimal(18,2),@nValue decimal(18,2)
declare @cContent nvarchar(1000)
set @cContent=''
declare @nLogTypeId int
if @tag=1 --bill
begin
select @nBillId=nBillId,@nConsumeKindId=nConsumeKindId,@nProductTypeId=nProductTypeId,@cProductName=cProductName,
@nCount=nCount,@nUnitId=nUnitId,@cUnitName=cUnitName,@nPrice=nPrice,
@nValue=nValue
from dbo.C_BillCnmList
where nId=@nListId and nHotelId=@nHotelId
update C_BillCnmList set nConsumeListStateId=2,
dCashTime=getdate(),nCashUserId=@nUserId,cCashComputer=@cComputer,cCashRemark=@cRemark,nCshGroupId=@nCshGroupId
where nId=@nListId and nHotelId=@nHotelId
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银结账明细] '+[dbo].[F_GetConsumeKindName](@nConsumeKindId)+' 分类下的产品: '+@cProductName+' '+convert(nvarchar(50),@nCount)+@cUnitName+' ,共计金额: '+convert(nvarchar(50),@nValue)+' 元'
-- set @cContent='主单消费明细:结算 ,分类['+[dbo].[F_GetConsumeKindName](@nConsumeKindId)+'] ,产品名称:['+convert(nvarchar(50),@cProductName)+'] ,数量'+convert(nvarchar(50),@nCount)+' ,金额:'+convert(nvarchar(50),@nValue)
set @nLogTypeId=[dbo].[F_GetLogTypeId_Bill]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_BillCnmList',@nUserId,null,null,@nBillId,null,@nLogTypeId
--2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
end
else if @tag=2 --guest
begin
select @nGuestId=nGuestId,@nProductTypeId=nProductTypeId,@nConsumeKindId=nConsumeKindId,@nProductId=nProductId,
@cProductName=cProductName,@nCount=nCount,@nUnitId=nUnitId,@cUnitName=cUnitName,
@nPrice=nPrice,@nValue=nValue
from dbo.C_GuestCnmList
where nId=@nListId and nHotelId=@nHotelId
update C_GuestCnmList set nConsumeListStateId=2,
dCashTime=getdate(),nCashUserId=@nUserId,cCashComputer=@cComputer,cCashRemark=@cRemark,nCshGroupId=@nCshGroupId
where nId=@nListId and nHotelId=@nHotelId
-----------------------------------------------------
-------Begin Log-------------------------------------
set @cContent='[收银结账明细] '+[dbo].[F_GetConsumeKindName](@nConsumeKindId)+' 分类下的产品: '+@cProductName+' '+convert(nvarchar(50),@nCount)+@cUnitName+' ,共计金额: '+convert(nvarchar(50),@nValue)+' 元'
-- set @cContent='客单消费明细:结算 分类:['+[dbo].[F_GetConsumeKindName](@nConsumeKindId)+'] ,产品名称:['+convert(nvarchar(50),@cProductName)+'] ,数量:'+convert(nvarchar(50),@nCount)+' ,金额:'+convert(nvarchar(50),@nValue)
set @nLogTypeId=[dbo].[F_GetLogTypeId_Guest]()
exec P_DoLog @ret output,@nHotelId,@cComputer,@cContent,'C_GuestCnmList',@nUserId,null,@nGuestId,null,null,@nLogTypeId
--2009-04-17
-------End Log---------------------------------------
-----------------------------------------------------
set @ret=1
end
end
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理