if exists(select 1 from sysobjects where name='pr_wxsf_distribution_plan')
  drop procedure pr_wxsf_distribution_plan
go



CREATE procedure pr_wxsf_distribution_plan 
@plan_no nvarchar(50) --方案编号

WITH ENCRYPTION
as

begin
 SELECT DISTINCT
	ms.plan_no,ms.plan_name,ms.card_type as vip_level,ms.begin_date as starttime ,ms.end_date as endtime,
	op.oper_name as operateman,ms.oper_date as operatetime,cp.oper_name as checker,ms.work_date as checktime,
	ms.plan_memo as memo,
	--case d.push_type when 'C' then '按类别' when 'B' then '按品牌' when 'I' then '按商品' else '' end
	'' as distribution_type,
	--case d.push_way when '0' then '按比例' when '1' then '按金额' else '' end
	'' as percentage_type    
 FROM t_vip_father_card_master ms 
 left join t_sys_operator op on ms.oper_id=op.oper_id 
 left join t_sys_operator cp on ms.confirm_man=cp.oper_id 
 where ms.approve_flag='1' and  ms.plan_no=@plan_no
end
go