IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[report_33_data]') AND type = 'P')
DROP PROCEDURE [dbo].[report_33_data]
GO
CREATE PROCEDURE report_33_data
@cmpid int,@branchid int,@userdpid int,@userotid int,@useruid int,@tableid varchar(8000),@objids varchar(8000),@pagesize int,@qry_fgs varchar(512)
,@qry_date1 varchar(512)
,@qry_date2 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)
create table #temp (
    tableid varchar(10),
    ord_dpmc varchar(100)
)



insert into #temp 
select 'tb_report1',dp_depart from mps_depart 
where dp_bcid = @qry_fgs 
and dp_status !='关店' 
and dp_isdepart = 1 
and dp_depart not in (select distinct ord_dpmc from order_248
where ord_status != '已作废' and charindex('临',ord_no) = 0
and ord_date >= @qry_date1 + ' 00:00:00' and  ord_date <= @qry_date2 + ' 23:59:59'
and ord_bcid = @qry_fgs)


select * from #temp
END