此人已疯
当你有了仁慈之心,你就不再是妖了,是人妖!

-- =============================================
-- Author:  <Author:Caiqun.li>
-- Create date: <Create Date:2006-05-11>
-- Description: <Description,,>
-- exec sp_Report_GetPROrderStatus '','',2,2,29
-- =============================================
alter PROCEDURE [dbo].[sp_Report_GetPROrderStatus]
 @DateFrom datetime='1900-1-1',
 @DateTo datetime='1900-1-1',
 @CityID int=0,
 @Status int=0,
 @UserID int --createuserid and prapproval userid
AS
BEGIN
 SET NOCOUNT ON;
 select
 PrNumber,Requester,SubmitDate,Subject,RejectReason,
 (select description_EN from misccode m where m.id=p.cityid) as City,
 (select CompanyCode from Company where CompanyID=p.IssueCompanyID) as Company ,
 (select description_EN from misccode where  id=p.Deptid) as Department ,
    (select Description from statusmaster where FlowID=p.StatusMasterID) as Status,
 (select u.userid from userinfo u where u.id=a.userid) as Approvedby
 from pr p inner join prapproval a on p.prid=a.prid
 where p.Createuser=@UserID or a.userid=@userid
   and (cityid=@Cityid or @cityid=0)
   and (statusMasterid=@Status or @status=0)
   and (p.SubmitDate>@DateFrom or @DateFrom='1900-1-1')
   and (p.SubmitDate<@DateTo or @DateTo='1900-1-1')

END

posted on 2006-05-11 16:13  此人已疯  阅读(111)  评论(0)    收藏  举报