IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[report_4_data]') AND type = 'P')
DROP PROCEDURE [dbo].[report_4_data]
GO
CREATE PROCEDURE report_4_data
@cmpid int,@branchid int,@userdpid int,@userotid int,@useruid int,@tableid varchar(8000),@objids varchar(8000),@pagesize int,@qry_whzt varchar(512)

AS
BEGIN
 set nocount on 

declare @dataIds table(objid int)
if @objids!='_NONE' and @objids!='_none_' and @objids!='' 
insert into @dataIds(objid)
select value from dbo.fn_split_int(@objids)
select 'tb_report1' tableid, ord_creator,ord_whzt,count(ord_creator) ord_count 
from order_239 
where (@qry_whzt = '全部' or ord_whzt = @qry_whzt)
and ord_status in ('外呼跟进','预约成功')
and ord_createdpid =  @userdpid
group by ord_creator,ord_whzt
order by ord_creator
END