IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_g_all_report]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_g_all_report]
GO
CREATE proc [dbo].[mps_g_all_report](
@cmpid int , 
@useruid int ,
@mobile int
)
as
begin
  -- 返回所有的报表。
  set nocount on
  if (@mobile=0) 
  begin
  select a.* from mps_report a , mps_report_users 
  where rpt_id=rptp_rptid and rptp_type='rptview' and rptp_cuid=@useruid and rpt_title>'' and  rpt_hidemenu_mobile =1 and rpt_widget=1
  order by rpt_category,rpt_categorysub,rpt_order,rpt_title 
  end else 
  begin
select a.* from mps_report a , mps_report_users 
  where rpt_id=rptp_rptid and rptp_type='rptview' and rptp_cuid=@useruid and rpt_title>'' and rpt_hidemenu=1 and rpt_widget=1
  order by rpt_category,rpt_categorysub,rpt_order,rpt_title 
  end 
  set nocount off 
end