存储过程3前台

代码
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

 

 

代码
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

代码
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




原文地址:https://www.cnblogs.com/callbin/p/1634832.html