zoukankan      html  css  js  c++  java
  • 存储过程前台2

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

    (select 1 from C_Calltype where nHotelId=@nHotelId and cName=@cNameand not exists (select 1 from C_Calltype where nHotelId=@nHotelId and cCode=@cCodeand @nCallTypeKindId>0
            
    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<>@nIdand not exists (select 1 from C_Calltype where nHotelId=@nHotelId and cCode=@cCode and nId<>@nIdand @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
     
    PROCEDURE [dbo].[P_ADDAreaCode]
    (
        
    @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 bitfrom A_SystemParms 
            
    where cName='OptionKey' and cType='bit' and nHotelId =@nHotelId
        
    end
        
    if @ret is null
        
    begin
         
    set @ret=0
        
    end
        
    return @ret
    end

  • 相关阅读:
    Android adb from work ---three
    作为一个程序员,分享一下我自己常用的几款非常方便的chrome插件
    chrome浏览器安装网页测试插件postman的图文介绍
    【转】精选十二款餐饮、快递、票务行业微信小程序源码demo推荐
    浅谈微信小程序对于房地产行业的影响
    推荐三款自己使用过的鼠标手势插件
    微信小程序基本目录结构学习
    怎么提交小程序给微信?微信小程序的提交审核流程
    微信小程序理解8大误区,你中招了吗?
    微信小程序火爆,谁能在微信小程序赚取第一桶金?
  • 原文地址:https://www.cnblogs.com/callbin/p/1634793.html
Copyright © 2011-2022 走看看