-- =============================================
-- Author:张连海
-- Create date: 2013.09.28
-- Description:用于机房收费系统中结账,查询相应的信息
-- =============================================
ALTER procedure [dbo].[Proc_SelectAccounts]
@operateUserName varchar(20),
@isSettleAccounts varchar(10)
as
begin
select
(select isnull(count(cardNo),0) from T_Register where regUser =@operateUserName and isSettleAccounts=@isSettleAccounts) as '售卡张数',
(select isnull(count(cardNo),0) from T_AbsentCard where abCardUser =@operateUserName and isSettleAccounts=@isSettleAccounts) as '退卡张数',
(select isnull(sum(recMoney),0) from T_Recharge where recUser=@operateUserName and isSettleAccounts=@isSettleAccounts) as '充值金额',
(select isnull(sum(abCardMoney),0) from T_AbsentCard where abCardUser=@operateUserName and isSettleAccounts=@isSettleAccounts) as '退卡金额',
(select isnull(count(cardNo),0) from T_Register where regUser =@operateUserName) as '总售卡张数'
End